Tainted flow: 'req' from os.environ.get (line 17, credential/environment) → urllib.request.urlopen (network output)
Critical
- Category
- Data Flow
- Content
def download(url, out_path): try: req = urllib.request.Request(url, headers={'User-Agent': 'Mozilla/5.0'}) with urllib.request.urlopen(req, timeout=20) as r, open(out_path, 'wb') as f: f.write(r.read()) return os.path.exists(out_path) and os.path.getsize(out_path) > 0 except Exception as e:- Confidence
- 92% confidence
- Finding
- The script sends a user-supplied or environment-supplied URL directly to urllib.request.urlopen with no allowlist, scheme restriction, or destination validation. This creates an SSRF-style primitive that can be abused to make the agent fetch arbitrary internal or local resources (for example localhost, cloud metadata endpoints, or file://-like targets depending on runtime support), which is especially risky in an agent environment with network reachability beyond the end user.
