High severityPythonInjectionHIGH confidence
OS Command Injection
Untrusted input flows into an OS command executed via a shell.
Standards mapping
- CWE
- CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
- OWASP Top 10
- A03:2021 - Injection
- OWASP ASVS
- V5.3.8 (L1)
Vulnerable vs. safe
Flagged by this check
os.system(host)Passes - the safe pattern
subprocess.run(["ping", "-c", "1", host], shell=False)Why it matters & how to fix it
Untrusted input flows into an OS command executed via a shell. This enables OS command injection (CWE-78). Avoid the shell: pass an argument list to subprocess.run/Popen with shell=False (the default) and never concatenate user input into the command string. If a shell is unavoidable, quote arguments with shlex.quote().
References
Rule ID integsec-python-os-command-injection - engine: Opengrep - license: MIT - Copyright (c) IntegSec Inc.
TurboPentest runs this check automatically
Connect a GitHub repo and this check runs on every white-box pentest - AI-validated and reported with proof, from $99 per target.
Start a pentestRelated checks
- JavaScript / TypeScript - InjectionCode Injection Tainted Input
- JavaScript / TypeScript - InjectionEval Dynamic Argument
- JavaScript / TypeScript - InjectionNoSQL Query From Request
- JavaScript / TypeScript - InjectionNoSQL Where Operator
- JavaScript / TypeScript - InjectionOS Command Injection Tainted Input
- JavaScript / TypeScript - InjectionSQL Injection String Concatenation