subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
f.write(content) if dest.stat().st_size > max_kb * 1024: return f"[PDF too large: {dest.stat().st_size//1024}KB, skipped]", str(dest) result = subprocess.run(['pdftotext', str(dest), '-'], capture_output=True, text=True, timeout=60) return result.stdout, str(dest) except Exception as e:- Confidence
- 84% confidence
- Finding
- The code downloads attacker-controlled remote PDFs and passes them to the external `pdftotext` binary. Although `subprocess.run` is used without a shell, which avoids classic command injection, this still exposes the host to parser-level vulnerabilities in `pdftotext`/Poppler and potential denial-of-service from malformed or hostile files.
