Tainted flow: 'cmd' from os.environ.get (line 67, credential/environment) → subprocess.run (code execution)
Medium
- Category
- Data Flow
- Content
return {"cleaned": False, "skipped": "scripts/asset_cleanup.py不存在"} try: cmd = [sys.executable, str(script)] + (["--dry-run"] if dry_run else []) result = subprocess.run(cmd, capture_output=True, text=True, timeout=120) if result.returncode == 0: d = json.loads(result.stdout.strip()).get("data", {}) return {"cleaned": True, "expired_count": d.get("expired_count", 0),- Confidence
- 84% confidence
- Finding
- The script path is derived from JUEJIN_HOME, which comes from the environment, and that path is then used to select and execute another Python file. If an attacker can influence the service environment or startup context, they can redirect execution to an attacker-controlled asset_cleanup.py and achieve arbitrary code execution under the job's privileges.
