## https://sploitus.com/exploit?id=CCA85162-05DE-56EE-B7E8-7CB7B1C71C6D
# CVE-2026-XXXXX (Pending): Command Injection in delegator.py
## Vulnerability Information
- **Product**: delegator.py
- **Version**: 0.1.1 (Latest on PyPI)
- **Vulnerability Type**: Command Injection (CWE-78) / Unsafe Default Configuration
- **Severity**: CRITICAL (CVSS 9.8 if used with user input)
- **Impact**: Arbitrary Command Execution
## Description
`delegator.py` is a popular Python library promoted as "Subprocesses for Humans 2.0". It simplifies the usage of the `subprocess` module.
However, the library sets `shell=True` by default for all commands executed via `delegator.run()`. This is a dangerous default configuration that contradicts the standard security practices of the `subprocess` module.
If a developer passes unsanitized user input to `delegator.run()`, it leads to immediate **Command Injection**, as the input is interpreted by the system shell (e.g., `/bin/sh`).
**Vulnerable Code (`delegator.py`):**
```python
@property
def _default_popen_kwargs(self):
return {
# ...
"shell": True, # <--- CRITICAL: Enabled by default!
# ...
}
```
## Proof of Concept (PoC)
An attacker can inject arbitrary commands using shell operators (`;`, `&&`, `|`).
```python
import delegator
# Supposed to echo a string, but executes 'rm -rf /' (simulated here)
user_input = "hello; echo HACKED"
delegator.run(f"echo {user_input}")
```
**Output:**
```
hello
HACKED
```
## Mitigation
Developers using `delegator.py` must manually disable the shell feature if they cannot guarantee input sanitization, but the library does not expose a simple argument to disable `shell=True` in the high-level `run()` function easily.
**Recommendation**: The library maintainers should change the default to `shell=False` or strictly warn users in the documentation. Ideally, users should switch to the standard `subprocess.run()` which is secure by default.