Back to skill

Security audit

huawei-cloud-alarm-reduce-noise

Security checks for vulnerabilities and agentic risk

Overview

ClawScan rates this skill suspicious because scanners report an unsafe remote installer, destructive CLI cleanup instructions, and a possible script injection issue in HTML reports.

Given the suspicious verdict and incomplete scan coverage (81.2%), review the reported installer, cleanup instructions, and HTML report issue before installing. The scan does not establish malicious intent, but it also does not fully assess every component.

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/analyze_alarm.py
Finding

Unescaped cloud alarm metadata enables stored script injection in HTML reports

Content
View full analysis

Impact

Injected markup and event handlers can execute JavaScript when the report is opened or a region is selected. Such code can read and transmit alarm details embedded in the report or alter displayed recommendations. This does not establish access to local AK/SK environment variables or arbitrary local files.

Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Output HandlingUnvalidated Output Injection, Cross-Context Output, Unbounded Output
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
Findings (28)

Tp2

High
Category
MCP Tool Poisoning
Confidence
85% confidence
Finding

Mixing characters from multiple Unicode scripts in a single identifier is a common technique to create visually ambiguous tool names.

Content

No source excerpt is available for this finding.

Tp2

High
Category
MCP Tool Poisoning
Confidence
85% confidence
Finding

Mixing characters from multiple Unicode scripts in a single identifier is a common technique to create visually ambiguous tool names.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding

The supplied shell commands perform destructive CLI removal and user configuration cleanup rather than alarm analysis or report generation. Although CLI setup can support cloud analysis, these commands provide only deletion behavior, including removal of user-local data, with no demonstrated installation or repair context. This capability is not represented in the declared purpose.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding

The supplied command performs local cache deletion rather than alarm analysis or report generation. Although CLI maintenance could support a cloud workflow, the supplied chunk establishes no need for this deletion as an implementation detail of the declared functionality.

Content

No source excerpt is available for this finding.

External Script Fetching

High
Category
Supply Chain
Confidence
97% confidence
Finding

The command downloads a mutable remote installer and immediately executes it without verifying a signature or trusted digest. HTTPS and an apparently official endpoint reduce some risks but do not protect against compromised publishing infrastructure; a substituted installer could execute with the user's privileges and access cloud credentials available in the environment.

Content

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

One-click Installation

bash
# Download and run official installation script (interactive)
curl -sSL https://cn-north-4-hdn-koocli.obs.cn-north-4.myhuaweicloud.com/cli/latest/hcloud_install.sh -o ./hcloud_install.sh && bash ./hcloud_install.sh

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

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

Uninstall KooCLI

bash
# Linux/macOS:
rm -f /usr/local/bin/hcloud  # requires write permission
rm -rf /usr/local/hcloud/  # requires write permission
rm -rf ~/.hcloud/

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

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

bash
# Linux/macOS:
rm -f /usr/local/bin/hcloud  # requires write permission
rm -rf /usr/local/hcloud/  # requires write permission
rm -rf ~/.hcloud/

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

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

bash
# Linux/macOS:
rm -f /usr/local/bin/hcloud  # requires write permission
rm -rf /usr/local/hcloud/  # requires write permission
rm -rf ~/.hcloud/

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
94% confidence
Finding

Although confined to the CLI's configuration directory, this command silently deletes saved profiles and credentials shared by potentially unrelated workflows. The uninstall context explains the intent but does not eliminate the risk of unexpected configuration loss; this is the same underlying issue as the SQP-2 finding.

Content

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

Linux/macOS:

rm -f /usr/local/bin/hcloud # requires write permission rm -rf /usr/local/hcloud/ # requires write permission rm -rf ~/.hcloud/

text

### Clean Cache

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

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

Linux/macOS:

rm -f /usr/local/bin/hcloud # requires write permission rm -rf /usr/local/hcloud/ # requires write permission rm -rf ~/.hcloud/

text

### Clean Cache

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

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

Clean Cache

bash
rm -rf ~/.hcloud/cache/

Best Practices

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

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

Clean Cache

bash
rm -rf ~/.hcloud/cache/

Best Practices

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

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

Content

Scanner excerpt · references/iam-policies.md (reported line 75)May include surrounding context.

export HW_REGION_NAME=cn-south-1

text

### Method 2: .env File (Local Development Only)

Create a `.env` file in the skill root directory (gitignored, not committed):

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

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

Content

Scanner excerpt · scripts/config.py (reported line 21)May include surrounding context.

python
skillPath = os.path.dirname(scriptPath)
projectPath = os.path.abspath(os.path.join(skillPath, '..', '..', '..'))

# 从 skill 根目录加载 .env(仅本地开发便利,.env 已加入 .gitignore 不提交)
load_dotenv(os.path.join(skillPath, ".env"))

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

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

Content

Scanner excerpt · scripts/config.py (reported line 22)May include surrounding context.

python
projectPath = os.path.abspath(os.path.join(skillPath, '..', '..', '..'))

# 从 skill 根目录加载 .env(仅本地开发便利,.env 已加入 .gitignore 不提交)
load_dotenv(os.path.join(skillPath, ".env"))


def fetch_project_id(region: str) -> str:

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

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

Content

Scanner excerpt · scripts/config.py (reported line 78)May include surrounding context.

python
if not ak or not sk:
        raise ValueError(
            "HW_ACCESS_KEY and HW_SECRET_KEY must be set via environment variables. "
            "Set them with: export HW_ACCESS_KEY=xxx HW_SECRET_KEY=xxx (or optionally in .env which is gitignored)."
        )

    return ak, sk, region, project_id, security_token

Skill declares no tool scope ('permissions' or 'allowed-tools') but code capabilities were detected: env, file_read, file_write, 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.

Docker image referenced without tag or digest: 'docker run --rm'.

Medium
Category
MCP Rug Pull
Confidence
75% confidence
Finding

Docker image references without a specific tag (:latest is implicit) or digest (@sha256:...) can be silently replaced by a malicious image.

Content

No source excerpt is available for this finding.

Uninstall instructions delete the user's KooCLI configuration without warning about loss of saved profiles and credentials.

Medium
Category
Output Handling
Confidence
94% confidence
Finding

The uninstall procedure unconditionally removes ~/.hcloud/, including saved profiles and credentials, without warning or a preservation option. This can disrupt other workflows using the same CLI, not just this alarm-analysis skill; it is a destructive maintenance hazard rather than evidence of malicious deletion.

Content

No source excerpt is available for this finding.

The credential check prints the cloud access key without warning about exposing it in terminal output or logs.

Medium
Category
Output Handling
Confidence
96% confidence
Finding

The suggested check echoes HW_ACCESS_KEY into terminal output, potentially exposing the credential identifier in agent transcripts, CI logs, or shared support records. An access key identifier alone normally cannot authenticate without the secret key, which limits impact, but printing it is unnecessary for checking configuration.

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

python
cmd.append(f"--{key}={value}")

    try:
        result = subprocess.run(cmd, capture_output=True, text=True, timeout=120)
        if result.returncode != 0:
            logger.error("hcloud %s %s failed (rc=%d): %s",
                         service, operation, result.returncode, result.stderr.strip()[:500])

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

python
# 检查凭据是否已配置
    try:
        result = subprocess.run(["hcloud", "configure", "list"],
                                capture_output=True, text=True, timeout=10)
        if result.returncode != 0 or not result.stdout.strip():
            print("[WARN] hcloud credentials not configured")

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

python
project_id 字符串,失败时返回空字符串。
    """
    try:
        result = subprocess.run(
            ["hcloud", "IAM", "KeystoneListProjects", f"--cli-region={region}"],
            capture_output=True,
            text=True,

Tainted flow: 'region' from os.getenv (line 107, 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/config.py (reported line 39)May include surrounding context.

python
project_id 字符串,失败时返回空字符串。
    """
    try:
        result = subprocess.run(
            ["hcloud", "IAM", "KeystoneListProjects", f"--cli-region={region}"],
            capture_output=True,
            text=True,

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

python
def fetch_resource_summary(region=DEFAULT_REGION):
    """调用 hcloud RMS CollectAllResourcesSummary,返回 {provider: set(types)}。"""
    cmd = ["hcloud", "RMS", "CollectAllResourcesSummary", f"--cli-region={region}"]
    result = subprocess.run(cmd, capture_output=True, text=True, timeout=60)
    if result.returncode != 0:
        logger.error(f"CollectAllResourcesSummary 失败: {result.stderr.strip()}")
        raise RuntimeError(f"CollectAllResourcesSummary failed: {result.stderr.strip()}")