T03 · Remote Payload Retrieval and Execution
Error
- Location
- scripts/run.py:244
- Finding
- Unpinned Remote Repository and Submodule Code Is Installed and Executed## Vulnerability Details **File Location**: `scripts/run.py:244-253` **Vulnerability Type**: Unverified remote payload retrieval and supply-chain exposure **Risk Level**: High **Complete Code Snippet**: ```python cmds = [ f"git clone --recursive https://github.com/HKUDS/CLI-Anything {self.cli_path}", f"cd {self.cli_path} && ./setup.sh 2>/dev/null || pip install -e . 2>/dev/null || echo 'setup.sh 不存在,尝试手动安装'", ] for cmd in cmds: print(f"\n$ {cmd}") result = subprocess.run(cmd, shell=True, capture_output=True, text=True) if result.returncode != 0 and "already exists" not in result.stderr: print(f"⚠️ 命令可能失败: {result.stderr[:200]}") ``` ### Technical Analysis The `--install` operation clones the mutable default branch of an external repository, including recursive submodules, and immediately executes code from the resulting checkout. Neither the main repository nor its submodules are pinned to reviewed commits. The implementation also performs no cryptographic hash, release-signature, or provenance verification before invoking `setup.sh` or editable package installation logic. Consequently, the effective code executed by this skill can change after the skill itself has been reviewed. This creates a remote payload execution and supply-chain trust boundary: control of the upstream repository, its default branch, or any recursively cloned submodule is sufficient to alter locally executed installation code. The use of `shell=True` is unnecessary and enlarges the command execution surface. The destination currently derives from `Path.home()` rather than direct user input, so no standalone shell-injection path through that variable was established during this audit; the confirmed issue is execution of mutable, unverified remote code. ### Attack Path 1. An attacker compromises the upstream repository, a maintainer account, the default branch, or one of its recursive submodules. 2. The attacke ...[truncated 1006 chars]
- Remediation
- ## Remediation Suggestions - Pin the main repository to an explicitly reviewed commit hash or signed release tag. - Pin and verify every submodule commit rather than trusting mutable branch state. - Verify downloaded content against hardcoded expected hashes or validated cryptographic signatures before executing it. - Prefer distributing a reviewed, versioned dependency artifact through a trusted package channel. - Present the exact revision and planned commands and require explicit user confirmation before installation. - Replace `shell=True` command strings with argument arrays and separate subprocess calls for cloning and installation. - Do not suppress installer error output, because doing so obscures security-relevant failures. - Run installation in a sandbox or isolated environment with minimal filesystem, credential, and network access.
