Summary
pyLoad's AntiVirus plugin allows a non-admin user with configuration permissions to change the executable path used for virus scanning, which is then passed directly to subprocess.Popen() without sufficient protection.
Under these conditions, an attacker can inject arbitrary commands via the plugin configuration and achieve remote code execution in the context of the pyLoad process.
Affected context
This vulnerability affects pyLoad installations that:
- Run version 0.5.0b3.dev96 or earlier
- Enable and use the AntiVirus plugin
- Delegate SETTINGS permissions to non-admin users
- Rely on the ADMIN_ONLY_OPTIONS mechanism to protect security-sensitive configuration values
The issue specifically involves the AntiVirus plugin's avfile configuration option, which stores the path to the antivirus executable and is treated as a trusted command path.
Exploit preconditions
- Attack surface: pyLoad web interface or API where plugin configuration (AntiVirus plugin) is exposed.
- Required access: Authenticated non-admin user with SETTINGS or equivalent permission that allows editing plugin configuration options.
- Trigger point: Execution of the AntiVirus scan operation, which invokes subprocess.Popen() using the configured
avfilepath. - Why exploitation is possible: The ADMIN_ONLY_OPTIONS protection covers only core configuration entries, not plugin-specific options. As a result, the AntiVirus plugin's executable path can be edited by less-privileged users and is passed to subprocess.Popen() without strong validation, enabling command injection.
Why this happens
The root cause is inconsistent enforcement of privilege boundaries and lack of command sanitization in a security-sensitive configuration path.
pyLoad's ADMIN_ONLY_OPTIONS mechanism correctly restricts core configuration values such as reconnect scripts, SSL certificates, and proxy credentials to admin users. However, plugin configuration options – including the AntiVirus plugin's avfile field – are not covered by this protection. This field is directly supplied as the command to subprocess.Popen(), with no robust validation, escaping, or fixed command template.
This pattern maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection'), where user-controllable data is incorporated into an operating system command without sufficient validation or neutralization, allowing execution of unintended commands.
Potential impact
- Remote code execution with the privileges of the pyLoad service account
- Installation of backdoors or malware on the underlying host
- Reading, modifying, or deleting files accessible to the pyLoad process
- Pivoting to other systems or services reachable from the compromised host
- Tampering with downloads, logs, or configuration to hide malicious activity
General mitigation guidance
Effective mitigation focuses on tightening privilege boundaries around configuration and removing direct command injection opportunities:
- Treat all executable paths and commands as high-risk configuration values, regardless of whether they reside in core or plugin configuration, and restrict them to administrative users only.
- Avoid passing user-configurable strings directly to subprocess.Popen() as a command. Prefer:
- Fixed, hard-coded binaries with only constrained arguments derived from configuration, or
- Whitelisted, pre-resolved executable paths that are not directly editable by untrusted users.
- Use safer subprocess invocation patterns:
- Pass commands as argument lists instead of shell strings.
- Disable shell invocation (
shell=False) wherever possible. - Apply strict validation to configuration values used in commands:
- Enforce path-only semantics (no spaces, separators, or shell metacharacters).
- Restrict to known directories or a fixed set of allowed executables.
- Run the pyLoad service with least privileges and consider OS-level confinement (e.g., containers, AppArmor/SELinux) to reduce blast radius if command injection occurs.
How teams detect issues like this
Detection should combine code-level analysis with configuration and runtime monitoring:
- Static analysis & code review:
- Search for uses of subprocess.Popen() and related APIs where arguments are derived from configuration values without validation.
- Flag plugin code paths where user-editable settings can directly influence executable names, script paths, or command-line fragments.
- Review privilege checks on configuration update endpoints, ensuring plugin configuration is covered by the same protections as core options.
- Configuration review:
- Periodically audit plugin configurations, especially for fields that represent commands, scripts, or paths, for unexpected or non-standard values.
- Runtime monitoring:
- Monitor the pyLoad process or host for unusual child processes spawned from pyLoad, particularly those not matching the expected antivirus executable.
- Use host-based intrusion detection or logging to capture command-line arguments and flag anomalies.
- Automated tooling:
- Integrate SAST tools or custom linters into CI pipelines to detect command construction from untrusted inputs.
- Enforce policy checks that mark any "command-like" configuration fields as security-sensitive and subject to additional review.

