Summary
pyLoad's ClickNLoad feature improperly trusts the HTTP Host header to enforce localhost-only access, allowing remote attackers to bypass the local_check decorator.
By spoofing the Host header, unauthenticated users can reach endpoints intended to be restricted to local access, inject arbitrary downloads, write files into the storage directory, and trigger JavaScript execution in the web interface.
Affected context
This vulnerability affects pyLoad deployments running versions 0.4.20 through versions prior to 0.5.0b3.dev97 that expose the web interface over a network.
The issue is specifically tied to the ClickNLoad feature, where access control logic relies on the HTTP Host header to decide if a request originates from localhost.
Any environment where the pyLoad service is reachable from remote clients and where Host headers are not strictly validated or normalized may be exposed to this issue.
Exploit preconditions
- Attack surface: pyLoad HTTP interface, in particular the ClickNLoad endpoints protected by the
local_checkdecorator. - Required access: Network-level ability to send HTTP requests to the pyLoad service (no prior authentication required).
- Trigger point: The application's trust in the HTTP Host header to determine whether a request is "local," allowing an attacker to craft requests with a spoofed Host value.
- Why exploitation is possible: Authorization decisions are bound to a manipulable request header rather than to reliable client attributes such as source IP, authenticated identity, or a dedicated, unforgeable token.
Why this happens
The root cause is an authorization design flaw where access control for sensitive ClickNLoad endpoints is implemented using the HTTP Host header as a proxy for local origin.
Under CWE-639: Authorization Bypass Through User-Controlled Key, the application relies on a user-controlled value (the Host header) to decide whether a request should be treated as originating from localhost.
Because HTTP clients can arbitrarily set the Host header, a remote attacker can craft requests that appear to pass the local_check decorator, thereby reaching functionality that should only be available to local users.
This reflects a broader insecure pattern: deriving authorization decisions from untrusted request metadata without enforcing robust, server-side trust boundaries.
Potential impact
- Remote, unauthenticated injection of arbitrary downloads into pyLoad's queue.
- Writing attacker-controlled files into pyLoad's configured storage directory, which may reside on shared or sensitive storage.
- Execution of attacker-supplied JavaScript within users' browsers via the pyLoad web interface (e.g., in embedded or reflected contexts).
- Abuse of the pyLoad instance as an automated downloader to fetch malicious or illegal content.
- Potential pivoting into the underlying system if written files or browser-based script execution can be chained with other weaknesses.
General mitigation guidance
Effective mitigation centers on removing trust in user-controlled headers for authorization and reinforcing local-only features with robust checks:
- Replace Host-header-based checks with reliable attributes such as validated source IP ranges, explicit loopback binding, or authenticated sessions for any sensitive endpoint.
- Introduce explicit authorization layers for ClickNLoad endpoints, ensuring that only authenticated or explicitly trusted clients can access localhost-restricted functionality.
- Avoid conflating transport-level reachability (e.g., localhost vs. remote) with application-level permission decisions; treat all request metadata as untrusted unless independently verified.
- Restrict file writing logic to well-defined, validated paths and enforce strict validation of download sources to limit abuse.
- Run pyLoad with least-privilege file system permissions so that any compromised endpoint can access only the minimal directories needed for normal operation.
How teams detect issues like this
Organizations can look for this class of vulnerability through a combination of code-level and behavioral detection:
- Static analysis and code review:
- Flag authorization logic that relies on HTTP headers (e.g., Host, X-Forwarded-For, X-Real-IP) as trust anchors.
- Identify decorators or middleware that determine "local" or "trusted" status based on request metadata without cross-checking against server-side configuration.
- Review file-writing routines that are reachable from HTTP endpoints and verify that they require strong authorization.
- Dynamic and runtime monitoring:
- Analyze access logs for remote clients invoking endpoints intended for local-only use, particularly where Host headers differ from expected values.
- Instrument security monitoring to alert on anomalous spikes in download queue creation or unexpected file writes from unauthenticated sessions.
- Automated tooling:
- Use API security scanners or web vulnerability scanners configured to fuzz request headers, specifically testing whether Host spoofing alters authorization outcomes.

