Sploitus

Exploit for Code Injection in Protobufjs Project Protobufjs

githubexploit · 2026-08-07

Exploit Code

README47 lines
## https://sploitus.com/exploit?id=5E1E4284-3238-5DDF-83FE-6D58F84C1E36
# CVE-2026-41242 — protobuf.js Code Injection to RCE

**CVSS 9.4 (Critical)** | Code Injection (CWE-94)

## Tổng quan

protobuf.js (npm: `protobufjs`) phiên bản ≤ 7.5.4 và ≤ 8.0.0 bị lỗ hổng **thực thi code tùy ý** thông qua tên type trong protobuf schema. Module `@protobufjs/codegen` ghép tên type trực tiếp vào chuỗi JavaScript rồi chạy qua `Function()` constructor (tương đương `eval()`). Attacker kiểm soát schema có thể inject code chạy trên server.

**Đã vá:** protobufjs 7.5.5 / 8.0.1

## Cấu trúc thư mục

```
CVE-2026-41242/
├── REPORT.md               # Báo cáo phân tích đầy đủ
├── cve_2026_41242.py        # Script exploit (Python)
├── vuln-app/                # Ứng dụng Node.js vulnerable
│   ├── server.js            # Express server
│   ├── poc_local.js         # PoC local — chứng minh code injection
│   ├── package.json
│   └── package-lock.json
└── img/                     # Screenshots
    └── *.png                # setup, recon, exploit, debug, patch
```

## Cách chạy

```bash
cd vuln-app
npm install
npm install @protobufjs/codegen@2.0.4   # BẮT BUỘC pin version — 2.0.5 đã chứa bản vá

# PoC local
node poc_local.js

# Server vulnerable
node server.js

# Exploit từ Kali
python3 cve_2026_41242.py -t http://:3000 -c "whoami"
```

## Tham khảo

- [GitHub Advisory — GHSA-xq3m-2v4x-88gg](https://github.com/advisories/GHSA-xq3m-2v4x-88gg)
- [Patch commit (type.js)](https://github.com/protobufjs/protobuf.js/commit/535df444ac060243722ac5d672db205e5c531d75)