Back to skill

Security audit

Qweather

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent QWeather weather-query helper, with ordinary API-key handling risks users should manage carefully.

Install only if you are comfortable storing a QWeather API key locally. Use the API host copied directly from QWeather, do not commit qweather_config.json after adding a real key, restrict file access where possible, and avoid sharing logs or command output that include full request URLs.

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

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:36
Finding

Unvalidated API Host Can Redirect Authentication Credentials

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 36-47
Vulnerability Type: Unvalidated endpoint configuration and credential disclosure
Risk Level: Medium

Vulnerable Code

text
配置有效后,所有 API 请求的基地址为 `https://{api_host}`,认证方式为在 URL 查询参数中附加 `key={api_key}`。

## 核心查询流程

**必须严格遵循以下顺序,不可跳过步骤:**

### 第一步:GeoAPI 获取城市 LocationID

使用城市名称(中文)调用 GeoAPI 获取精确位置信息。**禁止直接使用城市名称调用天气 API。**

GET https://{api_host}/geo/v2/city/lookup?location={城市名}&range=cn&number=3&key={api_key}

Technical Analysis

The Skill reads api_host from an editable configuration file and uses it directly as the destination for authenticated HTTPS requests. It checks only whether the value is empty; it does not require the host to belong to QWeather, reject IP addresses or embedded credentials, restrict ports, or define redirect handling.

Because the API key is included in the query string, every request to a substituted host discloses the credential to that host. HTTPS only secures transport to the selected server; it does not establish that the selected server is an authorized QWeather endpoint.

Attack Path

  1. An attacker or compromised installation process modifies qweather_config.json.
  2. The attacker sets api_host to a domain under their control while leaving a valid QWeather API key configured.
  3. A user invokes the Skill for a weather query.
  4. The Skill constructs an HTTPS request to the attacker-controlled host.
  5. The complete query string, including key={api_key}, is delivered to the attacker.
  6. The attacker extracts the key and may use it against QWeather until it is revoked or expires.

Impact Assessment

Successful exploitation exposes the configured QWeather API credential and permits unauthorized API consumption within the credential's assigned quota and permissions. It also allows weather-query inputs, such as requested city names, to be sent to an unintended server. This f ...[truncated 192 chars]

Remediation
View remediation

Remediation Suggestions

  • Validate api_host against an explicit allowlist of official QWeather API domains.
  • Parse the configured value as a hostname rather than interpolating an unrestricted string.
  • Reject URL schemes, paths, query strings, fragments, embedded credentials, IP literals, unexpected ports, and unapproved subdomains in api_host.
  • Disable redirects or validate the destination of every redirect before forwarding authentication data.
  • Fail closed with a clear configuration error when validation fails.
  • Prefer a fixed, trusted API base URL where deployment requirements permit it.
  • Add tests covering malicious values such as attacker.example, user@host, IP addresses, added paths, and redirecting endpoints.
  • Rotate the API key if requests may already have been sent to an untrusted host.

T09 · Insecure Skill Coding Practices

Warning
Location
SKILL.md:16
Finding

API Credential Is Stored in Plaintext and Included in Request URLs

Content
View full analysis

Vulnerability Details

File Location: SKILL.md, lines 16-20 and line 36
Vulnerability Type: Plaintext secret storage and query-string credential exposure
Risk Level: Medium

Vulnerable Code

json
{
  "api_host": "",
  "api_key": ""
}
text
配置有效后,所有 API 请求的基地址为 `https://{api_host}`,认证方式为在 URL 查询参数中附加 `key={api_key}`。

The same query-string authentication pattern is documented in references/api_reference.md, lines 9-14:

text
在请求 URL 的查询参数中传入 `key={api_key}`:

https://{api_host}/v7/weather/now?location=101010100&key={api_key}

`api_host` 和 `api_key` 从项目根目录的 `qweather_config.json` 读取。

Technical Analysis

The Skill directs users to store a long-lived API credential in the plaintext file qweather_config.json. No file-permission requirement, secret-store integration, exclusion rule, or output-redaction requirement is specified.

It also places the credential in URL query parameters. Depending on the calling environment, complete URLs can be exposed through command history, process inspection, shell tracing, proxy logs, HTTP access logs, monitoring systems, exception messages, or debugging output. The repository currently contains an empty placeholder rather than an active credential, so no hardcoded secret was discovered during this audit; the risk arises when users follow the documented configuration procedure.

Attack Path

  1. A user writes a valid QWeather API key into qweather_config.json.
  2. The file remains readable to another local account, is accidentally committed, is included in an archive, or is collected by an overly broad backup or diagnostic process.
  3. Alternatively, the Skill constructs a command or request URL containing the key as a query parameter.
  4. A local process observer or logging component captures the plaintext file or complete URL.
  5. The observer extracts the key and uses it for unauthorized QWeather API requests.

Impa

...[truncated 478 chars]

Remediation
View remediation

Remediation Suggestions

  • Load the API key from a dedicated secret manager or protected environment variable rather than a project file.
  • If file-based configuration is unavoidable, separate secrets from non-sensitive settings and require restrictive permissions such as owner read/write only.
  • Add the local credential file to version-control ignore rules and provide a non-secret example file.
  • Never print, echo, or persist complete authenticated request URLs.
  • Redact key values from errors, traces, telemetry, and debugging output.
  • Use an authorization header instead of a query parameter if the QWeather API supports it.
  • If query-string authentication is mandatory, construct requests without exposing the full URL in shell command arguments and ensure clients, proxies, and monitoring systems redact the parameter.
  • Document key rotation and revocation procedures, and rotate any credential suspected of appearing in logs or repositories.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
Findings (4)

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The file specifies Chinese-only inputs and outputs in natural language, including requiring Chinese city names and mandating user-facing time/output formatting in Chinese. This is a locale/language constraint presented as a blanket rule rather than an optional or user-selected preference.

Content

No source excerpt is available for this finding.

Ae4

Medium
Category
analysis-evasion
Confidence
80% confidence
Finding

Suspicious Unicode normalization or mixed-script content

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The document instructs passing the API key in the URL query string, which can leak secrets through logs, browser history, analytics, reverse proxies, monitoring tools, and referrer-like handling in surrounding systems. In an agent skill context, this is more dangerous because tool calls and request URLs may be captured in traces or debugging output, increasing the chance of credential exposure.

Content

No source excerpt is available for this finding.