Back to skill

Security audit

huawei-cloud-maas-tokens-usage

Security checks for vulnerabilities and agentic risk

Overview

The usage query fits its purpose, but optional notifications could forward your usage statistics to an unapproved recipient through redirects.

Use query-only mode until webhook redirects are blocked or every redirect destination is validated. If enabling notifications, approve the exact recipient and the usage data shared. Prefer temporary credentials with minimum read-only permissions and protect any credential file. The bundled script and material scanner gaps were reviewed; live cloud behavior and installed dependencies were not tested. No malicious intent was established.

Vulnerability Patterns
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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
Findings (1)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/maas_rest_usage_stats.py
Finding

Automatic webhook redirects bypass the HTTPS and destination allowlist

Content
View full analysis

Impact

A 307 or 308 redirect preserves the POST body, disclosing the query period, region, token totals, request count, and error count to an unauthorized receiver. An HTTP redirect also removes transport confidentiality. The notification payload does not contain AK/SK or the security token.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (17)

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The core querying behavior matches the description. However, the optional --notify-url feature calls _send_notification(), which performs an additional HTTP POST containing token totals, request/error counts, region, and reporting period. This data-export capability is not disclosed in the declared read-only querying purpose. Restricting the initial webhook URL to Huawei Cloud domains does not remove the mismatch. Credential loading, IAM project lookup, and aggregation are supporting implementation details rather than separate mismatches.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The query examples align with the declared purpose, and credential handling and filtering are supporting details. However, the webhook example introduces an additional data-delivery capability beyond querying and displaying statistics. Restricting destinations to HTTPS Huawei Cloud hosts does not eliminate this mismatch. The underlying Python implementation is not supplied, so the assessment identifies the capability exposed by the shell example rather than independently verifying its execution.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The authentication methods and date-range options support the declared query purpose. However, the webhook example introduces an additional data-transmission capability beyond querying and displaying statistics. The stated HTTPS and Huawei Cloud hostname restrictions do not make this capability declared. The underlying Python implementation is not supplied, so the assessment concerns the explicitly documented invocation rather than verification of the POST behavior or allowlist enforcement.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
91% confidence
Finding

Most examples align with the declared statistics-query functionality. However, the webhook option introduces an outbound notification capability beyond retrieving statistics. Restricting the destination to HTTPS and Huawei Cloud hosts does not make that capability declared. The underlying Python implementation is not supplied, so the notification payload and enforcement of destination restrictions cannot be verified; there is no evidence here that credentials are transmitted to the webhook.

Content

No source excerpt is available for this finding.

Skill declares no tool scope ('permissions' or 'allowed-tools') but code capabilities were detected: env, file_read, network.

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

Standalone triggers such as "request count" and "error count" can activate this Huawei Cloud MaaS skill for unrelated requests.

Medium
Category
Trigger Abuse
Confidence
97% confidence
Finding

The trigger list explicitly activates on mentions of generic metrics, including "request count", "error count", and "token consumption", without requiring Huawei Cloud MaaS context. These terms also occur in other providers' usage queries and general application monitoring, and no exclusion conditions distinguish those requests.

Content

No source excerpt is available for this finding.

Unsafe Defaults

Medium
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool defaults are unsafe or overly permissive (e.g. disabled TLS verification, no authentication, world-writable permissions). Unsafe defaults widen the attack surface.

Content

Scanner excerpt · SKILL.md (reported line 49)May include surrounding context.

md
| ❌ Query a time range longer than 29 days without segmentation | The API retains only 30 days of data, and a single request must span ≤ 29 days; the script auto-segments ranges > 29 days |
| ❌ Use a region other than `cn-southwest-2` | MaaS ShowStatistics only supports Southwest-Guiyang-1 |
| ❌ Point `--notify-url` at an HTTP URL, an IP literal, or any host outside `*.myhuaweicloud.com` / `*.huaweicloud.com` | SSRF/exfiltration risk; the script rejects such URLs before sending the query |
| ❌ Disable TLS verification for the notification (`verify=False`) | Notification must keep `verify=True` |
| ❌ Write a new query script instead of using `maas_rest_usage_stats.py` | Must use the script in `scripts/` directory |

> **If a user requests a prohibited operation, you must refuse and explain the security constraint.**

Unsafe Defaults

Medium
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool defaults are unsafe or overly permissive (e.g. disabled TLS verification, no authentication, world-writable permissions). Unsafe defaults widen the attack surface.

Content

Scanner excerpt · references/security-guide.md (reported line 165)May include surrounding context.

md
| Host | non-empty DNS name | empty host |
| Host type | DNS name | IP literal (IPv4 dotted-quad or IPv6 containing `:`) |
| Domain | `myhuaweicloud.com`, `huaweicloud.com`, or any subdomain of either (e.g. `maas.myhuaweicloud.com`) | any other domain, look-alikes such as `myhuaweicloud.com.evil.example` |
| TLS | `verify=True` (always, not configurable) | `verify=False` is never used |

**Rejection (validation stage, nothing sent):**

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · SKILL.md (reported line 232)May include surrounding context.

md
(`YYYY-MM-DD`, both at local 00:00); map user expressions ("last 7 days" / "last 14 days" / "last 30 days" / "this month") to a calendar window. `--last-days` and `--from`/`--to` are mutually exclusive
3. **1c. Auto-segment** — If the **whole-day span** `(to - from).days` is more than 29 days, split into multiple ≤ 29-day segments and aggregate results
4. **1d. SDK sign request** — `Signer(_Creds(ak, sk)).sign(sdk_request)` — AK/SK in Python process memory only
5. **1e. POST ShowStatistics** — `requests.post("https://modelarts.{region}.myhuaweicloud.com/v1/{project_id}/maas/monitoring/show-statistics", headers=signed_headers, data=body_bytes)`
6. **1f. Aggregate & convert** — Sum segment results; convert token unit (thousand → M tokens, actual = value × 1000)
7. **1g. Print table** — Print the 5 core metrics plus `Error Rate` (always), then one row for every other numeric field **actually present in the response** (see "Output fields" below), then `Period: <start> ~ <end> (<tz>)`; if e

The workflow includes posting usage summaries to a webhook, beyond the declared statistics-query purpose.

Medium
Category
Excessive Agency
Confidence
92% confidence
Finding

L112–L113 document an invocation that posts the query summary JSON to a separate webhook using --notify-url. The manifest describes read-only MaaS statistics queries, not forwarding usage data to another destination; the HTTPS and Huawei Cloud host restrictions do not make that additional disclosure part of the declared purpose.

Content

No source excerpt is available for this finding.

Unrestricted Tool Access

Medium
Category
Excessive Agency
Confidence
80% confidence
Finding

Skill grants unrestricted tool access without appropriate constraints. An agent with unfettered tool access can perform arbitrary actions including file modification, network requests, and code execution.

Content

Scanner excerpt · references/security-guide.md (reported line 46)May include surrounding context.

If a user attempts to provide AK/SK directly (e.g., "my AK is xxx, SK is yyy"):

  1. Stop immediately — Do not execute any commands

  2. Politely refuse and return the following message:

    text

The documented webhook capability sends usage statistics to a separate endpoint, beyond the manifest's read-only MaaS query purpose (L151–L155).

Medium
Category
Excessive Agency
Confidence
90% confidence
Finding

The guide describes --notify-url posting the query summary JSON to a caller-selected webhook, whereas the manifest declares only querying and analyzing MaaS statistics. This introduces an additional data-disclosure capability; restricting destinations to Huawei Cloud domains does not establish that the receiving endpoint is authorized to receive the user's usage data.

Content

No source excerpt is available for this finding.

The skill documents exporting usage statistics to a webhook, beyond the manifest's read-only MaaS query scope.

Medium
Category
Excessive Agency
Confidence
93% confidence
Finding

The manifest describes retrieving MaaS statistics from ShowStatistics, but this reference documents an additional operation that POSTs the resulting usage summary to a separately supplied webhook. This optional outbound disclosure is distinct from the API request needed to retrieve statistics; restricting destinations to Huawei Cloud domains does not make the recipient the authorized MaaS statistics service.

Content

No source excerpt is available for this finding.

The documented --notify-url capability sends usage results to a webhook, beyond the skill's stated read-only query purpose.

Medium
Category
Excessive Agency
Confidence
94% confidence
Finding

The guide describes a separate webhook POST and confirms that query results are sent to the supplied URL. This outbound reporting capability is not necessary to retrieve MaaS statistics and is not declared in the manifest; restricting destinations to Huawei Cloud domains does not establish that the recipient is authorized to receive usage data.

Content

No source excerpt is available for this finding.

The verification workflow includes an outbound webhook notification capability outside the declared usage-query purpose.

Medium
Category
Excessive Agency
Confidence
94% confidence
Finding

The executable example passes --notify-url to send a notification to a separate webhook, and lines L134–L135 explicitly describe notification delivery behavior. The manifest declares read-only MaaS statistics queries, not forwarding results to notification recipients; restricting destinations to Huawei Cloud hosts does not make this additional outbound capability necessary for querying statistics.

Content

No source excerpt is available for this finding.

External Transmission

Medium
Category
Data Exfiltration
Confidence
97% confidence
Finding

The initial URL is allowlisted, but requests.post follows redirects by default without reapplying that validation. A permitted endpoint controlled or influenced by an attacker could return a 307/308 redirect to an off-allowlist destination, forwarding the usage-summary body and bypassing the advertised transmission restriction; exploitation requires the optional notification feature to be enabled.

Content

Scanner excerpt · scripts/maas_rest_usage_stats.py (reported line 180)May include surrounding context.

python
def _send_notification(url, payload):
    """POST the summary JSON. Raises on any failure; callers must only warn."""
    resp = requests.post(
        url,
        json=payload,
        headers={"Content-Type": "application/json"},

The skill can publish usage statistics to a webhook despite the manifest describing only read-only MaaS queries.

Medium
Category
Excessive Agency
Confidence
99% confidence
Finding

When --notify-url is supplied, the code sends token counts, request counts, error counts, region, and reporting period to a separate webhook. This is an additional data-disclosure operation beyond querying the ShowStatistics API; restricting the destination to Huawei Cloud domains does not make webhook delivery part of the manifest's declared scope.

Content

No source excerpt is available for this finding.