CVE-2025-62495 Type confusion in string addition in QuickJS
- Published
- Updated
- Exploit status
- No public exploit known
- CISA SSVC
- Proof of concept public · automatable: no · technical impact: total
- Technology
- UbuntuDebian
Description
An integer overflow vulnerability exists in the QuickJS regular expression engine (libregexp) due to an inconsistent representation of the bytecode buffer size.
-
The regular expression bytecode is stored in a DynBuf structure, which correctly uses a $\text{size}_\text{t}$ (an unsigned type, typically 64-bit) for its size member.
-
However, several functions, such as re_emit_op_u32 and other internal parsing routines, incorrectly cast or store this DynBuf $\text{size}_\text{t}$ value into a signed int (typically 32-bit).
-
When a large or complex regular expression (such as those generated by a recursive pattern in a Proof-of-Concept) causes the bytecode size to exceed $2^{31}$ bytes (the maximum positive value for a signed 32-bit integer), the size value wraps around, resulting in a negative integer when stored in the int variable (Integer Overflow).
-
This negative value is subsequently used in offset calculations. For example, within functions like re_parse_disjunction, the negative size is used to compute an offset (pos) for patching a jump instruction.
-
This negative offset is then incorrectly added to the buffer pointer (s->byte_code.buf + pos), leading to an out-of-bounds write on the first line of the snippet below:
put_u32(s->byte_code.buf + pos, len);
Upgrade path
7 packages: 2 fixed, 5 with no fix yet.
| Package | Affected | Fixed in | Status |
|---|---|---|---|
| debian/quickjs(Debian 13) | = 2025.04.26-1; All versions | No fix listed | No fix yet |
| debian/quickjs(Debian 14) | = 2025.04.26-1; All versions | No fix listed | No fix yet |
| ubuntu/quickjs(Ubuntu 24.04) | All versions | No fix listed | No fix yet |
| ubuntu/quickjs(Ubuntu 26.04) | All versions | No fix listed | No fix yet |
| ubuntu/quickjs(Ubuntu 26.10) | All versions | No fix listed | No fix yet |
| QuickJS | >= 2025-04-26, < 2025-09-13 | 2025-09-13 | Fixed |
| quickjs project quickjs | < 2025-09-13 | 2025-09-13 | Fixed |
Affected products
| Product | Affected versions | Fixed in |
|---|---|---|
| debian/quickjs(Debian:13) | All versions | No fix listed |
| debian/quickjs(Debian:13) | = 2025.04.26-1 | No fix listed |
| debian/quickjs(Debian:14) | All versions | No fix listed |
| debian/quickjs(Debian:14) | = 2025.04.26-1 | No fix listed |
| QuickJS | >= 2025-04-26, < 2025-09-13 | 2025-09-13 |
| ubuntu/quickjs(Ubuntu:24.04) | All versions | No fix listed |
| ubuntu/quickjs(Ubuntu:26.04) | All versions | No fix listed |
| ubuntu/quickjs(Ubuntu:26.10) | All versions | No fix listed |
| quickjs project quickjs | < 2025-09-13 | 2025-09-13 |
References
- Debian Security Tracker CVE-2025-62495 vendor-advisory
- bellard.org release-notes
- issuetracker.google.com exploit issue-tracking
- Ubuntu CVE tracker vendor-advisory
- www.cve.org
- bugs.debian.org issue-tracking