T03 · Remote Payload Retrieval and Execution
Error
- Location
- scripts/detect_network.py:28
- Finding
- Automatic Retrieval and Execution of Mutable Code Through an Unverified Third-Party Mirror<![CDATA[ ## Vulnerability Details **File Location**: `scripts/detect_network.py:28-51`; execution sinks in `SKILL.md:128-169`; mirror policy in `references/network-mirrors.md:11-18` **Vulnerability Type**: Remote payload retrieval and software supply-chain exposure **Risk Level**: High ### Vulnerable Code ```python def detect_network(): """Detect network environment and return mirror config.""" github_ok, github_ms = probe_url("https://github.com") pypi_ok, pypi_ms = probe_url("https://pypi.org/simple/") # Use mirrors if unreachable or slow (>3s) need_github_mirror = not github_ok or github_ms > 3000 need_pypi_mirror = not pypi_ok or pypi_ms > 3000 result = { "github": { "direct_reachable": github_ok, "latency_ms": round(github_ms, 1) if github_ms >= 0 else None, "use_mirror": need_github_mirror, "prefix": "https://ghfast.top/https://github.com" if need_github_mirror else "https://github.com", }, "pypi": { "direct_reachable": pypi_ok, "latency_ms": round(pypi_ms, 1) if pypi_ms >= 0 else None, "use_mirror": need_pypi_mirror, "index_flag": "-i https://pypi.tuna.tsinghua.edu.cn/simple" if need_pypi_mirror else "", }, } return result ``` The selected source is subsequently used by the following commands: ```bash docker exec <CONTAINER> bash -c " cd /tmp && git clone ${GITHUB_PREFIX}/FlagOpen/FlagGems cd FlagGems && pip install ${PIP_INDEX} -e . " ``` ```bash docker exec <CONTAINER> bash -c " cd /tmp && git clone ${GITHUB_PREFIX}/flagos-ai/FlagCX cd FlagCX && git submodule update --init --recursive make <MAKE_FLAG> -j\$(nproc) " ``` ```bash docker exec <CONTAINER> bash -c " cd /tmp && git clone ${GITHUB_PREFIX}/flagos-ai/vllm-plugin-FL cd vllm-plugin-FL pip install ${PIP_INDEX} -r requirements.txt pip install --no-build-isolation -e . " ``` ### Technical Analysis The Skill switches from GitHub ...[truncated 3243 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove automatic fallback to an unverified third-party GitHub proxy. Only use origins that the operator has explicitly approved. 2. Require explicit user confirmation before changing the repository or package source. 3. Pin every repository to a reviewed full commit SHA rather than cloning the current default branch. 4. Pin and verify recursive submodule commits. Reject any submodule URL or commit that is absent from an approved manifest. 5. Prefer signed release tags or release artifacts and verify signatures against pinned trusted keys. 6. Maintain SHA-256 hashes for downloaded wheels, source archives, and dependency artifacts. Abort on any mismatch. 7. Use dependency lock files with exact versions and hashes. Avoid installing mutable, unconstrained `requirements.txt` dependencies. 8. Remove unnecessary `--trusted-host` configuration and require normal certificate and hostname validation. 9. Build untrusted source in a restricted environment without credentials, host mounts, Docker sockets, excessive Linux capabilities, or unnecessary outbound network access. 10. Separate downloading, verification, building, and deployment. Only verified artifacts should enter the operational GPU container. 11. Record the final source URL, commit SHA, submodule SHAs, package hashes, and signature verification results in the installation report. ]]>
