Back to skill

Security audit

huawei-cloud-rds-smart-service

Security checks for vulnerabilities and agentic risk

Overview

This Huawei Cloud RDS admin skill is coherent in purpose, but it needs review because it can perform high-impact database operations and its confirmation and installation safeguards are incomplete.

Install only after reviewing the RDS operations you intend to allow. Prefer read-only IAM permissions first, avoid running the curl-to-bash installer without independent verification, keep AK/SK credentials out of shell history and shared logs, and require explicit human approval for any restart, failover, resize, restore, delete, security, SQL-limit, or parameter-change operation. The confirmation wrapper should be fixed to fail closed before use in production.

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/rds_cli.sh:22
Finding

Destructive RDS Operations Can Bypass the Confirmation Gate

Content
View full analysis

Vulnerability Details

File Location: scripts/rds_cli.sh, lines 22–34 and 60–61
Vulnerability Type: Incomplete mutation classification causing confirmation bypass
Risk Level: Medium

Vulnerable Code

bash
# Mutating operations — require explicit user confirmation (ISSUE-013)
MUTATING_OPS="
  StartInstanceRestartAction StartInstanceEnlargeVolumeAction StartInstanceReduceVolumeAction
  StartResizeFlavorAction StartFailover SetReadOnlySwitch UpdateInstanceAlias SetAutoEnlargePolicy
  CreateSqlLimit CreateIntelligentKillSession ValidateInstanceConnection
  SetBackupPolicy ChangeBackupConfig CreateManualBackup DeleteManualBackup BatchDeleteManualBackup
  CreateRestoreInstance RestoreToExistingInstance RestoreTables
  SetSecurityGroup SwitchSsl SetAuditlogPolicy CreateConfiguration UpdateConfiguration
  ApplyConfigurationAsync UpdateInstanceConfiguration BatchDeleteInstance
"
if echo "$MUTATING_OPS" | grep -qw "$OPERATION"; then
  echo "⚠️  变更操作: $OPERATION"
  read -r -p "  确认执行? (yes/no): " _ans
  if [[ "$_ans" != "yes" ]]; then
    echo "已取消。"
    exit 0
  fi
fi

The operation is subsequently passed directly to the authenticated cloud CLI:

bash
if command -v hcloud &>/dev/null; then
  cli_out="$(hcloud RDS "$OPERATION" "$@" 2>&1)"

The project documents an omitted destructive operation in references/api-paths.md, line 55:

markdown
| Delete Configuration | DELETE | `/v3/{project_id}/configurations/{config_id}` |

Technical Analysis

The confirmation mechanism uses a finite list of operation names. It prompts only when the caller-supplied OPERATION exactly matches an entry in MUTATING_OPS. Operations absent from that list proceed without confirmation and are passed to hcloud RDS under the user's authenticated Huawei Cloud identity.

DeleteConfiguration is a concrete reachable example: it is documented by the project as a configuration-deletion API operation but is not included in MUTATING_OPS. This contradict ...[truncated 1834 chars]

Remediation
View remediation

Remediation Suggestions

  1. Replace the mutation denylist with a fail-closed policy:

    • Maintain an explicit allowlist of verified read-only operations.
    • Require confirmation for every operation not on that allowlist.
    • Reject unknown operations rather than passing them to hcloud.
  2. Add DeleteConfiguration to the confirmed mutation set as an immediate fix, but do not rely on this alone because future API operations could recreate the bypass.

  3. Use authoritative operation metadata where available to classify HTTP methods and side effects. Treat POST, PUT, PATCH, and DELETE operations as mutating unless explicitly proven otherwise.

  4. Validate operation names and required parameters before invoking the CLI.

  5. Add regression tests covering:

    • DeleteConfiguration;
    • every documented create, update, set, switch, start, stop, restore, apply, kill, and delete operation;
    • unknown operation names;
    • refusal or EOF at the confirmation prompt;
    • confirmation behavior across CLI and fallback paths.
  6. Keep the implementation synchronized with the confirmation requirements in SKILL.md, references/api-paths.md, and references/acceptance-criteria.md.

Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (22)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The description promises a comprehensive RDS intelligent service spanning six major capability domains across multiple database engines. The actual code chunk only performs a minimal subset of one domain: a basic inspection that lists instances and checks status plus backup policy presence. This is a materially narrower primary purpose than the declared description. There is no evidence here of the advertised SQL optimization, troubleshooting, O&M actions, parameter tuning, or restore guidance. While the code is consistent with a small part of 'database巡检'/'health inspection' and uses SDK access compatible with the broader theme, the gap between the declared broad service and the actual implemented behavior in this chunk is substantial enough to count as a mismatch.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The supplied code does not match the broad declared description as a standalone skill behavior. It is a small SDK fallback utility for Huawei Cloud RDS, limited to four non-mutating API calls: ListInstances, ListFlavors, ShowBackupPolicy, and ListBackups. It does not implement the six declared capability domains such as SQL optimization, diagnostics, O&M actions, parameter tuning, backup creation/restoration, or Q&A logic. The code is consistent with only a small subset of the declared backup/instance information retrieval functionality and with the stated SDK fallback architecture, but the overall declared purpose significantly overstates what this code chunk actually does.

Content

No source excerpt is available for this finding.

External Script Fetching

High
Category
Supply Chain
Confidence
99% confidence
Finding

This command downloads a shell script from an external URL and executes it immediately, creating a direct arbitrary-code-execution path if the remote content is tampered with. Because the file is installation guidance, users are likely to trust and copy-paste it without scrutiny, increasing exploitability.

Content

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

Linux (x86_64)

bash
curl -sSL https://obs.cn-north-4.myhuaweicloud.com/hcloud_client/hcloud_install.sh | bash

Linux (ARM64)

Chaining Abuse

High
Category
Tool Misuse
Confidence
97% confidence
Finding

The | bash pipeline chains a network fetch directly into a shell, eliminating any review boundary and making command execution automatic. This is particularly risky in a cloud administration skill because users may run it from privileged environments containing credentials and access to production infrastructure.

Content

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

Linux (x86_64)

bash
curl -sSL https://obs.cn-north-4.myhuaweicloud.com/hcloud_client/hcloud_install.sh | bash

Linux (ARM64)

External Script Fetching

High
Category
Supply Chain
Confidence
99% confidence
Finding

The ARM64 installation example repeats the same unsafe remote-script execution pattern, exposing users to arbitrary code execution if the hosted installer is malicious or replaced. Repetition across platforms increases the chance that many users will adopt the insecure pattern as standard practice.

Content

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

Linux (ARM64)

bash
curl -sSL https://obs.cn-north-4.myhuaweicloud.com/hcloud_client/hcloud_install.sh | bash

macOS

Chaining Abuse

High
Category
Tool Misuse
Confidence
97% confidence
Finding

The chained execution pattern on the ARM64 path creates the same automatic arbitrary command execution risk, with no opportunity for users to verify the installer before it runs. The risk is amplified by presenting it as the canonical install method in operational documentation.

Content

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

Linux (ARM64)

bash
curl -sSL https://obs.cn-north-4.myhuaweicloud.com/hcloud_client/hcloud_install.sh | bash

macOS

External Script Fetching

High
Category
Supply Chain
Confidence
99% confidence
Finding

The macOS instructions also fetch and execute a remote shell script in one step, which is dangerous because any compromise of the source or delivery path becomes immediate code execution on the client machine. On developer/admin workstations, that can lead to credential theft, persistence, or lateral movement into cloud environments.

Content

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

macOS

bash
curl -sSL https://obs.cn-north-4.myhuaweicloud.com/hcloud_client/hcloud_install.sh | bash

Windows

Chaining Abuse

High
Category
Tool Misuse
Confidence
97% confidence
Finding

The macOS example includes the same shell-chaining construct, allowing any malicious or altered remote script to execute immediately on the endpoint. Since this skill is for database operations, compromise of the operator workstation can expose cloud credentials and lead to destructive RDS actions.

Content

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

macOS

bash
curl -sSL https://obs.cn-north-4.myhuaweicloud.com/hcloud_client/hcloud_install.sh | bash

Windows

Missing User Warnings

High
Category
Not specified by scanner
Confidence
95% confidence
Finding

The failover recommendation is especially sensitive because failover can change primary/standby roles, interrupt connections, and create application-side consistency or routing issues if performed incorrectly. Presenting it as a remediation option without a strong disruption warning increases the chance of an operator triggering a high-impact control-plane action during troubleshooting.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

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.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The trigger list is unusually broad and includes generic phrases like database troubleshooting, DBA, SQL performance, and backup terms that can match ordinary conversation. In a skill that documents many mutating cloud database operations, overbroad activation increases the chance of accidental invocation, context confusion, and unintended access to sensitive operational data or dangerous workflows.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

This markdown file includes a locale/region constraint stating that the default region is cn-north-4. Under the policy, forcing a specific locale or region without explicit user choice or documented justification can be a natural-language policy violation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
98% confidence
Finding

The guide instructs users to fetch and immediately execute a remote shell script with curl ... | bash, which runs unreviewed code directly from the network. If the hosting bucket, transport path, or script contents are ever compromised, users could execute arbitrary code on their systems with the privileges of the invoking user.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

The authentication section shows users multiple ways to place long-lived access keys and secret keys directly into shell environment variables and CLI commands without any warning about credential sensitivity, shell history leakage, process exposure, or secure storage practices. In an ops-focused skill handling cloud databases, these secrets could grant broad control over RDS resources if copied, logged, or reused insecurely.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The diagram documents destructive or availability-impacting RDS actions such as restart, failover, volume expansion, configuration updates, and restore flows, but it does not communicate operational risk, expected side effects, or rollback considerations. In a skill that can guide or trigger real cloud database operations, this omission can lead users to approve actions without understanding downtime, replication impact, configuration propagation, or possible data-state changes.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The troubleshooting guide includes a connection validation command that takes a database username and password but does not warn about shell history, terminal logging, screenshots, or credential leakage through copied commands. In an ops-oriented skill, users may paste real credentials directly into CLI arguments, which can expose secrets on shared hosts or in audit/logging systems.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
84% confidence
Finding

The guide lists disruptive actions such as killing sessions, resizing instance flavor, and changing parameters without clearly warning about service interruption, connection drops, restart requirements, or workload impact. In an operational runbook, omission of these cautions can lead users to execute production-affecting actions prematurely during incident response.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
86% confidence
Finding

The decision tree references restore actions without warning that restoring to a new or existing instance can alter recovery workflows, create divergent data states, or risk operator confusion about which instance is authoritative. In a database operations skill, this omission is dangerous because restore-related actions are high-consequence and often time-sensitive.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The instructions recommend applying SQL concurrency limits but omit warnings that this can suppress or queue application queries, reduce throughput, and create user-visible outages for critical transactions. Because this skill is positioned as an intelligent RDS operations assistant, users may trust it for production actions, which makes omission of impact warnings more dangerous than in a purely educational reference.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The guide includes a write-capable command (CreateSqlLimit) inside an optimization workflow without any embedded requirement to obtain explicit user confirmation at the point of use. In this skill's context, that is dangerous because SQL concurrency limits can directly alter live database behavior, throttle legitimate workload, and cause unexpected latency or availability degradation if an agent follows the document as an operational runbook.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The script presents confirmation and cancellation messages only in Chinese, which imposes a specific language on users. The file does not offer a language choice or explain a justified region-specific locale requirement, so this is a natural-language policy violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
72% confidence
Finding

The documentation sets a default region of cn-north-4, which is a locale/region-specific operational default. While users can override it, the skill text does not clearly frame this as an opt-in choice or narrowly justify why this specific region should be assumed for all users.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.