Skip to content
Info disclosure Advisory Advanced CVE-2026-87497

Uninitialized resource in Codecs (CVE-2026-87497)

A flaw in libjpeg-turbo's lossless decoder combined with Blink's progressive image decoding allows uninitialized heap memory to be leaked to a canvas. An attacker could use this to defeat ASLR by reading leaked memory via getImageData.

Google Chrome

Originally disclosed on Chrome VRP

  • Fix shipped in 5 months

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 without the Chrome Security team. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.

Overview: A potential uninitialized heap disclosure exists in libjpeg-turbo's lossless decoder when combined with Blink's progressive image decoding. A premature watermark advancement in libjpeg-turbo's memory manager, coupled with a flaw in Blink's JPEGImageDecoder::all_components_seen(), allows an attacker to leak uninitialized PartitionAlloc heap memory to a canvas. This can be used as an ASLR-defeat primitive.

Affected files:

  • third_party/libjpeg_turbo/src/jddiffct.c
  • third_party/libjpeg_turbo/src/jmemmgr.c
  • third_party/blink/renderer/platform/image-decoders/jpeg/jpeg_image_decoder.cc
  • third_party/libjpeg_turbo/src/jdlhuff.c
  • third_party/libjpeg_turbo/src/jdcolor.c

Estimated timestamp from git blame: 2025-08-07

Summary

A potential uninitialized heap disclosure vulnerability exists in the libjpeg-turbo lossless decoder (used for SOF3 JPEGs) when combined with Blink's progressive image decoding. A Time-of-Check Time-of-Use (TOCTOU) flaw in libjpeg-turbo's memory management, combined with incomplete state tracking in Blink's JPEGImageDecoder, allows an attacker to read renderer process PartitionAlloc heap memory via a <canvas> element.

Technical Details

The vulnerability arises from the interaction between libjpeg-turbo's virtual array management and Blink's progressive display logic:

  1. Premature Watermark Advancement: In jddiffct.c, the lossless difference controller allocates virtual sample arrays with pre_zero=FALSE. When processing a scan, consume_data() calls access_virt_sarray with writable=TRUE. Inside jmemmgr.c:987, the memory manager immediately advances the first_undef_row watermark before any data is written to the buffer.
  2. Suspension: If the input stream is truncated or stalls mid-row, decompress_data() returns JPEG_SUSPENDED. The current row is left completely unwritten, but is incorrectly marked as 'defined' by the memory manager because the watermark was already advanced.
  3. Progressive Display Bypass: Back in Blink, JPEGImageDecoder::Decode checks if the partial image can be displayed progressively using the all_components_seen lambda (jpeg_image_decoder.cc:592). This lambda checks info.coef_bits. Because lossless JPEGs do not use DCT, coef_bits is NULL. The lambda immediately returns true, causing Blink to bypass the check and force output of the incomplete scan via jpeg_start_output.
  4. Uninitialized Read: During output generation, output_data() (jddiffct.c:315) calls access_virt_sarray with writable=FALSE to read the stalled row. Because the first_undef_row watermark was advanced in Step 1, the memory manager does not throw a JERR_BAD_VIRTUAL_ACCESS error.
  5. Leak to Canvas: output_data copies the uninitialized PartitionAlloc heap memory into the output buffer. Blink's OutputScanlines then writes this data into the ImageFrame. An attacker can subsequently draw the partially decoded image to a canvas and use getImageData() to read the leaked heap data.

Potential Attacker Steps to Trigger

Note: These are suggested steps based on code analysis; a working Proof of Concept has not been run.

  1. Serve a crafted, multi-scan 3-component SOF3 (lossless) JPEG.
  2. Provide full entropy for the first two scans.
  3. For the third scan, provide valid entropy for the first R rows, then artificially stall the TCP connection mid-way through row R+1.
  4. In the victim's browser, load the image and draw it to a <canvas> using ctx.drawImage().
  5. Call ctx.getImageData() and inspect the color channels corresponding to the stalled scan of row R+1. The resulting bytes will contain uninitialized heap memory.

Suggested Fix

  1. Blink: Fix the logic in all_components_seen (jpeg_image_decoder.cc:592) so that it accurately tracks component availability for lossless JPEGs, rather than defaulting to true when info.coef_bits is NULL.
  2. libjpeg-turbo: Either initialize the virtual arrays by setting pre_zero=TRUE when allocating them in jddiffct.c:392, or delay advancing first_undef_row in jmemmgr.c until the caller signals that the write has actually completed.

Evaluated with Chrome root at commit: 7353d249d9cacf9c7218e1d7b8a39cf39c72d646


Results so far have been promising, but there can be wrong deductions. If this proves to be a false positive, please close as WAI; 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.

The original report as published on the Chromium issue tracker. Images and videos are our own copies; raw HTML is shown as text. View it on Chromium issue tracker.

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 a TOCTOU flaw where libjpeg-turbo advances its 'defined' watermark before data is written, and Blink's all_components_seen incorrectly returns true for lossless JPEGs because coef_bits is NULL.

Impact

An attacker could leak uninitialized heap memory to a canvas, potentially defeating ASLR; however, the report notes that a working proof of concept has not been run.

What the attacker needed

Victim loads a crafted image; attacker can stall the connection; victim draws image to canvas

The fix

The fix should correct Blink's all_components_seen logic for lossless JPEGs and either pre-zero the virtual arrays or delay advancing the watermark in libjpeg-turbo.

How it was found

  1. Serve a crafted, multi-scan 3-component SOF3 (lossless) JPEG.
  2. Provide full entropy for the first two scans.
  3. For the third scan, provide valid entropy for the first R rows, then artificially stall the TCP connection mid-way through row R+1.
  4. In the victim's browser, load the image and draw it to a <canvas> using ctx.drawImage().
  5. Call ctx.getImageData() and inspect the color channels corresponding to the stalled scan of row R+1.

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.

When a browser decodes an image, it sometimes shows a partial version before the whole file arrives. A bug in how the image library marks parts of the image as 'ready' means that a stalled download can cause the browser to display memory that was never written, which may contain leftover data from other parts of the program. An attacker who can make a victim load a specially crafted image and then read pixels from it could see that leftover memory.

What is Info disclosure?

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Information disclosure

The lesson behind this report.

Data the application should keep private (personal data, internal details, other users' records) reaches someone it should not.