Integer overflow in V8 (CVE-2026-10964)
An integer overflow in V8's LiteralBuffer::ConvertToTwoByte during background parsing of a 1 GiB string literal causes an out-of-bounds write outside the V8 sandbox. An attacker could potentially achieve remote code execution in the renderer by racing heap grooming against the write.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 26 days
Project Fortify, an experimental security project, has identified the following potential security issue. If you're a feature owner CC-ed on this bug, please do your best to review these reports without the Chrome Security team. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.
Overview: An integer overflow exists in LiteralBuffer::ConvertToTwoByte during the background parsing of JavaScript strings. By providing a 1 GiB string literal via streaming compilation, an attacker can overflow a signed 32-bit size calculation, causing a massive out-of-bounds write outside the V8 sandbox. A concurrent heap grooming strategy can exploit the resulting race window to achieve remote code execution in the renderer.
Affected files:
v8/src/parsing/literal-buffer.ccv8/src/parsing/literal-buffer.hv8/src/codegen/compiler.ccv8/src/parsing/scanner.ccv8/src/parsing/scanner-character-streams.ccthird_party/blink/renderer/bindings/core/v8/script_streamer.cc
Estimated timestamp from git blame: 2023-06-13
Summary
A potential integer overflow vulnerability exists in V8's LiteralBuffer::ConvertToTwoByte, which is triggered when parsing a massive (1 GiB) string literal. Because the streaming compilation path (BackgroundCompileTask) does not enforce standard V8 string length limits during parsing, an attacker can force a buffer to grow to 1 GiB. When a non-ASCII character is subsequently encountered, a signed integer overflow occurs during buffer expansion calculation. This results in the reuse of an undersized buffer and a massive out-of-bounds backward sweep across the renderer heap, completely bypassing the V8 sandbox.
Vulnerability Details
In v8/src/parsing/literal-buffer.cc, the ConvertToTwoByte() method converts a string literal buffer from one-byte (Latin-1) to two-byte (UC16) when a non-Latin-1 character is found.
void LiteralBuffer::ConvertToTwoByte() {
DCHECK(is_one_byte());
base::Vector<uint8_t> new_store;
int new_content_size = position_ * base::kUC16Size; // [1] Integer Overflow
if (new_content_size >= backing_store_.length()) { // [2] Comparison Failure
new_store = base::Vector<uint8_t>::New(NewCapacity(new_content_size));
} else {
new_store = backing_store_;
}
uint8_t* src = backing_store_.begin();
uint16_t* dst = reinterpret_cast<uint16_t*>(new_store.begin());
for (int i = position_ - 1; i >= 0; i--) { // [3] OOB Write Loop
dst[i] = src[i];
}
// ...
}
- Integer Overflow:
position_is a signedinttracking the number of accumulated characters. Normally,String::kMaxLengthprevents strings from reaching 1 GiB. However, the backgroundScannerdoes not enforce this limit while accumulating literals. Whenposition_reaches exactly0x40000000(1 GiB),position_ * base::kUC16Size(wherekUC16Sizeis 2) overflows to0x80000000. As signed 32-bit integers are used and Chromium compiles with-fno-strict-overflow, this safely wraps to-2147483648(INT_MIN). - Comparison Failure: The check
new_content_size >= backing_store_.length()evaluatesINT_MIN >= 0x40000000. This returnsfalse. The function skips allocating a new 2 GiB buffer and aliasesnew_storeto the existing 1 GiBbacking_store_. - Out-of-Bounds Write: The loop expands characters in-place by sweeping backwards. On the first iteration (
i = 0x3FFFFFFF), the code reads safely fromsrc[i]but writes todst[i], which translates to byte offset0x7FFFFFFE. Since the buffer is only0x40000000bytes long, this write lands almost 1 GiB out-of-bounds.
Exploitability and Sandbox Bypass
The LiteralBuffer allocates memory using base::Vector::New, which routes to PartitionAlloc's default Malloc partition. Crucially, this partition is outside the V8 Sandbox.
While the backward write loop sweeps from 0x7FFFFFFE down towards 0x40000000, it will eventually hit the uncommitted PartitionAlloc guard pages that precede the 1 GiB LiteralBuffer allocation, causing a deterministic SIGSEGV crash.
However, this sweeping operation over ~1 GiB of memory takes tens of milliseconds, creating a substantial race window. An attacker can exploit this via concurrent heap grooming on the main thread:
- Before the background thread reaches the overflow, the attacker's main thread allocates a massive 1 GiB target object (e.g., a Blink
ArrayBuffer). - PartitionAlloc's
AddressPoolManagerplaces DirectMap allocations sequentially bottom-up. The Target object will be placed adjacently above theLiteralBuffer. - When the out-of-bounds write starts at offset
0x7FFFFFFE, it lands squarely inside the Target object's payload. - While the background thread sweeps downward (corrupting the Target object), the attacker's main thread can observe the corruption and use it to escape the sandbox before the background thread hits the guard page and crashes.
Suggested Reproduction Steps
Note: These are potential steps as our tooling cannot currently execute code to verify.
- Set up an HTTP server to deliver a large JavaScript file with
Content-Type: application/javascript; charset=utf-8andContent-Encoding: gzip(to bypass network fetch limits and optimize delivery). - The script body should contain a string literal starting with
0x40000000bytes (1 GiB) of ASCII characters (e.g.,'A'), followed by a non-ASCII two-byte character (e.g.,\u0100, encoded as0xC4 0x80in UTF-8), and ending with a quote. - Navigate Chrome to an HTML page that includes this script via
<script src="..."></script>. - The background parser will accumulate 1 GiB of characters. Upon encountering the two-byte character, it triggers the overflow in
ConvertToTwoByte, resulting in an OOB write and eventual crash.
Suggested Fix
- Immediate Fix: Use
base::CheckedNumericorbase::CheckedMulfor thenew_content_sizecalculation inLiteralBuffer::ConvertToTwoByte()to safely catch the overflow and trigger a safe OOM crash. - Structural Fix: Enforce
v8::String::kMaxLengthlimits directly within theScannerorLiteralBufferduring the streaming compilation phase to prevent the buffer from growing beyond safe sizes in the first place.
Evaluated with Chrome root at commit: eca8648a4e1cdfdda68c495a6003059fed641955
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. And please feel free to reach out to me directly if you have concerns or feedback on the project.
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 a signed 32-bit integer overflow in the size calculation for converting a one-byte string buffer to two-byte, combined with a missing length limit in the background scanner.
Impact
The out-of-bounds write could lead to remote code execution in the renderer, but the write eventually hits guard pages causing a crash, and exploitation requires winning a race window.
What the attacker needed
Victim visits a malicious page; page loads a large gzipped script; script contains a 1 GiB string literal
The fix
The calculation should use checked arithmetic to catch the overflow, and the scanner should enforce string length limits during streaming compilation.
How it was found
- Set up an HTTP server to deliver a large JavaScript file with gzip encoding.
- Create a script containing a 1 GiB ASCII string literal followed by a non-ASCII character.
- Navigate Chrome to an HTML page that loads this script via a script tag.
- The background parser accumulates the string and triggers the overflow when it encounters the non-ASCII character, causing an out-of-bounds write and crash.
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 stores text, it sometimes needs to switch from a compact one-byte-per-character format to a two-byte format for special characters. The code calculates how much space is needed, but with a very large input that calculation wraps around to a negative number, so the program thinks it already has enough space and writes past the end of its buffer. This can crash the browser and, with careful timing, might let an attacker run their own code.
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.