Описание
pyload-ng: SSRF via HTTP Redirect Bypass in parse_urls API
Summary
The SSRF mitigation added in commit 33c55da for GHSA-7gvf-3w72-p2pg is incomplete. The PREREQFUNCTION-based private IP check was correctly applied to HTTPChunk (download path) but not to HTTPRequest (used by the parse_urls API). An authenticated attacker can supply a URL pointing to an attacker-controlled server that responds with a 302 redirect to an internal/private IP address, bypassing the is_global_host() check on the initial URL.
Details
The parse_urls API method validates the initial URL hostname:
get_url() is imported from request_factory.py and creates an HTTPRequest with default settings:
HTTPRequest.__init__ sets allow_private_ip = True by default:
The init_handle() method enables redirect following:
The _pre_request_callback that should block redirects to private IPs is a no-op when allow_private_ip is True:
The fix at commit 33c55da correctly set allow_private_ip = False in HTTPChunk (http_chunk.py:136) for the download path, but HTTPRequest used by RequestFactory.get_url() retains the default of True, leaving the parse_urls API unprotected against redirect-based SSRF.
PoC
Impact
An authenticated attacker with ADD permission can perform SSRF against:
- Cloud metadata endpoints (AWS IMDSv1 at
169.254.169.254, GCP, Azure) — potentially leaking IAM credentials, instance metadata, and secrets - Internal services on private networks (e.g.,
10.x.x.x,172.16.x.x,192.168.x.x) - Localhost services (
127.0.0.1) running on the pyload server
Data exfiltration is partially limited by the RE_URLMATCH regex filter (only URL-like strings from the response body are returned), but cloud metadata responses often contain URLs or URL-like paths that match this pattern. The REDIR_PROTOCOLS setting limits redirects to HTTP/HTTPS only.
Recommended Fix
Set allow_private_ip = False in RequestFactory.get_url():
Alternatively, change the default in HTTPRequest.__init__ to False:
The second approach is more defensive (secure by default), but may require auditing other callers that legitimately need to access private IPs. The first approach is the targeted fix.
Пакеты
pyload-ng
< 0.5.0b3.dev100
0.5.0b3.dev100
Связанные уязвимости
pyLoad is a free and open-source download manager written in Python. Prior to 0.5.0b3.dev100, the PREREQFUNCTION-based private IP check was not applied to HTTPRequest (used by the parse_urls API). An authenticated attacker can supply a URL pointing to an attacker-controlled server that responds with a 302 redirect to an internal/private IP address, bypassing the is_global_host() check on the initial URL. This vulnerability is fixed in 0.5.0b3.dev100.
pyLoad is a free and open-source download manager written in Python. P ...