Back to skill

Security audit

huawei-cloud-sac-new-api

Security checks for vulnerabilities and agentic risk

Overview

This skill is a coherent Huawei Cloud Terraform deployment helper, but it needs review because it combines cloud mutation authority with unverified remote infrastructure downloads, plaintext local credential materialization, and an unsafe Playwright npx fallback.

Review before installing. Use a least-privilege Huawei Cloud IAM user, inspect and verify any downloaded Terraform template before running Terraform, avoid exposing cloud credentials in shared workspaces, remove `terraform.auto.tfvars.json` after use, restrict SSH and web access to trusted IPs, and avoid the `npx playwright-cli` fallback unless the package identity and version are pinned.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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)

T08 · Insecure Dependencies

Error
Location
scripts/playwright_utils.py:19
Finding
Unscoped npx Fallback May Execute an Unintended Registry Package## Vulnerability Details **File Location**: `scripts/playwright_utils.py`, lines 19–24 **Vulnerability Type**: Dependency confusion caused by an incorrect package fallback **Risk Level**: High ### Vulnerable Code ```python def build_pw_command() -> list[str]: pw = resolve_command("playwright-cli") if pw: return [pw] npx = resolve_command("npx") if npx: return [npx, "playwright-cli"] raise RuntimeError( "playwright-cli is not installed. Install with: npm install -g @playwright/cli@latest" ) ``` The installation instructions identify the intended dependency as the scoped package `@playwright/cli`. However, when the `playwright-cli` executable is unavailable, the fallback invokes: ```text npx playwright-cli ``` This resolves the unscoped registry package named `playwright-cli`, not necessarily the documented `@playwright/cli` package. ### Technical Analysis The returned command is passed to `run_pw()`, where it is executed through `subprocess.run()` with the current Agent or user privileges. Although `shell=False` prevents shell metacharacter injection, it does not address package identity: `npx` may retrieve and execute code associated with the unintended unscoped package. The issue is reachable when all of the following conditions hold: 1. The Skill runs `extract_sac_deploy_info.py`. 2. No local `playwright-cli` executable is found. 3. `npx` is available. 4. The fallback command resolves the unscoped `playwright-cli` package from the configured npm registry. This is classified as an insecure dependency flaw rather than malicious behavior because the reviewed project contains no evidence that the authors control the resolved package or intentionally seek to execute a malicious payload. ### Attack Path 1. A user invokes the Skill’s solution-information extraction workflow. 2. `extract_sac_deploy_info.py` calls `build_pw_command()`. 3. The expected `playwright-cli` executable is absent, while `npx` is pres ...[truncated 1094 chars]
Remediation
## Remediation Suggestions 1. Remove the automatic `npx` fallback and fail closed when the expected executable is unavailable. 2. If fallback execution is necessary, explicitly select the intended scoped package and pin its version, for example: ```python return [ npx, "--yes", "--package=@playwright/cli@<reviewed-version>", "playwright-cli", ] ``` 3. Keep the package version consistent with the installation guide and avoid `@latest` in automated execution paths. 4. Verify the resolved executable or package identity before execution. 5. Use a lockfile or controlled installation process where practical. 6. Run the extraction helper in a restricted environment that does not expose Huawei Cloud credentials unless they are required. 7. Document the exact trusted package name and version so installation and fallback behavior cannot diverge.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
Findings (23)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding
The skill directs users to download a Terraform template from a remote URL and proceed toward deployment, yet it does not require integrity verification of the fetched infrastructure code. In a deployment skill, that context makes this more dangerous because compromised or swapped templates could lead to unauthorized resource creation, credential exposure, or hostile bootstrap commands.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
The skill directs users to download a Terraform template from a remote URL and proceed toward deployment, yet it does not require integrity verification of the fetched infrastructure code. In a deployment skill, that context makes this more dangerous because compromised or swapped templates could lead to unauthorized resource creation, credential exposure, or hostile bootstrap commands.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The skill directs users to download a Terraform template from a remote URL and proceed toward deployment, yet it does not require integrity verification of the fetched infrastructure code. In a deployment skill, that context makes this more dangerous because compromised or swapped templates could lead to unauthorized resource creation, credential exposure, or hostile bootstrap commands.

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding
The skill directs users to download a Terraform template from a remote URL and proceed toward deployment, yet it does not require integrity verification of the fetched infrastructure code. In a deployment skill, that context makes this more dangerous because compromised or swapped templates could lead to unauthorized resource creation, credential exposure, or hostile bootstrap commands.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The skill directs users to download a Terraform template from a remote URL and proceed toward deployment, yet it does not require integrity verification of the fetched infrastructure code. In a deployment skill, that context makes this more dangerous because compromised or swapped templates could lead to unauthorized resource creation, credential exposure, or hostile bootstrap commands.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The skill directs users to download a Terraform template from a remote URL and proceed toward deployment, yet it does not require integrity verification of the fetched infrastructure code. In a deployment skill, that context makes this more dangerous because compromised or swapped templates could lead to unauthorized resource creation, credential exposure, or hostile bootstrap commands.

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
The skill directs users to download a Terraform template from a remote URL and proceed toward deployment, yet it does not require integrity verification of the fetched infrastructure code. In a deployment skill, that context makes this more dangerous because compromised or swapped templates could lead to unauthorized resource creation, credential exposure, or hostile bootstrap commands.

Lp3

Medium
Category
MCP Least Privilege
Confidence
95% confidence
Finding
The skill clearly instructs use of powerful capabilities including environment-variable access, file reads/writes, network downloads, and shell execution, but it declares no corresponding tool scope or permission boundary. This increases the blast radius if the skill is misused or if supporting scripts behave unexpectedly, because reviewers and runtime policy layers lack explicit constraints.

Autonomous Decision Making

Medium
Category
Excessive Agency
Content
### Security

- 🚫 Never expose AK/SK in conversation or output
- 🚫 Never ask user to type AK/SK in chat
- 🚫 Never read or display `terraform.auto.tfvars.json` in conversation context (contains AK/SK)
- ✅ Prefer IAM users over primary account
- ✅ Modification ops (`apply`, `destroy`) require explicit user confirmation
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.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The JSON sets "region" to "cn-north-4", which imposes a specific locale/region in natural-language-like configuration without any indication that this choice is optional or user-selected. Per the policy, locale constraints should either offer user choice or be clearly documented and justified as region-specific.

External Transmission

Medium
Category
Data Exfiltration
Content
### Install — Linux / macOS

```bash
curl -fsSL -o <temp_dir>/terraform.zip "<URL_from_table_above>"
unzip -o <temp_dir>/terraform.zip -d /usr/local/bin/
```
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
This file is a markdown document, so SQP-2 applies to whether the description warns about behaviors affecting user data or system integrity. The document enumerates destructive permissions such as deleting ECS instances, VPCs, subnets, EIPs, and volumes, but does not clearly warn readers near the deployment section about the operational impact or potential data/resource loss from Apply/Destroy actions.

Missing User Warnings

Medium
Confidence
89% confidence
Finding
This markdown file documents `terraform apply` and `terraform destroy`, which can modify or remove infrastructure, but it provides no warning about their impact on user data, service availability, or irreversibility. Under the markdown-specific warning criterion, destructive or system-affecting behaviors should be accompanied by clear cautionary language.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The file explicitly recommends `ssh root@<EIP>` for remote administration, normalizing direct root login over the network without any warning or safer alternative. In the context of an internet-exposed LLM gateway deployment, this increases the risk of credential compromise, weak access practices, and high-impact host takeover if operators follow the example literally.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
The document explicitly instructs writing Huawei Cloud access credentials into `terraform.auto.tfvars.json` and only checks that the file is 'not in git', which is not sufficient protection for sensitive secrets. This creates a realistic risk of credential exposure through local disk persistence, shell history, backups, logs, artifact collection, or accidental sharing during troubleshooting.

Missing User Warnings

Medium
Confidence
88% confidence
Finding
The verification steps require opening ports 22 and 3000 and validating public HTTP access to the deployed service, but they provide no warning about attack surface expansion, public exposure, or cloud cost/resource consequences. In the context of deploying an internet-reachable LLM gateway, this omission can lead operators to expose administrative or application interfaces without understanding the security implications.

Description-Behavior Mismatch

Medium
Confidence
95% confidence
Finding
The script persists HuaweiCloud access credentials into terraform.auto.tfvars.json, creating a local plaintext secrets file as part of a normalization workflow. Even though it warns not to commit the file and masks console output, the secret material is still written to disk, where it can be accidentally committed, included in artifacts, read by other local users/processes, or exfiltrated by malware.

Context-Inappropriate Capability

Medium
Confidence
97% confidence
Finding
The script reads cloud credentials from environment variables and then materializes them into a local file, increasing secret exposure beyond the process environment. In the context of a deployment skill for an LLM gateway on cloud infrastructure, this is more dangerous because such automation commonly runs in CI/CD, shared workspaces, or operator laptops where generated files may be archived, logged, synced, or accidentally checked into version control.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
allow_failure: bool = False,
) -> subprocess.CompletedProcess:
    full_cmd = [*base_cmd, f"-s={session}", *args]
    proc = subprocess.run(
        full_cmd,
        capture_output=True,
        text=True,
Confidence
70% confidence
Finding
subprocess module calls execute external commands. Without careful input validation, this enables command injection.

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
The automation only attempts to dismiss dialogs using Chinese button text such as '知道了', '关闭', and '同意'. This imposes a specific language/locale assumption in the skill logic without offering a language choice or documenting that the skill is intentionally limited to Chinese-language pages.

Natural-Language Policy Violations

Medium
Confidence
88% confidence
Finding
The configuration sets the region to "cn-north-4" by default, which imposes a specific locale/region selection in natural-language-relevant configuration without any indication that the user can choose or opt in. Under the policy, forcing a specific locale is a violation unless it is clearly documented and justified as region-specific.

Missing User Warnings

Low
Confidence
80% confidence
Finding
This markdown file instructs users to install Terraform for deploying the NewAPI LLM Gateway and includes commands that place binaries into system locations such as /usr/local/bin and system32. The guide does not include any user-facing warning that these steps modify privileged system paths and enable subsequent infrastructure deployment actions that could affect system integrity or cloud resources.

Natural-Language Policy Violations

Low
Confidence
77% confidence
Finding
The verification criteria require `region` to equal `cn-north-4`, which imposes a specific locale/region constraint. This file does not explain the reason for the restriction or indicate that the user can opt into this region-specific behavior.

Static analysis

No suspicious patterns detected.