subprocess module call
Medium
- Category
- Dangerous Code Execution
- Content
return {'ok': False, 'text': '', 'error': 'high ocr unavailable'} out = Path(tempfile.mktemp(prefix='two-pass-high-', suffix='.json')) try: proc = subprocess.run( [str(HIGH_OCR_PY), str(HIGH_OCR), str(image_path), '--output', str(out)], capture_output=True, text=True, timeout=90 )- Confidence
- 78% confidence
- Finding
- This code uses tempfile.mktemp to choose the JSON output path for the high-OCR subprocess, which is a known insecure temporary-file pattern. An attacker with local filesystem access could race to pre-create or replace that path, potentially causing overwrite of unintended files or reading/writing attacker-controlled content during OCR result handling.
