OS Command Injection
Description
Detects untrusted user input flowing into operating system command execution functions without proper sanitization.
How to fix
Use subprocess with argument lists and shell=False. ```python subprocess.run(["ping", "-c", "2", ip_address], check=True) ``` Learn more: https://shoulder.dev/learn/python/cwe-78/command-injection
Applies to
Languages
Frameworks
django
flask
fastapi
pyramid
tornado
bottle
References
Scan for this issue
Detect with Shoulder CLI
npx @shoulderdev/cli trust --rule=python-command-injection .
Real-world examples
Known CVEs in the OS Command Injection vulnerability class that this rule helps detect.