Use after free in Dawn (CVE-2024-6103)
A use-after-free vulnerability exists in the Dawn WebGPU implementation when compiling HLSL shaders on Windows. An attacker could trigger a crash in the GPU process by supplying a crafted WebGPU shader.
- Fix shipped in 15 days
VULNERABILITY DETAILS
Chromium translates wgsl shaders via tint to an OS-specific shader format. On Windows, the OS-specific file format is hlsl, processed in dxcompiler.dll. When compiling chrome-generated hlsl files, this triggers an UAF inside the hlsl compiler.
VERSION
Chrome Version: Pre-compiled ASAN Chromium 127.0.6520.0 (Developer Build) (64-bit)
Operating System: Win10 Build 19045.4291
REPRODUCTION CASE
Attached is a .html file containing a WebGPU shader. Opening the html file (on windows with the D3D12 backend) crashes the GPU process. Note that the crash may NOT manifest on machines which support the 6.6 shader model.
Reproducing the issue stand-alone on Linux also possible:
- Compile the standalone.wgsl with tint (commit 3c05043f3c070f78b33b3f51124b661f97ec6512) to hlsl via
./tint standalone.wgsl -o standalone.hlsl. I also attached standalone.hlsl, but you should get the very same file when compiling standalone.wgsl yourself - Compile the hlsl with dxc (commit 978d36221daecfb745fde05a78bd134a389cb934):
./dxc-3.7 standalone.hlsl -T cs_6_2 -HV 2018. This should trigger an ASAN violation. Setting the shader model tocs_6_6prevents the UAF.
I verified this bug is not fixed by the upstream patches for bug 339169163 or bug 342428008.
Attached:
- html that triggers an ASAN violation in chromium
- wgsl for producing the hlsl shader
- the hlsl shader
- asan log file
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 GPU process by providing a malicious WebGPU shader, potentially leading to a denial of service.
What the attacker needed
Windows with D3D12 backend; Shader model below 6.6
How it was found
- Compile the standalone.wgsl with tint to hlsl.
- Compile the hlsl with dxc using shader model cs_6_2.
- Observe an ASAN violation.
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 use-after-free is a bug where a program keeps using memory after it has been freed, which can cause crashes or worse. Here, a specially crafted WebGPU shader makes the shader compiler access freed memory, crashing the GPU process. This could let an attacker disrupt the browser.
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.