T03 · Remote Payload Retrieval and Execution
Error
- Location
- scripts/env_init.sh:30
- Finding
- Unverified Remote SDK Retrieval and Execution<![CDATA[ ## Vulnerability Details **File Location**: `scripts/env_init.sh:30-40` **Vulnerability Type**: Unverified remote dependency installation **Risk Level**: High ### Vulnerable Code ```bash manifest_url="https://las-ai-cn-beijing-online.tos-cn-beijing.volces.com/operator_cards_serving/public/skills/sdk/manifest.json" manifest=$(curl -sf "$manifest_url" || echo '{}') ``` ```bash pip install --quiet --upgrade https://las-ai-cn-beijing-online.tos-cn-beijing.volces.com/operator_cards_serving/public/skills/sdk/las_sdk-0.2.0-py3-none-any.whl ``` ### Technical Analysis The mandatory environment initialization workflow retrieves metadata from a remote endpoint and installs a remotely hosted Python wheel. The wheel is installed without validating a cryptographic hash, package signature, trusted publisher identity, or immutable artifact digest. Although the URL uses HTTPS, transport encryption does not establish that the downloaded artifact is the exact package reviewed with this skill. The effective code executed by the skill can therefore change after the package itself has been audited. Python package installation may execute package-controlled installation behavior, and subsequently invoking `lasutil` executes code from the installed package. The remote manifest also affects whether the installation branch is entered. If manifest retrieval fails, the script substitutes an empty JSON object, causing `remote_ver` to become `unknown`; this can still make the local and remote versions differ and trigger installation. ### Attack Path 1. An attacker compromises the remote storage account, publication pipeline, artifact, or another component in the remote dependency delivery chain. 2. The attacker replaces the wheel at the hard-coded URL with a malicious package. 3. A user or agent follows the documented initialization procedure and sources `scripts/env_init.sh`. 4. The script invokes `pip install` against the mutable remote URL without checking an expected d ...[truncated 846 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Pin the SDK artifact to an immutable version and a documented SHA-256 digest. 2. Download the wheel to a temporary file, calculate its digest, and abort unless it exactly matches the expected value. 3. Verify a trusted publisher signature in addition to the digest where supported. 4. Store dependency versions and hashes in a reviewed lock file, such as a requirements file used with `pip --require-hashes`. 5. Do not allow a mutable remote manifest to trigger installation automatically. 6. Require explicit user approval before installing or upgrading executable dependencies. 7. Fail closed when the manifest cannot be fetched or parsed rather than treating an empty response as an update condition. 8. Install with the minimum required privileges in an isolated virtual environment. 9. Restrict access to credentials while dependency installation occurs and audit the provenance of the SDK release pipeline. ]]>
