Back to skill

Security audit

huawei-cloud-rds-detail

Security checks for vulnerabilities and agentic risk

Overview

The skill is a disclosed read-only Huawei Cloud RDS query tool, but its handling of credentials and cloud API connections creates review-worthy security risk.

Review this skill before installing. Use only a least-privileged Huawei Cloud IAM user, be aware it returns infrastructure details such as instance IDs, IPs, VPCs, subnets, security groups, and metrics, and fix the TLS verification, region validation, explicit credential-variable selection, and dependency pinning issues before using it with sensitive accounts.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (4)

T09 · Insecure Skill Coding Practices

Error
Location
huawei_cloud_rds_detail.py:70
Finding

TLS Certificate Verification Is Disabled for All Cloud API Clients

Content
View full analysis

Vulnerability Details

File Location: huawei_cloud_rds_detail.py:67-75, huawei_cloud_rds_detail.py:103-111, and huawei_cloud_rds_detail.py:121-129
Vulnerability Type: Improper certificate validation
Risk Level: High

Vulnerable Code

python
credentials = BasicCredentials(ak=self.ak, sk=self.sk)
config = HttpConfig.get_default_config()
config.timeout = self.timeout
config.ignore_ssl_verification = True

client = IamClient.new_builder() \
    .with_http_config(config) \
    .with_credentials(credentials) \
    .with_endpoint(f'https://iam.{self.region}.myhuaweicloud.com') \
    .build()
python
credentials = BasicCredentials(ak=self.ak, sk=self.sk, project_id=project_id)
config = HttpConfig.get_default_config()
config.timeout = self.timeout
config.ignore_ssl_verification = True

return RdsClient.new_builder() \
    .with_http_config(config) \
    .with_credentials(credentials) \
    .with_endpoint(f'https://rds.{self.region}.myhuaweicloud.com') \
    .build()
python
credentials = BasicCredentials(ak=self.ak, sk=self.sk, project_id=project_id)
config = HttpConfig.get_default_config()
config.timeout = self.timeout
config.ignore_ssl_verification = True

return CesClient.new_builder() \
    .with_http_config(config) \
    .with_credentials(credentials) \
    .with_endpoint(f'https://ces.{self.region}.myhuaweicloud.com') \
    .build()

Technical Analysis

The implementation explicitly disables TLS certificate verification for IAM, RDS, and CES connections. HTTPS encryption without certificate verification does not authenticate the remote server. A server presenting an arbitrary or self-signed certificate can therefore be accepted as if it were the intended Huawei Cloud service.

Requests are authenticated using Huawei Cloud credentials. Although the secret key itself is not normally transmitted, a man-in-the-middle server can observe signed ...[truncated 1679 chars]

Remediation
View remediation

Remediation Suggestions

  • Remove every config.ignore_ssl_verification = True assignment and retain the SDK's default certificate verification.
  • If a private trust infrastructure is required, configure an explicit trusted CA bundle rather than disabling verification globally.
  • Do not expose a general-purpose insecure TLS option in production.
  • Add tests that verify connections fail for expired, self-signed, hostname-mismatched, and otherwise untrusted certificates.
  • Combine this correction with strict region validation so requests cannot be redirected to attacker-controlled hosts.

T09 · Insecure Skill Coding Practices

Error
Location
huawei_cloud_rds_detail.py:75
Finding

Unvalidated Region Input Is Embedded into Authenticated API Endpoint URLs

Content
View full analysis

Vulnerability Details

File Location: huawei_cloud_rds_detail.py:75, huawei_cloud_rds_detail.py:111, huawei_cloud_rds_detail.py:129, and huawei_cloud_rds_detail.py:314
Vulnerability Type: Endpoint injection through insufficient input validation
Risk Level: High

Vulnerable Code

python
client = IamClient.new_builder() \
    .with_http_config(config) \
    .with_credentials(credentials) \
    .with_endpoint(f'https://iam.{self.region}.myhuaweicloud.com') \
    .build()
python
return RdsClient.new_builder() \
    .with_http_config(config) \
    .with_credentials(credentials) \
    .with_endpoint(f'https://rds.{self.region}.myhuaweicloud.com') \
    .build()
python
return CesClient.new_builder() \
    .with_http_config(config) \
    .with_credentials(credentials) \
    .with_endpoint(f'https://ces.{self.region}.myhuaweicloud.com') \
    .build()
python
parser.add_argument(
    '--region',
    default='cn-north-4',
    help='华为云区域(默认: cn-north-4)'
)

Technical Analysis

The --region argument is accepted as an unrestricted string and interpolated directly into three authenticated endpoint URLs. No allowlist, syntax validation, or SDK-managed region resolution is applied.

URL metacharacters can change how the resulting endpoint is interpreted. For example, a value shaped like attacker.example# produces an endpoint resembling:

text
https://iam.attacker.example#.myhuaweicloud.com

Under standard URL parsing, the text after # is a fragment and is not part of the network destination. The effective host can therefore become iam.attacker.example rather than a Huawei Cloud host. Equivalent destinations are constructed for the RDS and CES clients.

Exploitation is made practical by the separate decision to disable TLS certificate verification. A malicious destination does not need a certificate trusted for a Huawei Cloud ...[truncated 1351 chars]

Remediation
View remediation

Remediation Suggestions

  • Resolve endpoints through official SDK region facilities instead of constructing URLs manually.
  • Prefer an explicit allowlist of supported Huawei Cloud region identifiers.
  • If dynamic validation is necessary, require a strict region syntax such as ^[a-z0-9]+(?:-[a-z0-9]+)+$.
  • Explicitly reject dots, slashes, colons, percent encoding, query delimiters, fragment delimiters, whitespace, control characters, and user-info delimiters.
  • Parse the final URL and verify that its scheme is https, it has no user information, query, or fragment, and its hostname exactly matches an approved Huawei Cloud endpoint.
  • Restore TLS certificate verification.
  • Add negative tests covering values containing #, ?, /, @, :, dots, encoded delimiters, and control characters.

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
huawei_cloud_rds_detail.py:20
Finding

Broad Environment Scanning Can Select Unintended or Mismatched Cloud Credentials

Content
View full analysis

Vulnerability Details

File Location: huawei_cloud_rds_detail.py:20-31
Vulnerability Type: Overbroad secret discovery and ambiguous credential selection
Risk Level: Medium

Vulnerable Code

python
def _load_credentials() -> Tuple[str, str]:
    """动态扫描环境变量获取 AK/SK,不依赖固定变量名。"""
    ak, sk = '', ''
    for k, v in os.environ.items():
        u = k.upper()
        if not (u.startswith('HUAWEI') or u.startswith('HW') or u.startswith('HWC')):
            continue
        if 'ACCESS_KEY' in u or u.endswith('_AK') or u == 'AK':
            ak = v or ak
        if 'SECRET_KEY' in u or u.endswith('_SK') or u == 'SK':
            sk = v or sk
    return ak, sk

Technical Analysis

The function scans the entire process environment and treats numerous loosely matched variable names as cloud credentials. It does not restrict access to the exact documented variables, and it does not ensure that an access key and secret key come from the same named credential pair.

When multiple matching variables exist, later matches overwrite earlier values. Selection therefore depends on environment contents and iteration order. One access key can be combined with an unrelated secret key, or a credential intended for another Huawei-related tool can be used without explicit operator consent.

The behavior also contradicts the documented hard constraint that credentials are obtained from HUAWEICLOUD_SDK_AK and HUAWEICLOUD_SDK_SK, or from a specifically defined project configuration. The implementation does not load the documented project configuration.

Attack Path

  1. A shared shell, CI runner, container, process supervisor, or agent environment contains more than one variable matching the broad prefixes and suffixes.
  2. Alternatively, an actor able to influence the child process environment adds a matching variable such as a prefixed _AK or _SK name.
  3. _load_credentials() scans every environme ...[truncated 1171 chars]
Remediation
View remediation

Remediation Suggestions

  • Read only exact, documented environment-variable pairs.
  • Use deterministic pair selection, for example:
    1. HUAWEICLOUD_SDK_AK with HUAWEICLOUD_SDK_SK.
    2. A separately documented legacy pair, only if both values exist.
  • Never combine an access key from one naming scheme with a secret key from another.
  • Fail closed if multiple credential sources are configured, unless the operator explicitly selects one.
  • Do not scan all environment variables for names that merely resemble credentials.
  • If .project-info loading is retained in the documentation, implement it with strict file permissions, an explicit schema, and deterministic precedence. Otherwise, remove that claim.
  • Store credentials only as long as needed and ensure exception messages and debug logging cannot serialize credential-bearing objects.

T08 · Insecure Dependencies

Warning
Location
requirements.txt:1
Finding

Cloud SDK Dependencies Are Not Reproducibly Pinned

Content
View full analysis

Vulnerability Details

File Location: requirements.txt:1-4
Vulnerability Type: Unbounded dependency version selection
Risk Level: Medium

Vulnerable Code

text
huaweicloudsdkrds>=3.1.212
huaweicloudsdkces>=3.1.212
huaweicloudsdkiam>=3.1.212
huaweicloudsdkcore>=3.1.212

Related installation instructions also use unpinned package names:

bash
pip install huaweicloudsdkrds huaweicloudsdkces huaweicloudsdkiam

Technical Analysis

Every dependency uses only a minimum version. Any later release can therefore be selected at installation time, and no integrity hashes are provided. The installed code can change after this project has been reviewed without any modification to the repository.

Python packages can execute code during installation and are imported into the same process that holds Huawei Cloud credentials. A compromised upstream release, compromised package index, or materially changed future version could consequently execute with the privileges of the CLI process.

The package names are consistent with the declared Huawei Cloud SDK and no direct evidence of typosquatting or an actively malicious package was identified. The confirmed weakness is the absence of reproducible version and integrity controls.

Attack Path

  1. A future, compromised, or unexpectedly changed package release satisfies the >=3.1.212 constraint.
  2. An operator or automated build runs pip install -r requirements.txt.
  3. The resolver selects the newer unaudited release.
  4. Installation hooks or imported package code execute in the application environment.
  5. That code can access process environment variables, including cloud credentials, and can perform network or filesystem operations with the process user's permissions.

Impact Assessment

A compromised dependency executes with the local privileges of the user running installation or the skill. At runtime, imported SDK c ...[truncated 387 chars]

Remediation
View remediation

Remediation Suggestions

  • Pin every reviewed dependency to an exact version using ==.
  • Generate and commit a lock file that includes all transitive dependencies.
  • Require package hashes during installation, such as with pip's --require-hashes.
  • Install only from an explicitly configured trusted package index over verified TLS.
  • Review and update pinned versions through a controlled dependency-update process.
  • Run vulnerability and provenance checks in CI before accepting dependency changes.
  • Build and install dependencies in a restricted environment without production cloud credentials.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (20)

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.

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.

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.

Env Variable Harvesting

High
Category
Data Exfiltration
Confidence
99% confidence
Finding

Enumerating os.environ.items() to locate credentials is a classic environment-variable harvesting pattern because it inspects the full process environment rather than reading only expected keys. In a shared agent runtime, this can capture unintended secrets and makes the skill more dangerous than its stated read-only RDS purpose suggests.

Content

Scanner excerpt · huawei_cloud_rds_detail.py (reported line 23)May include surrounding context.

python
def _load_credentials() -> Tuple[str, str]:
    """动态扫描环境变量获取 AK/SK,不依赖固定变量名。"""
    ak, sk = '', ''
    for k, v in os.environ.items():
        u = k.upper()
        if not (u.startswith('HUAWEI') or u.startswith('HW') or u.startswith('HWC')):
            continue

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
85% confidence
Finding

The skill accesses sensitive runtime capabilities via environment variables and optionally project knowledge secrets, but it does not declare an explicit tool/permission scope in the manifest. That weakens governance and reviewability because a consumer cannot easily tell that the skill depends on secret material and environment access before execution.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The trigger phrase 'RDS查询' is broad enough to match generic database or cloud lookup requests that the user may not have intended for this specific Huawei Cloud skill. Over-broad invocation can cause unintended access to cloud account metadata and monitoring data, especially because the skill uses credentials from the environment/project context.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
88% confidence
Finding

This markdown file presents all skill acceptance criteria exclusively in Chinese, with no indication that the user can choose another language or that the skill is intentionally limited to a Chinese-language audience. Under the language/locale policy, forcing a specific language without user opt-in is a natural-language policy concern.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The skill dynamically iterates over environment variables and accepts any Huawei/HW/HWC-prefixed AK/SK-style names instead of using narrowly defined credential variables. This broad credential discovery exceeds the minimal scope needed for a read-only RDS helper and can cause the skill to silently consume unintended secrets present in the runtime environment.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The script makes authenticated outbound requests to IAM, RDS, and CES APIs and returns detailed infrastructure metadata and monitoring data, but it provides no explicit user-facing notice that cloud account resources will be queried using ambient credentials. In an agent/skill context, silent external access increases the risk of unintended data exposure and surprise use of privileged account context.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The file title and all instructions are written entirely in Chinese, with no indication that other languages are supported or that Chinese is required for a region-specific purpose. Under the stated policy, forcing a specific language without user opt-in 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
78% confidence
Finding

The workflow description states that clients are initialized for region "cn-north-4", which imposes a specific locale/region by default. Although a later parameter table says the region can be overridden, the natural-language description does not clearly present this as a user choice or justify why that locale is the default.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
84% confidence
Finding

The file's natural-language content, headings, labels, and instructions are all in Chinese, which can amount to a language policy violation when no user opt-in or alternative language is offered. The provided rules say to flag skills that force a specific language without user choice unless the locale constraint is clearly documented and justified.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
90% confidence
Finding

This markdown file documents access to sensitive environment variables ('AK/SK') as part of the script flow. Under the missing user warnings rule for markdown files, descriptions should disclose behaviors that affect privacy or credential handling, and this line provides the behavior without any caution about credential sensitivity or secure setup.

Content

No source excerpt is available for this finding.

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
94% confidence
Finding

The dependency is specified with a lower-bound constraint only, which allows future unreviewed versions to be installed. That creates supply-chain and stability risk because a compromised, vulnerable, or breaking upstream release could be pulled into the skill without explicit approval.

Content

Scanner excerpt · requirements.txt (reported line 1)May include surrounding context.

text
huaweicloudsdkrds>=3.1.212
huaweicloudsdkces>=3.1.212
huaweicloudsdkiam>=3.1.212
huaweicloudsdkcore>=3.1.212

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
94% confidence
Finding

The dependency is specified with a lower-bound constraint only, which allows future unreviewed versions to be installed. That creates supply-chain and stability risk because a compromised, vulnerable, or breaking upstream release could be pulled into the skill without explicit approval.

Content

Scanner excerpt · requirements.txt (reported line 2)May include surrounding context.

text
huaweicloudsdkrds>=3.1.212
huaweicloudsdkces>=3.1.212
huaweicloudsdkiam>=3.1.212
huaweicloudsdkcore>=3.1.212

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
94% confidence
Finding

The dependency is specified with a lower-bound constraint only, which allows future unreviewed versions to be installed. That creates supply-chain and stability risk because a compromised, vulnerable, or breaking upstream release could be pulled into the skill without explicit approval.

Content

Scanner excerpt · requirements.txt (reported line 3)May include surrounding context.

text
huaweicloudsdkrds>=3.1.212
huaweicloudsdkces>=3.1.212
huaweicloudsdkiam>=3.1.212
huaweicloudsdkcore>=3.1.212

Unpinned Dependencies

Low
Category
Supply Chain
Confidence
94% confidence
Finding

The dependency is specified with a lower-bound constraint only, which allows future unreviewed versions to be installed. That creates supply-chain and stability risk because a compromised, vulnerable, or breaking upstream release could be pulled into the skill without explicit approval.

Content

Scanner excerpt · requirements.txt (reported line 4)May include surrounding context.

text
huaweicloudsdkrds>=3.1.212
huaweicloudsdkces>=3.1.212
huaweicloudsdkiam>=3.1.212
huaweicloudsdkcore>=3.1.212

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
91% confidence
Finding

This markdown file presents all user-facing content in Chinese, including the title, report labels, and conclusion, but does not indicate that the user opted into Chinese or that the skill is region-specific. Under the policy criteria, forcing a specific language without user choice can be a natural-language policy violation.

Content

No source excerpt is available for this finding.