T08 · Insecure Dependencies
Warning
- Location
- SKILL.md:56
- Finding
- Unpinned Runtime Installation of a Third-Party Package## Vulnerability Details **File Location**: `SKILL.md`, lines 56–57 **Vulnerability Type**: Unsafe, unpinned dependency installation **Risk Level**: Medium **Complete Code Snippet**: ```bash # Python pip-audit 2>/dev/null || pip install pip-audit && pip-audit ``` ### Technical Analysis If the initial `pip-audit` command fails, the instruction automatically installs `pip-audit` from the configured Python package index. It does not pin an audited version, verify package hashes, restrict resolution to an approved index, or isolate the installation from the host Python environment. Because Python package versions and transitive dependencies are mutable external inputs, the code executed during installation and subsequent invocation may differ from what was reviewed in this project. Operator-controlled package-index configuration could also redirect resolution to an untrusted source. The command mutates the audit environment and then executes the newly retrieved tool. Shell operator precedence also means the final `pip-audit` executes whenever the installation command succeeds; therefore, newly downloaded package code is immediately invoked. ### Attack Path 1. An agent follows the dependency-scanning instructions on a system where the initial `pip-audit` invocation fails or the command is unavailable. 2. The fallback runs `pip install pip-audit`. 3. `pip` resolves an unpinned release and its transitive dependencies through the environment's configured package index. 4. A compromised release, dependency, or untrusted package index supplies malicious package code. 5. Package installation processes the downloaded distribution, and the final `pip-audit` invocation executes the installed code. 6. The malicious code runs with the privileges and environmental access of the user performing the audit. ### Impact Assessment Successful exploitation could execute arbitrary code under the auditing user's a ...[truncated 410 chars]
- Remediation
- ## Remediation Suggestions - Do not automatically install security tools as a fallback during an audit. Declare `pip-audit` as a prerequisite and fail with a clear installation message when it is unavailable. - Run the scanner from a dedicated, non-privileged container or isolated virtual environment rather than modifying the audited application's environment. - Pin a reviewed `pip-audit` version and all relevant transitive dependencies. - Require cryptographic hashes, such as through a hash-locked requirements file and `pip install --require-hashes`. - Restrict package retrieval to an explicitly approved HTTPS package index and prevent fallback to untrusted indexes. - Build and verify the scanner environment separately, then invoke it without installing packages at audit time. - Run the audit using a least-privileged account without access to unrelated credentials or sensitive resources. A safer workflow is: ```bash command -v pip-audit >/dev/null 2>&1 || { echo "ERROR: pip-audit must be installed in an approved isolated environment." exit 1 } pip-audit ```
