Back to skill

Security audit

huawei-cloud-mrs-host-alarm-diagnose

Security checks for vulnerabilities and agentic risk

Overview

This skill is a plausible MRS alarm-diagnosis tool, but it ships credential-bearing API clients with unsafe TLS defaults and reachable mutation APIs that exceed its stated read-only purpose.

Review before installing. Use only least-privileged read-only MRS/LakeWatch accounts, turn TLS verification on with a trusted CA before sending credentials, and remove or block Manager mutation APIs such as user creation/deletion, alarm clearing/shielding, and task abortion unless they are moved to a separate admin-only workflow with explicit confirmation.

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/lakewatch_api_config.yaml:48
Finding
TLS Certificate Verification Disabled for Credential-Bearing API Requests## Vulnerability Details **File Location**: `scripts/lakewatch_api_config.yaml:48`, `scripts/manager_api_config.yaml:56`, `scripts/lakewatch_api_client.py:160-164`, `scripts/manager_api_client.py:162-166` **Vulnerability Type**: Improper certificate validation **Risk Level**: High ### Vulnerable Code `scripts/lakewatch_api_config.yaml:48`: ```yaml verify_ssl: false ``` `scripts/manager_api_config.yaml:56`: ```yaml verify_ssl: false ``` `scripts/lakewatch_api_client.py:160-164`: ```python ctx = ssl.create_default_context() verify_ssl = config.get("crypto", {}).get("verify_ssl", True) if not verify_ssl: ctx.check_hostname = False ctx.verify_mode = ssl.CERT_NONE ``` `scripts/manager_api_client.py:162-166`: ```python ctx = ssl.create_default_context() verify_ssl = config.get("crypto", {}).get("verify_ssl", True) if not verify_ssl: ctx.check_hostname = False ctx.verify_mode = ssl.CERT_NONE ``` The LakeWatch client subsequently sends the decrypted username and password to the configured endpoint in `scripts/lakewatch_api_client.py:207-224`: ```python encrypted_password = auth["encrypted_password"] if not encrypted_password: raise RuntimeError("encrypted_password not set in config") password = decrypt(encrypted_password, self.config) url = f"{scheme}://{host}:{port}/lakewatch/v1/system/get-token" payload = json.dumps({"username": username, "password": password}).encode("utf-8") ctx = _build_ssl_context(self.config) req = urllib.request.Request( url=url, data=payload, headers={"Content-Type": "application/json"}, method="POST", ) try: res = urllib.request.urlopen(req, context=ctx) ``` ### Technical Analysis Both shipped configurations set `verify_ssl` to `false`. The corresponding SSL-context builders respond by disabling hostname checking and setting the verification mode to `ssl.CERT_NONE`. Encryption without certif ...[truncated 2119 chars]
Remediation
## Remediation Suggestions 1. Change both shipped configurations to use certificate verification by default: ```yaml crypto: verify_ssl: true ca_cert: "/path/to/trusted/internal-ca.pem" ``` 2. Require a valid system-trusted certificate or an explicitly configured internal CA for private deployments. 3. Fail closed when the CA file is missing, malformed, or cannot validate the configured endpoint. 4. Do not transmit passwords, Basic credentials, tokens, or cookies when `ssl.CERT_NONE` is active. 5. If an exceptional insecure mode must remain available, require an explicit per-invocation opt-in, display a prominent warning, and prohibit credential-bearing requests in that mode. 6. Add tests confirming that untrusted certificates, expired certificates, and hostname mismatches are rejected.

T05 · Unauthorized Access and Privilege Escalation

Warning
Location
scripts/manager_api_apis/permission.yaml:20
Finding
Read-Only Diagnostic Skill Exposes Ungated Account and Cluster Mutation APIs## Vulnerability Details **File Location**: `scripts/manager_api_apis/permission.yaml:20-29`, `scripts/manager_api_apis/permission.yaml:41-50`, `scripts/manager_api_apis/command.yaml:32-41`, `scripts/manager_api_client.py:541-544`, `scripts/manager_api_client.py:698-700` **Vulnerability Type**: Excessive administrative capability without enforced confirmation **Risk Level**: Medium ### Vulnerable Code `scripts/manager_api_apis/permission.yaml:20-29` exposes user creation: ```yaml create_user: # 2.20.42 创建用户 # 权限: 用户管理 desc: "创建用户" method: "POST" path: "/api/v2/permission/users" required_params: - user_data optional_params: [] request_body_template: "{user_data}" ``` `scripts/manager_api_apis/permission.yaml:41-50` exposes user deletion: ```yaml delete_user: # 2.20.44 删除用户 # 权限: 用户管理 desc: "删除用户" method: "DELETE" path: "/api/v2/permission/users" required_params: - user_data optional_params: [] request_body_template: "{user_data}" ``` `scripts/manager_api_apis/command.yaml:32-41` exposes task abortion: ```yaml abort_command: # 2.9.3 中止指定任务 # 中止指定任务的执行 # 权限: 集群管理 desc: "中止指定任务" method: "PUT" path: "/api/v2/commands/{command_id}/abort" required_params: - command_id optional_params: [] ``` `scripts/manager_api_client.py:541-544` prepares mutation requests without enforcing confirmation: ```python if method in ("POST", "PUT", "DELETE"): headers["Content-Type"] = "application/json" body = _build_request_body(api_def, params) req_data = body if body else b"{}" ``` `scripts/manager_api_client.py:698-700` dispatches the selected API directly: ```python result = call_api(config, args.api, params, output_file=args.output, auth_mode=args.auth) ``` This conflicts with the authorization boundary declared in `SKILL.md:78-81`: ```markdown > **Important constraints:** > 1. **Read-on ...[truncated 2872 chars]
Remediation
## Remediation Suggestions 1. Remove user-management, command-abortion, and other mutation API definitions from this diagnostic Skill. 2. Enforce a deny-by-default read-only policy in `manager_api_client.py`, allowing only explicitly reviewed GET endpoints and narrowly defined non-mutating diagnostic POST endpoints. 3. Do not rely solely on the HTTP method: maintain an explicit allowlist of permitted diagnostic API names. 4. If mutation support is genuinely required, move it to a separate administrative tool with separate credentials and authorization documentation. 5. For any retained mutation operation, require all of the following: - An explicit mutation-mode flag. - An operation-specific confirmation token. - A clear preview of the target and request body. - Interactive confirmation immediately before transmission. - Audit logging that excludes credentials and session secrets. 6. Configure the Skill with a least-privileged Manager account that lacks user-management and cluster-management mutation permissions. 7. Add automated tests proving that `create_user`, `delete_user`, `abort_command`, and all other non-approved mutation APIs are rejected in diagnostic mode.
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • 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
  • Memory PoisoningPersistent Context Injection, Context Window Stuffing, Memory Manipulation
Findings (105)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
The skill is presented as a narrowly scoped alarm-diagnosis workflow, but the documented behavior exposes more general-purpose authenticated API access patterns, including generic manager queries, proxy access, credential handling, token/cookie caching, and references to broader client capabilities. That mismatch is dangerous because an agent may invoke privileged functionality outside the user’s expected scope, increasing the chance of overbroad data access or misuse of cluster-management interfaces.

Memory Manipulation

High
Category
Memory Poisoning
Content
| collectd | Abnormal collection plugin or excessively high collection frequency | Check whether there is an fd leak: `ls /proc/<pid>/fd \| wc -l` |
| rsyslog | A surge in log volume causes log writing to consume CPU | Check disk usage via `get_host_resource` |
| python/shell script | Scheduled task or abnormal script infinite loop | Confirm the script path and parameters |
| kswapd0 | Kernel paging process, indicating insufficient memory | Confirm the memory and swap state via `get_host_resource` |

---
Confidence
85% confidence
Finding
Skill manipulates agent memory, state, or stored context. Memory corruption can alter personality, override safety rules, or cause unpredictable behavior.

Missing User Warnings

High
Confidence
99% confidence
Finding
Restarting sshd on a faulty host without warning is materially risky because a configuration mistake can immediately sever remote administrative access, potentially locking operators out of the machine. In this skill context, the instruction follows SSH configuration guidance, making it especially dangerous if the user applies unverified config changes and then restarts the daemon remotely.

Tool Parameter Abuse

High
Category
Tool Misuse
Content
**HTTP/HTTPS type**: Manually request the health check URL to confirm reachability:
```bash
curl -k <monitor.info>
```

| Phenomenon | Conclusion |
Confidence
93% confidence
Finding
The recommendation to use `curl -k <monitor.info>` disables TLS certificate validation while contacting a URL sourced from configuration. This trains operators to bypass transport security and can hide man-in-the-middle interception or let them trust a malicious endpoint during diagnosis, especially if `monitor.info` is altered.

Chaining Abuse

High
Category
Tool Misuse
Content
>
> **ACS has no GC logs**: If high CPU is located on the acs process, it cannot be investigated through GC logs; thread state must be analyzed directly via jstack.
>
> **messages log permission**: The omm user may not have permission to read `/var/log/messages`; sudo is required. If API collection fails, it is recommended that the user manually view it with sudo on the node.

```bash
python3 lakewatch_api_client.py -a collect_alarm_log_data \
Confidence
75% confidence
Finding
Tool calls are chained to bypass individual safety checks or escalate capabilities beyond what any single tool call would allow.

Lp1

High
Category
MCP Least Privilege
Confidence
75% confidence
Finding
The skill uses 'file_read' capability that is not listed in its permissions. This may indicate deceptive intent or missing permission declarations.

Lp1

High
Category
MCP Least Privilege
Confidence
75% confidence
Finding
The skill uses 'env' capability that is not listed in its permissions. This may indicate deceptive intent or missing permission declarations.

Lp1

High
Category
MCP Least Privilege
Confidence
75% confidence
Finding
The skill uses 'network' capability that is not listed in its permissions. This may indicate deceptive intent or missing permission declarations.

Context-Inappropriate Capability

High
Confidence
98% confidence
Finding
The clear_alarm endpoint allows changing the alarm state by marking alarms as cleared, which can hide active issues or corrupt incident response records. In a skill advertised as root-cause diagnosis only, this is dangerous because an LLM or caller could invoke it without the operator understanding that they are performing a destructive administrative action rather than analysis.

Context-Inappropriate Capability

High
Confidence
98% confidence
Finding
The shield_alarms endpoint can suppress alarms for services or hosts, directly reducing monitoring visibility and potentially allowing ongoing failures or malicious activity to go unnoticed. That capability is especially risky in a diagnostic skill because the surrounding context encourages users to trust the agent for investigation, while the hidden side effect is operational suppression rather than diagnosis.

Vague Triggers

Medium
Confidence
89% confidence
Finding
The trigger phrases include broad terms such as 'root cause' and generic alarm-diagnosis wording that could match unrelated troubleshooting conversations. Overbroad activation is risky because it can cause the skill to engage in contexts where cluster credentials, logs, or privileged APIs should not be touched, creating unnecessary exposure and cross-task confusion.

Vague Triggers

Medium
Confidence
87% confidence
Finding
The internal keyword list is similarly ambiguous and lacks exclusion logic, so the skill may be selected for requests that only partially resemble alarm diagnosis. In a skill that can reach authenticated monitoring and manager APIs, accidental invocation expands the attack surface and may expose sensitive operational data without a sufficiently specific user intent.

Autonomous Decision Making

Medium
Category
Excessive Agency
Content
- The password MUST be encrypted with `--encrypt-password` and stored in `scripts/lakewatch_api_config.yaml` (`auth.encrypted_password`). Never store the plaintext password.
- **Security Rules**:
  - Never expose the LakeWatch password in conversation or command output
  - Never ask the user to input the plaintext password in conversation; use the interactive `--encrypt-password` flow
  - The token is cached locally with owner-only file permissions (Win: `%TEMP%\lakewatch_token\`, Linux: `/tmp/lakewatch_token/`)

### 3. MRS Manager Credential Configuration (Manager Mode)
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.

Autonomous Decision Making

Medium
Category
Excessive Agency
Content
- The password MUST be encrypted with `--encrypt-password` and stored in `scripts/lakewatch_api_config.yaml` (`auth.encrypted_password`). Never store the plaintext password.
- **Security Rules**:
  - Never expose the LakeWatch password in conversation or command output
  - Never ask the user to input the plaintext password in conversation; use the interactive `--encrypt-password` flow
  - The token is cached locally with owner-only file permissions (Win: `%TEMP%\lakewatch_token\`, Linux: `/tmp/lakewatch_token/`)

### 3. MRS Manager Credential Configuration (Manager Mode)
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.

Context-Inappropriate Capability

Medium
Confidence
93% confidence
Finding
The skill is described as API-driven and read-only, but it embeds manual troubleshooting steps that instruct shell execution, direct network probing, and interactive SFTP authentication outside that scope. In an agent setting, this can blur trust boundaries and cause an operator or downstream automation to perform unreviewed actions on production hosts based on skill output.

Intent-Code Divergence

Medium
Confidence
95% confidence
Finding
The file explicitly says the skill is restricted to read-only operations, yet later recommends state-changing actions such as creating directories, changing permissions, restarting services, and reconfiguring systems. This inconsistency can mislead users or orchestration layers into trusting the skill as safe while it still promotes potentially disruptive remediation commands.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The markdown includes commands that can alter filesystem state, permissions, database/service availability, and deployment consistency without any explicit warning about operational risk, prerequisites, rollback, or least-privilege expectations. In practice, this increases the chance of accidental damage or unsafe copy-paste execution in production environments.

Sudo/Root Execution

Medium
Category
Privilege Escalation
Content
**Repair suggestions**:
- Check and set the `$GAUSSDATA` environment variable
- Create the directory and grant permissions: `mkdir -p ${GAUSSDATA}/../dumpData/iam/operatelog/ && chmod 755 ${GAUSSDATA}/../dumpData/iam/operatelog/`
- Clean up disk space

### 2. Database connection exception
Confidence
80% confidence
Finding
Commands invoke sudo or root privileges. Verify this elevated access is necessary and justified.

Context-Inappropriate Capability

Medium
Confidence
87% confidence
Finding
The knowledge base explicitly instructs use of the `gather_log` API to collect a KrbServer log package, which can expand the skill from targeted read-only diagnosis into bulk log collection. In this Kerberos-diagnosis context, those logs may contain sensitive authentication, host, and system details, so invoking collection without tighter scoping and approval increases data-exposure risk beyond the skill's stated analyze/diagnose purpose.

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The log-collection step lacks any warning that the gathered package may include sensitive Kerberos, authentication, host, and operational data. In a security-sensitive service like KrbServer, omission of a sensitivity warning makes accidental over-collection and inappropriate sharing more likely, especially when the instruction is presented as a routine fallback step.

Context-Inappropriate Capability

Medium
Confidence
95% confidence
Finding
The guide explicitly instructs operators to run host shell commands such as `ps aux` outside the declared Manager API workflow. That expands the skill from read-only/API-driven diagnosis into direct host-level interaction, which can bypass platform guardrails, encourage unsafe execution, and create inconsistency with the manifest's claim that no commands outside the knowledge base are fabricated.

Context-Inappropriate Capability

Medium
Confidence
98% confidence
Finding
This section contains multiple system-level commands (`iostat`, `/proc` inspection, `ss`, `cat /proc/sys/fs/file-nr`) that direct host introspection beyond the skill's declared API-only scope. Even though they are framed as diagnostic checks, they normalize unrestricted shell access and could expose sensitive system/process data or be misused by an agent or operator following the document too literally.

Description-Behavior Mismatch

Medium
Confidence
92% confidence
Finding
The repair guidance directs users to perform SSH access, modify startup scripts or configuration files, restart services, and run tooling like `jmap`. This materially exceeds the manifest's representation that diagnosis is driven by built-in API clients and knowledge-base content, creating a scope mismatch that can mislead downstream systems into trusting the skill as non-invasive when it actually prescribes privileged host actions.

Context-Inappropriate Capability

Medium
Confidence
95% confidence
Finding
The skill explicitly instructs the operator to manually run `iostat -x 1 5` on the alarm node when API/log checks are inconclusive. This breaks the stated API/knowledge-base-only operating model and expands the skill from bounded diagnosis into direct host command execution guidance, which can normalize out-of-band shell access and bypass the intended safety and audit controls of the skill framework.

Missing User Warnings

Medium
Confidence
96% confidence
Finding
The skill recommends system-wide kernel and shell limit changes such as modifying ip_local_port_range, enabling tcp_tw_reuse, and appending a higher nofile limit to /etc/profile, but it does not warn that these changes affect the whole host and may have stability, compatibility, or security consequences. In an operational diagnosis skill, users may copy these commands directly during incident response, increasing the risk of unsafe persistent configuration changes without validation, rollback planning, or environment-specific review.

Static analysis

Detected: suspicious.insecure_tls_verification

HTTPS certificate verification is disabled.

Warn
Code
suspicious.insecure_tls_verification
Location
scripts/lakewatch_api_client.py:163

HTTPS certificate verification is disabled.

Warn
Code
suspicious.insecure_tls_verification
Location
scripts/manager_api_client.py:165