T03 · Remote Payload Retrieval and Execution
- Location
scripts/remove_watermark.py:35- Finding
Mutable Remote Model Code Is Trusted and Executed
- Content
View full analysis
Vulnerability Details
File Location:
scripts/remove_watermark.py, lines 35-37
Vulnerability Type: Remote payload retrieval and execution
Risk Level: Highpython processor = AutoProcessor.from_pretrained(model_id, trust_remote_code=True) model = AutoModelForCausalLM.from_pretrained( model_id, trust_remote_code=True ).to(device)Technical Analysis
Both model-loading operations enable
trust_remote_code=True. This permits Python implementation files obtained from the remotemicrosoft/Florence-2-basemodel repository to execute locally.The model repository is referenced by name without an immutable
revisioncommit hash. Consequently, the executable code retrieved during a future run may differ from the code available when the Skill was reviewed. Trusting a reputable namespace reduces likelihood but does not eliminate risks from repository compromise, account takeover, upstream changes, or dependency-resolution manipulation.The downloaded implementation executes in the same process and security context as the Skill. It is therefore not restricted to model inference and can perform any operation available to the invoking user.
Attack Path
- An attacker compromises the upstream model repository, its publisher account, or the model retrieval path.
- The attacker modifies the repository's custom Python implementation while preserving the expected model identifier.
- A user runs the watermark-removal script.
from_pretrained()retrieves the modified remote implementation.trust_remote_code=Trueauthorizes Transformers to load and execute that implementation.- The payload executes with the invoking user's permissions before or during image processing.
Impact Assessment
Successful exploitation provides arbitrary code execution with the privileges of the user running the Skill. The payload could read or modify user-accessible files, inspect process-accessible sec ...[truncated 264 chars]
- Remediation
View remediation
Remediation Suggestions
- Remove
trust_remote_code=Truewhen using a Transformers release that supports Florence-2 natively. - If custom remote code remains necessary, pin
revisionto a reviewed immutable commit hash for both loading calls. - Download, inspect, and package the required model implementation as a controlled local dependency rather than retrieving mutable code at runtime.
- Verify downloaded model artifacts against approved cryptographic hashes.
- Run model loading and inference in a least-privilege container or sandbox with restricted filesystem access and no unnecessary network connectivity.
- Establish a controlled update process in which new model revisions are reviewed and tested before deployment.
- Remove
