T08 · Insecure Dependencies
Warning
- Location
- scripts/ligand_designer.py:21
- Finding
- Unpinned Third-Party Dependency Installation Guidance## Vulnerability Details **File Location**: `scripts/ligand_designer.py`, lines 21-27 **Vulnerability Type**: Unpinned third-party dependency and unsafe installation guidance **Risk Level**: Medium ### Vulnerable Code ```python try: from rdkit import Chem from rdkit.Chem import AllChem, Descriptors, Draw, rdMolDescriptors, rdmolops from rdkit.Chem import RWMol except ImportError: print(json.dumps({"error": "RDKit not installed. Run: pip install rdkit", "status": "error"})) sys.exit(1) ``` ### Technical Analysis When RDKit is unavailable, the application recommends installing it with `pip install rdkit`. This command does not pin a reviewed package version, verify artifact hashes, require a lockfile, or constrain resolution to a documented trusted package source. The application does not execute this command automatically, so exploitation requires a user or an automation agent to follow the emitted guidance. If followed, pip resolves the package and its transitive dependencies according to the mutable state of the configured package index. A compromised package release, dependency, package-index mirror, or local pip configuration could consequently introduce attacker-controlled code. Python packages can execute code during installation and subsequently during import. The absence of version and integrity constraints therefore exposes the installation workflow to supply-chain compromise. ### Attack Path 1. RDKit is absent from the runtime environment. 2. The user or automation agent invokes `ligand_designer.py`. 3. The script emits the recommendation `pip install rdkit`. 4. The user or agent executes that command without adding version, hash, or trusted-source restrictions. 5. Pip resolves artifacts from its configured package index or mirror. 6. An attacker who has compromised a resolved package, dependency, release, or configured index supplies a malicious artifact. 7. Malicious code executes during package installation or when the ...[truncated 1053 chars]
- Remediation
- ## Remediation Suggestions 1. Declare RDKit in a reviewed dependency manifest rather than presenting an unconstrained installation command. 2. Pin RDKit and all transitive dependencies to approved versions. 3. Use a lockfile or hash-verified requirements file, such as installation with `pip --require-hashes`. 4. Document and enforce an approved package index or internal artifact repository. 5. Verify downloaded package provenance and integrity before deployment. 6. Replace the current message with guidance referencing the controlled installation procedure, for example: ```python except ImportError: print(json.dumps({ "error": "RDKit is not installed. Install dependencies from the project's reviewed, hash-locked requirements file.", "status": "error" })) sys.exit(1) ``` 7. Perform dependency vulnerability and provenance scanning in CI, and update pinned versions through a reviewed change-management process. 8. Run dependency installation and the Skill under a least-privileged account in an isolated virtual environment or container.
