Tainted flow: 'out_file' from os.environ.get (line 155, credential/environment) → open (file write)
Medium
- Category
- Data Flow
- Content
} out_file = os.environ.get("BONUS_OUTPUT_FILE", "/tmp/casino_bonuses.json") with open(out_file, "w") as f: json.dump(output, f, indent=2) print(f"\nCasino Bonus Hunter — {len(results)} bonuses ranked by EV (adjusted for reputation)")- Confidence
- 93% confidence
- Finding
- The script takes BONUS_OUTPUT_FILE directly from the environment and passes it to open(..., "w") without validation, allowing an external caller to control where the process writes. In an agent or automation context, this can overwrite arbitrary writable files, clobber application state, or place attacker-chosen content in sensitive locations if the process has elevated filesystem access.
