Out of bounds read and write in GFX (CVE-2026-7950)
An arithmetic mismatch in X11 property length calculations between the generated parser and the GetArrayProperty consumer allows a malicious X server to cause a heap out-of-bounds read and write in the browser process. An attacker controlling the X server could trigger memory corruption by returning a crafted format value.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 42 days
Project Fortify, an experimental security project, has identified the following potential security issue.
Overview: An arithmetic mismatch in X11 property calculations between the generated parser and the GetArrayProperty consumer can lead to a heap out-of-bounds read and write. A malicious X server can return a crafted format value, causing the consumer to calculate a larger copy size than the allocated buffer. This allows an attacker to perform a controlled OOB memory corruption in the highly-privileged browser process.
Affected files:
ui/gfx/x/connection.hui/gfx/x/generated_protos/xproto.cc
Estimated timestamp from git blame: 2025-04-21
Summary
There is a potential heap out-of-bounds (OOB) write and read in Chrome's X11 property handling logic within ui/gfx/x. The issue stems from a discrepancy in how the byte length of property data is calculated between the auto-generated protocol parser and the GetArrayProperty template.
Note: This report was generated by our setup through static code analysis. The steps below are theoretical and a working Proof-of-Concept has not yet been executed.
Technical Details
The vulnerability is caused by an integer arithmetic mismatch when calculating the byte length of an X11 property value based on its format (bits per item) and value_len (number of items) fields.
1. Parser Logic (ui/gfx/x/generated_protos/xproto.cc):
When reading a GetPropertyReply, the auto-generated parser advances its read buffer using the following calculation (line 4279):
value = buffer->ReadAndAdvance((value_len) * ((format) / (8)));
Due to the parentheses, integer division of format by 8 occurs first, truncating any remainder. For a non-standard format like 39, 39 / 8 evaluates to 4.
2. Consumer Logic (ui/gfx/x/connection.h):
The GetArrayProperty template processes the reply and calculates the copy length (line 379):
size_t byte_len = response->value_len * response->format / 8u;
Here, multiplication occurs before division. For value_len=1000 and format=39, this evaluates as (1000 * 39) / 8 = 4875.
3. The OOB Copy (ui/gfx/x/connection.h):
The consumer allocates a destination std::vector<T> based on value_len and performs an unsafe memcpy (lines 380-382):
value->resize(response->value_len);
if (byte_len > 0u) {
UNSAFE_TODO(memcpy(value->data(), response->value->bytes(), byte_len));
}
If T=uint32_t, the vector allocates 1000 * 4 = 4000 bytes. The memcpy then attempts to copy 4875 bytes. This reads 875 bytes past the end of the X11 reply buffer (OOB read) and writes 875 bytes past the end of the vector's backing store (OOB write).
Potential Attacker Steps
To trigger this vulnerability, an attacker would need to control the X11 server the victim connects to (e.g., via malicious local X server, X11 forwarding over SSH, or a compromised proxy).
- The attacker sets up a malicious X11 server.
- The victim launches Chrome, which connects to the X display.
- Chrome requests a standard property, such as
WM_NORMAL_HINTS, which invokesGetArrayProperty<uint32_t>. - The malicious server responds to the
GetPropertyRequestwith:format = 39value_len = 1000length = 1000(to satisfy the parser's expected 4000-byte payload length)
- The parser successfully processes the 4000-byte payload.
GetArrayPropertyevaluates the guardresponse->format / 8u != sizeof(T). Since39 / 8 == 4 == sizeof(uint32_t), the check passes.byte_lenis calculated as 4875. Thememcpyreads 4875 bytes from the 4000-byte source and writes 4875 bytes to the 4000-byte vector, causing a heap OOB read and write.
Suggested Fix
-
Strict Format Validation: The most robust fix is to strictly validate that the
formatfield provided by the X server is a standard value (i.e., exactly8,16, or32). If a non-standard format is encountered, the reply should be rejected early. -
Consistent Arithmetic: Update
GetArrayPropertyto calculate the copy size exactly as the parser does, or derive it directly from the allocatedsizeof(T):C++ size_t byte_len = response->value_len * sizeof(T);
Evaluated with Chrome root at commit: 0eb4855bda702feaaa8b899336664f97e3df88b8
Results so far have been promising, but there can be wrong deductions. If this proves to be a false positive, please close as WAI; data from false positives will be used to improve accuracy over time. Please feel free to reach out to me if you have concerns or feedback.
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 an integer arithmetic mismatch: the parser truncates format/8 before multiplying by value_len, while the consumer multiplies value_len by format before dividing by 8, leading to a larger byte_len than the allocated buffer.
Impact
A malicious X server could cause a controlled heap out-of-bounds read and write in the highly-privileged browser process, potentially leading to memory corruption or code execution.
What the attacker needed
Attacker controls the X11 server; victim connects to the malicious X server
The fix
The fix should strictly validate that the format field is 8, 16, or 32, and make the arithmetic consistent by deriving byte_len from sizeof(T).
How it was found
- The attacker sets up a malicious X11 server.
- The victim launches Chrome, which connects to the X display.
- Chrome requests a standard property, such as WM_NORMAL_HINTS, which invokes GetArrayProperty<uint32_t>.
- The malicious server responds to the GetPropertyRequest with format = 39, value_len = 1000, and length = 1000.
- The parser successfully processes the 4000-byte payload.
- GetArrayProperty evaluates the guard response->format / 8u != sizeof(T), which passes because 39 / 8 == 4 == sizeof(uint32_t), then calculates byte_len as 4875 and performs memcpy, causing a heap OOB read and write.
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.
When a program asks the X server (the software that manages windows on Linux) for information about a window property, it receives a reply with a length field. The code that reads this reply calculates the length in two different ways, so a malicious X server can make the program copy more data than it allocated, corrupting memory. This could let an attacker who controls the X server run code or crash 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.