T08 · Insecure Dependencies
Error
- Location
- SKILL.md:100
- Finding
- Unverified Installation Archive Is Extracted and Executed with Elevated Privileges## Vulnerability Details **File Location**: `SKILL.md:100-120, 171-186`; duplicated workflow in `references/installation_guide.md:43-56, 105-120` **Vulnerability Type**: Untrusted software supply chain and unsafe privileged execution **Risk Level**: High ### Vulnerable Code From `SKILL.md:100-120`: ```bash # Check if the installation package exists if [ ! -f "$INSTALL_PACKAGE_PATH" ]; then echo "Error: Installation package does not exist, please check if the path is correct" exit 1 fi # Check filename format if [[ "$(basename $INSTALL_PACKAGE_PATH)" != KaiwuDB*.tar.gz ]]; then echo "Error: Installation package filename is incorrect. It should be a tar.gz file with KaiwuDB as the prefix" exit 1 fi # Create installation directory sudo mkdir -p /opt/kaiwudb # Extract installation package tar -xzf "$INSTALL_PACKAGE_PATH" -C /opt/kaiwudb # Enter installation directory cd /opt/kaiwudb/kaiwudb_install ``` From `SKILL.md:171-186`: ```bash # Single-node deployment ./deploy.sh install --single # Single-replica cluster deployment ./deploy.sh install --single-replica # Multi-replica cluster deployment ./deploy.sh install --multi-replica ``` The same unsafe trust model appears in `references/installation_guide.md:43-56, 105-120`: ```bash sudo mkdir -p /opt/kaiwudb tar -xzf "$INSTALL_PACKAGE_PATH" -C /opt/kaiwudb cd /opt/kaiwudb/$(basename "$INSTALL_PACKAGE_PATH" .tar.gz) ./deploy.sh install --single ./deploy.sh install --single-replica ./deploy.sh install --multi-replica ``` ### Technical Analysis The workflow validates only that the supplied path exists and that its basename matches `KaiwuDB*.tar.gz`. A filename pattern does not establish the archive's authenticity, integrity, provenance, or safety. The instructions do not require any of the following before execution: - Verification of a vendor signature or trusted cryptographic digest. - Confirmat ...[truncated 2519 chars]
- Remediation
- ## Remediation Suggestions 1. **Require authenticated package provenance** - Accept packages only from an allowlisted official KaiwuDB source over authenticated HTTPS. - Do not treat a user-provided filename as proof of origin. 2. **Verify package integrity and authenticity** - Require a vendor-provided digital signature and verify it against a pinned trusted public key. - Alternatively, require an approved SHA-256 or stronger digest obtained through a separate trusted channel. - Abort deployment if verification fails or verification material is unavailable. 3. **Validate archive contents before extraction** - List and inspect all archive members first. - Reject absolute paths, `..` traversal components, device files, unexpected hard links, and symbolic links escaping the staging directory. - Enforce an allowlist of expected top-level directories and installation files. 4. **Use a restricted staging directory** - Extract into a newly created directory owned by an unprivileged deployment account. - Apply restrictive permissions and ensure the destination is not shared or writable by other users. - Move only validated files into `/opt/kaiwudb`. 5. **Review executable content** - Confirm the digest or signature of `deploy.sh` independently. - Display the verified package version and publisher to the user before execution. - Refuse execution if the script or archive changes after verification. 6. **Minimize privileges** - Run validation and extraction without root privileges. - Elevate only individual operations that demonstrably require administrative access. - Avoid running the entire vendor deployment script as root when narrower sudo rules or a dedicated service account can satisfy the task. 7. **Apply the same controls consistently** - Update both `SKILL.md` and `references/installation_guide.md` so the secondary guide cannot bypass the hardened workflow.
