Back to skill

Security audit

huawei-cloud-cdn-dns-resolution-diagnosis

Security checks for vulnerabilities and agentic risk

Overview

The skill is mostly a coherent read-only Huawei Cloud CDN DNS diagnostic tool, but it includes under-scoped instructions that could change the host DNS resolver and unsafe command-template guidance for authenticated CLI use.

Review before installing. Use only with a least-privilege Huawei Cloud account, never paste AK/SK into chat, validate the domain and region before any hcloud command, avoid shell-string command construction, and do not let the skill or agent change your system DNS resolver automatically. Prefer installing dnspython in a dedicated virtual environment with a pinned reviewed version.

Vulnerability Patterns
  • 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
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
references/task-permission-check.md:27
Finding
Potential Command Injection Through Unvalidated CLI Parameters<![CDATA[ ## Vulnerability Details **File Location**: `references/task-permission-check.md:27-29` **Vulnerability Type**: Command injection through unsafe command construction **Risk Level**: High ### Vulnerable Code ```bash hcloud CDN ShowDomainDetailByName --cli-region=<region> --domain_name=<domain> ``` ### Technical Analysis The documented workflow interpolates the user-supplied `region` and `domain` values into a shell-form command. The document does not require these values to be validated before this command is executed, nor does it require the command to be invoked through an argument-array API that avoids shell interpretation. Although `scripts/dns_resolve.py` subsequently validates the domain against an RFC 1035-oriented regular expression, that validation occurs inside the DNS probe and does not protect the earlier `hcloud` command. The region parameter is also not explicitly enforced against the documented allowlist of `cn-north-1` and `ap-southeast-1`. If an Agent implementation constructs this command as a string and executes it through a shell, metacharacters in either value could be interpreted as shell syntax rather than as part of a CLI argument. ### Attack Path 1. An attacker supplies a crafted domain or region containing shell metacharacters and an additional command. 2. The Agent substitutes the value directly into the documented command template. 3. The resulting command string is passed to a shell. 4. The shell interprets the injected metacharacters and executes the attacker-controlled command. 5. The injected process inherits the Agent process's operating-system permissions and environment. Exploitation depends on the command being executed through a shell without independent validation or safe argument handling. ### Impact Assessment Successful exploitation could permit arbitrary local command execution with the privileges of the Agent process. Depending on its runtime permissions, this could expose local files, CLI configurat ...[truncated 414 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Validate the domain before any CLI command using the same strict policy applied by `scripts/dns_resolve.py`. 2. Restrict the region to an explicit allowlist: - `cn-north-1` - `ap-southeast-1` 3. Execute `hcloud` through an argument-array API without invoking a shell. For example, use a structure equivalent to: ```python subprocess.run( [ "hcloud", "CDN", "ShowDomainDetailByName", f"--cli-region={region}", f"--domain_name={domain}", ], shell=False, check=True, ) ``` 4. Explicitly prohibit string concatenation, `shell=True`, `os.system`, and similar shell-mediated execution in the Skill instructions. 5. Reject values containing whitespace, control characters, shell metacharacters, or unexpected Unicode characters. 6. Perform all validation before credential checks or authenticated cloud commands. 7. Apply the same safe execution requirements consistently to every documented `hcloud` invocation. ]]>

T08 · Insecure Dependencies

Warning
Location
references/cli-installation-guide.md:51
Finding
Unpinned Third-Party Dependency Installation<![CDATA[ ## Vulnerability Details **File Location**: `references/cli-installation-guide.md:51-57` **Vulnerability Type**: Unbounded third-party dependency installation **Risk Level**: Medium ### Vulnerable Code ```markdown ### dnspython >= 2.1 Install via pip: ```bash pip install dnspython>=2.1 ``` ``` ### Technical Analysis The installation instructions specify only a minimum dependency version. The constraint `dnspython>=2.1` permits pip to install any later version available from the configured package index. The project provides no lockfile, exact version pin, package hash, or trusted-index enforcement. Consequently, the code installed and imported by the Skill can change after the package itself has been audited. A compromised package release, compromised package index, malicious index configured in the environment, or incompatible future release could introduce unintended code into the execution path. Python packages may execute code during installation, and imported package modules execute initialization code when `dns.resolver` is imported by `scripts/dns_resolve.py`. ### Attack Path 1. The DNS probe reports that `dnspython` is missing. 2. The user or Agent follows the documented `pip install dnspython>=2.1` instruction. 3. Pip resolves the package using the environment's configured package indexes and selects an uncontrolled later release. 4. A compromised or malicious package artifact is downloaded and installed. 5. Package-controlled code executes during installation or when `dns.resolver` is imported. 6. The malicious code runs with the permissions of the user or Agent performing the installation or probe. This path requires compromise or malicious configuration of the dependency source or an affected future package release. ### Impact Assessment A malicious dependency could execute arbitrary Python code with the installing user's privileges. This may expose environment variables, local configuration, cloud credentials, files accessible ...[truncated 233 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Pin `dnspython` to an exact reviewed version rather than using an open-ended lower bound. 2. Maintain dependency versions in a lockfile generated through a controlled build process. 3. Require package hashes, for example through a requirements file used with `pip install --require-hashes`. 4. Explicitly use the official Python Package Index or an organization-controlled package mirror. 5. Install dependencies in a dedicated virtual environment rather than a system-wide interpreter. 6. Avoid privileged installation and do not recommend `sudo pip install`. 7. Establish a review and testing process before updating the pinned dependency. 8. Update all repeated installation guidance in `SKILL.md`, `references/troubleshooting.md`, and script error messages so that they use the same pinned and verified installation procedure. ]]>
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • 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
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
Findings (13)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
The code chunk only implements a narrow subset of the declared workflow: DNS probing of a domain's A records and reporting results/errors. The declared description promises a broader CDN diagnosis flow involving cloud API/CLI access to fetch CDN domain details, expected CNAME retrieval, and verification that resolved IPs belong to Huawei Cloud CDN. None of those CDN-specific steps or resource accesses appear in the code. While DNS probing is relevant support for the declared use case, the actual code's primary behavior is materially narrower and more generic than the declared purpose.

Vague Triggers

Medium
Confidence
96% confidence
Finding
This markdown file defines activation triggers, so SQP-1 applies. The phrase "DNS配置" is ambiguous because it can refer to general DNS configuration work, including write operations, while the skill is only for read-only CDN DNS diagnosis; this creates risk of unintended invocation despite later exclusions.

Vague Triggers

Medium
Confidence
94% confidence
Finding
Although the document later describes scope limits, the explicit trigger list still contains phrases that could match many DNS issues outside this skill's intended use, such as authoritative DNS changes, resolver setup, or non-CDN diagnostics. Under SQP-1, activation language should be specific enough to distinguish when the skill should and should not run.

Unrestricted Tool Access

Medium
Category
Excessive Agency
Content
>
> If a user attempts to provide AK/SK directly (e.g., "my AK is xxx, SK is yyy"):
>
> - **Stop immediately** - Do not execute any commands
>
> - **Politely refuse** and return the following message:
>
Confidence
80% confidence
Finding
Skill grants unrestricted tool access without appropriate constraints. An agent with unfettered tool access can perform arbitrary actions including file modification, network requests, and code execution.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The guide instructs users to run `hcloud configure` and enter AK/SK credentials, but it does not warn that these are sensitive secrets, may be stored locally, and must be protected from shell history, shared terminals, screenshots, or checked-in config files. In a security-sensitive troubleshooting skill, omission of credential-handling guidance can lead to accidental exposure or misuse of cloud access keys.

Natural-Language Policy Violations

Medium
Confidence
89% confidence
Finding
The documentation specifies example region/platform values in Chinese, such as `四川`, `北京`, and `华为云`, without indicating that output locale may vary or that the user can choose a language. This can violate language/locale policy by implicitly fixing the skill's outputs to a specific language.

Description-Behavior Mismatch

Medium
Confidence
95% confidence
Finding
Advising users to switch the host's system DNS resolver goes beyond passive diagnosis and changes local system/network configuration. Even though intended for troubleshooting, this expands the skill's operational scope and could disrupt other applications, alter security monitoring paths, or normalize unauthorized environment changes.

Description-Behavior Mismatch

Medium
Confidence
97% confidence
Finding
The troubleshooting text tells the operator to 'add a CNAME record' to fix resolution, which is a configuration change and contradicts the skill's declared read-only scope. In an agent setting, this can cause the agent to step beyond diagnostic behavior into making or recommending live DNS changes, increasing the risk of unintended service impact or policy bypass.

Description-Behavior Mismatch

Medium
Confidence
98% confidence
Finding
The best-practices section explicitly recommends changing the host DNS resolver for verification, directly conflicting with the skill's stated 'strictly read-only' and 'no configuration change' boundaries. In context, that mismatch is dangerous because agents or users may treat these steps as sanctioned actions and perform environment changes under the guise of diagnosis.

Vague Triggers

Low
Confidence
90% confidence
Finding
The phrase is broad everyday technical language and does not specify DNS, CDN, or Huawei Cloud context. Because triggers are used for activation, this generic English phrase could overlap with unrelated troubleshooting requests.

Excessive Permissions

Low
Category
Privilege Escalation
Content
Ensure the IAM user has the required permissions. See [references/iam-policies.md](references/iam-policies.md) for details.

**Minimum required permissions:**

- `cdn:domain:get` — Query domain details
- `cdn:ip:info` — Query IP attribution information (if the IAM policy can be split)
Confidence
80% confidence
Finding
Skill requests more permissions than appear necessary for its stated functionality. Review if elevated access is justified.

Natural-Language Policy Violations

Low
Confidence
81% confidence
Finding
The file states a recommended region of `cn-north-1`, which is a locale-specific instruction. Under the policy, locale constraints should either be justified as region-specific or presented as a user choice; this line presents the preference without either.

Missing User Warnings

Low
Confidence
83% confidence
Finding
This markdown file instructs the user to run `hcloud configure list` and inspect AK/SK-based credential configuration, which involves sensitive authentication material. The document does not include any warning to avoid exposing credentials in shared terminals, logs, or screenshots while performing the verification.

Static analysis

No suspicious patterns detected.