Back to skill

Security audit

huawei-cloud-flexus-l-server-ops

Security checks for vulnerabilities and agentic risk

Overview

This skill is for Huawei Cloud server operations and mostly matches that purpose, but it needs review because it can change cloud instances and reset passwords while some safeguards are only documented, not enforced in code.

Review before installing. Use only with least-privilege Huawei Cloud credentials, preferably temporary credentials limited to the intended Flexus L instances. Do not run env | grep HW_ or paste credentials/passwords into chat or logs. Treat stop, reboot, update, and password reset as real cloud changes, and require a clear target instance and explicit confirmation before invoking scripts.

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/auth.py:88
Finding

TLS Certificate Verification Disabled for Huawei Cloud Config API

Content
View full analysis

Vulnerability Details

File Location: scripts/auth.py:88-94
Vulnerability Type: Improper certificate validation
Risk Level: High

Vulnerable Code

python
def get_config_client(self, region: str = "cn-north-4"):
    """Get Config client (for resource configuration queries)"""
    config = HttpConfig.get_default_config()
    config.ignore_ssl_verification = True
    return ConfigClient.new_builder() \
        .with_http_config(config) \
        .with_credentials(self.get_global_credentials()) \
        .with_region(ConfigRegion.value_of(region)) \
        .build()

Technical Analysis

The Config API client explicitly disables TLS certificate verification through:

python
config.ignore_ssl_verification = True

Consequently, the client does not authenticate the identity of the remote HTTPS endpoint. This affects every operation that obtains a client through get_config_client(), including:

  • Listing Flexus L resources across regions
  • Resolving an ECS ID to a Flexus L instance
  • Listing traffic-package resource identifiers
  • Querying traffic packages by region
  • Performing the documented Flexus-instance validation workflow

These requests are authenticated using GlobalCredentials. When temporary credentials are configured, the requests also carry the associated security token. A network-positioned attacker capable of intercepting or redirecting the connection can present an untrusted certificate without the client rejecting it.

The trust boundary crossed is between the trusted local process, which holds Huawei Cloud credentials, and a remote endpoint whose identity is no longer cryptographically verified.

Attack Path

  1. A user configures valid Huawei Cloud credentials and invokes an operation that calls get_config_client().
  2. An attacker obtains a network interception position, such as through a malicious proxy, compromised gateway, DNS redirection, or hostile local network.
  3. The attacker redirects or intercept ...[truncated 1143 chars]
Remediation
View remediation

Remediation Suggestions

  1. Remove the explicit TLS bypass and use the Huawei Cloud SDK's default certificate verification:

    python
    def get_config_client(self, region: str = "cn-north-4"):
        return ConfigClient.new_builder() \
            .with_credentials(self.get_global_credentials()) \
            .with_region(ConfigRegion.value_of(region)) \
            .build()
    
  2. If a private enterprise CA is required, configure a narrowly scoped trusted CA bundle rather than disabling certificate validation.

  3. Do not provide a production option that globally disables TLS verification.

  4. Add tests confirming that:

    • A valid Huawei Cloud certificate is accepted.
    • An untrusted or self-signed certificate is rejected.
    • Certificate hostname mismatches are rejected.
  5. Rotate temporary or permanent credentials if they were used over an intercepted or otherwise untrusted network while verification was disabled.

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
scripts/lifecycle.py:24
Finding

Stop and Reboot Operations Do Not Enforce Required Confirmation or Flexus-Type Validation

Content
View full analysis

Vulnerability Details

File Location: scripts/lifecycle.py:24-48, 60-97; documented safeguards at SKILL.md:264-306, 429-434
Vulnerability Type: Missing authorization and safety-gate enforcement
Risk Level: Medium

Vulnerable Code

python
def manage_servers(action: str, server_ids: list, region: str = "cn-north-4", reboot_type: str = "SOFT", auth: AuthManager = None):
    """Manage Flexus L instance lifecycle (start/stop/reboot)"""
    action = action.lower()
    if action not in ["start", "stop", "reboot"]:
        raise ValueError(f"Invalid action: {action}, must be start/stop/reboot")
    
    auth = auth or AuthManager()
    if not auth.is_configured():
        raise ValueError("Please set environment variables HW_ACCESS_KEY, HW_SECRET_KEY, HW_SECURITY_TOKEN or provide --ak --sk parameters")
    
    client = auth.get_ecs_client(region)
    server_id_list = [ServerId(id=sid) for sid in server_ids]
    
    try:
        if action == "start":
            request = BatchStartServersRequest(body=BatchStartServersRequestBody(
                os_start=BatchStartServersOption(servers=server_id_list)))
            response = client.batch_start_servers(request)
        elif action == "stop":
            request = BatchStopServersRequest(body=BatchStopServersRequestBody(
                os_stop=BatchStopServersOption(servers=server_id_list)))
            response = client.batch_stop_servers(request)
        else:  # reboot
            request = BatchRebootServersRequest(body=BatchRebootServersRequestBody(
                reboot=BatchRebootSeversOption(servers=server_id_list, type=reboot_type)))
            response = client.batch_reboot_servers(request)

The command-line entry point invokes the operation directly:

python
auth = AuthManager(ak=ak, sk=sk, security_token=security_token)
action_name = "Starting" if action == "start" else "Stopping" if action == "stop" else "Rebooting"
print(f"{action_name} {len(server_ids)} server(s)...")
...[truncated 2579 chars]
Remediation
View remediation

Remediation Suggestions

  1. Enforce confirmation in executable code rather than relying solely on Agent instructions.

  2. Split disruptive operations into plan and execute phases:

    • The plan phase resolves and displays the exact action, region, and server IDs.
    • The execute phase requires a short-lived confirmation token cryptographically or structurally bound to that exact plan.
  3. Reject stop and reboot when the required confirmation evidence is absent. The confirmation mechanism should be non-default and should not accept an unrelated generic value.

  4. Before submitting the ECS request, query the Config API for hcss.l-instance resources and verify every supplied ECS ID against their physical resource IDs. Reject the complete batch if any target fails validation.

  5. Use least-privilege IAM credentials restricted to the intended instances and lifecycle actions where Huawei Cloud policy capabilities allow it.

  6. Add automated tests confirming that:

    • Stop and reboot fail without confirmation.
    • Confirmation for one action or target set cannot authorize another.
    • Non-Flexus ECS IDs are rejected.
    • Mixed batches containing an invalid target are rejected atomically.
    • Start behavior remains consistent with the intended policy.
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
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (14)

Tp4

High
Category
MCP Tool Poisoning
Confidence
97% confidence
Finding

The description presents a comprehensive Flexus L operations skill, but the provided code only covers authentication-backed ECS server listing, optional server detail retrieval through a class method, and batch password reset, exposed on the CLI as test/list/reset. There is no code for traffic package APIs, instance power operations (start/stop/reboot), or modifying instance metadata/information. This is a description-to-behavior mismatch because the declared purpose materially overstates the implemented functionality and suggests operational capabilities absent from the supplied code. The code does not show harmful undeclared behavior; the issue is that the description is substantially broader than the actual implementation.

Content

No source excerpt is available for this finding.

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The code chunk accurately supports part of the description: querying instance lists/details and traffic package/usage information for Flexus L-related resources. However, the declared purpose significantly overstates the implemented functionality by claiming operational management actions such as batch start/stop/reboot, password reset, and modification of instance information. The actual code only performs read-only queries via Config, ECS show-server, and BSS free-resource usage APIs, with no mutating operations present. This is a material description-to-behavior mismatch because several core declared capabilities are absent.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
79% confidence
Finding

The skill documents access to environment-based Huawei Cloud credentials and operational scripts, but it does not declare an explicit tool scope such as allowed-tools or permissions. In an agent environment, missing scope boundaries can let the skill activate with broader-than-intended access to environment variables or execution facilities, increasing the blast radius if the skill is invoked unexpectedly or composed with other behaviors.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

Broad trigger phrases like 'start', 'stop', 'reboot', 'query instance', and similar generic terms can cause unsafe over-activation of a high-impact infrastructure skill. In context, this skill can perform destructive cloud operations and password resets, so ambiguous activation materially raises the risk of accidental execution on unrelated user requests.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The trigger keyword table includes vague phrases such as 'My Servers', 'List All Servers', and lifecycle verbs that could match many benign conversations. Because this skill governs cloud instance lifecycle and password resets, accidental activation is more dangerous than in a read-only skill and could lead to unintended privileged operations.

Content

No source excerpt is available for this finding.

Autonomous Decision Making

Medium
Category
Excessive Agency
Confidence
80% confidence
Finding

The instruction to automatically obtain credentials from environment variables and 'NEVER ask user' encourages autonomous progression through privileged authentication and operation selection. In a cloud-operations skill, this reduces human checkpoints and can normalize acting with ambient credentials, which increases the risk of unintended or unauthorized infrastructure actions.

Content

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

⚠️ Security Note: Temporary credentials are more secure, please prefer using them!

text

**Note:** We prioritize obtaining credentials from environment variables and NEVER ask users to input AK/SK directly. However, we still support parsing credentials if user voluntarily provides them via other methods (e.g., conversation input, config file).

### Step 2: Select Operation

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

The password reset workflow handles a highly sensitive new password but does not explicitly instruct the agent to avoid echoing, storing, logging, or re-displaying that password. In an agent setting, omission of strict secret-handling requirements can expose credentials in chat history, tool logs, or audit output, directly compromising server access.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The verification step instructs users to run env | grep HW_, which can print active cloud credential environment variables directly to the terminal, including access keys and temporary security tokens. This creates an unnecessary secret exposure risk through terminal scrollback, shell logging, screen sharing, CI logs, or copied troubleshooting output, especially in an infrastructure-operations skill that handles privileged Huawei Cloud instance management.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The manifest describes a skill for Flexus L instance management and traffic-package queries, which aligns with ECS and BSS usage. This file additionally imports and constructs a Config service client for resource configuration queries, a separate capability not mentioned in the manifest description or trigger set.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
92% confidence
Finding

The get_config_client method enables access to Huawei Cloud Config, a resource inventory/configuration service unrelated to the stated Flexus L operational scope, and it also disables SSL certificate verification. This combination increases the attack surface by allowing unnecessary resource-enumeration capability and weakening transport security for that client, which could expose sensitive cloud configuration data or permit man-in-the-middle interception.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
89% confidence
Finding

This code performs a safety-sensitive account operation by changing an instance login password, but it only prints a status message immediately before executing the reset. There is no confirmation prompt, explicit warning about loss of current credentials, or other user disclosure before the irreversible change is sent to the cloud API.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
77% confidence
Finding

The instructions require the user to reply with exact English phrases like "confirm stop" before execution, despite the skill otherwise supporting both English and Chinese triggers. Requiring a fixed-language confirmation without offering alternatives can impose an unnecessary language constraint.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
78% confidence
Finding

The reboot flow says execution should occur only after the user replies "confirm reboot," which hard-codes English even though the document includes Chinese-language usage elsewhere. This creates a locale-specific requirement without user opt-in.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
76% confidence
Finding

After password reset, the documented flow says to reboot only after the user replies "confirm reboot." Since the skill otherwise supports multilingual triggers, this exact English-only confirmation is a natural-language policy issue.

Content

No source excerpt is available for this finding.