Back to skill

Security audit

huawei-cloud-cce-cluster-migrator

Security checks for vulnerabilities and agentic risk

Overview

This skill is a high-impact but coherent Kubernetes-to-Huawei CCE migration assistant; its credential, secret, data-transfer, and cluster-mutation steps are disclosed and aligned with that purpose.

Use this only from a trusted operator or bastion host. Prefer the custom least-privilege IAM policy over full-access policies, secure and delete temporary kubeconfigs, secret YAML files, Velero credentials, and k8clone dumps after migration, avoid logging command output that may include credentials, verify downloaded tool binaries, and require an explicit approved migration plan before running mutating commands.

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
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • 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
Findings (111)

Tp4

High
Category
MCP Tool Poisoning
Confidence
98% confidence
Finding

The supplied code does not implement Kubernetes cluster migration behavior. Instead, it is a testing utility for the skill: it loads test cases, substitutes a region value, executes commands concurrently, checks their output, and produces a report. This is materially different from the declared end-to-end CCE migration assistant purpose. While a test script can be a supporting artifact within such a project, this specific code chunk’s actual behavior is clearly command testing/execution, not source assessment, PV/PVC migration, image synchronization, Velero restore, or traffic cutover. Therefore the code chunk does not accurately represent the declared skill behavior.

Content

No source excerpt is available for this finding.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
`) via `skopeo` with `set -o pipefail` and `skopeo list-tags` validation. Ref: `references/swr-image-sync-guide.md`.|

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
`) via `skopeo` with `set -o pipefail` and `skopeo list-tags` validation. Ref: `references/swr-image-sync-guide.md`.|

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
`) via `skopeo` with `set -o pipefail` and `skopeo list-tags` validation. Ref: `references/swr-image-sync-guide.md`.|

Credential Access

High
Category
Privilege Escalation
Confidence
78% confidence
Finding

The command writes a cluster kubeconfig to ~/.kube/cce-config without any safeguards or warnings about file permissions, lifecycle, or secret exposure. Kubeconfigs often contain bearer tokens or client credentials, so persisting them on a shared operator host can expose administrative access if the file is later read, copied, or backed up insecurely.

Content

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

2. Kubeconfig & Target Readiness

bash
# Sync CCE kubeconfig on operator host (intranet or public EIP access)
hcloud CCE update-kubeconfig --cluster-id={target_cluster_id} --region=cn-north-4 --output=~/.kube/cce-config

# Verify Everest CSI add-on

Credential Access

High
Category
Privilege Escalation
Confidence
86% confidence
Finding

The command uses kubeconfig files and performs a metadata backup from the source cluster, which can include secret-bearing Kubernetes objects depending on tool behavior and configuration. In a migration skill, encouraging backup and local artifact creation without strict warnings about secret content, encryption, access control, and cleanup materially raises the risk of credential leakage or unauthorized cluster access.

Content

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

bash
# Option A (Primary / Recommended): k8clone Metadata Clone + Direct DB Logical Restore
k8clone backup --kubeconfig=~/.kube/source-config --exclude-having-owner-ref=true --local-dir=./k8clone-dump
k8clone restore --kubeconfig=~/.kube/cce-config --local-dir=./k8clone-dump.zip --restore-conf=./restore.json
# Logical DB stream (example: PostgreSQL)
kubectl exec -i {source_db_pod} -n {namespace} -- pg_dump -U {user} {dbname} | kubectl exec -i {cce_db_pod} -n {namespace} -- psql -U {user} {dbname}

Credential Access

High
Category
Privilege Escalation
Confidence
91% confidence
Finding

The database dump pipeline streams live application data between clusters and may expose credentials and sensitive records through process arguments, shell history, terminal logging, or interception on the operator host. Because this step can transfer entire databases, the impact includes compromise of regulated data, secrets stored in tables, and production information across trust boundaries.

Content

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

bash
# Option A (Primary / Recommended): k8clone Metadata Clone + Direct DB Logical Restore
k8clone backup --kubeconfig=~/.kube/source-config --exclude-having-owner-ref=true --local-dir=./k8clone-dump
k8clone restore --kubeconfig=~/.kube/cce-config --local-dir=./k8clone-dump.zip --restore-conf=./restore.json
# Logical DB stream (example: PostgreSQL)
kubectl exec -i {source_db_pod} -n {namespace} -- pg_dump -U {user} {dbname} | kubectl exec -i {cce_db_pod} -n {namespace} -- psql -U {user} {dbname}

Credential Access

High
Category
Privilege Escalation
Confidence
90% confidence
Finding

This section instructs users to create a static kubeconfig backed by a Base64-encoded client certificate and private key for headless access. Even though the intent is operational, embedding long-lived or reusable client-key material into a portable kubeconfig materially increases the risk of credential leakage, copying, reuse in CI runners, and unauthorized cluster access if the file is exposed.

Content

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

hcloud CCE CreateKubernetesClusterCert --cli-region=<region_id> --cluster_id= --duration=30

text

This API returns self-contained Base64-encoded client certificate and private key data (`client-certificate-data` and `client-key-data`), which can be embedded directly into a static kubeconfig that operates universally across Linux, Windows, and containerized runners without binary dependencies.

#### Verification

Chaining Abuse

High
Category
Tool Misuse
Confidence
75% confidence
Finding

Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Content

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

bash
# Debian / Ubuntu
sudo apt-get update && sudo apt-get install -y skopeo

# RHEL / CentOS / EulerOS
sudo yum install -y skopeo

Credential Access

High
Category
Privilege Escalation
Confidence
94% confidence
Finding

Exporting Secrets to filtered-secrets.json writes all non-paas.elb secret data to disk in a portable form, creating a concentration point for sensitive credentials. Even though the document warns against some secret types, the workflow still risks accidental disclosure through local files, backups, shell history, developer workstations, or CI artifacts.

Content

Scanner excerpt · references/configmap-secret-migration-guide.md (reported line 51)May include surrounding context.

bash
kubectl get secrets -n <namespace> -o json | \
  jq '.items[] | select(.metadata.name != "paas.elb")' > filtered-secrets.json

Credential Access

High
Category
Privilege Escalation
Confidence
96% confidence
Finding

This command exports all namespace Secrets except service-account tokens to secrets.yaml, which still includes other highly sensitive credentials such as database passwords, API keys, and TLS private keys. The skill context makes this somewhat understandable for migration, but it remains dangerous because it normalizes bulk extraction of secrets and may capture more material than necessary.

Content

Scanner excerpt · references/configmap-secret-migration-guide.md (reported line 69)May include surrounding context.

Export all Secrets excluding auto-generated default service account tokens

kubectl get secret -n
--field-selector=type!=kubernetes.io/service-account-token
-o yaml > secrets.yaml

text

#### Step 2: Sanitize Metadata

Credential Access

High
Category
Privilege Escalation
Confidence
89% confidence
Finding

The sanitization script processes secrets.yaml, preserving the secret payload while only removing metadata. That means sensitive material continues to reside unencrypted on disk and may be rewritten, duplicated, or exposed through editor temp files, logs, or developer systems during processing.

Content

Scanner excerpt · references/configmap-secret-migration-guide.md (reported line 97)May include surrounding context.

yaml.safe_dump_all(cleaned_docs, f)

clean_manifest('configmaps.yaml') clean_manifest('secrets.yaml') print('Sanitization completed.') "

text

Credential Access

High
Category
Privilege Escalation
Confidence
91% confidence
Finding

Applying secrets.yaml to the target cluster imports secret values into a new environment without validating whether all credentials are still appropriate, scoped correctly, or rotated. In cross-cloud migration, this can carry over legacy trust relationships and broaden blast radius if source-environment credentials remain valid elsewhere.

Content

Scanner excerpt · references/configmap-secret-migration-guide.md (reported line 106)May include surrounding context.

bash
kubectl apply -f configmaps.yaml --kubeconfig=~/.kube/cce-config
kubectl apply -f secrets.yaml --kubeconfig=~/.kube/cce-config

Credential Access

High
Category
Privilege Escalation
Confidence
91% confidence
Finding

Applying secrets.yaml to the target cluster imports secret values into a new environment without validating whether all credentials are still appropriate, scoped correctly, or rotated. In cross-cloud migration, this can carry over legacy trust relationships and broaden blast radius if source-environment credentials remain valid elsewhere.

Content

Scanner excerpt · references/configmap-secret-migration-guide.md (reported line 106)May include surrounding context.

bash
kubectl apply -f configmaps.yaml --kubeconfig=~/.kube/cce-config
kubectl apply -f secrets.yaml --kubeconfig=~/.kube/cce-config

Credential Access

High
Category
Privilege Escalation
Confidence
70% confidence
Finding

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

Content

Scanner excerpt · references/configmap-secret-migration-guide.md (reported line 156)May include surrounding context.

md
1. **Zero Secret Leakage**:
   - Never print Secret contents (`.data`) in cleartext in console transcripts or CI/CD logs.
   - Store temporary YAML secret files with restricted permissions (`chmod 600 secrets.yaml`) and purge them after application.
2. **Encryption at Rest**:
   - Verify that target CCE cluster has KMS secret encryption enabled if required for compliance:
     ```bash

Credential Access

High
Category
Privilege Escalation
Confidence
75% confidence
Finding

This command streams a logical database dump directly from a source cluster pod into a target cluster pod using live administrative kubeconfig contexts. In a migration guide that already handles Secrets and production workloads, this creates a high-risk path for bulk sensitive data transfer without guardrails such as encryption validation, audit controls, least-privilege identities, or warnings about operator terminal/log exposure.

Content

Scanner excerpt · references/k8clone-migration-guide.md (reported line 172)May include surrounding context.

  1. Stream Database Data Directly via Kubectl Pipe:
    bash
    # PostgreSQL streaming dump & load
    kubectl --kubeconfig=~/.kube/source-config -n <namespace> exec -i <source-pg-pod> -- \
      pg_dump -U <db-user> -d <db-name> --no-owner --clean | \
    kubectl --kubeconfig=~/.kube/cce-config -n <namespace> exec -i <cce-pg-pod> -- \
      psql -U <db-user> -d <db-name>
    

Credential Access

High
Category
Privilege Escalation
Confidence
75% confidence
Finding

The target-side kubectl exec/psql half of the pipe participates in direct cross-cluster ingestion of potentially sensitive database contents. If copied into production without safeguards, it can bypass established migration controls, expose data to local shell history or process observation, and encourage use of broad kubeconfig access for database operations.

Content

Scanner excerpt · references/k8clone-migration-guide.md (reported line 174)May include surrounding context.

md
# PostgreSQL streaming dump & load
   kubectl --kubeconfig=~/.kube/source-config -n <namespace> exec -i <source-pg-pod> -- \
     pg_dump -U <db-user> -d <db-name> --no-owner --clean | \
   kubectl --kubeconfig=~/.kube/cce-config -n <namespace> exec -i <cce-pg-pod> -- \
     psql -U <db-user> -d <db-name>

   # Redis replication / data reload

Credential Access

High
Category
Privilege Escalation
Confidence
72% confidence
Finding

The Redis example encourages dumping live key material through kubectl exec, which may expose application data or secrets stored in Redis and normalizes ad hoc extraction from production workloads. Although shown as an example, it lacks boundaries, authentication guidance, and safe handling controls for data that may be highly sensitive.

Content

Scanner excerpt · references/k8clone-migration-guide.md (reported line 178)May include surrounding context.

psql -U -d

Redis replication / data reload

kubectl --kubeconfig=~/.kube/source-config -n exec -i --
redis-cli --raw dump | ...

text
4. **Scale Application Deployments to Target Replicas**:

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 35)May include surrounding context.

md
# Related Commands Quick Reference

This document provides a consolidated quick-reference table of verified Huawei Cloud KooCLI (`hcloud`) and Kubernetes commands used in CCE migrations. All `hcloud` commands require `--cli-region` (or `--region` for `update-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 · SKILL.md (reported line 79)May include surrounding context.

md
# Related Commands Quick Reference

This document provides a consolidated quick-reference table of verified Huawei Cloud KooCLI (`hcloud`) and Kubernetes commands used in CCE migrations. All `hcloud` commands require `--cli-region` (or `--region` for `update-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 · SKILL.md (reported line 150)May include surrounding context.

md
# Related Commands Quick Reference

This document provides a consolidated quick-reference table of verified Huawei Cloud KooCLI (`hcloud`) and Kubernetes commands used in CCE migrations. All `hcloud` commands require `--cli-region` (or `--region` for `update-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 · references/acceptance-criteria.md (reported line 59)May include surrounding context.

md
# Related Commands Quick Reference

This document provides a consolidated quick-reference table of verified Huawei Cloud KooCLI (`hcloud`) and Kubernetes commands used in CCE migrations. All `hcloud` commands require `--cli-region` (or `--region` for `update-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 · references/acceptance-criteria.md (reported line 68)May include surrounding context.

md
# Related Commands Quick Reference

This document provides a consolidated quick-reference table of verified Huawei Cloud KooCLI (`hcloud`) and Kubernetes commands used in CCE migrations. All `hcloud` commands require `--cli-region` (or `--region` for `update-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 · references/cli-installation-guide.md (reported line 9)May include surrounding context.

md
# Related Commands Quick Reference

This document provides a consolidated quick-reference table of verified Huawei Cloud KooCLI (`hcloud`) and Kubernetes commands used in CCE migrations. All `hcloud` commands require `--cli-region` (or `--region` for `update-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 · references/cli-installation-guide.md (reported line 77)May include surrounding context.

md
# Related Commands Quick Reference

This document provides a consolidated quick-reference table of verified Huawei Cloud KooCLI (`hcloud`) and Kubernetes commands used in CCE migrations. All `hcloud` commands require `--cli-region` (or `--region` for `update-kubeconfig`).

---

Static analysis

Detected: suspicious.exposed_secret_literal

File appears to expose a hardcoded API secret or token.

Critical
Code
suspicious.exposed_secret_literal
Location
references/velero-migration-guide.md:26