T03 · Remote Payload Retrieval and Execution
Warning
- Location
- README.md:25
- Finding
- Unverified Remote Payload Retrieval and Subsequent Execution## Vulnerability Details **File Location**: `README.md`, lines 25-29 **Vulnerability Type**: Mutable remote code download without integrity verification **Risk Level**: Medium ### Vulnerable Code ```bash pip install sqlparse # Or download directly curl -O https://raw.githubusercontent.com/your-repo/main/sql_explain.py chmod +x sql_explain.py ``` ### Technical Analysis The installation documentation instructs users to retrieve `sql_explain.py` from a remote, mutable `main` branch and mark it as executable. The downloaded file is not verified using a cryptographic checksum or signature, and the URL is not pinned to an immutable commit or release artifact. Consequently, the code users execute can differ from the version included in and reviewed as part of this project. The placeholder repository namespace (`your-repo`) also does not identify a verified official source. If that namespace is replaced with or resolves to an attacker-controlled source, users may download arbitrary code under the impression that it is the audited SQL utility. Although the documented command does not immediately invoke the downloaded file, making it executable and presenting it as the installation procedure creates a clear retrieval-and-execution chain when the user subsequently runs the documented CLI commands. Network retrieval is not necessary for the Skill's core functionality because the complete local implementation is already included in the project. The adjacent `pip install sqlparse` command also lacks a version constraint and integrity hash. No evidence indicates that the legitimate `sqlparse` package is malicious, but reproducible, hash-verified dependency installation would reduce supply-chain exposure. ### Attack Path 1. An attacker gains control of the referenced repository, branch, account, or replacement namespace. 2. The attacker publishes a modified `sql_explain.py` containing malicious Python code. 3. A user follows the README and runs the `curl` command. 4. ...[truncated 1073 chars]
- Remediation
- ## Remediation Suggestions 1. Remove the direct-download instructions when the bundled local file is sufficient. 2. Replace the placeholder repository URL with a verified, project-controlled release location. 3. Reference an immutable release tag or full commit hash rather than the mutable `main` branch. 4. Publish a SHA-256 checksum or cryptographic signature for each release and require verification before use. For example: ```bash curl --fail --proto '=https' --tlsv1.2 -o sql_explain.py \ https://raw.githubusercontent.com/ORGANIZATION/REPOSITORY/IMMUTABLE_COMMIT/sql_explain.py echo 'EXPECTED_SHA256 sql_explain.py' | sha256sum --check - ``` 5. Prefer a signed package release through a controlled package registry instead of downloading a standalone executable source file. 6. Pin `sqlparse` to a reviewed version and use a lock file or requirements file with hashes, for example through `pip install --require-hashes -r requirements.txt`. 7. Clearly state that users should not run the tool with `sudo` or administrative privileges. 8. Ensure release automation verifies that distributed artifacts exactly match the reviewed source tree.
