Tainted flow: 'target' from os.environ.get (line 161, credential/environment) → shutil.copy2 (file write)
Medium
- Category
- Data Flow
- Content
continue target = dest / src.name try: shutil.copy2(src, target) results.append({ "copied": True, "source": str(src),- Confidence
- 89% confidence
- Finding
- The destination directory is derived from untrusted sources such as environment variables or a user-supplied --dest, then used in shutil.copy2 without constraining where files may be written. In an agent or host environment, a malicious or misconfigured workspace variable could redirect copied outputs to an unintended path, causing data leakage, overwriting files the agent can access, or delivery into an attacker-controlled directory.
