Object lifecycle issue in SVG (CVE-2026-11688)
An external SVG resource's layout tree can be dirtied after its one-time lifecycle update, and the host document then paints the dirty subtree without re-running layout. This could lead to memory corruption such as use-after-free or out-of-bounds access inside the sandboxed renderer process.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 12 days
Project Fortify, an experimental security project, has identified the following potential security issue. If you're a feature owner CC-ed on this bug, please do your best to review these reports. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.
Overview: A potential security vulnerability exists in Blink's handling of external SVG resources, where the layout tree of an isolated document can be dirtied after its initial lifecycle pass. When the host document subsequently paints, it can paint the dirty layout subtree of the isolated document without validating or re-running its layout lifecycle. This violates core layout invariants, potentially leading to memory corruption (such as use-after-free or out-of-bounds access) inside the sandboxed renderer process.
Affected files:
third_party/blink/renderer/core/svg/svg_resource_document_content.ccthird_party/blink/renderer/core/paint/clip_path_clipper.ccthird_party/blink/renderer/core/paint/svg_shape_painter.ccthird_party/blink/renderer/core/layout/svg/layout_svg_resource_clipper.ccthird_party/blink/renderer/core/layout/svg/layout_svg_resource_pattern.cc
Estimated timestamp from git blame: 2024-04-25
Summary
SVGResourceDocumentContent manages the lifecycle of external SVG resources (such as markers, clip-paths, and patterns referenced via url(ext.svg#id)). These resources are hosted inside an IsolatedSVGDocumentHost under kStatic mode, and their layout lifecycle is initially updated exactly once when the resource finishes loading. If the isolated document's layout is subsequently dirtied (for example, via an inline data: URL stream containing a multipart/x-mixed-replace image), subsequent repaints by the host document paint the dirty layout subtree without performing a corresponding layout lifecycle update. This violates rendering engine invariants, potentially resulting in use-after-free or out-of-bounds access inside the sandboxed renderer process.
Technical Analysis
When an external SVG resource finishes loading, SVGResourceDocumentContent::LoadingFinished() executes a single, one-time layout lifecycle pass:
void SVGResourceDocumentContent::LoadingFinished() {
LocalFrame* frame = document_host_->GetFrame();
frame->View()->UpdateAllLifecyclePhasesExceptPaint(
DocumentUpdateReason::kSVGImage);
UpdateStatus(ResourceStatus::kCached);
}
Source: third_party/blink/renderer/core/svg/svg_resource_document_content.cc
However, subsequent invalidations via the document's ChromeClient (such as ScheduleAnimation() or InvalidateContainer()) only trigger a repaint notification (ContentChanged()) to the host document's observers, but do not run the layout lifecycle for the internal isolated document.
When the host document paints, the associated SVG painters and layout objects invoke the paint methods of the resource's layout objects directly without verifying that the layout subtree is clean. Crucially:
ClipPathClipper::ResolveElementReference()(inthird_party/blink/renderer/core/paint/clip_path_clipper.cc) only performs a debug-only check:SECURITY_DCHECK(!resource_clipper->SelfNeedsFullLayout()). This is compiled out in official release builds and only asserts the container itself, not its child subtree.LayoutSVGResourceClipper::CreatePaintRecord()andLayoutSVGResourcePatternsimilarly iterate and paint child objects directly without ensuring that their layout states are clean.
Suggested Potential Exploitation Scenario
Note: These are potential steps; our testing tools do not currently have the capability to execute code to verify this programmatically.
An attacker could potentially use a same-origin external SVG document containing an inline data:multipart/x-mixed-replace subresource to schedule asynchronous tasks and dirty the isolated document's layout:
- The external SVG resource (
ext.svg) contains an<image>pointing to an inlinedata:multipart/x-mixed-replace;boundary=boundary,...URL. - In
ResourceLoader::Start(), thedata:URL bypassesGetURLLoaderFactory()checks entirely and loads in-process viaResourceLoader::HandleDataUrl(). This sets up aMultipartImageResourceParserinsideImageResourceand feeds it bytes asynchronously. - The attacker structures the data stream so that the first part of the multipart stream (the first image frame) is exactly 1MB (
1,048,576bytes). - When
ResponseBodyLoader::OnStateChange(Task A) runs, its parsing loop is constrained bynetwork::kMaxNumConsumedBytesInTask(exactly 1MB). Task A completes parsing the first frame, which firesImageResource::OnePartInMultipartReceived(). This sets the resource status tokCached, triggers the isolated document'sloadevent, and schedules Task C (IsolatedSVGDocumentHost::AsyncLoadCompleted) to complete loading. - Because Task A reached the 1MB limit, it posts Task B (
ResponseBodyLoader::OnStateChangecontinuation loop) to process the rest of the stream. - Task C, having been posted during Task A's execution, runs before Task B. Task C calls
SVGResourceDocumentContent::LoadingFinished(), running the single layout lifecycle update and successfully clearing theNeedsLayoutdirty flags on the tree. - Task B then runs, processing the second part of the multipart stream (which specifies different image dimensions). This calls
LayoutImage::ImageChanged(), which invokesSetNeedsLayout()and dirties the layout subtree of the isolated document. - The host document receives the invalidation and schedules a repaint. The SVG painters (e.g.
ClipPathClipper) directly callPaint()on the dirty layout subtree of the isolated document. This violates rendering assumptions and could lead to renderer memory corruption.
Suggested Fix
To resolve this issue, Blink should ensure that the isolated document's layout lifecycle is automatically updated before any painting occurs if its layout tree has been dirtied.
- Introduce layout safety validations: Upgrade layout checks in
ClipPathClipper::ResolveElementReferencefrom debug-only assertions to robustSECURITY_CHECKs and extend them to cover child subtrees. - Ensure the lifecycle runs: Update
SVGResourceDocumentContentto track when its document's layout state is dirtied, and ensureUpdateAllLifecyclePhasesExceptPaintis run on the isolated document before any of its components are painted.
Evaluated with Chrome root at commit: b1520ef4a76878853a31f0943b565e42060edec8
Results so far have been promising, but there can be wrong deductions. Feel free to adjust as follows:
- If you are familiar with the severity guidelines, you may adjust the severity.
- If this is a false positive, and there's no work to be done, please close as WAI.
- If there is work to do here but not a vulnerability, please change the issue type to Task/Bug/FR.
Data from false positives will be used to improve accuracy over time. And please feel free to reach out to me directly if you have concerns or feedback on the project.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the isolated SVG document's layout lifecycle is only updated once on load, and later layout invalidations only trigger a repaint without re-running layout before painting.
Impact
This could lead to memory corruption such as use-after-free or out-of-bounds access inside the sandboxed renderer process, though the report notes the exploitation steps are potential and not verified.
What the attacker needed
Same-origin external SVG resource; inline data URL with multipart stream; specific 1MB first frame size
The fix
The report suggests upgrading debug-only layout checks to robust security checks covering child subtrees and ensuring the isolated document's layout lifecycle is updated before any painting.
How it was found
- Create an external SVG resource containing an image element that points to an inline data URL with a multipart/x-mixed-replace stream.
- Structure the multipart stream so the first image frame is exactly 1MB, causing the parser to stop at the task byte limit and schedule a continuation task.
- The first frame completes loading, triggers the isolated document's load event, and schedules a task to finish loading.
- That finish-loading task runs before the continuation task, performing the single layout lifecycle update and clearing dirty flags.
- The continuation task processes the second frame, which changes image dimensions and dirties the layout subtree.
- The host document repaints and paints the dirty subtree without re-running layout.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
A web page can load an external SVG image and use parts of it as a clip or pattern. The browser normally prepares the SVG's internal layout once when it loads. If that layout changes later, the browser may still draw it without re-checking, which can confuse the rendering engine and potentially crash or corrupt memory in the sandboxed renderer.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.