Summary
A privilege management weakness in pyLoad's set_config_value() API lets users with the non-admin SETTINGS permission modify sensitive configuration options without proper restriction.
By changing the reconnect.script option to point to an arbitrary executable on the system, a SETTINGS-level user can trigger execution via subprocess.run(), leading to remote code execution under specific conditions.
Affected context
This vulnerability affects pyLoad deployments that:
- Run versions from 0.4.0 up to (but not including) 0.5.0b3.dev97
- Expose the set_config_value() API endpoint to users with the SETTINGS permission
- Use the reconnect feature that calls an external script via subprocess.run()
In these contexts, configuration values are treated as trusted even when written by non-admin users, including paths used for script execution.
Exploit preconditions
- Attack surface: pyLoad HTTP/API interface (set_config_value() endpoint)
- Required access: Valid pyLoad account with the SETTINGS permission (non-admin but with configuration write access)
- Trigger point: Invocation of the reconnect logic in the thread manager, which reads reconnect.script and passes it directly to subprocess.run()
- Why exploitation is possible: The configuration API lacks fine-grained authorization and does not restrict or validate security-critical options like reconnect.script, allowing lower-privileged users to control an executable path that is later run by the server process.
Why this happens
The root cause is an improper privilege management design where the SETTINGS permission grants broad write access to configuration fields without differentiating between benign and security-sensitive options.
Instead of enforcing fine-grained authorization and validation, set_config_value() allows nearly all keys to be modified, with only a special-case check for general.storage_folder.
This aligns with CWE-269 (Improper Privilege Management), where a user with some level of authorization can perform actions beyond their intended scope—in this case, indirectly controlling what executable subprocess.run() invokes via reconnect.script.
Potential impact
- A SETTINGS-level user may execute arbitrary system commands or binaries under the pyLoad service account.
- Attackers could install or run backdoors or additional malicious tools on the host.
- Local data, including downloaded files and configuration secrets, can be accessed or exfiltrated by the attacker-controlled code.
- The compromised pyLoad instance can be used as a pivot point for further attacks within the same host or network environment.
General mitigation guidance
Mitigation generally focuses on tightening privilege boundaries and restricting which configuration fields lower-privileged users can modify.
Useful defensive patterns include:
- Splitting configuration into security-sensitive and non-sensitive domains, with only administrators allowed to update security-sensitive keys (such as script paths and command templates).
- Introducing explicit allowlists for configuration keys that lower-privileged roles can modify, rather than blocking only one or two fields.
- Treating any configuration-derived value that influences command execution or file paths as untrusted, validating and constraining it to safe directories or predefined options.
- Running the pyLoad service with least-privilege OS accounts and minimizing the presence of unnecessary executables on the system to reduce the blast radius if script paths are abused.
How teams detect issues like this
Organizations can detect and monitor this class of issue using several approaches:
- Static analysis and code review to identify configuration-update endpoints that:
- Authorize based on broad roles or flags (e.g., SETTINGS) without per-field checks.
- Allow direct control of values later passed to subprocess, shell commands, or interpreters.
- Logging and alerting for configuration changes to sensitive keys such as reconnect.script, especially when initiated by non-admin users.
- Policy-based configuration management that periodically inspects configuration files or database entries for unexpected script paths or executable references.
- Automated security testing that exercises API endpoints with lower-privileged accounts to confirm proper enforcement of role-based access control for configuration updates.

