subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
def merge_pdfs(pdf_paths, output_path): """Merge multiple PDFs into one""" try: result = subprocess.run( ['pdftk'] + pdf_paths + ['cat', 'output', output_path], capture_output=True, timeout=60 )- Confidence
- 80% confidence
- Finding
- The code passes attacker-controlled PDF paths directly to pdftk as command arguments. Although shell injection is avoided, many CLI tools treat filenames beginning with option-like tokens specially, which can cause argument/option injection or unsafe file handling if untrusted paths are accepted.
