Tainted flow: 'att_path' from os.getenv (line 142, credential/environment) → open (file write)
Medium
- Category
- Data Flow
- Content
for att in email_data['attachments']: if att.filename: att_path = os.path.join(att_dir, att.filename) with open(att_path, 'wb') as f: f.write(att.payload) db_attachments.append({ 'filename': att.filename,- Confidence
- 99% confidence
- Finding
- Attachment filenames are written directly with os.path.join(att_dir, att.filename) and are not sanitized or canonicalized. A malicious email attachment name containing path separators or traversal sequences could cause files to be written outside the intended attachment directory, potentially overwriting arbitrary files accessible to the process.
