T03 · Remote Payload Retrieval and Execution
- Location
scripts/setup.py:20- Finding
Mutable Third-Party Code Is Downloaded and Executed with Authentication Secrets
- Content
View full analysis
Path: if shutil.which("git"): checkout = workdir / "my-collection-skills" code = run(["git", "clone", "--depth", "1", repo_url, str(checkout)]) if code == 0: return checkout print("[warn] git clone failed, trying main.zip") archive = workdir / "my-collection-skills-main.zip" urllib.request.urlretrieve(HCTEC_REPO_ZIP, archive) with zipfile.ZipFile(archive) as zf: zf.extractall(workdir) return workdir / "my-collection-skills-main" ``` ```python def load_env_file(path: str | Path) -> int: env_path = expand_path(path) if not env_path.exists(): return 0 loaded = 0 for raw in env_path.read_text(encoding="utf-8").splitlines(): line = raw.strip() if not line or line.startswith("#"): continue if line.startswith("export "): line = line[len("export ") :].strip() if "=" not in line: continue key, value = line.split("=", 1) key = key.strip() value = value.strip().strip('"').strip("'") if key: os.environ[key] = value loaded += 1 return loaded ``` ```python def run_json(cmd: list[str], timeout: int = 60 ...[truncated 2683 chars]- Remediation
View remediation
