Back to skill

Security audit

huawei-cloud-cce-metric-analyzer

Security checks for vulnerabilities and agentic risk

Overview

The monitoring workflow is coherent, but exposed credential arguments and a separately downloaded plugin warrant review before use.

Review before production use. Request removal of credential-bearing process arguments and verify the plugin through a trusted build or authenticated release. Use short-lived, least-privilege credentials and restrict Secret access to intended namespaces; disable certificate checks when unnecessary. Temporary kubeconfig files can survive abrupt termination. The exact external plugin release could not be verified, and no malicious behavior was established in the bundled code.

Vulnerability Patterns
  • 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
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Vulnerability Patterns
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (52)

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding

The supplied chunk performs software installation and local system modification, not metric queries or analysis. Although a kubectl plugin could support CCE workflows, the description does not establish this third-party plugin installation as a prerequisite or part of the declared Python/hcloud implementation. The downloaded binary's internal behavior is not shown and cannot be assessed from this chunk.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding

Resource discovery, credential handling, and temporary kubeconfig creation can reasonably support the declared monitoring workflow and are not independently treated as mismatches. However, get_cce_secret_with_kubectl accepts an arbitrary namespace and Secret name and returns the full Secret object. Although certificate-expiration monitoring could require reading a TLS certificate, this implementation exposes broader secret-reading capability not described by the declared metric-analysis purpose. No external exfiltration or destructive Kubernetes operations are shown.

Content

No source excerpt is available for this finding.

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

python3 scripts/huawei-cloud.py key=value key=value

text

The dispatcher converts cloud service queries to KooCLI calls. AOM Prometheus range queries use signed HTTPS requests because that path is not compatible with hcloud. Avoid Kubernetes resource reads unless the tool explicitly needs Pod labels, Ingress TLS Secrets, or LoadBalancer Services. Quote values containing spaces, `>`, `<`, `|`, JSON, or PromQL; never print or persist AK/SK, security tokens, kubeconfig files, or temporary payloads; keep Kubernetes/AOM PromQL scoped with `cluster="<cluster_id>"`.

### 1. CCE Pod Metrics

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/acceptance-criteria.md (reported line 21)May include surrounding context.

md
| ID | Area | Acceptance Standard |
| --- | --- | --- |
| SAF-01 | Read-only boundary | No tool creates, updates, deletes, restarts, scales, or remediates resources |
| SAF-02 | Secret handling | AK/SK, security tokens, kubeconfig content, and TLS Secret content are not printed or persisted |
| SAF-03 | Credential priority | hcloud calls use explicit parameters, then hcloud profile, then environment fallback |
| SAF-04 | AOM signing | AOM Prometheus HTTP uses explicit/environment credentials and supports temporary security tokens |
| SAF-05 | Query scope | PromQL defaults include `cluster="<cluster_id>"` or a cluster-equivalent selector |

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · references/iam-policies.md (reported line 41)May include surrounding context.

md
## Security Requirements

- Never print or persist AK/SK, security tokens, kubeconfig content, or TLS Secret content.
- Prefer hcloud profile for normal hcloud calls.
- Use explicit AK/SK or environment credentials only for AOM signed HTTP and kubectl-cce paths that require signing material.
- Keep all metric queries scoped by `cluster="<cluster_id>"` where possible.

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/huawei_cloud/kubectl_client.py (reported line 76)May include surrounding context.

python
if not result.get("success"):
        return result
    kubeconfig = result.get("data") or {}
    if not kubeconfig.get("clusters"):
        return {"success": False, "error": "CreateKubernetesClusterCert returned no kubeconfig clusters"}
    _prefer_external_context(kubeconfig)
    return {"success": True, "kubeconfig": kubeconfig}

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/huawei_cloud/kubectl_client.py (reported line 77)May include surrounding context.

python
return result
    kubeconfig = result.get("data") or {}
    if not kubeconfig.get("clusters"):
        return {"success": False, "error": "CreateKubernetesClusterCert returned no kubeconfig clusters"}
    _prefer_external_context(kubeconfig)
    return {"success": True, "kubeconfig": kubeconfig}

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/huawei_cloud/kubectl_client.py (reported line 106)May include surrounding context.

python
return {"success": False, "error": "cluster has no bound EIP/external endpoint"}

    kubeconfig_result = _create_kubeconfig(region, cluster_id, ak, sk, project_id)
    if not kubeconfig_result.get("success"):
        return kubeconfig_result

    kubeconfig_file = None

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/huawei_cloud/kubectl_client.py (reported line 109)May include surrounding context.

python
if not kubeconfig_result.get("success"):
        return kubeconfig_result

    kubeconfig_file = None
    try:
        with tempfile.NamedTemporaryFile("w", delete=False, suffix=".json") as handle:
            json.dump(kubeconfig_result["kubeconfig"], handle)

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/huawei_cloud/kubectl_client.py (reported line 113)May include surrounding context.

python
try:
        with tempfile.NamedTemporaryFile("w", delete=False, suffix=".json") as handle:
            json.dump(kubeconfig_result["kubeconfig"], handle)
            kubeconfig_file = handle.name
        result = _run_json_command(["kubectl", "--kubeconfig", kubeconfig_file, "get", *resource_args, "-o", "json"])
        if result.get("success"):
            result["access_method"] = "kubectl_kubeconfig_external"

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/huawei_cloud/kubectl_client.py (reported line 116)May include surrounding context.

python
kubeconfig_file = handle.name
        result = _run_json_command(["kubectl", "--kubeconfig", kubeconfig_file, "get", *resource_args, "-o", "json"])
        if result.get("success"):
            result["access_method"] = "kubectl_kubeconfig_external"
        return result
    finally:
        if kubeconfig_file and os.path.exists(kubeconfig_file):

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/huawei_cloud/kubectl_client.py (reported line 119)May include surrounding context.

python
result["access_method"] = "kubectl_kubeconfig_external"
        return result
    finally:
        if kubeconfig_file and os.path.exists(kubeconfig_file):
            os.remove(kubeconfig_file)

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/huawei_cloud/kubectl_client.py (reported line 119)May include surrounding context.

python
result["access_method"] = "kubectl_kubeconfig_external"
        return result
    finally:
        if kubeconfig_file and os.path.exists(kubeconfig_file):
            os.remove(kubeconfig_file)

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/huawei_cloud/kubectl_client.py (reported line 120)May include surrounding context.

python
return result
    finally:
        if kubeconfig_file and os.path.exists(kubeconfig_file):
            os.remove(kubeconfig_file)


def _kubectl_get_with_cce_plugin(region: str, cluster_id: str, resource_args: List[str], ak: Optional[str], sk: Optional[str], project_id: Optional[str], security_token: Optional[str]) -> Dict[str, Any]:

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/huawei_cloud/kubectl_client.py (reported line 165)May include surrounding context.

python
profile_ak, profile_sk, profile_project = get_credentials(ak, sk, project_id)
    kubeconfig_result = _kubectl_get_with_kubeconfig(region, cluster_id, resource_args, profile_ak, profile_sk, profile_project)
    if kubeconfig_result.get("success"):
        return kubeconfig_result

    plugin_result = _kubectl_get_with_cce_plugin(region, cluster_id, resource_args, ak, sk, project_id, security_token)

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/huawei_cloud/kubectl_client.py (reported line 174)May include surrounding context.

python
return {
        "success": False,
        "error": "failed to get Kubernetes resources via kubectl kubeconfig or kubectl cce plugin",
        "kubeconfig_error": kubeconfig_result.get("error"),
        "plugin_error": plugin_result.get("error"),
    }

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

md
It also includes CoreDNS, nginx-ingress, and autoscaler summaries. Cloud resources are scoped to the current cluster when an association can be proven: ELB is matched through LoadBalancer Service IP/EIP, NAT Gateway is filtered by the cluster VPC, and EIP is limited to associated ELB/NAT/Service IPs.

LoadBalancer Service discovery uses `kubectl` with generated kubeconfig through the cluster EIP when external access is available. If the cluster has no EIP, it uses the `kubectl cce` plugin. If neither path works, aggregation fails.

## Risk Levels

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

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

md
| `python3` | Run the dispatcher and parse results | All tools |
| `hcloud` / KooCLI | Query Huawei Cloud CCE, ECS, ELB, EIP, NAT, CES, IAM, and add-on metadata | Cloud service and CES metric tools |
| `kubectl` | Read Kubernetes resources only when AOM/hcloud cannot derive them | Pod label filtering, Ingress TLS checks, LoadBalancer Service association |
| `kubectl-cce` | Connect to CCE clusters without direct kubeconfig access | Same Kubernetes resource-read paths |

## hcloud Setup

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/huawei_cloud/kubectl_client.py (reported line 79)May include surrounding context.

python
if not kubeconfig.get("clusters"):
        return {"success": False, "error": "CreateKubernetesClusterCert returned no kubeconfig clusters"}
    _prefer_external_context(kubeconfig)
    return {"success": True, "kubeconfig": kubeconfig}


def _prefer_external_context(kubeconfig: Dict[str, Any]) -> None:

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/huawei_cloud/kubectl_client.py (reported line 79)May include surrounding context.

python
if not kubeconfig.get("clusters"):
        return {"success": False, "error": "CreateKubernetesClusterCert returned no kubeconfig clusters"}
    _prefer_external_context(kubeconfig)
    return {"success": True, "kubeconfig": kubeconfig}


def _prefer_external_context(kubeconfig: Dict[str, Any]) -> None:

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/huawei_cloud/kubectl_client.py (reported line 94)May include surrounding context.

python
for context in kubeconfig.get("contexts", []) or []:
        context_data = context.get("context") or {}
        if context_data.get("cluster") == external_cluster_name:
            kubeconfig["current-context"] = context.get("name")
            return

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/huawei_cloud/kubectl_client.py (reported line 107)May include surrounding context.

python
kubeconfig_result = _create_kubeconfig(region, cluster_id, ak, sk, project_id)
    if not kubeconfig_result.get("success"):
        return kubeconfig_result

    kubeconfig_file = None
    try:

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/huawei_cloud/kubectl_client.py (reported line 164)May include surrounding context.

python
return {"success": False, "error": "cluster_id is required"}

    profile_ak, profile_sk, profile_project = get_credentials(ak, sk, project_id)
    kubeconfig_result = _kubectl_get_with_kubeconfig(region, cluster_id, resource_args, profile_ak, profile_sk, profile_project)
    if kubeconfig_result.get("success"):
        return kubeconfig_result

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/huawei_cloud/kubectl_client.py (reported line 164)May include surrounding context.

python
return {"success": False, "error": "cluster_id is required"}

    profile_ak, profile_sk, profile_project = get_credentials(ak, sk, project_id)
    kubeconfig_result = _kubectl_get_with_kubeconfig(region, cluster_id, resource_args, profile_ak, profile_sk, profile_project)
    if kubeconfig_result.get("success"):
        return kubeconfig_result

Credential Access

High
Category
Privilege Escalation
Confidence
60% confidence
Finding

Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Content

Scanner excerpt · scripts/huawei_cloud/kubectl_client.py (reported line 166)May include surrounding context.

python
profile_ak, profile_sk, profile_project = get_credentials(ak, sk, project_id)
    kubeconfig_result = _kubectl_get_with_kubeconfig(region, cluster_id, resource_args, profile_ak, profile_sk, profile_project)
    if kubeconfig_result.get("success"):
        return kubeconfig_result

    plugin_result = _kubectl_get_with_cce_plugin(region, cluster_id, resource_args, ak, sk, project_id, security_token)
    if plugin_result.get("success"):