T03 · Remote Payload Retrieval and Execution
Error
- Location
- realtime_asr.py:186
- Finding
- Unpinned Third-Party Model Code Is Trusted and Executed<![CDATA[ ## Vulnerability Details **File Location**: `realtime_asr.py:186-191`; related download instructions at `README.md:54` and `SKILL.md:52` **Vulnerability Type**: Remote model-supplied code execution through an unsafe trust configuration **Risk Level**: High ### Vulnerable Code ```python with contextlib.redirect_stdout(io.StringIO()): self.asr_model = AutoModel( model=model_path, trust_remote_code=True, device="cpu", disable_update=True, ) ``` The model is acquired using the following documented command: ```bash modelscope download --model gongjy/SenseVoiceSmall --local_dir ./model/SenseVoiceSmall ``` ### Technical Analysis The model is downloaded from a mutable third-party ModelScope repository without an immutable revision, checksum, or signature verification. The application then initializes the model with `trust_remote_code=True`, permitting model-associated custom Python code to execute. The `disable_update=True` setting does not establish the integrity of the initially downloaded model or its accompanying code. It only affects subsequent update behavior. If the model repository, distribution account, download channel, or local model directory is compromised, malicious Python code can execute when the model is loaded. ### Attack Path 1. An attacker compromises or gains control over the referenced ModelScope repository, its account, or the model delivery channel. 2. The attacker publishes a modified model revision containing malicious custom Python code. 3. A user follows the documented download command without pinning or verifying the artifact. 4. The user starts the transcription process. 5. `AutoModel` loads the downloaded model with `trust_remote_code=True`. 6. The malicious model code executes with the permissions and environment of the user running the Skill. A local attacker who can replace files under `./model/SenseVoiceSmall` could exploit the same loading behavior. ### Impact Assessment Su ...[truncated 628 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Set `trust_remote_code=False` and use a model format that does not require execution of repository-provided Python code. 2. Pin the model to a reviewed, immutable revision or content digest. 3. Publish and verify cryptographic hashes or signatures for every model and code artifact. 4. Prefer an official, audited model source and vendor any required custom model code after security review. 5. Store the verified model in a directory that untrusted users and processes cannot modify. 6. Run model loading in a restricted subprocess or container with: - No access to Agent credentials or unrelated user files. - Network access disabled unless strictly necessary. - Read-only model files. - Minimal operating-system permissions. 7. Fail closed when model integrity verification is unavailable or unsuccessful. ]]>
