Back to skill

Security audit

huawei-cloud-cce-kubernetes-event-analyzer

Security checks for vulnerabilities and agentic risk

Overview

This skill is a disclosed read-only Huawei CCE/Kubernetes event diagnostic tool, but it should be used only with scoped cluster credentials because it touches sensitive cloud and kubeconfig access paths.

Install only in an environment where hcloud, kubectl, and kubectl-cce are trusted and where the agent has least-privilege Huawei IAM and Kubernetes RBAC for event/log reads. Prefer scoped profiles or short-lived credentials, avoid passing AK/SK in visible command lines when possible, and run the plugin in a shell that does not contain unrelated secrets.

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 (51)

Tp4

High
Category
MCP Tool Poisoning
Confidence
99% confidence
Finding
Yes, this is a mismatch. The declared description promises a specific operational capability: querying and analyzing Kubernetes events in Huawei Cloud CCE clusters, including troubleshooting scenarios like FailedScheduling, FailedMount, and ImagePullBackOff. However, the provided code chunk contains only an __init__.py docstring with no executable logic, integrations, APIs, triggers, or resource access related to Kubernetes, CCE, events, or LTS. Based on the supplied code alone, the actual behavior is merely a generic module placeholder, which does not substantiate the declared purpose.

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
The declared purpose centers on querying and analyzing CCE/Kubernetes events and historical event data. This code chunk only retrieves LogConfig CRs related to CCE plugin logging configuration, presumably to help locate where events are sent in LTS. That is a supporting/configuration-discovery function, not actual event retrieval or analysis. Because the primary behavior is materially different from the declared event-analysis purpose and accesses different resources (LogConfig CRs rather than Event objects or LTS event records), this is a mismatch.

Credential Access

High
Category
Privilege Escalation
Content
Query and analyze Kubernetes Events in Huawei Cloud CCE clusters to identify warnings, repeated failure patterns, affected resources, and useful diagnosis handoffs. The skill supports a current Event view through `kubectl` and a historical Event view through LTS.

**Architecture**: `python3 scripts/huawei-cloud.py` dispatcher -> `kubectl` through external kubeconfig or `kubectl cce` for current Events / `kubectl cce` LogConfig discovery plus `hcloud LTS ListLogs` for historical Events -> filtering and grouping -> diagnosis handoff.

**Execution Method**: Invoke only the bundled dispatcher. Do not query Kubernetes Events with raw Python Kubernetes SDK calls, direct Kubernetes API calls, or ad hoc cloud commands. The `huawei_get_cce_events` implementation invokes `kubectl` internally: external kubeconfig access first, then the `kubectl cce` plugin fallback.
Confidence
86% confidence
Finding
The skill is explicitly designed to obtain and use Kubernetes access material, including temporary kubeconfig and cloud credentials, through shell-invoked tooling. Even though it says not to print or persist secrets, any skill that handles live credentials and kubeconfig materially increases the attack surface for credential theft, accidental disclosure, or misuse if the dispatcher, logs, or shell invocation are not tightly controlled.

Credential Access

High
Category
Privilege Escalation
Content
**Architecture**: `python3 scripts/huawei-cloud.py` dispatcher -> `kubectl` through external kubeconfig or `kubectl cce` for current Events / `kubectl cce` LogConfig discovery plus `hcloud LTS ListLogs` for historical Events -> filtering and grouping -> diagnosis handoff.

**Execution Method**: Invoke only the bundled dispatcher. Do not query Kubernetes Events with raw Python Kubernetes SDK calls, direct Kubernetes API calls, or ad hoc cloud commands. The `huawei_get_cce_events` implementation invokes `kubectl` internally: external kubeconfig access first, then the `kubectl cce` plugin fallback.

**Related Skills**:
- `huawei-cloud-kubectl-cce-installer` - Install `kubectl` and the `kubectl-cce` plugin required for cluster access
Confidence
86% confidence
Finding
Referencing related tooling that installs cluster-access components reinforces that this skill depends on privileged access paths to Kubernetes and cloud APIs. The danger is contextual: a read-only diagnostic skill still becomes security-sensitive when it can access kubeconfig and invoke cluster tooling from a shell environment.

Credential Access

High
Category
Privilege Escalation
Content
**Capabilities**:
- Query current Kubernetes Events across a cluster or in a namespace
- Read Events through external `kubectl` kubeconfig access or `kubectl cce`
- Query historical Event records from LTS within an explicit time window
- Filter and group Events by type, reason, namespace, resource, and timestamps
- Check the current status of supported resources referenced by Events
Confidence
87% confidence
Finding
The capability list confirms access to current events, LTS records, and resource-status checks through authenticated cluster/cloud paths. This broadens exposure from just event text to potentially sensitive operational metadata, making credential handling and output redaction critical in case the skill is abused or misconfigured.

Credential Access

High
Category
Privilege Escalation
Content
### 1. Runtime Dependencies

- Python 3.8+ for the dispatcher and result processing
- `hcloud` (KooCLI) for cluster lookup and temporary external kubeconfig generation
- `kubectl` for current Event reads
- `kubectl-cce` when the cluster has no usable external endpoint; see [kubectl-cce.md](references/kubectl-cce.md)
- `hcloud` LTS command support and the Cloud Native Log Collection add-on (`log-agent`) with a `default-event` Event-to-LTS `LogConfig`. `huawei_query_k8s_events_from_lts` reads `logconfigs.logging.openvessel.io` through `kubectl cce`, then invokes `hcloud LTS ListLogs` using the configured LTS IDs.
Confidence
89% confidence
Finding
The runtime dependency on hcloud, kubectl, kubectl-cce, and LTS access means the skill operates with multiple authenticated command-line clients. That creates several possible leakage points—process arguments, logs, temp files, plugin configs, and shell history—despite the stated read-only intent.

Credential Access

High
Category
Privilege Escalation
Content
### 2. Credential Configuration

- External kubeconfig access uses hcloud credential priority: explicit tool parameters > local hcloud profile > environment variables.
- The `kubectl cce` fallback requires AK/SK and the target cluster's `project_id` from explicit tool parameters or environment variables; encrypted hcloud profile credentials cannot be reused by the plugin. When `project_id` is available, the implementation passes it explicitly as `kubectl cce --project-id <project-id>`.
- LTS queries require valid Huawei Cloud credentials and an authorized project.
Confidence
93% confidence
Finding
This section explicitly describes using explicit AK/SK, environment variables, and project identifiers for cluster access. Credentials supplied via tool parameters or environment variables are high-risk because they are commonly exposed via logs, process listings, crash dumps, or inherited subprocess environments.

Credential Access

High
Category
Privilege Escalation
Content
- LTS queries require valid Huawei Cloud credentials and an authorized project.

**Security Rules**:
- Never print, persist, or hardcode AK/SK, security tokens, kubeconfig content, or temporary client credentials.
- Never use `echo $HUAWEI_AK` or `echo $HUAWEI_SK` to inspect credentials.
- Prefer a local hcloud profile for external kubeconfig access.
- Use least-privilege IAM identities and read-only Kubernetes RBAC permissions.
Confidence
78% confidence
Finding
The presence of explicit security rules shows awareness, but it also confirms the skill handles highly sensitive kubeconfig and temporary client credentials. In this context the issue is not that the text says 'never print secrets'; it is that the skill’s normal operation requires touching secrets at all, which is risky in an agent-executed shell environment.

Credential Access

High
Category
Privilege Escalation
Content
**Security Rules**:
- Never print, persist, or hardcode AK/SK, security tokens, kubeconfig content, or temporary client credentials.
- Never use `echo $HUAWEI_AK` or `echo $HUAWEI_SK` to inspect credentials.
- Prefer a local hcloud profile for external kubeconfig access.
- Use least-privilege IAM identities and read-only Kubernetes RBAC permissions.

**Optional Environment Fallback**:
Confidence
76% confidence
Finding
The environment fallback encourages patterns where secrets may reside in long-lived environment variables. While common operationally, this is still a security weakness in shared or multi-tool runtimes because child processes and diagnostics may inherit or expose those variables.

Credential Access

High
Category
Privilege Escalation
Content
| Permission | Purpose |
| ---------- | ------- |
| `cce:cluster:get` | Inspect cluster external endpoint availability |
| `cce:cluster:createCert` | Generate temporary kubeconfig for external `kubectl` access |
| `lts:logs:search` | Query historical Event records in LTS |

The effective Kubernetes identity also needs read-only `get` and `list` permission for Events in the target namespace or cluster.
Confidence
85% confidence
Finding
The required permission `cce:cluster:createCert` is particularly sensitive because it enables generation of temporary kubeconfig for cluster access. Even for read-only diagnostics, the ability to mint access material can be abused for broader cluster reconnaissance or lateral movement if combined with weak RBAC or output leakage.

Credential Access

High
Category
Privilege Escalation
Content
## KooCLI Command Format Standard

Users invoke the dispatcher rather than raw `hcloud` commands. For current Event queries, the dispatcher internally uses hcloud only to inspect the CCE cluster and generate a temporary external kubeconfig when appropriate.

```bash
python3 scripts/huawei-cloud.py huawei_get_cce_events \
Confidence
86% confidence
Finding
Generating temporary external kubeconfig through the dispatcher is a sensitive operation because it transforms cloud credentials into Kubernetes API access material. In agent workflows, this makes the skill more dangerous than a simple log reader, since compromise of the dispatcher or its outputs can expose cluster access.

Credential Access

High
Category
Privilege Escalation
Content
Follow these rules:

- Use `key=value` parameters and quote values containing spaces or special shell characters.
- Do not print or persist credentials, security tokens, or temporary kubeconfig files.
- Use exact `cluster_id` values for cluster-scoped queries.
- Keep LTS queries time-bounded with both `start_time` and `end_time`.
Confidence
74% confidence
Finding
The documented warning not to print or persist credentials is good practice, but from a security review perspective it indicates the workflow passes through secret-bearing files and tokens. The danger comes from relying on operator discipline instead of enforceable controls in a shell-based system.

Credential Access

High
Category
Privilege Escalation
Content
region=cn-north-4 cluster_id=<cluster-id> event_type=all limit=100
```

The tool returns only Warning Events by default, using the Kubernetes API server-side field selector. It first uses the external endpoint with a temporary kubeconfig; it then falls back to `kubectl cce`. For large clusters, full Event history can be substantial; query all types only after the user explicitly requests it with `event_type=all`.

### 2. Historical Events From LTS
Confidence
83% confidence
Finding
This section reiterates that current event access uses temporary kubeconfig first and then falls back to plugin-based authenticated access. Multiple auth paths increase complexity and the chance of accidental credential leakage, especially when shell commands and plugins are involved.

Credential Access

High
Category
Privilege Escalation
Content
| `cluster_id` | Required | Exact CCE cluster ID | N/A |
| `ak` | Optional | Explicit AK for access paths that support it | profile/environment fallback |
| `sk` | Optional | Explicit SK for access paths that support it | profile/environment fallback |
| `project_id` | Required for `kubectl cce`; optional otherwise | Target cluster's Huawei Cloud project ID | hcloud profile/IAM/environment fallback for external kubeconfig access |

### Current Event Query Parameters
Confidence
91% confidence
Finding
Accepting `ak`, `sk`, `project_id`, and `security_token` as parameters is a direct credential-handling risk. Parameterized secrets are especially dangerous because they may be captured by agent traces, telemetry, shell history, or process inspection, turning a read-only diagnostic workflow into a credential-exposure vector.

Credential Access

High
Category
Privilege Escalation
Content
| Symptom | Likely Cause | Action |
| ------- | ------------ | ------ |
| External kubeconfig access fails | No external endpoint, invalid profile, or missing CCE permission | Verify `cce:cluster:get` and `cce:cluster:createCert`; the tool then tries `kubectl cce` |
| `kubectl cce` fallback fails | Plugin missing or plugin credentials unavailable | Install/configure the plugin using [kubectl-cce.md](references/kubectl-cce.md) |
| LTS query finds no default Event stream | Default Event collection is not enabled or has not finished provisioning | Enable default Event collection through the log-agent add-on, then retry |
| LTS query returns no records | Time window, keywords, retention, or event collection does not match | Narrow or correct the window and verify the default LTS group and stream |
Confidence
79% confidence
Finding
The troubleshooting section confirms fallback behavior around external kubeconfig access and plugin credentials, reinforcing that credential acquisition is part of normal operation. The more authentication branches a skill has, the more opportunities there are for unsafe storage, verbose error output, or misuse of privileged access.

Credential Access

High
Category
Privilege Escalation
Content
# kubectl-cce Usage

`huawei_get_cce_events` uses `kubectl` to read Events. It first uses a temporary kubeconfig through the cluster external endpoint. When no external endpoint is available, it falls back to the `kubectl cce` plugin.

## Install
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
# kubectl-cce Usage

`huawei_get_cce_events` uses `kubectl` to read Events. It first uses a temporary kubeconfig through the cluster external endpoint. When no external endpoint is available, it falls back to the `kubectl cce` plugin.

## Install
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
# kubectl-cce Usage

`huawei_get_cce_events` uses `kubectl` to read Events. It first uses a temporary kubeconfig through the cluster external endpoint. When no external endpoint is available, it falls back to the `kubectl cce` plugin.

## Install
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
# kubectl-cce Usage

`huawei_get_cce_events` uses `kubectl` to read Events. It first uses a temporary kubeconfig through the cluster external endpoint. When no external endpoint is available, it falls back to the `kubectl cce` plugin.

## Install
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
# kubectl-cce Usage

`huawei_get_cce_events` uses `kubectl` to read Events. It first uses a temporary kubeconfig through the cluster external endpoint. When no external endpoint is available, it falls back to the `kubectl cce` plugin.

## Install
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
# kubectl-cce Usage

`huawei_get_cce_events` uses `kubectl` to read Events. It first uses a temporary kubeconfig through the cluster external endpoint. When no external endpoint is available, it falls back to the `kubectl cce` plugin.

## Install
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
# kubectl-cce Usage

`huawei_get_cce_events` uses `kubectl` to read Events. It first uses a temporary kubeconfig through the cluster external endpoint. When no external endpoint is available, it falls back to the `kubectl cce` plugin.

## Install
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
# kubectl-cce Usage

`huawei_get_cce_events` uses `kubectl` to read Events. It first uses a temporary kubeconfig through the cluster external endpoint. When no external endpoint is available, it falls back to the `kubectl cce` plugin.

## Install
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
# kubectl-cce Usage

`huawei_get_cce_events` uses `kubectl` to read Events. It first uses a temporary kubeconfig through the cluster external endpoint. When no external endpoint is available, it falls back to the `kubectl cce` plugin.

## Install
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Credential Access

High
Category
Privilege Escalation
Content
# kubectl-cce Usage

`huawei_get_cce_events` uses `kubectl` to read Events. It first uses a temporary kubeconfig through the cluster external endpoint. When no external endpoint is available, it falls back to the `kubectl cce` plugin.

## Install
Confidence
60% confidence
Finding
Code accesses credential files (SSH keys, AWS credentials, etc.). This could indicate credential theft attempts.

Static analysis

No suspicious patterns detected.