Back to skill

Security audit

huawei-cloud-msmodelslim-model-adapt

Security checks for vulnerabilities and agentic risk

Overview

This model-adapter skill needs review because its required verification automatically permits model-supplied code to run without clearly explaining the risk or offering a safety choice.

Review before running verification. Random weights do not make accompanying model code safe. Use reviewed model code from a fixed revision, require explicit opt-in before enabling custom-code execution, and run it in an isolated environment without credentials. Inspect the external install.sh before executing it. The bundled files support Review, but do not establish malicious intent or data theft.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Vulnerability Patterns
  • Output HandlingUnvalidated Output Injection, Cross-Context Output, Unbounded Output
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (8)

The troubleshooting solution enables execution of model-provided code without warning the user.

High
Category
Output Handling
Confidence
99% confidence
Finding

The troubleshooting solution unconditionally enables model-supplied Python execution for both model and tokenizer loading. Custom code can be necessary for adapter development, but an unreviewed model repository can thereby execute code with the agent's filesystem, credential, and network access.

Content

No source excerpt is available for this finding.

Quantization commands enable execution of model-provided code without a safety warning.

High
Category
Output Handling
Confidence
98% confidence
Finding

The verification commands enable trust_remote_code without warning or an approval gate, allowing model-provided Python to run during quantization. A local test-model path does not establish trust because it may contain code copied from an untrusted model repository.

Content

No source excerpt is available for this finding.

Code capability 'file_read' detected in scripts/step1_generate_test_model.py but not covered by declared permissions.

High
Category
MCP Least Privilege
Confidence
75% confidence
Finding

The skill uses 'file_read' capability that is not covered by the declared 'allowed-tools' preapproval. Review the host runtime's actual enforcement policy; runtime permissions are unknown unless separately verified, and this declaration alone does not establish a permission ceiling.

Content

No source excerpt is available for this finding.

Code capability 'file_write' detected in scripts/step1_generate_test_model.py but not covered by declared permissions.

High
Category
MCP Least Privilege
Confidence
75% confidence
Finding

The skill uses 'file_write' capability that is not covered by the declared 'allowed-tools' preapproval. Review the host runtime's actual enforcement policy; runtime permissions are unknown unless separately verified, and this declaration alone does not establish a permission ceiling.

Content

No source excerpt is available for this finding.

Model loading permits execution of model-supplied Python without disclosing this to the user.

High
Category
Output Handling
Confidence
99% confidence
Finding

The script copies model-provided files into the output directory and loads its configuration with trust_remote_code=True; model construction also explicitly enables this trust. Malicious custom configuration or model classes can therefore execute before any weight verification, even though the generated weights are random.

Content

No source excerpt is available for this finding.

Model-provided code execution is enabled without user disclosure.

High
Category
Output Handling
Confidence
99% confidence
Finding

The script always passes --trust_remote_code True to quantization, silently authorizing execution of custom code from the selected model. Full-fallback quantization does not remove model-loading risks, so a malicious model can execute with the invoking process's privileges.

Content

No source excerpt is available for this finding.

subprocess module call

Medium
Category
Dangerous Code Execution
Confidence
70% confidence
Finding

subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Content

Scanner excerpt · scripts/step2_run_quantization.py (reported line 100)May include surrounding context.

python
"--trust_remote_code",
        "True",
    ]
    rc = subprocess.run(cmd, check=False).returncode
    if rc != 0:
        print("[ERROR] step2lossfailure")
        return rc

Dynamic attribute access via getattr()

Low
Category
Dangerous Code Execution
Confidence
50% confidence
Finding

Dynamic getattr() with a non-literal attribute name can access arbitrary object attributes, potentially bypassing access controls.

Content

Scanner excerpt · scripts/step1_generate_test_model.py (reported line 62)May include surrounding context.

python
]
    errors = []
    for cls_name in candidate_auto_model_names:
        auto_cls = getattr(transformers, cls_name, None)
        if auto_cls is None:
            continue
        try: