T08 · Insecure Dependencies
Warning
- Location
- SKILL.md:92
- Finding
- Automatic Installation of Unpinned Runtime Dependencies<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md:92-98`, `SKILL.md:162-171`, `SKILL.md:450-456`, and `SKILL.md:474` **Vulnerability Type**: `T08: Insecure Dependencies` **Risk Level**: Medium ### Vulnerable Code ```python try: from PIL import Image import numpy as np except ImportError: os.system("pip install Pillow numpy -q") from PIL import Image import numpy as np ``` ```python try: import cv2 import numpy as np from PIL import Image from PIL.ExifTags import TAGS import imagehash except ImportError: os.system("pip install opencv-python-headless Pillow imagehash numpy -q") import cv2 import numpy as np from PIL import Image from PIL.ExifTags import TAGS import imagehash ``` The prerequisite instructions also recommend installing mutable package names without version or integrity constraints: ```bash pip install Pillow numpy opencv-python-headless imagehash pip install rawpy ``` ### Technical Analysis The generated scripts automatically invoke `pip` when imports fail. The dependency names have no pinned versions or cryptographic hashes, and installation uses the Python environment's currently configured package index. The packages are then imported immediately. Python packages may execute arbitrary code during installation and import. Consequently, security depends on mutable third-party releases, the integrity of the configured index, and the absence of package-resolution manipulation. The installation is also not isolated from the Agent's existing Python environment. Suppressing installation output with `-q` reduces visibility into the package versions and sources selected. Automatic installation additionally occurs as a side effect of photo analysis rather than through a distinct, explicitly approved dependency setup step. ### Attack Path 1. An attacker compromises a dependency release, a configured package index, or the package-resolution/network path. 2. The skill run ...[truncated 931 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Remove all automatic `pip install` calls from generated runtime scripts. 2. Declare dependencies in a reviewed lock file with exact versions and cryptographic hashes. 3. Install dependencies during a separate, explicit setup phase after obtaining user approval. 4. Use a dedicated virtual environment instead of modifying the Agent's global or existing Python environment. 5. Configure installation to use a trusted package repository and require hash verification, for example with `pip install --require-hashes`. 6. Record and display the exact selected versions and source repository instead of suppressing installation output. 7. Fail safely with a clear missing-dependency message when the environment is not prepared. 8. Regularly scan locked dependencies for known vulnerabilities and review updates before changing versions. ]]>
