Closed Bug 1811464 (CVE-2023-25737) Opened 1 year ago Closed 1 year ago

cfi-derived-cast: Invalid downcast in SVGUtils::SetupStrokeGeometry

Categories

(Core :: SVG, defect)

defect

Tracking

()

RESOLVED FIXED
111 Branch
Tracking Status
firefox-esr102 110+ fixed
firefox109 --- wontfix
firefox110 + fixed
firefox111 + fixed

People

(Reporter: lukas.bernhard, Assigned: longsonr)

References

(Blocks 1 open bug)

Details

(Keywords: csectype-undefined, sec-high, Whiteboard: [adv-main110+][adv-esr102.8+])

Attachments

(2 files)

Steps to reproduce:

When compiling Firefox with cfi-derived-cast, crashtest layout/svg/crashtests/267650-1.svg fails due to the downcasting here:
https://searchfox.org/mozilla-central/rev/daf613efc5c358f3a94961d73b90472c00703838/layout/svg/SVGUtils.cpp#1525

The dynamic type of aFrame->GetContent() is nsTextNode, which is not derived from SVGElement.

This might not be s-s, just flagging as a precaution.

Blocks: cfi
Group: firefox-core-security → core-security
Component: Untriaged → DOM: Core & HTML
Product: Firefox → Core
Version: Firefox 111 → Trunk
Group: core-security → layout-core-security
Component: DOM: Core & HTML → SVG
Assignee: nobody → longsonr
Status: NEW → ASSIGNED

I believe this is security sensitive, we end up in layout/style with an nsIContent where we should have an Element and we do some Element specific things. While I could fix it without the MOZ_ASSERT, I don't think that makes it any more obvious. The main problem with this bug is how easy it is to trigger it. We really should get this into a Firefox release and into ESR too.

Attachment #9313377 - Attachment description: Bug 1811464 - check cast r=emilio → Bug 1811464 - Use SVGElement::FromNode more r=emilio

Comment on attachment 9313377 [details]
Bug 1811464 - Use SVGElement::FromNode more r=emilio

Security Approval Request

  • How easily could an exploit be constructed based on the patch?: Any SVG with text in it is a problem so not very hard.
  • Do comments in the patch, the check-in comment, or tests included in the patch paint a bulls-eye on the security problem?: No
  • Which older supported branches are affected by this flaw?: All
  • If not all supported branches, which bug introduced the flaw?: None
  • Do you have backports for the affected branches?: Yes
  • If not, how different, hard to create, and risky will they be?: This patch should apply to older branches.
  • How likely is this patch to cause regressions; how much testing does it need?: Should be safe it's really a one line change in SVGTextFrame.cpp the rest is clean up and may serve to obfuscate the real issue very slightly.
  • Is Android affected?: Yes
Attachment #9313377 - Attachment description: Bug 1811464 - Use SVGElement::FromNode more r=emilio → Bug 1811464 - check cast r=emilio
Attachment #9313377 - Flags: sec-approval?
Attachment #9313377 - Attachment description: Bug 1811464 - check cast r=emilio → Bug 1811464 - Use SVGElement::FromNode more r=emilio

Comment on attachment 9313377 [details]
Bug 1811464 - Use SVGElement::FromNode more r=emilio

Approved to land and request uplift

Attachment #9313377 - Flags: sec-approval? → sec-approval+

I guess I'll mark this sec-high based on comment 2 and comment 3.

(It's late in longsonr's timezone, so I landed it at his request, and am tagging him with needinfo as a reminder to do the beta-uplift-request dance when he's awake.)

Flags: needinfo?(longsonr)
Group: layout-core-security → core-security-release
Status: ASSIGNED → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → 111 Branch

Comment on attachment 9313377 [details]
Bug 1811464 - Use SVGElement::FromNode more r=emilio

Beta/Release Uplift Approval Request

  • User impact if declined: invalid pointer dereferences, possibly exploitable although there are no known exploits.
  • Is this code covered by automated tests?: Yes
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: No
  • If yes, steps to reproduce: Existing crashtests should now crash in debug as there's a new MOZ_ASSERT in the patch.
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Patch is fairly small and includes an assert.
  • String changes made/needed: none
  • Is Android affected?: Unknown

ESR Uplift Approval Request

  • If this is not a sec:{high,crit} bug, please state case for ESR consideration: It's sec:high currently.
  • User impact if declined: invalid pointer dereferences, possibly exploitable although there are no known exploits.
  • Fix Landed on Version: 111
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Patch is fairly small and includes an assert.
Flags: needinfo?(longsonr)
Attachment #9313377 - Flags: approval-mozilla-esr102?
Attachment #9313377 - Flags: approval-mozilla-beta?

Comment on attachment 9313377 [details]
Bug 1811464 - Use SVGElement::FromNode more r=emilio

Approved for 110 beta 5, thanks.

Attachment #9313377 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

Comment on attachment 9313377 [details]
Bug 1811464 - Use SVGElement::FromNode more r=emilio

Approved for 102.8esr.

Attachment #9313377 - Flags: approval-mozilla-esr102? → approval-mozilla-esr102+
Whiteboard: [adv-main110+]
Whiteboard: [adv-main110+] → [adv-main110+][adv-esr102.8+]
Alias: CVE-2023-25737
QA Whiteboard: [post-critsmash-triage]
Flags: sec-bounty?
Flags: sec-bounty? → sec-bounty+
Group: core-security-release
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: