Integer overflow in V8 (CVE-2026-14430)
A signed 32-bit separator counter in Array.prototype.join can overflow to a negative value on 32-bit V8 architectures, and missing lower-bound checks let that negative value reach a C++ string-flattening routine. There it is treated as a repeat-last count, causing a large heap out-of-bounds write with attacker-controlled data.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 21 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. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.
Overview: On 32-bit V8 architectures (arm32/ia32), the signed intptr separator counter in Array.prototype.join can wrap negative when iterating over arrays with lengths approaching 2^32. Due to missing negative bounds checks in the Torque layer, the negative value is stored in the chunk list and interpreted by the C++ string flattening sink as a repeat-last count, resulting in a large linear heap OOB write.
Affected files:
src/builtins/array-join.tqsrc/objects/objects.cc
Estimated timestamp from git blame: 2025-08-14
1. Summary of the Issue (Meant for Human Triage)
A highly severe, potential heap out-of-bounds (OOB) write vulnerability has been identified in V8's Array.prototype.join implementation when executed on 32-bit architectures (arm32 and ia32).
In the Torque implementation ArrayJoinImpl, a signed intptr counter named nofSeparators is used to keep track of consecutive separators. When joining arrays with length properties approaching kMaxArrayLength (which is kMaxUInt32, or 0xFFFFFFFF), the loop can iterate billions of times. On 32-bit architectures, where an intptr is a signed 32-bit integer, this counter eventually overflows and wraps around to a negative value.
Because AddSeparators and AddStringLength lack lower-bounds checking or negativity guards, this negative counter value is processed as valid and stored as a negative Smi in the internal chunk list. When rendering the final string in the C++ routine WriteChunkListToFlat, the negative Smi is interpreted as a repeat_last directive. Since the bounds checks in the C++ memcpy loops are compiled out in production/release builds (being gated behind DCHECK macros), this results in a massive, linear heap buffer overflow (memcpy) of attacker-controlled data past a freshly allocated SeqOneByteString buffer.
Since 32-bit V8 architectures run with V8_ENABLE_SANDBOX=0 and lack pointer-compression cages or guard regions, this translates to a highly reliable and direct renderer heap corruption primitive. 64-bit systems are structurally unaffected because intptr is a 64-bit signed integer, meaning the counter cannot wrap negative.
2. Proof-of-Concept & Detailed Execution Flow
(Note: The steps below represent a potential trigger flow verified through static analysis and tooling; our agent tooling does not currently have the capability to execute this code dynamically.)
Step-by-Step Execution Flow Analysis
-
Entry Point & Vector Initialization: An attacker invokes
Array.prototype.joinon a receiver with a length close tokMaxUInt32(e.g.,0xFFFFFFFC) on a 32-bit platform:JavaScript const L = 0x1000; const s = "A".repeat(L); Array.prototype.join.call({0: s, length: 0xFFFFFFFC}, ",");This invokes the
GenericElementsAccessoror dictionary elements accessor fallback paths. Atsrc/builtins/array-join.tq:450, the length is converted to auintptr:TORQUE const len: uintptr = Convert<uintptr>(lengthNumber); // len = 0xFFFFFFFC -
Signed Counter Overflow: At
src/builtins/array-join.tq:452,nofSeparatorsis initialized as a signedintptr(which is a 32-bit signed integer on 32-bit targets):TORQUE let nofSeparators: intptr = 0;As the loop iterates over the
lenempty entries/holes, it bypasses adding string fragments but repeatedly increments the separator counter atsrc/builtins/array-join.tq:469:TORQUE nofSeparators = nofSeparators + 1;Once
nofSeparatorsexceeds0x7FFFFFFF(2,147,483,647), it wraps around to negative values. For0xFFFFFFFCiterations with empty elements,nofSeparatorswraps to0xFFFFFFFB, which represents-5as a signed 32-bit integer. -
Bypassing AddSeparators and AddStringLength Guards: At the end of the loop,
buffer.AddSeparators(nofSeparators, separatorLength, true)is called withnofSeparators = -5. Inside the macroAddSeparators(src/builtins/array-join.tq:202-220):TORQUE if (nofSeparators == 0 || separatorLength == 0) return; // -5 != 0, bypasses const nofSeparatorsInt: intptr = nofSeparators; const sepsLen: intptr = separatorLength * nofSeparatorsInt; // 1 * -5 = -5 if (sepsLen / separatorLength != nofSeparatorsInt) deferred { ... } // -5 / 1 == -5, bypassesThe macro then calls
AddStringLengthwith a negative length addition:TORQUE this.totalStringLength = AddStringLength(this.totalStringLength, sepsLen); // totalStringLength decrements by 5AddStringLength(src/builtins/array-join.tq:142-150) usesTryIntPtrAddand guards only against upper bounds exceedingkStringMaxLength, allowing negative values/decrements to slip through:TORQUE const length: intptr = TryIntPtrAdd(lenA, lenB) otherwise IfOverflow; if (length > kStringMaxLength) goto IfOverflow; // No lower-bound check! return length;Finally,
AddSeparatorsappends the negative value as a Smi into the chunk array:TORQUE this.AppendToChunk(Convert<Smi>(nofSeparatorsInt)); // Stores Smi(-5) -
Buffer Allocation:
BufferJoininsrc/builtins/array-join.tqallocates aSeqOneByteStringof sizetotalStringLength(which isL - 5whereLis the length of the string at index 0). The positivity check at line 325 (dcheck(IsValidPositiveSmi)) is aDCHECKonly and is disabled in release builds. -
C++ Out-of-Bounds Sink (memcpy): The C++ helper
WriteChunkListToFlatinsrc/objects/objects.ccprocesses the chunk list to fill the allocated sequential string. When it encounters the negative Smi element (value-5):C++ int count; CHECK(Object::ToInt32(element, &count)); // count = -5 if (count > 0) { ... } else { repeat_last = static_cast<uint32_t>(-count); // -(-5) = 5 DCHECK(IsString(last_element)); // Bypassed in release builds }When
repeat_last > 0(which is now5), the doubling-memcpy routine calculates the end destination:C++ uint32_t string_length = Cast<String>(last_element)->length(); uint32_t length_with_sep = string_length + separator_length; sinkchar* copy_end = sink + (length_with_sep * repeat_last) - separator_length;The loop duplicates the string data:
C++ while (sink < copy_end - copy_length) { DCHECK_LE(sink + copy_length, sink_end); // DCHECK ONLY (disabled in release) memcpy(sink, sink - copy_length, copy_length * sizeof(sinkchar)); sink += copy_length; copy_length *= 2; }Because the destination buffer
sinkwas allocated with lengthL - 5but the logic copies6L + 5bytes, the loop writes5L + 10bytes beyond the allocated boundaries of the flat string, overwriting subsequent heap objects.
Suggested Fix
Either change nofSeparators to a uintptr type in ArrayJoinImpl (propagating the unsigned type to AddSeparators), or add a strict non-negative bounds check in AddSeparators:
if (nofSeparators <= 0 || separatorLength == 0) return;
3. Technical Verification Details (Automated Audit Logs - Reviewers may skip this section)
Prior Critic Verdict Verbatim
* **Severity:** High (S1)
* **Brief Notes / Reasoning:**
The vulnerability report accurately identifies a layer-1 heap out-of-bounds (OOB) write in `Array.prototype.join` on 32-bit architectures (arm32/ia32). In `ArrayJoinImpl`, the `nofSeparators` counter is typed as an `intptr`. When joining a sparse or mostly empty array with a length approaching `kMaxArrayLength` (~4 billion elements), this signed 32-bit counter increments without overflow checks, eventually wrapping around to a negative value (e.g. -5). The `AddSeparators` and `AddStringLength` macros lack proper lower-bounds checking or negative guards for this counter, interpreting it as valid and eventually storing it as a negative Smi in the chunk list. In the C++ sink `WriteChunkListToFlat`, this negative Smi is interpreted as a `repeat_last` directive, which triggers an out-of-bounds `memcpy` write operation past the allocated bounds of the `SeqOneByteString`.
Since arm32 and ia32 architectures do not use pointer compression, the V8 sandbox and guard regions are absent (`V8_ENABLE_SANDBOX=0`). Therefore, this results in a direct renderer heap buffer overflow with attacker-controlled content and length, which is a powerful primitive for arbitrary code execution. The only constraint, ~4 billion iterations, is practically achievable in a few minutes due to the highly optimized, allocation-free `DictionaryElements` hole-path. The vulnerability maps to Class F (CSA/Torque builtin length arithmetic bug) and occurs on default flags on tier-1 architectures, fully justifying a High severity (S1).
Mitigations / Validators Checked (Environmental Assumptions)
- V8 Sandbox / Guard Regions / Pointer Compression: On 32-bit targets (arm32 and ia32),
V8_ENABLE_SANDBOXis0, and there is no pointer-compression cage. Hence, there are no sandbox constraints preventing direct corruption of adjacent pointers or objects. - Codebase Investigator Checks:
- Validated that
TryIntPtrAddinsrc/codegen/code-stub-assembler.cc:995-1002checks for signed overflow, meaning a large positivelenAand small negativelenBbypassesIfOverflowbecause the mathematical sum fits safely within a signed 32-bit integer range. - Confirmed the loop condition and structure in
ArrayJoinImplskips adding string fragments for holes viaif (str == kEmptyString) continue;(array-join.tq:484), allowingnofSeparatorsto continuously accumulate over billions of iterations allocation-free viaDictionaryElements. - Confirmed
WriteChunkListToFlatinsrc/objects/objects.cc:4396-4422usesrepeat_lastin awhileloop that callsmemcpy(sink, sink - copy_length, ...)restricted exclusively byDCHECK_LEbounds checks, which are omitted in release builds.
- Validated that
AddSeparatorsDivision Check (array-join.tq:211): The checksepsLen / separatorLength != nofSeparatorsIntperforms signed division. Because-5 / 1 == -5, the division check is bypassed and fails to identify the negative value as an anomaly.BufferJoinPositivity Verification (array-join.tq:325): The checkdcheck(IsValidPositiveSmi(...))is compiled out in release/non-debug builds.WriteChunkListToFlatBounds Checking (objects.cc:4312, 4380, 4408): All memory boundary verification utilizingsink_endis compiled out under#ifdef DEBUG, enabling unchecked sequential heap overwrite in release configurations.- 64-bit Systems: 64-bit systems are structurally unaffected because
intptris a 64-bit signed integer. Since the maximum loop length is capped atkMaxUInt32, the counternofSeparatorscannot overflow into a negative range on these systems.
Evaluated with Chrome root at commit: 71e7e1a98476f8faf0d126dc83935a84331b2194
Results so far have been promising, but there can be wrong deductions. Feel free to adjust as follows:
- If you are familiar with the severity guidelines, you may adjust the severity.
- If this is a false positive, and there's no work to be done, please close as WAI.
- If there is work to do here but not a vulnerability, please change the issue type to Task/Bug/FR.
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.
Note: This bug has been automatically redirected to the top-level Chromium component. Please move it to the actual component: https://b.corp.google.com/components/1456800 once PoCs have been generated.
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 separator counter is a signed intptr with no lower-bound check, so it can wrap negative and be stored as a negative Smi that the C++ sink interprets as a repeat-last count.
Impact
On 32-bit V8 architectures without the sandbox, this could give a reliable renderer heap corruption primitive with attacker-controlled data; 64-bit systems are structurally unaffected.
What the attacker needed
32-bit V8 architecture (arm32 or ia32); array-like length near 2^32; billions of loop iterations
The fix
The counter should be changed to an unsigned type or AddSeparators should reject non-positive separator counts.
How it was found
- Call Array.prototype.join on an object whose length is close to the maximum 32-bit unsigned value on a 32-bit platform.
- The loop iterates over empty entries and increments the signed separator counter until it wraps to a negative value.
- AddSeparators and AddStringLength accept the negative value because they only check upper bounds.
- The negative value is appended to the chunk list as a negative Smi.
- A string buffer is allocated using the reduced total length.
- WriteChunkListToFlat treats the negative Smi as a repeat-last count and memcpy writes past the buffer.
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 you join an array into a string, V8 counts how many separators it needs. On 32-bit systems that counter is a signed number, so with an array claiming billions of entries it can wrap around and become negative. The code then trusts that negative number and copies far more data than the output buffer can hold, corrupting memory next to it.
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.