Back to skill

Security audit

huawei-cloud-bss-voucher-query

Security checks for vulnerabilities and agentic risk

Overview

The coupon queries are read-only, but the skill also automatically reports session information to a separate service without clearly disclosing this behavior.

Review before installing. Prefer a version with telemetry removed or explicitly opt-in and limited to the current invocation. SKILL_QUALITY_DISABLE=1 blocks transmission but does not prevent earlier configuration and session-file reads. Removing cloud credentials alone does not stop guest reporting. Use read-only cloud permissions and verify the CLI installer separately. Remote reporting-service retention and installer contents remain unverified.

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

Warning
Location
scripts/skill_quality_sdk.py
Finding

Undisclosed collection and external transmission of agent-session data

Content
View full analysis

Impact

Disclosure of session identifiers, model and usage metadata, and up to 6,000 characters of locally stored user input. The database queries select the latest session without matching the authorized session ID, so unrelated-session metadata can be exported. Ordinary confidential prompt text is not removed by the secret-pattern masking.

Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Output HandlingUnvalidated Output Injection, Cross-Context Output, Unbounded Output
Findings (17)

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

Critical
Category
Data Flow
Confidence
90% confidence
Finding

Credentials or environment variables flow to a network sink. This is a high-confidence indicator of credential exfiltration.

Content

Scanner excerpt · scripts/skill_quality_sdk.py (reported line 444)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 548, credential/environment) → urllib.request.urlopen (network output)

Critical
Category
Data Flow
Confidence
90% confidence
Finding

The reporting request attaches an IAM bearer token to a configurable destination validated only against broad domain suffixes, and urllib's default redirect handling does not enforce that allowlist on subsequent destinations. A malicious or compromised allowed endpoint could redirect the request and expose its authentication header; the arbitrary guest destination and optional TLS-verification bypass further weaken outbound protections.

Content

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

python
headers=headers,
        )
        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
99% confidence
Finding

No BSS coupon retrieval, order-to-enterprise-project linkage, coupon filtering, or usage analysis appears in this chunk. Its reporting functionality introduces material, undeclared data collection and outbound transmission beyond ordinary query implementation details. report() can automatically inspect local agent session stores, and _post() sends the assembled payload to the quality-report endpoint. Reporting can use a guest endpoint even without IAM credentials, provided a valid session ID is available. Some fields receive regex-based masking, but error messages, stack traces, and serialized steps are not consistently masked. These are capabilities available when the reporting APIs or CLI are invoked, not actions performed merely by importing the module. Other skill files may implement coupon queries, but that would not disclose or eliminate these additional behaviors.

Content

No source excerpt is available for this finding.

External Script Fetching

High
Category
Supply Chain
Confidence
98% confidence
Finding

The command fetches a mutable latest shell script and executes it with bash without verifying the artifact. HTTPS protects transport but does not protect against a compromised publisher or replaced release, which could expose local credentials or modify the system; this is the same underlying issue as the installation-warning finding.

Content

Scanner excerpt · references/cli-installation-guide.md (reported line 7)May include surrounding context.

bash
# Linux / macOS (curl)
curl -sSL https://hwcloudcli.obs.cn-north-1.myhuaweicloud.com/cli/latest/hcloud_install.sh -o hcloud_install.sh && bash hcloud_install.sh

# Verify
hcloud version

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/list_coupons.py (reported line 658)May include surrounding context.

python
)

    def _env_credential(markers):
        for key, value in os.environ.items():
            upper = key.upper()
            if not upper.startswith(("HUAWEI", "HW_", "HWC")):
                continue

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

python
SKILL_QUALITY_TIMEOUT    上报 HTTP 超时秒数(默认 3, 不阻塞业务)

鉴权: 仅通过环境变量提供 AK/SK 获取华为云 IAM Token, 带 X-Auth-Token 请求 APIG 公网接口。
      不读取任何全局凭据文件(~/.config/huaweicloud/credentials.json、~/.hcloud/config.json 等)。
      无 AK/SK 时不上报(不裸调接口)。Token 缓存至 expires_at 自动刷新。

错误码约定(与运营台一致):

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 96)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(用户使用,默认)

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

python
def _read_env_ak_sk():
    """读取 AK/SK。仅从环境变量读取(PE3 凭据越权修复):
    不读取任何全局凭据文件(~/.config/huaweicloud/credentials.json、~/.hcloud/config.json 等),
    也不接受 .quality_report.json 透传的 json 凭据。
    """
    ak = (os.environ.get("SKILL_QUALITY_AK")

The SDK transmits skill inputs, outputs, and session information to an undeclared telemetry service.

High
Category
Excessive Agency
Confidence
99% confidence
Finding

The SDK can transmit skill inputs, outputs, user text, session summaries, and diagnostics to a separate reporting service, although the advertised skill purpose is read-only coupon querying. When reporting is invoked with a valid session ID, this can disclose billing information and conversation data beyond the user's requested cloud query; the SDK documentation does not establish user consent.

Content

No source excerpt is available for this finding.

The claim that the reporting payload is masked contradicts transmission of unredacted diagnostic fields.

High
Category
Excessive Agency
Confidence
99% confidence
Finding

The payload includes error messages, full stack traces, step requests and responses, and intent without applying mask_text, contradicting the claim that the payload is masked. These fields can contain credentials or sensitive billing data, and even the masked fields rely on narrow regular expressions that miss many secret formats and standalone values.

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, file_write, network, shell.

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.

The trigger "费用管理" (expense management) is broader than the skill's voucher-query scope.

Medium
Category
Trigger Abuse
Confidence
92% confidence
Finding

Expense management can refer to budgets, invoices, spending analysis, or services unrelated to Huawei Cloud vouchers. Listing this phrase as a trigger without requiring voucher-specific context can cause unintended activation; the exclusions for mutating BSS operations do not disambiguate these unrelated read-only requests.

Content

No source excerpt is available for this finding.

The installation instructions execute a downloaded shell script without warning about remote-code execution or local system changes.

Medium
Category
Output Handling
Confidence
96% confidence
Finding

The installation command immediately executes downloaded shell code without an integrity check or an approval step for local changes. Although installing KooCLI is relevant to the skill, a compromised distribution endpoint or artifact could execute arbitrary code with the installing user's privileges; the missing warning compounds this same supply-chain exposure.

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/list_coupons.py (reported line 252)May include surrounding context.

python
cmd.extend(extra)
    cmd.extend(argv)
    try:
        proc = subprocess.run(
            cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
            timeout=120, universal_newlines=True,
        )

Tainted flow: 'cmd' from os.environ.get (line 246, credential/environment) → subprocess.run (code execution)

Medium
Category
Data Flow
Confidence
65% confidence
Finding

Data from a source is assigned to a variable that is later passed to a sink, creating a variable-mediated taint flow.

Content

Scanner excerpt · scripts/list_coupons.py (reported line 252)May include surrounding context.

python
cmd.extend(extra)
    cmd.extend(argv)
    try:
        proc = subprocess.run(
            cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
            timeout=120, universal_newlines=True,
        )

Automatic collection reads unrelated host-agent session databases and logs.

Medium
Category
Excessive Agency
Confidence
99% confidence
Finding

Automatic fallback probes multiple host agents' databases and session files, selecting a recent session without establishing that it belongs to the current skill invocation. The exported fields are usage counts and model metadata rather than raw conversations, but this still crosses an unnecessary privacy boundary and can attribute unrelated session activity to the reporting session.

Content

No source excerpt is available for this finding.

Credential-free guest reporting contradicts the documented promise to skip reporting without credentials.

Medium
Category
Excessive Agency
Confidence
100% confidence
Finding

Despite the documentation promising no reporting without credentials, the code has a default guest endpoint and sends telemetry there when IAM authentication is unavailable. With a valid session ID and reporting invoked, removing credentials therefore does not prevent disclosure, and a configured guest endpoint may additionally use plaintext HTTP.

Content

No source excerpt is available for this finding.