Improper input validation in Media (CVE-2026-79182)
The VideoToolbox H.265 accelerator caches SPS bytes by ID without layer namespacing, so an alpha-layer SPS can overwrite the base-layer SPS mid-frame. Slices validated against the larger base-layer SPS are then passed to the macOS driver with the smaller alpha-layer format description, potentially causing out-of-bounds slice addresses in the hardware decoder.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 38 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: The VideoToolbox H.265 accelerator caches SPS bytes by ID without layer namespacing, allowing an alpha-layer SPS to overwrite the base-layer SPS mid-frame. Slices validated against a large base-layer SPS are passed to the macOS driver paired with the overwritten small alpha-layer format description. This potentially passes out-of-bounds slice segment addresses to the Apple hardware decoder.
Affected files:
media/gpu/mac/video_toolbox_h265_accelerator.ccmedia/gpu/h265_decoder.ccmedia/parsers/h265_parser.ccmedia/gpu/mac/video_toolbox_h265_accelerator.h
Estimated timestamp from git blame: 2023-09-20
1. Summary of the Issue (Meant for Human Triage)
In the VideoToolbox H.265 hardware video decoder on macOS, a state desynchronization vulnerability exists between the Chromium-side slice header parser and the format description passed to the native Apple driver. The VideoToolboxH265Accelerator caches Sequence Parameter Set (SPS) raw bytes in a map (seen_sps_data_) keyed solely by the sps_seq_parameter_set_id, without namespacing or disambiguating by the NALU layer ID (nuh_layer_id).
Furthermore, the auxiliary alpha-layer SPS parsing branch in H265Decoder::Decode() does not trigger FinishPrevFrameIfPresent(), a crucial frame-flushing mechanism that is enforced on the base layer. This discrepancy allows an attacker to supply an auxiliary/alpha layer SPS mid-picture that shares the same ID as the active base-layer SPS. The raw bytes of the alpha-layer SPS completely overwrite the base-layer SPS bytes in the accelerator's cache.
When the frame is finalized, the accelerator uses the overwritten, smaller alpha-layer SPS to construct the CMVideoFormatDescription. The native Apple decoder (VTDecompressionSessionDecodeFrame) then receives slice headers that were previously validated by Chromium against the larger base-layer SPS. Because the format description passed to the driver specifies much smaller dimensions, fields like slice_segment_address can bypass parser protections and appear completely out-of-bounds to the underlying macOS GPU process, potentially leading to driver-side memory corruption.
2. Proof-of-Concept & Detailed Execution Flow
Note: The following steps describe a potential execution flow based on static analysis. Our tooling agent does not yet have the ability to run code, but this sequence demonstrates how an attacker could hypothetically trigger the vulnerability.
An attacker serving a malicious H.265 bitstream (via WebCodecs, MSE, or <video src> on macOS where hardware HEVC is enabled by default) can craft a sequence to force a cache collision:
- Bitstream Initialization: The stream starts with a Video Parameter Set (VPS) indicating
aux_alpha_layer_id = 1. - Base-Layer SPS parsing: The stream provides a base-layer SPS (SPS_A) with
nuh_layer_id = 0,sps_seq_parameter_set_id = 0, and large spatial dimensions (e.g.,pic_size_in_ctbs_y = 16384). The decoder processes it inH265Decoder::Decode(media/gpu/h265_decoder.cc:450-457), callingFinishPrevFrameIfPresent(). The raw bytes are cached in the accelerator viaVideoToolboxH265Accelerator::ProcessSPS(media/gpu/mac/video_toolbox_h265_accelerator.cc:64-65):seen_sps_data_[0]= SPS_A bytes. - PPS parsing: A base-layer PPS (PPS_A) referencing
sps_id = 0is parsed and cached. - First Base-Layer Slice: An IDR slice (Slice 0) with
first_slice_segment_in_pic_flag = 1starts a new frame. It is submitted viaaccelerator_->SubmitSlice, which captures the active parameter set IDs (frame_sps_ids_.insert(0)) and records the slice intoframe_slice_data_. - Attacker Payload Slice: A second IDR slice (Slice 1) with
first_slice_segment_in_pic_flag = 0carries an artificially largeslice_segment_address(e.g.,16383). - Parser Validation: During
H265Parser::ParseSliceHeader(media/parsers/h265_parser.cc:1161-1164), the slice is bounds-checked against the active SPS (SPS_A).IN_RANGE_OR_RETURN(shdr->slice_segment_address, 0, sps->pic_size_in_ctbs_y - 1)succeeds because SPS_A allows sizes up to 16384. This slice is appended toframe_slice_data_. - Alpha-Layer SPS Overwrite Payload: The stream provides an alpha-layer SPS (SPS_B) with
nuh_layer_id = 1, using the samesps_seq_parameter_set_id = 0, but specifying minimal dimensions (e.g.,pic_size_in_ctbs_y = 1). - Missing Frame Flush: In
H265Decoder::Decode, the alpha-layer bypass branch is taken (media/gpu/h265_decoder.cc:264-340). Execution hits theH265NALU::SPS_NUTcase (media/gpu/h265_decoder.cc:313-319). Crucially, this branch lacks a call toFinishPrevFrameIfPresent(). - Cache Collision:
accelerator_->ProcessSPSis called with SPS_B.seen_sps_data_[0]is silently overwritten with the small SPS_B bytes. - Format Description Creation: The stream ends (
kEOStream).FinishPrevFrameIfPresentflushes the frame, callingaccelerator_->SubmitDecode(). This triggersCreateFormat()(media/gpu/mac/video_toolbox_h265_accelerator.cc:274-276). - Apple Driver Initialization:
CreateFormatcallsExtractParameterSetData, looking up ID0inseen_sps_data_. It retrieves the corrupted/overwritten SPS_B bytes. It passes these toCMVideoFormatDescriptionCreateFromHEVCParameterSets(media/gpu/mac/video_toolbox_h265_accelerator.cc:130-137), initializingactive_format_to a highly restrictive 1-CTB format description. - Driver Handoff:
SubmitDecodecreates aCMSampleBufferbinding the restrictiveactive_format_with the previously accumulatedframe_slice_data_(which contains Slice 1 withslice_segment_address = 16383). This is dispatched to the native Apple driver viaVTDecompressionSessionDecodeFrame. - Driver-Side Exploitation Consequence: Assuming the opaque native Apple VideoToolbox driver relies on the Format Description bounds without independently re-validating the slice segment addresses on-the-fly, the driver will perform an out-of-bounds write using the
16383index into a 1-CTB configuration, resulting in memory corruption within the sandboxed macOS GPU process.
3. Technical Verification Details (Automated Audit Logs)
The report accurately identifies a driver validation bypass in
VideoToolboxH265Accelerator.
seen_sps_data_(in the accelerator) andactive_sps_(in the parser) are keyed solely bysps_seq_parameter_set_id, withoutnuh_layer_idnamespacing.- In
H265Decoder::Decode(), the alpha-layer SPS parsing branch (unlike the base-layer branch) does not callFinishPrevFrameIfPresent().- An attacker can supply an alpha-layer SPS with the same ID as the base-layer SPS mid-frame. This overwrites the cached
seen_sps_data_andactive_sps_with the smaller alpha SPS bytes.- Prior slices in the frame were already parsed, and their fields (such as
slice_segment_address) were validated against the larger base-layer SPS.- During
SubmitDecode(), the overwritten (smaller) SPS is used to construct theCMVideoFormatDescription.- This mismatched format description is passed alongside the slice data to
VTDecompressionSessionDecodeFrame, effectively passing an out-of-boundsslice_segment_address(and other bounded fields) to the underlying hardware decoder.The consequence depends on opaque Apple driver behavior (whether VideoToolbox gracefully errors or performs an out-of-bounds write). Because the macOS GPU process is sandboxed, an actual memory corruption would be High (S1) severity (sandboxed RCE). Given the opaque and unproven driver-side memory corruption, downgrading to Medium (S2) is correct per the GPU validating-layer gap severity guidelines. This issue is A-SERVER reachable via web bitstreams since HEVC is default-enabled on macOS.
Codebase Investigator Output:
- The investigator confirmed
VideoToolboxH265Accelerator::ProcessSPSkeying atmedia/gpu/mac/video_toolbox_h265_accelerator.cc:57-66uses solelysps->sps_seq_parameter_set_idwith no layer-awareness. - The investigator confirmed the alpha-layer branch (
media/gpu/h265_decoder.cc:313-321) explicitly lacksFinishPrevFrameIfPresent(), whereas the base layer branch (media/gpu/h265_decoder.cc:450-457) correctly invokes it. - The investigator confirmed
IN_RANGE_OR_RETURNbounds checking atmedia/parsers/h265_parser.cc:1161-1164evaluates against the currently active SPS (sps->pic_size_in_ctbs_y). - The investigator confirmed
ExtractParameterSetDatapasses the mapped data toCMVideoFormatDescriptionCreateFromHEVCParameterSetsatmedia/gpu/mac/video_toolbox_h265_accelerator.cc:130-137.
Suggested Fix:
- Modify
VideoToolboxH265Accelerator::seen_sps_data_(and related structures for VPS/PPS) to namespace keys by bothsps_seq_parameter_set_idandnuh_layer_id(e.g., using a struct or packed integer(nuh_layer_id << 16) | sps_id). - Add
CHECK_ACCELERATOR_RESULT(FinishPrevFrameIfPresent())to the alpha-layer SPS and PPS decoding branches (H265NALU::SPS_NUTandH265NALU::PPS_NUTaround line 313 inmedia/gpu/h265_decoder.cc) to enforce the same frame boundaries as the base layer.
Evaluated with Chrome root at commit: b96d2ec58f4f5f92b540a723966b199d6e9951b4
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 accelerator's SPS cache is keyed only by sps_seq_parameter_set_id without nuh_layer_id, and the alpha-layer SPS branch does not flush the current frame, allowing a mid-frame overwrite.
Impact
Potentially passes out-of-bounds slice segment addresses to the Apple hardware decoder, which could lead to memory corruption within the sandboxed macOS GPU process, though the report notes this depends on opaque driver behaviour.
What the attacker needed
MacOS with hardware HEVC enabled; victim loads a malicious H.265 bitstream; attacker controls the video stream
The fix
The accelerator's SPS cache should be keyed by both sps_seq_parameter_set_id and nuh_layer_id, and the alpha-layer SPS and PPS branches should call FinishPrevFrameIfPresent() like the base layer.
How it was found
- Start a stream with a VPS that sets an auxiliary alpha layer ID.
- Provide a base-layer SPS with large dimensions and a matching PPS.
- Send a first base-layer IDR slice that starts a new frame.
- Send a second IDR slice with a large slice_segment_address that passes validation against the base-layer SPS.
- Send an alpha-layer SPS with the same SPS ID but minimal dimensions, overwriting the cached base-layer SPS without flushing the frame.
- End the stream so the frame is flushed and the overwritten SPS is used to build the format description passed to the Apple driver.
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 video decoder reads small configuration blocks called SPS to know how big each frame is. This report says the decoder stores those blocks in a table keyed only by a number, so a second block with the same number but a different layer can replace the first one while a frame is still being built. The frame's slices were checked against the old, larger size, but the hardware is later given the new, smaller size, which could make it read or write outside its buffer.
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.