Back to skill

Security audit

grafana-insepction

Security checks for vulnerabilities and agentic risk

Overview

This is a coherent Grafana inspection skill, but users should handle Grafana credentials and generated reports carefully.

Install only if you are comfortable giving the skill a least-privilege Grafana token and saving inspection outputs locally. Prefer a Viewer-scoped token, avoid passing API keys on the command line, keep config and generated reports out of shared folders and source control, and explicitly set dashboard_uids or disable auto_discover when you do not want broad dashboard enumeration.

Vulnerability Patterns
  • 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
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
Findings (1)

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/api_inspect.py:291
Finding
Grafana API Key Exposed Through Command-Line Arguments## Vulnerability Details **File Location**: `scripts/api_inspect.py`, lines 291-292 **Vulnerability Type**: Command-line secret exposure **Risk Level**: Medium ```python grafana_url = sys.argv[1] api_key = sys.argv[2] ``` ### Technical Analysis The standalone command-line interface accepts the Grafana API key directly through `sys.argv`. Command-line arguments are not an appropriate secret transport mechanism because they may be recorded in shell history, process execution telemetry, audit logs, terminal logs, or automation-system logs. Depending on operating-system access controls, command arguments may also be observable through process-inspection interfaces while the program is running. The value is subsequently used as a bearer token for authenticated Grafana API requests. Although the code does not deliberately disclose the key, accepting it through a command argument unnecessarily exposes sensitive authentication material outside the process. ### Attack Path 1. An operator invokes `api_inspect.py` and supplies a valid Grafana API key as the second command-line argument. 2. The complete command may be retained in shell history, process metadata, audit records, or execution logs. 3. A local user, monitoring service, support operator, or compromised log collector with access to one of those sources retrieves the key. 4. The attacker submits the recovered key as a bearer token to the configured Grafana instance. 5. The attacker accesses every Grafana API operation and resource authorized to that key until it is revoked or expires. This path requires access to local process information, command history, or collected execution logs. It does not independently grant access beyond the permissions assigned to the exposed token. ### Impact Assessment A recovered key can provide authenticated access to the Grafana organization within the token's assigned privileges. For a recommended Viewer-level key, this may expose dashboard definitions, datasource metadat ...[truncated 425 chars]
Remediation
## Remediation Suggestions 1. Remove support for supplying the API key as a command-line argument. 2. Read the key from a dedicated environment variable, such as `GRAFANA_API_KEY`, or from a secret manager. 3. For interactive execution, accept the key through a non-echoing prompt using Python's `getpass` module. 4. If configuration-file storage is supported, require restrictive file permissions and clearly warn users not to commit the file to source control. 5. Update usage documentation and examples so they never place credentials directly in command lines. 6. Fail securely when no credential is available rather than silently making unauthenticated requests. 7. Rotate any key that has already been used through command-line arguments if command histories or execution logs may be accessible. 8. Continue using a least-privilege Grafana service account token, preferably limited to Viewer permissions and only the required organization or resources.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
Findings (14)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
The supplied code is clearly aligned with Grafana inspection via API and includes multi-dashboard batch inspection plus automatic discovery of dashboards. However, the declared description explicitly says the skill supports '浏览器截图' (browser screenshots), and this code chunk contains no browser automation, screenshot capture, or related tooling. Since screenshot capability is presented as part of the skill’s supported functionality but is absent from the actual code shown, this is a description-to-behavior mismatch. There are no signs of unrelated or suspicious extra capabilities beyond the declared API inspection/reporting behavior.

Tp4

High
Category
MCP Tool Poisoning
Confidence
90% confidence
Finding
The code aligns with several declared aspects: Grafana automated inspection, API data inspection, batch handling of dashboards via dashboard_uids, and automatic discovery via auto_discover/discover_limit. However, the declared description explicitly includes browser screenshot capability, and the provided code chunk contains only API-driven inspection orchestration and report generation. Since a notable advertised capability is not represented in the supplied code, this is a description-behavior mismatch for the examined chunk.

Lp3

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding
The skill documentation describes behavior that requires network access, local file reads, and local file writes, but it declares no explicit tool scope or permission boundaries. In an agent environment, this increases the chance of over-broad execution and unclear user consent, especially because the skill handles API credentials and writes reports/screenshots to disk.

Vague Triggers

Medium
Confidence
92% confidence
Finding
The activation phrase '执行 Grafana 巡检' is broad and does not constrain target instances, dashboards, credential source, or write destinations. In an agent setting, ambiguous invocation can cause unintended network access, discovery of additional dashboards, and generation of local artifacts beyond what the user explicitly scoped.

Missing User Warnings

Medium
Confidence
94% confidence
Finding
The skill instructs users to create and place an API key into a local config file without any warning about secret handling, storage protection, rotation, or least privilege. Since Grafana API keys grant access to monitoring data and are commonly reused operational credentials, insecure handling can lead to credential disclosure and unauthorized access.

Vague Triggers

Medium
Confidence
90% confidence
Finding
The repeated OpenClaw example reinforces an unconstrained trigger phrase without any safety qualifiers. Because this skill can use API keys, perform network inspection, auto-discover dashboards, and write reports, a vague invocation increases the risk of unintended or over-broad actions.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
The skill explicitly stores inspection results and likely screenshots on disk, but it does not warn users that these artifacts may contain sensitive operational data such as dashboard names, metrics, incident indicators, or environment details. In monitoring contexts, saved reports can become a secondary data exposure risk if written to shared or insecure locations.

Natural-Language Policy Violations

Medium
Confidence
96% confidence
Finding
The file's title, docstrings, CLI usage text, and status messages are all presented in Chinese, which imposes a specific language on users. Under the language/locale policy, this is a natural-language policy issue because the skill does not offer any user-selectable language option or document that it is intentionally limited to a Chinese-speaking context.

Natural-Language Policy Violations

Medium
Confidence
94% confidence
Finding
The module docstring states the script purpose in Chinese, and all user-facing console strings in this file are also fixed to Chinese. This imposes a specific language/locale on users without any visible opt-in, selection mechanism, or documented region-specific justification, matching the language-policy violation criteria.

Natural-Language Policy Violations

Low
Confidence
91% confidence
Finding
The skill documentation is written entirely in Chinese and does not indicate that users can choose another language or locale. Per the policy criteria, forcing a specific language without user opt-in is a natural-language policy violation unless the locale constraint is explicitly documented and justified.

Natural-Language Policy Violations

Low
Confidence
89% confidence
Finding
The entire skill documentation, including the suggested invocation phrase, is presented only in Chinese and does not indicate that other languages are supported or that Chinese is a deliberate regional requirement. This can amount to a language policy issue when a skill constrains interaction to a specific language without user opt-in.

Intent-Code Divergence

Low
Confidence
92% confidence
Finding
SKILL.md 在“快速开始”中指示使用 `python main.py config.json`,但在后续“使用方式 1:命令行”又指示使用 `python inspect.py config.json`(L51),而文件结构中列出的脚本也没有 `inspect.py`,只有 `main.py`。这属于文档内部对实际执行入口的矛盾描述,可能误导用户调用不存在或错误的脚本。

Intent-Code Divergence

Low
Confidence
90% confidence
Finding
文件结构部分仅列出 `api_inspect.py`、`main.py` 和 `config.json`,但前文命令行使用示例要求执行 `inspect.py`(L51)。这不是简单遗漏,而是对技能实际可执行组件的相互矛盾描述,会造成对技能真实行为入口的误解。

Missing User Warnings

Low
Confidence
85% confidence
Finding
The script writes Markdown and JSON inspection reports to local files that include Grafana URL, dashboard metadata, alert information, and datasource details. While this is expected functionality for an inspection tool, it can still expose operationally sensitive information if the files are created in shared directories, picked up by other automation, or retained without access controls.

Static analysis

Detected: suspicious.install_untrusted_source

Install source points to URL shortener or raw IP.

Warn
Code
suspicious.install_untrusted_source
Location
scripts/config.json:2