T03 · Remote Payload Retrieval and Execution
Error
- Location
- references/command-library.md:69
- Finding
- Unverified Remote Shell Scripts Are Downloaded and Executed Directly<![CDATA[ ## Vulnerability Details **File Locations**: - `references/command-library.md:69` - `references/command-library.md:86` - `assets/upgrade-guide-template-standalone.md:151` - `assets/upgrade-guide-template-cluster.md:166` **Vulnerability Type**: Unverified remote payload retrieval and execution **Risk Level**: Critical ### Vulnerable Code Standalone deployment command, present in `references/command-library.md:69` and `assets/upgrade-guide-template-standalone.md:151`: ```bash bash -c "$(curl -fsSL https://pdpublic.mingdao.com/private-deployment/data/preset_mongodb_docker.sh)" -s {该操作涉及的最新版本号} ``` Kubernetes deployment command, present in `references/command-library.md:86` and `assets/upgrade-guide-template-cluster.md:166`: ```bash bash -c "$(curl -fsSL https://pdpublic.mingdao.com/private-deployment/data/preset_mongodb_k8s.sh)" -s {该操作涉及的最新版本号} {命名空间} ``` ### Technical Analysis These commands retrieve mutable shell-script content from an external URL and pass the response directly to `bash` through command substitution. The downloaded payload is neither pinned to an immutable release nor validated using a cryptographic signature or an expected checksum. HTTPS authenticates the remote endpoint under normal conditions, but it does not establish that the returned script is the exact version reviewed when this Skill was audited. The effective payload can change independently of the Skill package. Compromise of the remote origin, hosting account, delivery infrastructure, or another trusted publishing component could therefore turn these documented upgrade operations into arbitrary command execution. The commands are intended to be run on HAP deployment infrastructure. The standalone command may run on a server with Docker and database access, while the Kubernetes command may run on a control node with cluster-management credentials. Consequently, execution is likely to occur in a highly privileged operational context. ### Attack Path 1. An adminis ...[truncated 1676 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions Replace direct remote execution with a download, verification, inspection, and execution workflow: 1. Publish scripts as immutable, versioned release artifacts rather than mutable files at stable URLs. 2. Publish a trusted SHA-256 digest or, preferably, a detached digital signature for each script version. 3. Download the script to a securely created local file without executing it: ```bash curl --fail --show-error --location \ --output ./preset_mongodb_docker.sh \ "https://trusted.example/path/to/versioned/preset_mongodb_docker.sh" ``` 4. Verify its integrity against a digest distributed through an independent trusted channel: ```bash echo "EXPECTED_SHA256 ./preset_mongodb_docker.sh" | sha256sum --check - ``` 5. If signatures are available, verify the artifact using a pinned vendor signing key. 6. Allow the administrator to inspect the verified local script before execution. 7. Execute only the verified local copy: ```bash bash ./preset_mongodb_docker.sh -s {version} ``` 8. Apply the same process to the Kubernetes script. 9. Run the script with the minimum required operating-system, Docker, database, and Kubernetes privileges. 10. Where practical, bundle an audited script with the Skill or reference a signed package release so the executed implementation matches the reviewed artifact. 11. Add failure handling that prevents execution if download, checksum, or signature validation fails. 12. Remove all `curl | bash` and `bash -c "$(curl ...)"` patterns from the templates and command library. ]]>
