T03 · Remote Payload Retrieval and Execution
- Location
SKILL.md:53- Finding
Unpinned Remote Model Code Is Downloaded and Executed
- Content
View full analysis
Vulnerability Details
File Location:
SKILL.md:53-59,SKILL.md:69-80,SKILL.md:84-93,SKILL.md:107-118, andSKILL.md:122-131
Vulnerability Type: Untrusted remote payload retrieval and execution
Risk Level: HighVulnerable Code
bash docker exec <CONTAINER> python3 -c " from modelscope import snapshot_download snapshot_download('<MODEL_ID>', local_dir='/data/models/<MODEL_NAME>') "The downloaded model is subsequently loaded with remote code explicitly trusted:
bash docker exec <CONTAINER> bash -c ' export USE_FLAGGEMS=0 unset FLAGCX_PATH timeout 300 python3 /tmp/run_offline_inference.py \ --model <MODEL_PATH> \ --tp <TP_SIZE> \ --trust-remote-code ' > /tmp/run_a_offline.jsonThe same
--trust-remote-codeoption is present in the Run A serve command and both Run B commands.Technical Analysis
A model identified by a user-provided remote ID is downloaded from ModelScope without an immutable revision, expected cryptographic digest, or signature verification. The verification commands then use
--trust-remote-code, which permits custom Python code supplied by the model repository to execute during model loading.Consequently, the effective executable payload can change after this Skill has been reviewed. A repository owner, compromised account, registry compromise, or attacker-controlled model ID could supply malicious custom model code. This is not merely model-data processing: trusted remote model implementations can execute Python with the permissions of the inference process.
Attack Path
- An attacker publishes a model repository containing malicious custom Python model code, or compromises an otherwise trusted repository.
- The attacker supplies that repository ID as the requested model, or waits for an unpinned repository revision to be replaced.
- The Skill downloads the current repository ...[truncated 925 chars]
- Remediation
View remediation
Remediation Suggestions
- Disable remote model code by default and remove
--trust-remote-codeunless the selected model has a documented and reviewed requirement for it. - Require explicit, informed user approval before executing custom code from a model repository.
- Restrict downloads to an allowlist of approved registries, namespaces, and repositories.
- Pin every remote model to an immutable commit or revision rather than downloading the current mutable state.
- Verify repository signatures or cryptographic hashes before model loading.
- Review and locally vendor any required custom model implementation instead of executing mutable repository code.
- Run model loading as a dedicated non-root user in a hardened, disposable container.
- Remove sensitive mounts, credentials, host-control sockets, and unnecessary Linux capabilities from the container.
- Disable outbound network access during model loading and inference unless it is strictly required.
- Record the source repository, immutable revision, and verified digest in the generated report for auditability.
- Disable remote model code by default and remove
