T08 · Insecure Dependencies
Warning
- Location
- references/languages.md:64
- Finding
- Unpinned and Potentially Mismatched Third-Party Package Installation<![CDATA[ ## Vulnerability Details **File Location**: `references/languages.md:64-67` **Vulnerability Type**: Unsecured third-party dependency installation **Risk Level**: Medium ### Vulnerable Code ```python speak('Allahu Akbar') # plays audio immediately ``` ```text Install: `pip install gTTS mpg321` ``` ### Technical Analysis The fallback documentation instructs users to install `gTTS` and `mpg321` directly from the configured Python Package Index without specifying reviewed versions, package hashes, a lockfile, or a trusted repository. In addition, `mpg321` is presented elsewhere in the example as a command-line audio player, but the installation command treats it as a Python package. This package-name and package-manager mismatch creates a dependency-confusion or package-substitution risk. A Python package named `mpg321` is not necessarily the operating-system audio player expected by the example. Python packages may execute code during installation or when imported. Consequently, resolving an unintended, compromised, or attacker-controlled package could result in code execution under the account running the installation. ### Attack Path 1. A user enables the documented gTTS fallback. 2. The user follows the instruction `pip install gTTS mpg321`. 3. Pip resolves packages from the user's configured package index without enforcing a reviewed version or cryptographic hash. 4. An attacker-controlled, compromised, or unintended package is downloaded. 5. Package installation hooks or subsequently imported package code execute with the privileges of the user running pip. ### Impact Assessment Successful exploitation could execute arbitrary code with the privileges of the installing user. This may permit access to that user's files, environment variables, application credentials, and network resources. If the installation is run from an elevated shell or privileged environment, the impact could extend to system-level compromise. The project itself doe ...[truncated 127 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Pin every Python dependency to a reviewed version and require hashes, for example through a locked requirements file used with `pip install --require-hashes`. 2. Use an explicitly trusted package index and review transitive dependencies. 3. Install the `mpg321` executable through the operating system's package manager rather than pip, because it is invoked as a system command. 4. Clearly separate Python package installation from system package installation in the documentation. 5. Prefer a maintained audio library or player with documented provenance. 6. Add automated dependency scanning and periodic review of pinned versions. 7. Recommend installation inside an isolated virtual environment without elevated privileges. ]]>
