Back to skill

Security audit

Alibabacloud Elasticsearch Instance Diagnose

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent Elasticsearch diagnostic tool, but it needs review because it handles powerful credentials unsafely and includes under-scoped destructive administration examples.

Do not install or use this in production without tightening it first: use a least-privilege diagnostic ES user, require HTTPS with certificate validation for authenticated requests, avoid curl command-line passwords, remove command-line AccessKey setup, pin and verify CLI/plugin installs, and treat any DELETE/PUT/POST remediation as an approved change with backups and explicit human authorization.

Vulnerability Patterns
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (5)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/check_es_instance_health.py:1672
Finding

Elasticsearch administrator credentials may be transmitted over plaintext HTTP

Content
View full analysis
:9200" export ES_USERNAME="elastic" export ES_PASSWORD="" ``` ### Technical Analysis HTTP Basic authentication encodes the username and password but does not encrypt them. When `ES_ENDPOINT` is scheme-less, the script automatically prepends `http://`. It then sends the credentials through `curl -u`, which creates a Basic Authorization header over the unencrypted connection. The network requests are necessary for engine-level Elasticsearch diagnosis, but transmitting administrator credentials over HTTP is not necessary. HTTPS with certificate validation should be the mandatory default. ### Attack Path 1. An operator configures a scheme-less endpoint or follows the documented HTTP example. 2. The script normalizes the endpoint to `http://`. 3. An authenticated Elasticsearch probe is issued using `curl -u`. 4. An attacker with visibility into the network path captures the Authorization header. 5. The attacker decodes and reuses the Elasticsearch credentials. 6. If the documented `elastic` account is used, the ...[truncated 401 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/check_es_instance_health.py:1693
Finding

Elasticsearch passwords are exposed through curl process arguments

Content
View full analysis
Dict[str, Any]: import json as _json import subprocess as _subprocess cmd = [ "curl", "-sS", "--connect-timeout", _ct_s, "-m", _mt_s, "-u", f"{username}:{password}", "-X", method.upper(), f"{endpoint_url}{path}", ] if body is not None: cmd += ["-H", "Content-Type: application/json", "-d", body] proc = _subprocess.run( cmd, capture_output=True, text=True, check=False, timeout=subprocess_timeout ) ``` The documentation uses the same pattern: ```bash curl -sS --connect-timeout 10 --max-time 30 \ -u "${ES_USERNAME:-elastic}:${ES_PASSWORD}" \ "http://${ES_ENDPOINT#http://}/_cluster/health?pretty" ``` ### Technical Analysis Using an argument list and avoiding `shell=True` correctly prevents shell command injection. It does not, however, protect secrets placed directly in the process argument vector. The expanded value of `-u` can be visible while `curl` runs through process inspection, audit systems, tracing tools, crash diagnostics, or process telemetry available to sufficiently privileged local users and monitoring agents. Shell examples have the same weakness because variable expansion occurs before `curl` starts. The code attempts to redact timeout errors that might contain the argument list, but that does not address operating-system-level exposure of the live process arguments. ### Attack Path 1. The operator exports `ES_PASSWORD` and starts the health checker. 2. The checker constructs `curl` arguments containing `username:password`. 3. `curl` runs with the ...[truncated 541 chars]
Remediation
View remediation

T05 · Unauthorized Access and Privilege Escalation

Error
Location
SKILL.md:107
Finding

The Skill requests Elasticsearch superuser credentials instead of a least-privilege diagnostic role

Content
View full analysis
:9200" export ES_USERNAME="elastic" export ES_PASSWORD="" ``` The Skill further states: ```text Auth: Same ES_USERNAME / ES_PASSWORD as for HTTP (Basic auth over TLS). ``` ### Technical Analysis The implemented Elasticsearch probes primarily read cluster health, node statistics, thread-pool statistics, index metadata, cluster settings, and allocation information. These diagnostic operations do not inherently require the built-in `elastic` superuser. Requesting an administrator credential violates least privilege and materially increases the consequences of the transport and process-argument weaknesses. The Skill correctly describes its control-plane activity as read-only, but it does not establish an equivalent read-only authorization boundary for the Elasticsearch data plane. ### Attack Path 1. The operator follows the Skill setup instructions and configures the built-in `elastic` administrator account. 2. The health checker uses that credential for routine read-only diagnostic probes. 3. The credential is exposed through plaintext HTTP, process arguments, local telemetry, or another operational failure. 4. The attacker reuses the credential. 5. Because the credential is administrative, the attacker can perform actions far beyond health diagnosis. ### Impact Assessment A compromised superuser credential may grant complete Elasticsearch cluster control, including reading sensitive indexed data, modifying cluster settings, managing users and roles, changing index settings, and deleting indices. These privileges substantially exceed those required by the declared read-only diagnostic function. ...[truncated 4 chars]
Remediation
View remediation

T08 · Insecure Dependencies

Warning
Location
references/cli-installation-guide.md:22
Finding

Mutable CLI binaries and plugins are installed without integrity verification or version pinning

Content
View full analysis
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
references/cli-installation-guide.md:72
Finding

Credential setup guide places Alibaba Cloud AccessKeys in command-line arguments

Content
View full analysis
\ --access-key-secret \ --region cn-hangzhou ``` The primary Skill policy explicitly prohibits this behavior: ```text NEVER use aliyun configure set (or similar) to pass literal AccessKey ID/Secret on the command line. ``` ### Technical Analysis The linked installation guide instructs users to substitute real AccessKey values directly into command-line arguments. Those values may be retained in shell history, exposed through process inspection while the command runs, collected by endpoint monitoring, or included in terminal transcripts. This directly contradicts the mandatory security rules in `SKILL.md`. Because the installation guide is referenced as the prerequisite setup document, users may reasonably follow the unsafe command despite the safer policy elsewhere. ### Attack Path 1. A user opens the linked installation guide. 2. The user replaces the placeholders with real Alibaba Cloud AccessKey values. 3. The shell records the command in history, or a local process/audit observer captures its arguments. 4. An attacker obtains the AccessKey ID and secret. 5. The attacker uses the credentials to call Alibaba Cloud APIs. 6. The accessible resources and actions are determined by the RAM permissions attached to the compromised principal. ### Impact Assessment Compromise grants all cloud permissions assigned to the AccessKey's RAM identity. Depending on the account configuration, this can include reading Elasticsearch logs and metrics, accessing other cloud products, modifying resources, or incurring charges. The impact is not limited to the El ...[truncated 68 chars]
Remediation
View remediation
Vulnerability Patterns
  • Tool MisuseTool Parameter Abuse, Chaining Abuse, Unsafe Defaults
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (62)

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
> - **Prefer** `python3 scripts/check_es_instance_health.py` for the standard control-plane + CMS bundle so subprocess calls stay aligned with this repo.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
> - **Prefer** `python3 scripts/check_es_instance_health.py` for the standard control-plane + CMS bundle so subprocess calls stay aligned with this repo.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
> - **Prefer** `python3 scripts/check_es_instance_health.py` for the standard control-plane + CMS bundle so subprocess calls stay aligned with this repo.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
> - **Prefer** `python3 scripts/check_es_instance_health.py` for the standard control-plane + CMS bundle so subprocess calls stay aligned with this repo.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
> - **Prefer** `python3 scripts/check_es_instance_health.py` for the standard control-plane + CMS bundle so subprocess calls stay aligned with this repo.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
> - **Prefer** `python3 scripts/check_es_instance_health.py` for the standard control-plane + CMS bundle so subprocess calls stay aligned with this repo.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
> - **Prefer** `python3 scripts/check_es_instance_health.py` for the standard control-plane + CMS bundle so subprocess calls stay aligned with this repo.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
> - **Prefer** `python3 scripts/check_es_instance_health.py` for the standard control-plane + CMS bundle so subprocess calls stay aligned with this repo.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
> - **Prefer** `python3 scripts/check_es_instance_health.py` for the standard control-plane + CMS bundle so subprocess calls stay aligned with this repo.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
> - **Prefer** `python3 scripts/check_es_instance_health.py` for the standard control-plane + CMS bundle so subprocess calls stay aligned with this repo.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
> - **Prefer** `python3 scripts/check_es_instance_health.py` for the standard control-plane + CMS bundle so subprocess calls stay aligned with this repo.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
> - **Prefer** `python3 scripts/check_es_instance_health.py` for the standard control-plane + CMS bundle so subprocess calls stay aligned with this repo.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
> - **Prefer** `python3 scripts/check_es_instance_health.py` for the standard control-plane + CMS bundle so subprocess calls stay aligned with this repo.

Ae1

High
Category
analysis-evasion
Confidence
100% confidence
Finding

Referenced artifact was not completely inspected

Content

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

md
> - **Prefer** `python3 scripts/check_es_instance_health.py` for the standard control-plane + CMS bundle so subprocess calls stay aligned with this repo.

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
93% confidence
Finding

The skill instructs the agent to construct and execute a curl command using environment-controlled values for both credentials and the endpoint, with only minimal normalization. Because ES_ENDPOINT is not validated against an allowlist or expected hostname pattern, a malicious or compromised environment could redirect the authenticated request to an attacker-controlled server and capture Elasticsearch credentials.

Content

Scanner excerpt · references/es-api-call-failures.md (reported line 80)May include surrounding context.

*) BASE="http://${BASE}" ;; esac BASE="${BASE%/}" curl -sS --connect-timeout 10 --max-time 30 -u "${ES_USERNAME:-elastic}:${ES_PASSWORD}" "${BASE}/_cluster/health?pretty"

text

For **`https://`**, add **`--cacert /path/to/ca.pem`** (or **`-k`** for short, non-production tests) if the system trust store does not trust the cluster certificate. **Do not** switch from **`http://` to `https://`** as a blind fix for **`000`/timeout** when **`DescribeInstance` `protocol` is `HTTP`** — prefer allowlist / SG / path checks; see [SKILL.md](../SKILL.md) §2.2 (*If `http://` does not work — when to try `https://`* and *HTTPS — prerequisites*).

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
60% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · references/es-api-catalog.md (reported line 11)May include surrounding context.

export ES_PASSWORD=""

Generic template (HTTP)

curl -sS -u "${ES_USERNAME:-elastic}:${ES_PASSWORD}"
"http://${ES_ENDPOINT#http://}/?pretty"

text

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

The documented DELETE /old_index command is a destructive API action that could be copied or executed by an agent with insufficient safeguards. Even though presented as normal Elasticsearch administration, this skill is specifically for diagnosis and troubleshooting, so including raw destructive commands without confirmation gates or environment validation makes accidental production data deletion materially more dangerous.

Content

Scanner excerpt · references/sop-configuration.md (reported line 134)May include surrounding context.

}

4. Delete old index

DELETE /old_index

text

### Case B — too many primaries on a small index

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
80% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · references/sop-disk-storage.md (reported line 61)May include surrounding context.

md
| Action | How | Notes |
|--------|-----|-------|
| Drop expired indices | `DELETE /old_index_name` | Confirm with the app owner |
| Drop `.monitoring-*` | `DELETE /.monitoring-*` | Loses built-in monitoring history in-cluster |
| Lower replicas | `PUT /index/_settings` → `number_of_replicas: 0` | Temporary; reduces redundancy |
| Prune old snapshots | `GET _cat/snapshots` then `DELETE /_snapshot/repo/snap` | Confirm backups are not needed |

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
80% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · references/sop-disk-storage.md (reported line 62)May include surrounding context.

md
| Action | How | Notes |
|--------|-----|-------|
| Drop expired indices | `DELETE /old_index_name` | Confirm with the app owner |
| Drop `.monitoring-*` | `DELETE /.monitoring-*` | Loses built-in monitoring history in-cluster |
| Lower replicas | `PUT /index/_settings` → `number_of_replicas: 0` | Temporary; reduces redundancy |
| Prune old snapshots | `GET _cat/snapshots` then `DELETE /_snapshot/repo/snap` | Confirm backups are not needed |
| Expand disk | Console / provider API | Brief impact during resize |

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
80% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · references/sop-disk-storage.md (reported line 64)May include surrounding context.

md
| Drop expired indices | `DELETE /old_index_name` | Confirm with the app owner |
| Drop `.monitoring-*` | `DELETE /.monitoring-*` | Loses built-in monitoring history in-cluster |
| Lower replicas | `PUT /index/_settings` → `number_of_replicas: 0` | Temporary; reduces redundancy |
| Prune old snapshots | `GET _cat/snapshots` then `DELETE /_snapshot/repo/snap` | Confirm backups are not needed |
| Expand disk | Console / provider API | Brief impact during resize |

**Step 4 — Alerting** so the next incident is not a surprise.

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
80% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · references/sop-disk-storage.md (reported line 92)May include surrounding context.

Step 2 — Free space urgently

bash
DELETE /old_index_name
DELETE /.monitoring-*
PUT /big_index/_settings
{

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
80% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · references/sop-disk-storage.md (reported line 93)May include surrounding context.

bash
DELETE /old_index_name
DELETE /.monitoring-*
PUT /big_index/_settings
{
  "index.number_of_replicas": 0

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
80% confidence
Finding

Tool parameters are crafted to achieve unintended or unsafe behavior. Parameter abuse can bypass intended safety checks (e.g. shell=True, --force, dangerous glob patterns).

Content

Scanner excerpt · references/sop-disk-storage.md (reported line 370)May include surrounding context.

md
GET _cat/indices?v&s=store.size:desc

DELETE /index_name

GET _all/_settings?filter_path=*.settings.index.blocks
PUT _all/_settings

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

The skill includes a direct destructive API example, DELETE /_search/scroll, with placeholder scroll IDs and no guardrails around ownership, scope, or user confirmation. In an agentic setting, this can be abused or misapplied to invalidate active scroll sessions used by applications or operators, causing workflow interruption and data retrieval failures.

Content

Scanner excerpt · references/sop-query-thread-pool.md (reported line 315)May include surrounding context.

md
POST _tasks/{task_id}/_cancel

GET /_nodes/stats/indices/search?filter_path=nodes.*.indices.search.scroll_*
DELETE /_search/scroll
{
  "scroll_id": ["scroll_id_1", "scroll_id_2"]
}

Tool Parameter Abuse

High
Category
Tool Misuse
Confidence
90% confidence
Finding

The remediation text includes a destructive example command, 'DELETE /old_index', which an operator or downstream agent could execute literally during incident response. In a diagnostic skill, suggesting deletion without stronger safeguards, placeholders, or confirmation language increases the chance of accidental data loss under pressure.

Content

Scanner excerpt · scripts/check_es_instance_health.py (reported line 883)May include surrounding context.

python
remediation=[
                "GET _cat/allocation?v",
                "GET _cat/indices?v&s=store.size:desc   # largest indices",
                "DELETE /old_index                      # drop cold indices if safe",
                "PUT _all/_settings {\"index.blocks.read_only_allow_delete\": null}  # clear read-only if set",
                "Expand disk capacity in console if needed",
            ],