Use after free in Swiftshader (CVE-2024-6291)
Originally disclosed on Chrome VRP
- Fix shipped in 7 months
Steps to reproduce the problem:
tested os version:
ubuntu:22.04
tested chrome version:
Chromium 121.0.6128.0(gs://chromium-browser-asan/linux-release/asan-linux-release-1224132.zip)
Chromium 113.0.5624.0(I believe it should be possible to reproduce earlier than this version.)
Repro Steps:
1 python3 -m http.server 8000 --dir=|Path|
2 ./launcher.sh 2>&1 |grep -E 'AddressSanitizer'
Note:
-Due to the unstable repro with single browser, I wrote a script (according to the actual environment, it is necessary to modify the path of chrome and poc in launcher.sh), opened 20 chrome, and ran poc in --headless mode. It should be reproducible in over 30 seconds.
- |--remote-debugging-port=0 --headless| is not a necessary flags, it is only for faster reproduction.
Problem Description:
==750974==ERROR: AddressSanitizer: heap-use-after-free on address 0x511000073420 at pc 0x7f94094f626e bp 0x7f93fe5ba890 sp 0x7f93fe5ba888
READ of size 4 at 0x511000073420 thread T17
#0 0x7f94094f626d in isCubeCompatible ./../../third_party/swiftshader/src/Vulkan/VkImage.cpp:877:25
#1 0x7f94094f626d in requiresPreprocessing ./../../third_party/swiftshader/src/Vulkan/VkImage.cpp:1128:9
#2 0x7f94094f626d in vk::Image::prepareForSampling(VkImageSubresourceRange const&) const ./../../third_party/swiftshader/src/Vulkan/VkImage.cpp:1175:6
#3 0x7f94094c4474 in prepareForSampling ./../../third_party/swiftshader/src/Vulkan/VkImageView.hpp:129:37
#4 0x7f94094c4474 in vk::Device::prepareForSampling(vk::ImageView*) ./../../third_party/swiftshader/src/Vulkan/VkDevice.cpp:467:15
#5 0x7f94094bb52a in vk::DescriptorSet::ParseDescriptors(std::__Cr::array<vk::DescriptorSet*, 4ul> const&, vk::PipelineLayout const*, vk::Device*, vk::DescriptorSet::NotificationType) ./../../third_party/swiftshader/src/Vulkan/VkDescriptorSet.cpp:67:16
#6 0x7f94095fb2b7 in sw::Renderer::draw(vk::GraphicsPipeline const*, vk::DynamicState const&, unsigned int, int, sw::CountedEvent*, int, int, void*, VkRect2D const&, vk::Pipeline::PushConstantStorage const&, bool) ./../../third_party/swiftshader/src/Device/Renderer.cpp:296:2
#7 0x7f94094b4f45 in (anonymous namespace)::CmdDrawBase::draw(vk::CommandBuffer::ExecutionState&, bool, unsigned int, unsigned int, unsigned int, int, unsigned int) ./../../third_party/swiftshader/src/Vulkan/VkCommandBuffer.cpp:957:31
#8 0x7f94094b496b in (anonymous namespace)::CmdDraw::execute(vk::CommandBuffer::ExecutionState&) ./../../third_party/swiftshader/src/Vulkan/VkCommandBuffer.cpp:985:3
#9 0x7f94094add78 in vk::CommandBuffer::submit(vk::CommandBuffer::ExecutionState&) ./../../third_party/swiftshader/src/Vulkan/VkCommandBuffer.cpp:2330:12
#10 0x7f940951b391 in vk::Queue::submitQueue(vk::Queue::Task const&) ./../../third_party/swiftshader/src/Vulkan/VkQueue.cpp:104:42
#11 0x7f940951a1f4 in vk::Queue::taskLoop(marl::Scheduler*) ./../../third_party/swiftshader/src/Vulkan/VkQueue.cpp:156:4
#12 0x7f940951e1f5 in __invoke<void (vk::Queue::*)(marl::Scheduler *), vk::Queue *, marl::Scheduler *, void> ./../../third_party/libc++/src/include/__type_traits/invoke.h:312:25
#13 0x7f940951e1f5 in __thread_execute<std::__Cr::unique_ptr<std::__Cr::__thread_struct, std::__Cr::default_deletestd::__Cr::__thread_struct >, void (vk::Queue::*)(marl::Scheduler *), vk::Queue *, marl::Scheduler *, 2UL, 3UL> ./../../third_party/libc++/src/include/__thread/thread.h:220:5
#14 0x7f940951e1f5 in void* std::__Cr::__thread_proxy<std::__Cr::tuple<std::__Cr::unique_ptr<std::__Cr::__thread_struct, std::__Cr::default_deletestd::__Cr::__thread_struct>, void (vk::Queue::*)(marl::Scheduler*), vk::Queue*, marl::Scheduler*>>(void*) ./../../third_party/libc++/src/include/__thread/thread.h:231:5
#15 0x5564244aa348 in asan_thread_start(void*) asan_rtl:28
0x511000073420 is located 32 bytes inside of 200-byte region [0x511000073400,0x5110000734c8)
freed by thread T0 (chrome) here:
#0 0x5564244ac4e6 in __interceptor_free asan_rtl:3
#1 0x7f942ad50a4e in destroy ./../../third_party/angle/src/libANGLE/renderer/vulkan/vk_wrapper.h:1361:9
#2 0x7f942ad50a4e in DestroyGarbage<rx::vk::Image *, rx::vk::DeviceMemory *, rx::vk::Allocation *> ./../../third_party/angle/src/libANGLE/renderer/vulkan/RendererVk.h:1126:17
#3 0x7f942ad50a4e in void rx::RendererVk::collectGarbage<rx::vk::Image*, rx::vk::DeviceMemory*, rx::vk::Allocation*>(rx::vk::ResourceUse const&, rx::vk::Image*, rx::vk::DeviceMemory*, rx::vk::Allocation*) ./../../third_party/angle/src/libANGLE/renderer/vulkan/RendererVk.h:317:13
#4 0x7f942ad51503 in releaseImage ./../../third_party/angle/src/libANGLE/renderer/vulkan/vk_helpers.cpp:5816:15
#5 0x7f942ad51503 in rx::vk::ImageHelper::releaseImageFromShareContexts(rx::RendererVk*, rx::ContextVk*, rx::UniqueSerial) ./../../third_party/angle/src/libANGLE/renderer/vulkan/vk_helpers.cpp:5828:5
#6 0x7f942ab2d953 in rx::RenderbufferVk::releaseImage(rx::ContextVk*) ./../../third_party/angle/src/libANGLE/renderer/vulkan/RenderbufferVk.cpp:331:17
#7 0x7f942ab2cbc6 in releaseAndDeleteImage ./../../third_party/angle/src/libANGLE/renderer/vulkan/RenderbufferVk.cpp:309:5
#8 0x7f942ab2cbc6 in rx::RenderbufferVk::onDestroy(gl::Context const*) ./../../third_party/angle/src/libANGLE/renderer/vulkan/RenderbufferVk.cpp:38:5
#9 0x7f942b0d060a in gl::Renderbuffer::onDestroy(gl::Context const*) ./../../third_party/angle/src/libANGLE/Renderbuffer.cpp:118:26
#10 0x7f942b0d7479 in release ./../../third_party/angle/src/libANGLE/RefCountObject.h:45:13
#11 0x7f942b0d7479 in DeleteObject ./../../third_party/angle/src/libANGLE/ResourceManager.cpp:273:19
#12 0x7f942b0d7479 in gl::TypedResourceManager<gl::Renderbuffer, gl::RenderbufferManager, gl::RenderbufferID>::deleteObject(g
Additional Comments:
**Chrome version: ** 113.0.5624.0 **Channel: ** Not sure
OS: Linux
Context
This report covers a heap use-after-free in SwiftShader, the software Vulkan implementation that ships with Chromium and is used as a fallback when hardware GPU acceleration is unavailable. The bug was reported through the Chrome Vulnerability Reward Program, assigned CVE-2024-6291, rated high severity, and disclosed on 24 June 2024. The researcher is Cassidy Kim (@cassidy6564), and the bounty was 4,000 USD.
The crash happens in SwiftShader's Vulkan image handling, specifically while a descriptor set is being parsed during a draw. The object that is read has already been freed by ANGLE, Chromium's graphics translation layer, which sits above SwiftShader and manages its own Vulkan resources. So the report describes a lifetime mismatch between two components that share the same underlying Vulkan objects.
Setup
The researcher tested on Ubuntu 22.04 with two Chromium builds:
- Chromium 121.0.6128.0, taken from the ASan build at
gs://chromium-browser-asan/linux-release/asan-linux-release-1224132.zip - Chromium 113.0.5624.0, with the note that earlier versions should also be affected
The report lists the channel as "Not sure" and the OS as Linux. Reproduction uses a local HTTP server, a launcher script, and an AddressSanitizer build so that the use-after-free is detected reliably rather than manifesting as a silent corruption.
Finding it
The AddressSanitizer output shows a heap-use-after-free in SwiftShader. The read of size 4 happens in isCubeCompatible at third_party/swiftshader/src/Vulkan/VkImage.cpp:877, reached through requiresPreprocessing and Image::prepareForSampling, which is called from Device::prepareForSampling while DescriptorSet::ParseDescriptors is processing descriptors for a draw. The freed region was released on the main Chrome thread by ANGLE's garbage collection path, through RendererVk::collectGarbage and ImageHelper::releaseImageFromShareContexts, triggered when a renderbuffer is destroyed.
In other words, ANGLE frees a Vulkan image it considers unused, while SwiftShader still holds a reference to that image through a descriptor set that a queued draw is about to use. The two components disagree about when the image is dead.
Exploitation
Step 1: serve the proof of concept over HTTP
python3 -m http.server 8000 --dir=|Path|
This starts a static file server on port 8000 serving the directory containing the proof of concept. The |Path| placeholder stands for the local directory holding the PoC files.
Step 2: run the launcher and filter for the sanitizer report
./launcher.sh 2>&1 |grep -E 'AddressSanitizer'
The launcher script starts the browser instances and runs the PoC, and the output is filtered down to AddressSanitizer lines so the crash is easy to spot. The researcher notes that the paths to Chrome and to the PoC inside launcher.sh must be adjusted to the actual environment.
Because a single browser instance reproduced the bug unreliably, the script opens 20 Chrome instances and runs the PoC in --headless mode. With that setup the issue should reproduce within about 30 seconds. The flags --remote-debugging-port=0 --headless are not required for the bug itself; they are used only to make reproduction faster.
What the sanitizer reported
The crash is a heap-use-after-free on address 0x511000073420, a read of size 4 on thread T17. The stack shows the read inside SwiftShader's image code and the free inside ANGLE's resource cleanup:
==750974==ERROR: AddressSanitizer: heap-use-after-free on address 0x511000073420 at pc 0x7f94094f626e bp 0x7f93fe5ba890 sp 0x7f93fe5ba888
READ of size 4 at 0x511000073420 thread T17
#0 0x7f94094f626d in isCubeCompatible ./../../third_party/swiftshader/src/Vulkan/VkImage.cpp:877:25
#1 0x7f94094f626d in requiresPreprocessing ./../../third_party/swiftshader/src/Vulkan/VkImage.cpp:1128:9
#2 0x7f94094f626d in vk::Image::prepareForSampling(VkImageSubresourceRange const&) const ./../../third_party/swiftshader/src/Vulkan/VkImage.cpp:1175:6
#3 0x7f94094c4474 in prepareForSampling ./../../third_party/swiftshader/src/Vulkan/VkImageView.hpp:129:37
#4 0x7f94094c4474 in vk::Device::prepareForSampling(vk::ImageView\*) ./../../third_party/swiftshader/src/Vulkan/VkDevice.cpp:467:15
#5 0x7f94094bb52a in vk::DescriptorSet::ParseDescriptors(std::__Cr::array<vk::DescriptorSet\*, 4ul> const&, vk::PipelineLayout const\*, vk::Device\*, vk::DescriptorSet::NotificationType) ./../../third_party/swiftshader/src/Vulkan/VkDescriptorSet.cpp:67:16
#6 0x7f94095fb2b7 in sw::Renderer::draw(vk::GraphicsPipeline const\*, vk::DynamicState const&, unsigned int, int, sw::CountedEvent\*, int, int, void\*, VkRect2D const&, vk::Pipeline::PushConstantStorage const&, bool) ./../../third_party/swiftshader/src/Device/Renderer.cpp:296:2
#7 0x7f94094b4f45 in (anonymous namespace)::CmdDrawBase::draw(vk::CommandBuffer::ExecutionState&, bool, unsigned int, unsigned int, unsigned int, int, unsigned int) ./../../third_party/swiftshader/src/Vulkan/VkCommandBuffer.cpp:957:31
#8 0x7f94094b496b in (anonymous namespace)::CmdDraw::execute(vk::CommandBuffer::ExecutionState&) ./../../third_party/swiftshader/src/Vulkan/VkCommandBuffer.cpp:985:3
#9 0x7f94094add78 in vk::CommandBuffer::submit(vk::CommandBuffer::ExecutionState&) ./../../third_party/swiftshader/src/Vulkan/VkCommandBuffer.cpp:2330:12
#10 0x7f940951b391 in vk::Queue::submitQueue(vk::Queue::Task const&) ./../../third_party/swiftshader/src/Vulkan/VkQueue.cpp:104:42
#11 0x7f940951a1f4 in vk::Queue::taskLoop(marl::Scheduler\*) ./../../third_party/swiftshader/src/Vulkan/VkQueue.cpp:156:4
#12 0x7f940951e1f5 in __invoke<void (vk::Queue::\*)(marl::Scheduler \*), vk::Queue \*, marl::Scheduler \*, void> ./../../third_party/libc++/src/include/__type_traits/invoke.h:312:25
#13 0x7f940951e1f5 in __thread_execute<std::__Cr::unique_ptr<std::__Cr::__thread_struct, std::__Cr::default_delete<std::__Cr::__thread_struct> >, void (vk::Queue::\*)(marl::Scheduler \*), vk::Queue \*, marl::Scheduler \*, 2UL, 3UL> ./../../third_party/libc++/src/include/__thread/thread.h:220:5
#14 0x7f940951e1f5 in void\* std::__Cr::__thread_proxy<std::__Cr::tuple<std::__Cr::unique_ptr<std::__Cr::__thread_struct, std::__Cr::default_delete<std::__Cr::__thread_struct>>, void (vk::Queue::\*)(marl::Scheduler\*), vk::Queue\*, marl::Scheduler\*>>(void\*) ./../../third_party/libc++/src/include/__thread/thread.h:231:5
#15 0x5564244aa348 in asan_thread_start(void\*) _asan_rtl_:28
0x511000073420 is located 32 bytes inside of 200-byte region [0x511000073400,0x5110000734c8)
freed by thread T0 (chrome) here:
#0 0x5564244ac4e6 in __interceptor_free _asan_rtl_:3
#1 0x7f942ad50a4e in destroy ./../../third_party/angle/src/libANGLE/renderer/vulkan/vk_wrapper.h:1361:9
#2 0x7f942ad50a4e in DestroyGarbage<rx::vk::Image \*, rx::vk::DeviceMemory \*, rx::vk::Allocation \*> ./../../third_party/angle/src/libANGLE/renderer/vulkan/RendererVk.h:1126:17
#3 0x7f942ad50a4e in void rx::RendererVk::collectGarbage<rx::vk::Image\*, rx::vk::DeviceMemory\*, rx::vk::Allocation\*>(rx::vk::ResourceUse const&, rx::vk::Image\*, rx::vk::DeviceMemory\*, rx::vk::Allocation\*) ./../../third_party/angle/src/libANGLE/renderer/vulkan/RendererVk.h:317:13
#4 0x7f942ad51503 in releaseImage ./../../third_party/angle/src/libANGLE/renderer/vulkan/vk_helpers.cpp:5816:15
#5 0x7f942ad51503 in rx::vk::ImageHelper::releaseImageFromShareContexts(rx::RendererVk\*, rx::ContextVk\*, rx::UniqueSerial) ./../../third_party/angle/src/libANGLE/renderer/vulkan/vk_helpers.cpp:5828:5
#6 0x7f942ab2d953 in rx::RenderbufferVk::releaseImage(rx::ContextVk\*) ./../../third_party/angle/src/libANGLE/renderer/vulkan/RenderbufferVk.cpp:331:17
#7 0x7f942ab2cbc6 in releaseAndDeleteImage ./../../third_party/angle/src/libANGLE/renderer/vulkan/RenderbufferVk.cpp:309:5
#8 0x7f942ab2cbc6 in rx::RenderbufferVk::onDestroy(gl::Context const\*) ./../../third_party/angle/src/libANGLE/renderer/vulkan/RenderbufferVk.cpp:38:5
#9 0x7f942b0d060a in gl::Renderbuffer::onDestroy(gl::Context const\*) ./../../third_party/angle/src/libANGLE/Renderbuffer.cpp:118:26
#10 0x7f942b0d7479 in release ./../../third_party/angle/src/libANGLE/RefCountObject.h:45:13
#11 0x7f942b0d7479 in DeleteObject ./../../third_party/angle/src/libANGLE/ResourceManager.cpp:273:19
#12 0x7f942b0d7479 in gl::TypedResourceManager<gl::Renderbuffer, gl::RenderbufferManager, gl::RenderbufferID>::deleteObject(g
The allocation is a 200-byte region, and the faulting address sits 32 bytes inside it. The read happens on a worker thread (T17) inside the queue's task loop, while the free happens on the main Chrome thread (T0) during renderbuffer destruction. That split is the essence of the bug: the draw is queued and executed asynchronously, and the resource it depends on is torn down on another thread before the draw reaches the descriptor parsing stage.
Root cause
The report's stack traces point to a lifetime problem between ANGLE and SwiftShader. ANGLE decides that a renderbuffer's Vulkan image is no longer needed, releases it from shared contexts, and its garbage collector frees the underlying image. SwiftShader, which is the Vulkan implementation underneath, still has that image referenced from a descriptor set that a pending draw will parse. When the draw executes on the queue thread, ParseDescriptors calls prepareForSampling, which reaches isCubeCompatible and reads from the freed memory.
The report does not describe the exact synchronisation defect in the code, so the precise reason the free was not deferred until the queued draw completed is not stated. What the traces do show is that the free path runs on the main thread through ANGLE's garbage collection while the use path runs on a SwiftShader queue thread, and nothing in the reported sequence prevented the two from overlapping.
Impact
The report classifies the issue as a use-after-free in SwiftShader and the platform records it as high severity. The crash occurs in the software Vulkan path, which is the fallback used when hardware acceleration is not available. The report does not describe a concrete exploitation primitive, such as controlled reuse of the freed 200-byte region, and does not claim code execution. The demonstrated effect is a memory-safety violation in the browser's graphics stack, which in the worst case could be more than a crash, but the report itself only shows the sanitizer-detected read.
Fix
Variants to test
- Run the same PoC against older Chromium builds. The researcher believed versions earlier than 113.0.5624.0 should also reproduce; a positive result is the same AddressSanitizer heap-use-after-free in
isCubeCompatible. - Vary the number of browser instances and drop the
--remote-debugging-port=0 --headlessflags. The report says these flags only speed up reproduction, so a crash without them confirms the bug is not tied to the debugging setup. - Exercise other resource types that ANGLE releases through
releaseImageFromShareContexts, such as textures destroyed while draws are queued. A positive result is a use-after-free whose free stack goes through ANGLE's garbage collection and whose use stack goes through SwiftShader's descriptor parsing. - Target other software or fallback graphics paths where a translation layer and the underlying implementation share object lifetimes. A positive result is a sanitizer report showing the free and the use on different threads with no synchronisation between them.
What happened, in plain words
A security researcher found a bug in Google Chrome, the web browser most people use every day. The bug lives in a piece of Chrome called SwiftShader. To understand what SwiftShader is, imagine your computer has a graphics card, the chip that draws everything you see on screen. Normally Chrome asks that chip to draw web pages. But sometimes the chip is busy, missing, or blocked, and Chrome needs a backup plan. SwiftShader is that backup plan: it is software that draws graphics using the computer's ordinary processor instead of the graphics card. It is slower, but it works everywhere.
The bug is a "use after free". In everyday terms: imagine you borrow a library book, return it, and then later try to read a page from it. The book may still be on the shelf, or someone else may have taken it, or the librarian may have moved it. Reading it after you gave it back is exactly the kind of mistake this bug is. In a computer, memory is handed out to programs and later taken back ("freed"). If a program keeps using memory after it has been freed, it can read garbage, crash, or in the worst case be tricked into running someone else's instructions.
In this case two parts of Chrome disagreed about when a piece of graphics memory was finished with. One part, called ANGLE, decided a picture (an "image" in graphics terms) was no longer needed and freed it. Another part, SwiftShader, still had a note pointing at that picture and tried to read it while drawing. The result was a crash that a debugging tool called AddressSanitizer caught. The bug was reported through Google's Chrome Vulnerability Reward Program, which pays people for finding security problems. It got the identifier CVE-2024-6291, was rated high severity, and was disclosed on 24 June 2024. The researcher is Cassidy Kim (@cassidy6564), and the bounty was 4,000 USD.
Context
This section explains the pieces involved, because the bug only makes sense once you know who is who.
Chrome is the browser. Chromium is the open-source project Chrome is built from; the two share almost all of their code, so a bug in Chromium is a bug in Chrome.
Vulkan is an "API". An API (Application Programming Interface) is a set of agreed instructions one piece of software uses to ask another piece to do something. Think of it as a menu in a restaurant: you do not go into the kitchen, you order from the menu. Vulkan is the menu that programs use to ask a graphics system to draw things. It is designed to be fast and to let the program control the graphics hardware closely.
SwiftShader is a software implementation of Vulkan. Normally Vulkan talks to a real graphics card. SwiftShader is a stand-in that does the same job in ordinary processor code, so Chrome can still draw pages on machines without usable graphics acceleration. Chrome ships it as a fallback.
ANGLE is Chromium's graphics translation layer. Web pages use a different graphics API (called WebGL, and internally OpenGL ES). ANGLE takes those requests and translates them into Vulkan calls. So the chain is: web page, then ANGLE, then Vulkan, and in this case Vulkan is provided by SwiftShader. ANGLE sits above SwiftShader and manages its own Vulkan resources, including the images it asks SwiftShader to create.
A descriptor set is Vulkan's way of telling a draw which resources to use. Before drawing, the program fills in a small table saying "use this image here, that buffer there". When the draw runs, the graphics system reads that table. In this bug, the table still pointed at an image that ANGLE had already freed.
A draw is simply the instruction "paint this shape on screen". Draws are queued: the program says "do this later" and a worker thread picks the work up. That queuing is central here, because the free happened on one thread while the use happened on another.
A thread is one line of execution inside a program. A program can have many threads running at the same time, like several cooks in one kitchen. If two cooks reach for the same pot without coordinating, things go wrong. The report shows the free on thread T0 (the main Chrome thread) and the read on thread T17 (a SwiftShader worker).
AddressSanitizer (ASan) is a debugging tool built into special test versions of Chrome. It watches memory and shouts loudly the moment a program touches memory it has already freed. Without it, such a bug might silently corrupt data or crash only occasionally. With it, the bug produces a clear report naming the exact line of code.
CVE stands for Common Vulnerabilities and Exposures. It is a public catalogue number given to a security flaw so people can refer to it unambiguously. Severity is a rough rating of how serious the flaw is; here it is high.
Setup
The researcher tested on Ubuntu 22.04, a version of the Linux operating system. Two Chromium builds were used:
- Chromium 121.0.6128.0, taken from the ASan build at
gs://chromium-browser-asan/linux-release/asan-linux-release-1224132.zip - Chromium 113.0.5624.0, with the note that earlier versions should also be affected
An ASan build is a special build of the browser compiled with AddressSanitizer switched on. You cannot just download normal Chrome and see this report; you need the instrumented build. The gs:// prefix means the file lives in Google Cloud Storage, Google's file-hosting service.
The report lists the channel as "Not sure" and the OS as Linux. A channel is the release track of Chrome (stable, beta, dev, canary); the report lists the channel as "Not sure".
Reproduction uses three things: a local HTTP server, a launcher script, and the ASan build. A local HTTP server is a tiny web server running on your own machine. It serves files from a folder so the browser can load them over http://localhost:8000 exactly as if they came from the internet.
A proof of concept (PoC) is a small set of files that triggers the bug. It is not a weapon; it is a demonstration that the flaw is real.
Finding it
The researcher ran the PoC and watched for an AddressSanitizer report. ASan reported a heap-use-after-free. "Heap" is the general-purpose pool of memory a program uses for objects it creates while running; "use after free" means reading or writing an object after it was returned to that pool.
The read was 4 bytes in size, and it happened inside a function called isCubeCompatible in SwiftShader's image code. That function was reached through requiresPreprocessing and Image::prepareForSampling, which was called from Device::prepareForSampling while DescriptorSet::ParseDescriptors was working through the descriptor table for a draw. In plain terms: the draw was starting, it looked up the image in its table, and while checking the image it read a field that no longer existed.
The memory had been freed earlier on the main Chrome thread by ANGLE's garbage collection. Garbage collection here means a cleanup routine that waits for resources to become unused and then releases them. ANGLE decided a renderbuffer's image was unused, released it from shared contexts, and its collector freed the underlying memory. A renderbuffer is an off-screen drawing surface, a scratch canvas the browser draws into before combining it into the final page.
So ANGLE freed a Vulkan image it believed nobody needed, while SwiftShader still had a reference to that image through a descriptor set that a queued draw was about to use. The two components disagreed about when the image was dead. That disagreement is the whole bug.
Exploitation
This heading is about reproducing the crash, not about attacking anyone. The steps below are how the researcher made the bug appear reliably.
Step 1: serve the proof of concept over HTTP
python3 -m http.server 8000 --dir=|Path|
Line by line:
python3runs the Python 3 interpreter. Python is a programming language that ships with a small built-in web server, which is handy for testing.-m http.servertells Python to run its built-in HTTP server module. It serves the files in a folder over HTTP.8000is the port number. A port is like a door number on a building: one computer can run many services, and each listens on a different port. Port 8000 is a common choice for local testing.--dir=|Path|tells the server which folder to serve.|Path|is a placeholder: you replace it with the real local folder that holds the PoC files.
Why this step: the browser needs to load the PoC as a web page from a server, so the researcher starts one on the same machine.
Step 2: run the launcher and filter for the sanitizer report
./launcher.sh 2>&1 |grep -E 'AddressSanitizer'
Line by line:
./launcher.shruns a shell script namedlauncher.shin the current folder. A shell script is a text file of commands the computer runs in order. This one starts the browser instances and runs the PoC.2>&1redirects the error output (file descriptor 2) into the normal output (file descriptor 1), so both streams are captured together. Programs normally print errors to a separate stream; this merges them so nothing is missed.|is a pipe. It takes the output of the command on the left and feeds it as input to the command on the right.grep -E 'AddressSanitizer'filters that combined output, keeping only lines that match the patternAddressSanitizer.grepis a standard search tool, and-Emeans extended regular expressions, a pattern syntax.
Why this step: the launcher produces a lot of output, and the crash report is buried in it. Filtering makes the important lines easy to see.
The researcher notes that the paths to Chrome and to the PoC inside launcher.sh must be adjusted to the actual environment. In other words, the script contains placeholders for where Chrome lives and where the PoC lives on that particular machine.
Because a single browser instance reproduced the bug unreliably, the script opens 20 Chrome instances and runs the PoC in --headless mode. Headless means the browser runs without showing a window; it is still a full browser, just invisible. The researcher opened 20 instances because a single browser reproduced the bug unreliably. With that setup the issue should reproduce within about 30 seconds.
The flags --remote-debugging-port=0 --headless are not required for the bug itself. Remote debugging is a feature that lets another program control the browser; --remote-debugging-port=0 asks it to pick a free port automatically. The researcher used these flags only to make reproduction faster, not because the bug depends on them.
What the sanitizer reported
The crash is a heap-use-after-free on address 0x511000073420, a read of size 4 on thread T17. The stack shows the read inside SwiftShader's image code and the free inside ANGLE's resource cleanup:
==750974==ERROR: AddressSanitizer: heap-use-after-free on address 0x511000073420 at pc 0x7f94094f626e bp 0x7f93fe5ba890 sp 0x7f93fe5ba888
READ of size 4 at 0x511000073420 thread T17
#0 0x7f94094f626d in isCubeCompatible ./../../third_party/swiftshader/src/Vulkan/VkImage.cpp:877:25
#1 0x7f94094f626d in requiresPreprocessing ./../../third_party/swiftshader/src/Vulkan/VkImage.cpp:1128:9
#2 0x7f94094f626d in vk::Image::prepareForSampling(VkImageSubresourceRange const&) const ./../../third_party/swiftshader/src/Vulkan/VkImage.cpp:1175:6
#3 0x7f94094c4474 in prepareForSampling ./../../third_party/swiftshader/src/Vulkan/VkImageView.hpp:129:37
#4 0x7f94094c4474 in vk::Device::prepareForSampling(vk::ImageView\*) ./../../third_party/swiftshader/src/Vulkan/VkDevice.cpp:467:15
#5 0x7f94094bb52a in vk::DescriptorSet::ParseDescriptors(std::__Cr::array<vk::DescriptorSet\*, 4ul> const&, vk::PipelineLayout const\*, vk::Device\*, vk::DescriptorSet::NotificationType) ./../../third_party/swiftshader/src/Vulkan/VkDescriptorSet.cpp:67:16
#6 0x7f94095fb2b7 in sw::Renderer::draw(vk::GraphicsPipeline const\*, vk::DynamicState const&, unsigned int, int, sw::CountedEvent\*, int, int, void\*, VkRect2D const&, vk::Pipeline::PushConstantStorage const&, bool) ./../../third_party/swiftshader/src/Device/Renderer.cpp:296:2
#7 0x7f94094b4f45 in (anonymous namespace)::CmdDrawBase::draw(vk::CommandBuffer::ExecutionState&, bool, unsigned int, unsigned int, unsigned int, int, unsigned int) ./../../third_party/swiftshader/src/Vulkan/VkCommandBuffer.cpp:957:31
#8 0x7f94094b496b in (anonymous namespace)::CmdDraw::execute(vk::CommandBuffer::ExecutionState&) ./../../third_party/swiftshader/src/Vulkan/VkCommandBuffer.cpp:985:3
#9 0x7f94094add78 in vk::CommandBuffer::submit(vk::CommandBuffer::ExecutionState&) ./../../third_party/swiftshader/src/Vulkan/VkCommandBuffer.cpp:2330:12
#10 0x7f940951b391 in vk::Queue::submitQueue(vk::Queue::Task const&) ./../../third_party/swiftshader/src/Vulkan/VkQueue.cpp:104:42
#11 0x7f940951a1f4 in vk::Queue::taskLoop(marl::Scheduler\*) ./../../third_party/swiftshader/src/Vulkan/VkQueue.cpp:156:4
#12 0x7f940951e1f5 in __invoke<void (vk::Queue::\*)(marl::Scheduler \*), vk::Queue \*, marl::Scheduler \*, void> ./../../third_party/libc++/src/include/__type_traits/invoke.h:312:25
#13 0x7f940951e1f5 in __thread_execute<std::__Cr::unique_ptr<std::__Cr::__thread_struct, std::__Cr::default_delete<std::__Cr::__thread_struct> >, void (vk::Queue::\*)(marl::Scheduler \*), vk::Queue \*, marl::Scheduler \*, 2UL, 3UL> ./../../third_party/libc++/src/include/__thread/thread.h:220:5
#14 0x7f940951e1f5 in void\* std::__Cr::__thread_proxy<std::__Cr::tuple<std::__Cr::unique_ptr<std::__Cr::__thread_struct, std::__Cr::default_delete<std::__Cr::__thread_struct>>, void (vk::Queue::\*)(marl::Scheduler\*), vk::Queue\*, marl::Scheduler\*>>(void\*) ./../../third_party/libc++/src/include/__thread/thread.h:231:5
#15 0x5564244aa348 in asan_thread_start(void\*) _asan_rtl_:28
0x511000073420 is located 32 bytes inside of 200-byte region [0x511000073400,0x5110000734c8)
freed by thread T0 (chrome) here:
#0 0x5564244ac4e6 in __interceptor_free _asan_rtl_:3
#1 0x7f942ad50a4e in destroy ./../../third_party/angle/src/libANGLE/renderer/vulkan/vk_wrapper.h:1361:9
#2 0x7f942ad50a4e in DestroyGarbage<rx::vk::Image \*, rx::vk::DeviceMemory \*, rx::vk::Allocation \*> ./../../third_party/angle/src/libANGLE/renderer/vulkan/RendererVk.h:1126:17
#3 0x7f942ad50a4e in void rx::RendererVk::collectGarbage<rx::vk::Image\*, rx::vk::DeviceMemory\*, rx::vk::Allocation\*>(rx::vk::ResourceUse const&, rx::vk::Image\*, rx::vk::DeviceMemory\*, rx::vk::Allocation\*) ./../../third_party/angle/src/libANGLE/renderer/vulkan/RendererVk.h:317:13
#4 0x7f942ad51503 in releaseImage ./../../third_party/angle/src/libANGLE/renderer/vulkan/vk_helpers.cpp:5816:15
#5 0x7f942ad51503 in rx::vk::ImageHelper::releaseImageFromShareContexts(rx::RendererVk\*, rx::ContextVk\*, rx::UniqueSerial) ./../../third_party/angle/src/libANGLE/renderer/vulkan/vk_helpers.cpp:5828:5
#6 0x7f942ab2d953 in rx::RenderbufferVk::releaseImage(rx::ContextVk\*) ./../../third_party/angle/src/libANGLE/renderer/vulkan/RenderbufferVk.cpp:331:17
#7 0x7f942ab2cbc6 in releaseAndDeleteImage ./../../third_party/angle/src/libANGLE/renderer/vulkan/RenderbufferVk.cpp:309:5
#8 0x7f942ab2cbc6 in rx::RenderbufferVk::onDestroy(gl::Context const\*) ./../../third_party/angle/src/libANGLE/renderer/vulkan/RenderbufferVk.cpp:38:5
#9 0x7f942b0d060a in gl::Renderbuffer::onDestroy(gl::Context const\*) ./../../third_party/angle/src/libANGLE/Renderbuffer.cpp:118:26
#10 0x7f942b0d7479 in release ./../../third_party/angle/src/libANGLE/RefCountObject.h:45:13
#11 0x7f942b0d7479 in DeleteObject ./../../third_party/angle/src/libANGLE/ResourceManager.cpp:273:19
#12 0x7f942b0d7479 in gl::TypedResourceManager<gl::Renderbuffer, gl::RenderbufferManager, gl::RenderbufferID>::deleteObject(g
How to read this block. A stack trace is a list of function calls, newest first, that led to the moment of the crash. Each line has a number (#0, #1, ...), an address, a function name, and a file and line number. Reading from #0 downwards tells you what was happening at the crash; reading the second trace tells you where the memory was freed.
- The first line is the headline: AddressSanitizer says heap-use-after-free at address
0x511000073420.pc,bpandspare processor registers (program counter, base pointer, stack pointer) recorded at the moment of the fault; they are diagnostic detail, not something you need to interpret. READ of size 4 at 0x511000073420 thread T17says the program tried to read 4 bytes from that address, on thread T17.#0isisCubeCompatibleinVkImage.cppline 877. This is the exact instruction that touched freed memory.#1and#2show thatisCubeCompatiblewas called fromrequiresPreprocessing, which was called fromImage::prepareForSampling. "Prepare for sampling" means getting an image ready to be read by a shader (the small program that colours pixels).#3and#4show the call came throughDevice::prepareForSampling, so the device (the Vulkan device object) was preparing an image view.#5is the key line:DescriptorSet::ParseDescriptors. The draw was reading its descriptor table and preparing each image in it.#6to#8show the draw being executed:Renderer::draw, thenCmdDrawBase::draw, thenCmdDraw::execute. These are the drawing commands running.#9to#11show the command buffer being submitted and the queue's task loop picking it up. A command buffer is a recorded list of drawing commands; a queue is the line where those commands wait to be executed.#12to#15are threading plumbing: the queue's task loop running on a worker thread started by the thread library.
The second trace, "freed by thread T0 (chrome) here", is the other half of the story:
#0is__interceptor_free, the AddressSanitizer hook that records every free. This is where the memory was actually returned.#1to#3show ANGLE'sdestroyandDestroyGarbage, insideRendererVk::collectGarbage. This is ANGLE's garbage collector doing its job.#4and#5showreleaseImageandImageHelper::releaseImageFromShareContexts. The image was being released from contexts that shared it.#6to#8showRenderbufferVk::releaseImage,releaseAndDeleteImage, andRenderbufferVk::onDestroy. A renderbuffer was being destroyed, and its image went with it.#9to#12show the higher-level OpenGL-style renderbuffer object being destroyed and removed from the resource manager.
The line 0x511000073420 is located 32 bytes inside of 200-byte region [0x511000073400,0x5110000734c8) tells you the freed block was 200 bytes long, and the address that was read sits 32 bytes into it. In other words, the read was not at the very start of the block but a little way in, which fits reading a field inside a structure.
The read happens on a worker thread (T17) inside the queue's task loop, while the free happens on the main Chrome thread (T0) during renderbuffer destruction. That split is the essence of the bug: the draw is queued and executed asynchronously, and the resource it depends on is torn down on another thread before the draw reaches the descriptor parsing stage. Asynchronous means "not at the same time and not in a fixed order": the draw was handed off to be done later, and the cleanup ran in between.
Root cause
The stack traces point to a lifetime problem between ANGLE and SwiftShader. Lifetime here means how long an object is supposed to exist. ANGLE decides that a renderbuffer's Vulkan image is no longer needed, releases it from shared contexts, and its garbage collector frees the underlying image. SwiftShader, which is the Vulkan implementation underneath, still has that image referenced from a descriptor set that a pending draw will parse. When the draw executes on the queue thread, ParseDescriptors calls prepareForSampling, which reaches isCubeCompatible and reads from the freed memory.
The report does not describe the exact synchronisation defect in the code, so the precise reason the free was not deferred until the queued draw completed is not stated. Synchronisation means coordination between threads so they do not step on each other, like two people agreeing who uses the shared printer first. What the traces do show is that the free path runs on the main thread through ANGLE's garbage collection while the use path runs on a SwiftShader queue thread, and nothing in the reported sequence prevented the two from overlapping.
Impact
The report classifies the issue as a use-after-free in SwiftShader and the platform records it as high severity. The crash occurs in the software Vulkan path, which is the fallback used when hardware acceleration is not available.
The report does not describe a concrete exploitation primitive, such as controlled reuse of the freed 200-byte region, and does not claim code execution. An exploitation primitive is a small, reliable capability an attacker builds on, for example the ability to place chosen data where the freed memory used to be. Code execution means getting the computer to run an attacker's instructions, the worst outcome for a memory bug. The demonstrated effect is a memory-safety violation in the browser's graphics stack, which in the worst case could be more than a crash, but the report itself only shows the sanitizer-detected read.
Fix
Variants to test
These are follow-up experiments someone could run to learn more about the bug. Each one changes one thing and looks for the same kind of crash.
- Run the same PoC against older Chromium builds. The researcher believed versions earlier than 113.0.5624.0 should also reproduce; a positive result is the same AddressSanitizer heap-use-after-free in
isCubeCompatible. Why: if older versions crash too, the flaw has existed for a long time and is not a recent regression. - Vary the number of browser instances and drop the
--remote-debugging-port=0 --headlessflags. The report says these flags only speed up reproduction, so a crash without them confirms the bug is not tied to the debugging setup. Why: it separates the bug from the test harness. - Exercise other resource types that ANGLE releases through
releaseImageFromShareContexts, such as textures destroyed while draws are queued. A positive result is a use-after-free whose free stack goes through ANGLE's garbage collection and whose use stack goes through SwiftShader's descriptor parsing. Why: if other resources show the same pattern, the problem is in the shared lifetime rule, not in one image type. - Target other software or fallback graphics paths where a translation layer and the underlying implementation share object lifetimes. A positive result is a sanitizer report showing the free and the use on different threads with no synchronisation between them. Why: the same design mistake may exist wherever two layers share ownership of the same object.
Glossary
- AddressSanitizer (ASan): a debugging tool built into special test builds that detects memory errors such as reading memory after it was freed.
- ANGLE: Chromium's graphics translation layer that converts web graphics calls into Vulkan calls.
- API: a defined set of instructions one piece of software uses to ask another to do something, like a menu you order from.
- Asynchronous: work handed off to be done later, so it does not happen in a fixed order relative to other work.
- Channel: a release track of Chrome such as stable, beta, dev or canary.
- Chromium: the open-source browser project that Chrome is built from.
- Code execution: getting a computer to run instructions chosen by an attacker.
- Command buffer: a recorded list of drawing commands waiting to be executed.
- CVE: a public catalogue number for a security vulnerability, here CVE-2024-6291.
- Descriptor set: Vulkan's table telling a draw which resources (images, buffers) to use.
- Draw: the instruction to paint a shape on screen.
- Exploitation primitive: a small reliable capability an attacker builds on, such as controlling what data lands in freed memory.
- Garbage collection: a cleanup routine that releases resources once they are no longer in use.
- Headless: running a browser without a visible window.
- Heap: the general-purpose pool of memory a program uses for objects created while it runs.
- HTTP server: software that serves files over the HTTP protocol; a local one serves files from your own machine.
- Lifetime: how long an object is supposed to exist before it is destroyed.
- Pipe: a shell feature that feeds the output of one command into another.
- PoC (proof of concept): a small set of files that demonstrates a bug without causing harm.
- Port: a numbered door on a computer that a network service listens on.
- Queue: the line where drawing commands wait to be executed.
- Remote debugging: a feature that lets another program control the browser.
- Renderbuffer: an off-screen drawing surface used as a scratch canvas.
- Severity: a rating of how serious a vulnerability is; here high.
- Shell script: a text file of commands the computer runs in order.
- Stack trace: a list of function calls, newest first, showing how the program reached a particular point.
- SwiftShader: a software implementation of Vulkan that Chrome uses when hardware graphics acceleration is unavailable.
- Synchronisation: coordination between threads so they do not interfere with each other.
- Thread: one line of execution inside a program; a program can run several at once.
- Use after free: reading or writing memory after it has been returned to the system, which can cause crashes or worse.
- Vulkan: a graphics API that programs use to ask a graphics system to draw.
- WebGL: the web API browsers expose to pages for drawing 3D graphics.