Tainted flow: 'req' from os.environ.get (line 51, credential/environment) → urllib.request.urlopen (network output)
Critical
- Category
- Data Flow
- Content
"""Login and return SID cookie.""" data = urllib.parse.urlencode({"username": QBT_USER, "password": QBT_PASS}).encode() req = urllib.request.Request(f"{QBT_URL}/api/v2/auth/login", data=data) resp = urllib.request.urlopen(req, timeout=10) for header in resp.headers.get_all("Set-Cookie") or []: if "SID=" in header: return header.split("SID=")[1].split(";")[0]- Confidence
- 95% confidence
- Finding
- The request target is built from QBT_URL, which comes directly from an environment variable, and the code sends qBittorrent credentials to that URL during login. If an attacker can influence the environment or deployment configuration, they can redirect authentication to an attacker-controlled host and capture the username/password or force the script to interact with unintended internal/external services.
