subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
print(f'ERROR: {{e}}') """ result = subprocess.run( [python_cmd, "-c", test_import], capture_output=True, text=True- Confidence
- 81% confidence
- Finding
- The code dynamically constructs Python source in a string and executes it via 'python -c'. Although the interpolated path comes from the local filesystem path of the current script, embedding unsanitized data into executable code is dangerous because special characters in the path could break quoting or alter the executed snippet, leading to unintended code execution in edge cases.
