Tainted flow: 'filepath' from requests.post (line 196, network input) → open (file write)
Medium
- Category
- Data Flow
- Content
os.makedirs("output", exist_ok=True) filepath = f"output/output_{safe_style}_{timestamp}.jpg" with open(filepath, 'wb') as f: f.write(base64.b64decode(data['image_base64'])) style = data['hairstyle']- Confidence
- 77% confidence
- Finding
- The file path incorporates `data['hairstyle']` from an external API response with only spaces replaced, so path separators or traversal sequences could influence where the file is written. If the upstream service is compromised or returns malicious content, this can lead to arbitrary file overwrite within the process permissions instead of being constrained to the intended output directory.
