T03 · Remote Payload Retrieval and Execution
Warning
- Location
- scripts/setup.sh:23
- Finding
- Mutable Remote Repository Is Retrieved and Subsequently Executed<![CDATA[ ## Vulnerability Details **File Location**: `scripts/setup.sh:23-42`, `scripts/update.sh:24-31`, `scripts/run.sh:30` **Vulnerability Type**: Remote payload retrieval through an unpinned Git branch **Risk Level**: Medium ### Vulnerable Code From `scripts/setup.sh:23-42`: ```bash # Clone or update the project if [ -d "$PROJECT_DIR" ]; then echo "Project already exists; updating..." cd "$PROJECT_DIR" git pull origin main else echo "Cloning project repository..." git clone "$REPO_URL" "$PROJECT_DIR" cd "$PROJECT_DIR" fi # Create virtual environment if [ ! -d "$VENV_DIR" ]; then echo "Creating virtual environment..." python3 -m venv "$VENV_DIR" fi # Install dependencies echo "Installing Python dependencies..." "$VENV_DIR/bin/pip" install -q -r requirements.txt ``` From `scripts/update.sh:24-31`: ```bash # Retrieve latest code echo "Retrieving latest code..." git pull origin main # Update dependencies echo "Updating dependencies..." pip3 install -q -r requirements.txt ``` From `scripts/run.sh:30`: ```bash "$VENV_DIR/bin/python" main.py ``` ### Technical Analysis The installation and update scripts retrieve the mutable `main` branch of an external Git repository without pinning it to a reviewed commit hash or verifying a signed release. The effective code installed by the Skill can therefore change after this version of the Skill has been audited. The cloned repository's dependency manifest is immediately processed by `pip`, and its `main.py` is subsequently executed by `run.sh`. Consequently, compromise of the upstream repository, maintainer account, default branch, or release process could replace reviewed behavior with attacker-controlled code. Fetching an upstream project is related to the declared installation workflow, but accepting and executing an unauthenticated mutable branch exceeds the minimum trust required. A fixed, verified revision would provide the same functionality with a substantially narrower ...[truncated 1260 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Pin the upstream source to a reviewed immutable commit hash: ```bash REPO_COMMIT="<reviewed-full-commit-sha>" git clone --no-checkout "$REPO_URL" "$PROJECT_DIR" cd "$PROJECT_DIR" git checkout --detach "$REPO_COMMIT" ``` 2. Prefer signed, versioned release tags and verify the signature before installation: ```bash git tag -v "$RELEASE_TAG" ``` 3. Do not automatically pull and execute the latest default branch. Make updates explicit and require review of the commit difference before installation. 4. Verify downloaded release archives against a trusted SHA-256 digest when Git signature verification is unavailable. 5. Separate retrieval from execution. Display the resolved commit hash and require approval before installing dependencies or running newly retrieved code. 6. Run installation and analysis under an unprivileged, isolated account with only the filesystem and network access required for stock analysis. ]]>
