Back to skill

Security audit

huawei-cloud-devkit-webui-create

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly coherent with its DevKit installation purpose, but it has several high-impact safety flaws around cloud key deletion, SSH trust, public exposure, and remote installer execution.

Review carefully before installing. Use a least-privilege Huawei Cloud identity, restrict SSH/WebUI ingress to a trusted CIDR, do not run cleanup-kms unless the key is proven to be newly created for this workflow, verify SSH host keys before sending the root password, and only install DevKit packages from a trusted pinned source.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • 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
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/create_ecs_and_setup_devkit.py:199
Finding

Automatic SSH Host-Key Acceptance Enables Credential Interception

Content
View full analysis

Vulnerability Details

File Location: scripts/create_ecs_and_setup_devkit.py, lines 199–202 and 440–447
Vulnerability Type: Missing SSH server identity verification
Risk Level: High

Vulnerable Code

python
def ssh_install_devkit(eip, password, devkit_url, install_path="", install_port="", wait=False):
    import paramiko
    ssh = paramiko.SSHClient()
    ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
    try:
        ssh.connect(eip, port=22, username="root", password=password, timeout=30)

The status connection repeats the same insecure trust policy:

python
ssh = paramiko.SSHClient()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
try:
    ssh.connect(eip, port=22, username="root", password=password, timeout=15)
except Exception as e:
    print(f"ERROR: SSH connection to {eip} failed: {e}", file=sys.stderr)
    del password
    sys.exit(1)

Technical Analysis

paramiko.AutoAddPolicy() automatically accepts any SSH host key presented by an unknown endpoint. The code does not load a trusted host key, compare a fingerprint obtained through Huawei Cloud, or ask the user to verify the server identity.

Password authentication occurs immediately after accepting the unverified key. The credential is the generated ECS root password recovered from KMS, so accepting a hostile SSH endpoint exposes a high-privilege secret rather than merely establishing an unauthenticated monitoring connection.

This crosses the network trust boundary between the local deployment agent and the intended ECS. An endpoint that is reachable at the supplied EIP is implicitly treated as the newly created ECS without cryptographic identity verification.

Attack Path

  1. The user or agent invokes the install or status subcommand with the intended ECS EIP.
  2. A network-positioned attacker redirects, intercepts, or otherwise causes the SSH connection to reach an attacke ...[truncated 1159 chars]
Remediation
View remediation

Remediation Suggestions

  1. Replace AutoAddPolicy with paramiko.RejectPolicy() for both installation and status connections.
  2. Obtain the new ECS host-key fingerprint through a trusted channel, such as authenticated cloud-init output, the cloud console, or a provider API.
  3. Create a dedicated known-hosts file containing only the expected ECS address and host key, then load it with SSHClient.load_host_keys().
  4. Compare the server key or fingerprint before sending the password and abort on missing or mismatched identity data.
  5. Do not rely on a previously cached key unless its provenance and association with the current ECS instance are verified.
  6. Prefer short-lived SSH certificates or a freshly generated deployment key over reusable root-password authentication where supported.
  7. Apply the same host-identity enforcement to every connection path, including ssh_install_devkit() and _ssh_connect_with_kms().

T05 · Unauthorized Access and Privilege Escalation

Error
Location
scripts/create_ecs_and_setup_devkit.py:144
Finding

Arbitrary Existing KMS Key Can Be Reused and Later Destroyed

Content
View full analysis

Vulnerability Details

File Location: scripts/create_ecs_and_setup_devkit.py, lines 144–166, 186–197, and 503–530
Vulnerability Type: Missing resource ownership validation before destructive KMS operations
Risk Level: High

Vulnerable Code

If creation of a dedicated DevKit key fails, the workflow silently selects the first existing KMS key:

python
def kms_create_key(kms_client):
    key_alias = f"devkit-ecs-pwd-{uuid.uuid4().hex[:8]}"
    try:
        body = CreateKeyRequestBody(
            key_alias=key_alias,
            key_spec="AES_256",
            key_usage="ENCRYPT_DECRYPT",
        )
        req = CreateKeyRequest(body=body)
        resp = kms_client.create_key(req)
        if resp.key_info and resp.key_info.key_id:
            return resp.key_info.key_id
    except Exception as e:
        print(f"  WARNING: KMS key creation failed ({e}), trying existing keys...", file=sys.stderr)
    try:
        list_body = ListKeysRequestBody(limit=10)
        list_req = ListKeysRequest(body=list_body)
        list_resp = kms_client.list_keys(list_req)
        keys = list_resp.keys if hasattr(list_resp, "keys") else []
        if keys:
            return keys[0].key_id
    except Exception:
        pass
    return None

The selected key can later be disabled and scheduled for deletion:

python
def kms_disable_key(kms_client, key_id):
    from huaweicloudsdkkms.v2 import DisableKeyRequest, OperateKeyRequestBody
    body = OperateKeyRequestBody(key_id=key_id)
    req = DisableKeyRequest(body=body)
    kms_client.disable_key(req)


def kms_schedule_deletion(kms_client, key_id, delay_days=7):
    body = ScheduleKeyDeletionRequestBody(
        key_id=key_id,
        pending_days=str(delay_days),
    )
    req = DeleteKeyRequest(body=body)
    kms_client.delete_key(req)
python
def phase_cleanup_kms(args):
    credentials = get_credentia
...[truncated 3343 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove the fallback that selects an existing KMS key. If dedicated key creation fails, stop the workflow and report the error.
  2. Tag the newly created key with a unique workflow identifier and persist its key ID together with the ECS server ID and expected alias.
  3. Before disabling or deleting a key, retrieve its metadata and require an exact match for the expected alias, tags, region, account, and workflow identifier.
  4. Refuse cleanup for keys that predate the current workflow or lack explicit DevKit ownership metadata.
  5. Require a cleanup authorization token generated during key creation and bound to the key ID and ECS ID.
  6. Add an explicit confirmation that displays non-secret key metadata before the destructive operation.
  7. Remove or tightly restrict --force; it must never bypass ownership verification.
  8. Apply least-privilege IAM controls so the deployment identity can disable or delete only keys carrying the dedicated DevKit resource tag.
  9. Add tests covering key-creation failure and verify that no existing key is selected, disabled, or scheduled for deletion.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Rogue AgentSelf-Modification, Session Persistence
Findings (40)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

This is another instance of the same core problem: the skill claims to provision cloud infrastructure, manage passwords via KMS, use SSH/paramiko, and install DevKit, but the observed behavior instead appears limited to local verification/status actions. Such misrepresentation can cause operators to approve execution they would otherwise reject and can conceal unauthorized local activity.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

This is another instance of the same core problem: the skill claims to provision cloud infrastructure, manage passwords via KMS, use SSH/paramiko, and install DevKit, but the observed behavior instead appears limited to local verification/status actions. Such misrepresentation can cause operators to approve execution they would otherwise reject and can conceal unauthorized local activity.

Content

No source excerpt is available for this finding.

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

The use of curl -k disables TLS certificate validation, which allows man-in-the-middle attacks or acceptance of spoofed endpoints during WebUI verification. In this skill context, the command is presented as an acceptance check for a newly created cloud-hosted service, so operators may normalize insecure HTTPS validation and miss certificate or DNS interception issues.

Content

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

WebUI Access

bash
curl -k https://<ECS_IP>:8086 -I
# Expected: HTTP/1.1 302 or 200

YARA rule 'backdoor_persistence': Backdoor persistence with malicious payloads (shell commands, SSH key injection, hidden root users) [malware]

High
Category
YARA Match
Confidence
75% confidence
Finding

YARA rule matched a known malware signature (reverse shell, backdoor, ransomware, C2 framework, or info stealer).

Content

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

I) Installation

Auto Install (Recommended)

bash
bash skills/hcloud-cli/scripts/install.sh

Features:

  • Auto-detect OS and CPU architecture (x86_64/aarch64)
  • No sudo required, installs to ~/.local/bin/
  • Downloads latest version from Huawei Cloud official OBS

Configure PATH after installation:

bash
export PATH="$PATH:$HOME/.local/bin"

# Permanent addition to ~/.bashrc
echo 'export PATH="$PATH:$HOME/.local/bin"' >> ~/.bashrc
source ~/.bashrc

macOS

bash
# Install via Homebrew
brew install hcloudcli

# Or download directly
curl -O https://obs-community-tool.obs.cn-north-1.myhuaweicloud.com/hcloudcli/latest/hcloudcli-macos-amd64.tar.gz
tar -xzf hcloudcli-macos-amd64.tar.gz
chmod +x hcloud
sudo mv hcloud /usr/local/bin/

Linux (x86_64)

bash
curl -O https://obs-community-tool.obs.cn-north-1.myhuaweicloud.com/hcloudcli/latest/hcloudcli-linux-amd64.tar.gz
tar -xzf hcloudcli-linux-amd64.tar.gz
chmod +x hcloud
sudo mv hcloud /usr/local/bin/
`

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
85% confidence
Finding

The abort/status examples read a PID from /tmp/devkit_install.pid and pass it directly to kill, while also recommending rm -f cleanup. Because /tmp is world-writable, another local user or process could replace or tamper with the PID file, causing the operator to signal an unintended process. In the skill context this is more plausible because the workflow explicitly relies on predictable temporary-file paths and manual shell commands.

Content

Scanner excerpt · references/devkit-installation-workflow.md (reported line 189)May include surrounding context.

md
> - **Timeout**: 600s watchdog prevents indefinite hang
> - **Monitor**: `tail -f /tmp/devkit_install.log` — real-time log
> - **Status**: `kill -0 $(cat /tmp/devkit_install.pid) 2>/dev/null && echo RUNNING || echo STOPPED`
> - **Abort**: `kill $(cat /tmp/devkit_install.pid)` then `rm -f /tmp/devkit_install.pid`

> **⚠️ Critical: expect matching order**
>

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
91% confidence
Finding

The use of curl -k disables TLS certificate validation, which trains users and scripts to ignore HTTPS trust checks. Even though this example targets https://localhost:8086 for post-install verification, the pattern can mask certificate misconfiguration and, if copied to non-local contexts or used through port-forwarding/proxies, can enable man-in-the-middle or endpoint spoofing to go undetected.

Content

Scanner excerpt · references/verification-method.md (reported line 131)May include surrounding context.

7. WebUI Access Verification

bash
# Local curl verification of HTTPS port
curl -k https://localhost:8086 -I
# Expected: HTTP/1.1 302 or 200

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
94% confidence
Finding

This verification script uses curl -k in automation, which suppresses TLS validation and can cause insecure behavior to be normalized in operational scripts. In a cloud-install skill involving remote service deployment, this is more dangerous because users may reuse the script pattern for external endpoints, causing invalid or attacker-controlled certificates to be silently accepted.

Content

Scanner excerpt · references/verification-method.md (reported line 191)May include surrounding context.

md
echo ""
echo "[5] WebUI Access"
http_code=$(curl -k -s -o /dev/null -w "%{http_code}" https://localhost:8086 2>/dev/null || echo "000")
check "WebUI (HTTP $http_code)" "$([ "$http_code" == "200" ] || [ "$http_code" == "302" ] && echo ok || echo fail)"

echo ""

Missing User Warnings

High
Category
Not specified by scanner
Confidence
97% confidence
Finding

The script downloads an archive from a user-controlled URL, extracts it, and then executes install.sh from that archive. Because the signer identity is not strongly authenticated and the URL is fully attacker-influenced, this creates a direct remote code execution path on the target host.

Content

No source excerpt is available for this finding.

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
70% 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 · scripts/verify_devkit.sh (reported line 59)May include surrounding context.

sh
webui_ok=fail
for target in localhost "${INTERNAL_IP}"; do
    [[ -z "$target" ]] && continue
    http_code=$(curl -k -s -o /dev/null -w "%{http_code}" "https://${target}:8086" 2>/dev/null || echo "000")
    if [[ "$http_code" == "200" ]] || [[ "$http_code" == "302" ]]; then
        webui_ok=ok
        echo "  ✅ WebUI via ${target} (HTTP $http_code)"

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
89% confidence
Finding

The skill describes and relies on powerful capabilities including reading environment variables, reading/writing local files, and executing shell commands, but it does not declare any explicit tool scope or allowed-tools boundary. That increases the risk of overbroad execution and unintended access to secrets or local system resources, especially because the workflow handles cloud credentials and infrastructure changes.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The trigger list includes very broad terms like 'DevKit', which can cause the skill to activate on unrelated requests. Overbroad activation is risky here because the skill is capable of infrastructure operations, package installation, network exposure, and credential-adjacent handling, so accidental invocation can lead to unintended changes.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The skill later instructs opening ports 22 and 8086 and even references 0.0.0.0/0, but the high-level description does not clearly warn users that it may expose services to the public internet. In a cloud-provisioning context, omission of that warning can lead to unintentional attack-surface expansion and internet-reachable administrative interfaces.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
78% confidence
Finding

The use of 'nohup ... &' and background polling introduces session persistence beyond the immediate interaction, meaning processes continue running after the initiating session ends. In this context that can leave long-running installers, logs, or partially configured services active without continuous operator awareness, increasing the chance of unmanaged exposure or incomplete cleanup.

Content

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

md
1. **2a. KMS decrypt** — Python SDK reads cipher text from file and decrypts password from `kms_key_id`
2. **2b. paramiko SSH connect** — `SSHClient.connect(password=decrypted)` — password in Python memory only
3. **2c. Upload scripts** — SFTP upload `install_devkit_webui.sh`, `auto_install_devkit.expect`, `verify_devkit.sh` to `/tmp/`
4. **2d. Start DevKit install** — Execute `nohup bash /tmp/install_devkit_webui.sh <url> &` on remote ECS (background)
5. **2e. Poll install progress** — Launch `poll_devkit_status.py` in background (output to log file), then use `read` tool with incrementing offset to read the log every 10-20s and report to user (doom-loop safe, continuous visibility; see Polling Progress below)
6. **2f. Verify installation** — Run `verify_devkit.sh` and check results
7. **2g. Report result** — If verification passed, prompt agent to proceed to Task 4 (cleanup-kms); if failed, KMS key is preserved for retry

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
70% confidence
Finding

Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Content

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

md
**Features:**
- Auto-detect OS and CPU architecture (x86_64/aarch64)
- No sudo required, installs to `~/.local/bin/`
- Downloads latest version from Huawei Cloud official OBS

**Configure PATH after installation:**

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

This instruction downloads a binary archive and then uses sudo to place the executable into /usr/local/bin, which elevates the trust boundary from user space to a system-wide executable path. If the downloaded file is tampered with or insufficiently verified, this could lead to privileged installation of a malicious binary affecting all users on the host.

Content

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

curl -O https://obs-community-tool.obs.cn-north-1.myhuaweicloud.com/hcloudcli/latest/hcloudcli-macos-amd64.tar.gz tar -xzf hcloudcli-macos-amd64.tar.gz chmod +x hcloud sudo mv hcloud /usr/local/bin/

text

### Linux (x86_64)

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

This Linux installation flow also downloads an executable archive and then uses sudo to move the binary into /usr/local/bin. A compromised download source, MITM in a misconfigured environment, or user error could result in a malicious system-wide CLI being installed with elevated trust.

Content

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

curl -O https://obs-community-tool.obs.cn-north-1.myhuaweicloud.com/hcloudcli/latest/hcloudcli-linux-amd64.tar.gz tar -xzf hcloudcli-linux-amd64.tar.gz chmod +x hcloud sudo mv hcloud /usr/local/bin/

text

### Linux (ARM64)

Sudo/Root Execution

Medium
Category
Privilege Escalation
Confidence
80% confidence
Finding

The ARM64 variant has the same risk pattern: a downloaded executable is installed system-wide using sudo without an explicit verification step in that section. In the context of a cloud administration skill, a compromised CLI could expose credentials or perform unauthorized infrastructure actions.

Content

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

curl -O https://obs-community-tool.obs.cn-north-1.myhuaweicloud.com/hcloudcli/latest/hcloudcli-linux-arm64.tar.gz tar -xzf hcloudcli-linux-arm64.tar.gz chmod +x hcloud sudo mv hcloud /usr/local/bin/

text

### One-Click Install (Download-Verify-Execute)

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
80% 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/cli-installation-guide.md (reported line 119)May include surrounding context.

md
> **Security warning**: Method 3 will expose AK/SK in command history; only use in secure environments.

> **Prohibited actions:**
> - Do not ask the user to provide AK/SK directly in the conversation
> - Do not extract AK/SK from hcloud config files (credentials are encrypted)
> - Do not use `hcloud configure set` with plaintext AK/SK values in conversation

Ssd 3

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

Instructing users to obtain the default admin password from installation logs encourages storage of live credentials in plaintext files, which are commonly readable by admins, support tooling, backups, or log collectors. In this skill's context, the product is exposed over a networked WebUI, so log-disclosed credentials could directly enable unauthorized administrative access.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
65% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

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

Linux:

bash
nohup python3 scripts/poll_devkit_status.py \
  --region $R --eip $EIP --kms-key-id $KID --kms-cipher-text-file $CT_FILE \
  --interval 30 --max-polls 30 \
  --log-file /tmp/devkit_poll_progress.log &

Session Persistence

Medium
Category
Rogue Agent
Confidence
65% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

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

Linux:

bash
nohup python3 scripts/poll_devkit_status.py \
  --region $R --eip $EIP --kms-key-id $KID --kms-cipher-text-file $CT_FILE \
  --interval 30 --max-polls 30 \
  --log-file /tmp/devkit_poll_progress.log &

Session Persistence

Medium
Category
Rogue Agent
Confidence
65% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · references/devkit-installation-workflow.md (reported line 165)May include surrounding context.

Linux:

bash
nohup python3 scripts/poll_devkit_status.py \
  --region $R --eip $EIP --kms-key-id $KID --kms-cipher-text-file $CT_FILE \
  --interval 30 --max-polls 30 \
  --log-file /tmp/devkit_poll_progress.log &

Session Persistence

Medium
Category
Rogue Agent
Confidence
65% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · references/polling-progress-guide.md (reported line 15)May include surrounding context.

Linux:

bash
nohup python3 scripts/poll_devkit_status.py \
  --region $R --eip $EIP --kms-key-id $KID --kms-cipher-text-file $CT_FILE \
  --interval 30 --max-polls 30 \
  --log-file /tmp/devkit_poll_progress.log &

Session Persistence

Medium
Category
Rogue Agent
Confidence
65% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · scripts/create_ecs_and_setup_devkit.py (reported line 223)May include surrounding context.

python
**Linux:**
```bash
nohup python3 scripts/poll_devkit_status.py \
  --region $R --eip $EIP --kms-key-id $KID --kms-cipher-text-file $CT_FILE \
  --interval 30 --max-polls 30 \
  --log-file /tmp/devkit_poll_progress.log &

Session Persistence

Medium
Category
Rogue Agent
Confidence
65% confidence
Finding

Skill establishes unauthorized persistence across sessions via cron jobs, startup scripts, or state files. Session persistence allows an attacker to maintain access beyond the current interaction.

Content

Scanner excerpt · scripts/create_ecs_and_setup_devkit.py (reported line 256)May include surrounding context.

python
**Linux:**
```bash
nohup python3 scripts/poll_devkit_status.py \
  --region $R --eip $EIP --kms-key-id $KID --kms-cipher-text-file $CT_FILE \
  --interval 30 --max-polls 30 \
  --log-file /tmp/devkit_poll_progress.log &