T08 · Insecure Dependencies
Warning
- Location
- scripts/ingest-shared-rag.sh:4
- Finding
- Execution of Mutable External Code Without Integrity Verification## Vulnerability Details **File Location**: `scripts/ingest-shared-rag.sh:4-8`, `scripts/query-shared-rag.sh:9-14`, and `SKILL.md:8-9, 22-31` **Vulnerability Type**: T08: Insecure Dependencies **Risk Level**: Medium **Vulnerable code in `scripts/ingest-shared-rag.sh`:** ```bash RAG_DIR="/home/Mike/.openclaw/workspace/rag-pinecone-starter" cd "$RAG_DIR" source .venv/bin/activate python ingest.py ``` **Vulnerable code in `scripts/query-shared-rag.sh`:** ```bash RAG_DIR="/home/Mike/.openclaw/workspace/rag-pinecone-starter" QUESTION="$*" cd "$RAG_DIR" source .venv/bin/activate python query.py "$QUESTION" ``` **Related instructions in `SKILL.md`:** ```markdown Use the central RAG project at: `/home/Mike/.openclaw/workspace/rag-pinecone-starter` ``` ```markdown ## Requirements - `PINECONE_API_KEY` must be set in `rag-pinecone-starter/.env` - Python venv exists at `rag-pinecone-starter/.venv` ``` ### Technical Analysis Both shell wrappers transfer execution to a fixed external workspace that is not included in the audited project and is not protected by any version pinning, checksum, signature, ownership validation, or permission check. The command `source .venv/bin/activate` executes the contents of an external shell file inside the current shell process. A virtual-environment activation script can contain arbitrary shell commands, so modification of that file is sufficient to execute attacker-controlled code. The wrappers then invoke the external and mutable `ingest.py` or `query.py` file through a relative path. Consequently, the effective behavior of this Skill can change without any modification to the reviewed artifact. The absent external files cannot be classified as malicious based on the available evidence, but trusting and executing them without integrity controls creates an unsafe local supply-chain boundary. The query argument itself is passed as the safely quoted `"$QUESTION ...[truncated 1940 chars]
- Remediation
- ## Remediation Suggestions 1. Package the required Python entry points with the Skill so that all executable behavior can be reviewed and versioned together. 2. If the external project must remain separate, pin it to an approved version and verify a cryptographic hash or signature before every execution. 3. Do not source the virtual-environment activation script. Invoke the intended interpreter directly: ```bash "$RAG_DIR/.venv/bin/python" "$RAG_DIR/ingest.py" ``` ```bash "$RAG_DIR/.venv/bin/python" "$RAG_DIR/query.py" "$QUESTION" ``` 4. Use absolute paths for every executed file and validate that the project directory, interpreter, and Python entry points are owned by a trusted account and are not writable by untrusted users or groups. 5. Fail closed when ownership, permissions, expected versions, or integrity checks do not match the approved configuration. 6. Run the RAG code under a dedicated least-privilege account or sandbox with access only to required documents, network endpoints, and credentials. 7. Store the Pinecone credential with restrictive permissions and limit its service-side privileges to the necessary index and operations. 8. Document that ingestion and query data may be processed by an external service, including applicable data-handling, authorization, and confidentiality requirements.
