Back to skill

Security audit

weather-query-ych

Security checks for vulnerabilities and agentic risk

Overview

This weather skill is mostly purpose-aligned, but it embeds and exposes a Weather.com API key, so it should be reviewed before installation.

Review this skill before installing. It does not show malicious behavior or persistence, but it contains an exposed Weather.com API key and sends weather queries to an external service. Prefer a version that removes the embedded key, documents the provider/data flow, and uses a user-controlled secret or platform-managed credential.

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

Error
Location
agent.py:5
Finding
Hardcoded Weather API Credential## Vulnerability Details **File Location**: `agent.py`, lines 5–7 **Vulnerability Type**: Hardcoded API credential and credential exposure in a URL **Risk Level**: High ```python #https://api.weather.com/v2/turbo/vt1dailyForecast?apiKey=c1ea9f47f6a88b9acb43aba7faf389d4&format=json&geocode=39.93%2C116.40&language=zh-CN&units=m api_key = "c1ea9f47f6a88b9acb43aba7faf389d4" url = f"https://api.weather.com/v2/{city}/{date}?key={api_key}" ``` ### Technical Analysis A Weather.com API key is embedded directly in the source code and is also exposed in a commented example URL. Anyone who can access the skill package or its source history can recover the credential without authentication. The implementation additionally places the key in the request query string. Although HTTPS protects the URL while it is in transit, query strings may be retained by application logs, reverse proxies, monitoring systems, debugging tools, or error reports. This unnecessarily expands the credential's exposure surface. ### Attack Path 1. An attacker obtains the distributed skill package or access to its source repository. 2. The attacker opens `agent.py` and extracts the API key from line 5 or line 6. 3. The attacker sends independent requests to Weather.com using the recovered credential. 4. Requests are attributed to the credential owner and consume the associated quota or billable usage. 5. If URLs are logged in deployed infrastructure, additional parties with log access may recover and reuse the same key. ### Impact Assessment Exploitation does not grant local operating-system privileges or code execution. Its scope is limited to the permissions and service entitlements assigned to the exposed Weather.com credential. A successful attacker may consume API quota, cause service disruption through quota exhaustion, create billing impact where usage is chargeable, and access any Weather.com operations authorized for that key.
Remediation
## Remediation Suggestions 1. Revoke and rotate the exposed API key immediately; removing it from the current file does not invalidate copies already distributed. 2. Remove the key from executable code, comments, examples, repository history, build artifacts, and deployment logs. 3. Store the replacement credential in an environment variable or managed secret store and inject it only at runtime. 4. Use the authentication mechanism recommended by the API provider, preferably an authorization header rather than a query parameter when supported. 5. Restrict the replacement credential by permitted APIs, source addresses, environments, quotas, and spending limits where the provider supports such controls. 6. Add automated secret scanning to version-control and CI workflows to prevent future credential commits. 7. Ensure exceptions, request diagnostics, and observability systems redact authentication values and request URLs containing sensitive query parameters.
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
  • Supply ChainUnpinned Dependencies, External Script Fetching, Obfuscated Code
Findings (7)

Natural-Language Policy Violations

Medium
Confidence
90% confidence
Finding
The natural-language description, examples, responses, and output format are all defined only in Chinese, including fixed Chinese response text. There is no indication that users may choose another language or that the skill is intentionally limited to a Chinese-language or region-specific deployment.

Vague Triggers

Medium
Confidence
97% confidence
Finding
The phrase '当用户询问天气时,调用本技能' defines activation in a very broad way and does not specify boundaries, exclusions, or exact trigger phrases. This can overlap with ordinary conversation about weather and may cause unintended invocation when the user is not explicitly requesting this skill.

External Transmission

Medium
Category
Data Exfiltration
Content
import requests

def get_weather(city, date):
#https://api.weather.com/v2/turbo/vt1dailyForecast?apiKey=c1ea9f47f6a88b9acb43aba7faf389d4&format=json&geocode=39.93%2C116.40&language=zh-CN&units=m
    api_key = "c1ea9f47f6a88b9acb43aba7faf389d4"
    url = f"https://api.weather.com/v2/{city}/{date}?key={api_key}"
    response = requests.get(url)
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

External Transmission

Medium
Category
Data Exfiltration
Content
import requests

def get_weather(city, date):
#https://api.weather.com/v2/turbo/vt1dailyForecast?apiKey=c1ea9f47f6a88b9acb43aba7faf389d4&format=json&geocode=39.93%2C116.40&language=zh-CN&units=m
    api_key = "c1ea9f47f6a88b9acb43aba7faf389d4"
    url = f"https://api.weather.com/v2/{city}/{date}?key={api_key}"
    response = requests.get(url)
Confidence
60% confidence
Finding
Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Natural-Language Policy Violations

Medium
Confidence
91% confidence
Finding
The code hardcodes a Chinese locale in the commented API example (`language=zh-CN`) and returns a Chinese response string, with no option for the user to choose language or locale. This can violate language/locale policy when the skill imposes a specific language without opt-in or documented regional justification.

Missing User Warnings

Medium
Confidence
98% confidence
Finding
A hard-coded API key is embedded directly in source and used in outbound requests, which exposes the credential to anyone with code access and risks unauthorized reuse, quota exhaustion, or account abuse. The commented sample URL also repeats the secret, increasing exposure further.

Missing User Warnings

Low
Confidence
87% confidence
Finding
This code constructs an external API request using user-derived input and sends it to api.weather.com, but there is no confirmation prompt, logging, print statement, or comment/docstring disclosing that user input will be transmitted off-device. For a code file, outbound network transmission should have some visible disclosure unless clearly documented elsewhere.

Static analysis

No suspicious patterns detected.