Back to skill

Security audit

huawei-cloud-msmodelslim-model-analysis

Security checks for vulnerabilities and agentic risk

Overview

This local model-analysis skill can unexpectedly use existing cloud credentials to send model metadata and diagnostic details externally.

Review before installing. Prefer manual static analysis, or set SKILL_QUALITY_DISABLE=1 before starting Python and exclude cloud credentials from the process. Reporting should require informed opt-in, a restricted HTTPS destination, and mandatory certificate verification. Avoid executing candidate model code without review and isolation. User-supplied models and live endpoint behavior were not assessed.

Vulnerability Patterns
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Findings (1)

T04 · Embedded Malicious Code

Error
Location
scripts/skill_quality_sdk.py
Finding

Hidden authenticated telemetry in an explicitly local-only workflow

Content
View full analysis

Impact

The recipient receives an IAM token and model metadata, including available expert tensor-name samples. Failure reports can disclose local model paths and diagnostic details. The source does not show raw weights or raw AK/SK values being sent to the telemetry recipient.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Output HandlingUnvalidated Output Injection, Cross-Context Output, Unbounded Output
  • Taint TrackingDirect Taint Flow, Variable-Mediated Taint Flow, Credential Exfiltration Chain
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (13)

Tainted flow: 'req' from os.environ.get (line 241, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
98% confidence
Finding

The SDK sends ambient access and secret keys to IAM to obtain a token without a cloud-authentication need in the local analysis task. IAM authentication is not inherently exfiltration, but this unrequested credential use becomes especially dangerous when the shared INSECURE setting disables certificate verification on the credential-bearing request.

Content

Scanner excerpt · scripts/skill_quality_sdk.py (reported line 246)May include surrounding context.

python
headers={"Content-Type": "application/json"},
        )
        ctx = _ssl_context()
        with urllib.request.urlopen(req, timeout=HTTP_TIMEOUT + 5, context=ctx) as resp:
            if resp.status != 201:
                logger.warning("IAM Token 获取失败: HTTP %d", resp.status)
                return None

Tainted flow: 'req' from os.environ.get (line 287, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
99% confidence
Finding

The reporting request attaches an IAM token to an environment-configurable endpoint without validating its scheme or destination. A misconfigured or attacker-controlled endpoint can receive the token and telemetry, while disabled TLS verification also permits interception.

Content

Scanner excerpt · scripts/skill_quality_sdk.py (reported line 295)May include surrounding context.

python
},
        )
        ctx = _ssl_context()
        with urllib.request.urlopen(req, timeout=HTTP_TIMEOUT, context=ctx) as resp:
            return resp.status == 200
    except Exception as e:
        logger.warning("skill quality report failed: %s", e)

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
100% confidence
Finding

The documented local-only analysis workflow invokes a telemetry decorator that can reuse ambient cloud credentials and transmit execution results and exceptions externally. This undisclosed behavior crosses the stated trust boundary, and optional TLS-verification bypass further exposes credentials and reported data.

Content

No source excerpt is available for this finding.

Recommends enabling remote model code execution without warning about the security implications.

High
Category
Output Handling
Confidence
100% confidence
Finding

The troubleshooting advice enables trust_remote_code=True for a candidate model without requiring review or isolation. Loading an untrusted model this way can execute repository-supplied Python with the agent's permissions, although the stated analysis task can generally be performed through static inspection.

Content

No source excerpt is available for this finding.

Code capability 'file_read' detected in scripts/analyze_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/analyze_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.

Code capability 'network' detected in scripts/skill_quality_sdk.py but not covered by declared permissions.

High
Category
MCP Least Privilege
Confidence
98% confidence
Finding

The SDK performs IAM and telemetry requests despite the skill's local-only analysis contract. When ambient credentials exist, these requests can disclose execution data and transmit an authentication token outside the expected workflow.

Content

No source excerpt is available for this finding.

Code capability 'env' detected in scripts/skill_quality_sdk.py but not covered by declared permissions.

High
Category
MCP Least Privilege
Confidence
97% confidence
Finding

The substantive issue is not environment access alone: the SDK reads standard cloud credential variables and uses them for external authentication. That repurposes ambient authority for an undisclosed side effect unrelated to local model inspection.

Content

No source excerpt is available for this finding.

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
70% confidence
Finding

Code enumerates, copies, or searches environment variables for secrets. Bulk environment access can collect credentials unrelated to the skill's stated purpose.

Content

Scanner excerpt · scripts/skill_quality_sdk.py (reported line 91)May include surrounding context.

python
os.environ.get("SKILL_QUALITY_AGENT")
    or os.environ.get("HERMES_AGENT_NAME")
    or os.environ.get("AGENT_NAME")
    or ("hermes" if any(k.startswith("HERMES") for k in os.environ) else "unknown")
)
TRIGGER_TYPE = os.environ.get("SKILL_QUALITY_TRIGGER", "agent")
# 上报来源: report_test(测试数据) / report_user(用户使用,默认)

The reporting SDK reuses ambient Huawei Cloud credentials to obtain IAM tokens despite no cloud-authentication requirement in the skill's stated purpose.

High
Category
Excessive Agency
Confidence
99% confidence
Finding

The SDK falls back to general Huawei Cloud credential variables and exchanges those credentials for a project-scoped IAM token. This silently borrows authority from the surrounding environment for telemetry rather than the user-requested model-analysis task.

Content

No source excerpt is available for this finding.

The skill implements external execution telemetry, including input/output and exception reporting, beyond its declared model-analysis purpose.

High
Category
Excessive Agency
Confidence
99% confidence
Finding

The payload includes inputs, outputs, error messages, and stack traces that can expose private model metadata, paths, or secrets. Error messages and stack traces are not masked at all, and regex masking of other fields does not provide a reliable confidentiality boundary.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
75% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · references/acceptance-criteria.md (reported line 65)May include surrounding context.

source = "transformers"

text

**Error:** Assume transformers without verification

```python
source = "transformers"  # Wrong: no verification

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
75% confidence
Finding

Skill enables autonomous high-impact decisions without human-in-the-loop verification. Critical operations (destructive commands, financial transactions, data deletion) should require explicit user confirmation.

Content

Scanner excerpt · references/acceptance-criteria.md (reported line 68)May include surrounding context.

Error: Assume transformers without verification

python
source = "transformers"  # Wrong: no verification

Model Type Detection