Back to skill

Security audit

korea-air-quality

Security checks for vulnerabilities and agentic risk

Overview

This Korea air-quality skill is mostly purpose-aligned, but it needs review because it stores API keys and precise user locations in local plaintext and generates executable cron-agent instructions from unvalidated user input.

Review before installing or automating. Use environment variables rather than setup-provider --airkorea-api-key where possible, avoid --json output when configuring secrets, restrict access to the data directory, do not commit or sync data files, and inspect any cron-plan JSON before registering it, especially if user or region values came from chat input.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Insecure Skill Coding PracticesFinds exploitable flaws such as hardcoded secrets or command injection
  • 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 (3)

T01 · Skill Instruction Hijacking

Error
Location
scripts/air_quality.py:457
Finding

Untrusted values are embedded in scheduled agent instructions and shell-like commands

Content
View full analysis
Dict[str, Any]: if kind == "morning-brief": schedule_expr = f"{minute or 0} {hour or 7} * * *" command = f"python scripts/air_quality.py morning-brief {region or ''} --user {user} --provider airkorea".strip() message = f"C:\\Users\\김태완\\.openclaw\\workspace\\skills\\korea-air-quality 에서 `{command}` 를 실행해. 결과를 한국어로 그대로 전달해." name = f"대기질 아침 브리핑 ({user})" else: schedule_expr = f"{minute or 0} * * * *" command = f"python scripts/air_quality.py alert-check --user {user} --json --provider airkorea" message = f"C:\\Users\\김태완\\.openclaw\\workspace\\skills\\korea-air-quality 에서 `{command}` 를 실행해. 신규 hit만 한국어로 알려줘. 신규 hit가 없으면 정확히 NO_REPLY 만 출력해." name = f"대기질 알림 점검 ({user})" return {"name": name, "schedule": {"kind": "cron", "expr": schedule_expr, "tz": "Asia/Seoul"}, "payload": {"kind": "agentTurn", "message": message, "timeoutSeconds": 120}, "sessionTarget": "current", "delivery": {"mode": "announce"}, "notes": {"kind": kind, "region": region, "metric": metric, "threshold": threshold}} ``` ### Technical Analysis The `user` and `region` arguments are untrusted command-line inputs. They are interpolated directly into both: 1. A shell-like command string. 2. An OpenClaw `agentTurn` instruction that tells an agent to execute that command. No allowlist validation, quoting, escaping, or structural separation of executable arguments is applied. Consequently, specially crafted input can alter the apparent command or append additional natural-language instructions to the scheduled agent message. This is especially dangerous because the generat ...[truncated 1459 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Error
Location
scripts/air_quality.py:601
Finding

AirKorea API key is exposed through command-line arguments, plaintext storage, and setup output

Content
View full analysis
int: cfg = load_config() cfg["provider"] = args.provider if args.airkorea_api_key is not None: cfg["airkorea_api_key"] = args.airkorea_api_key save_config(cfg) print(json.dumps(cfg, ensure_ascii=False, indent=2) if args.json else f"기본 provider 저장 완료: {args.provider}") return 0 ``` The documented setup workflow passes the key directly on the command line: ```bash python scripts/air_quality.py setup-provider airkorea --airkorea-api-key "YOUR_KEY" --json ``` Configuration is persisted through the following generic writer: ```python def _write_json(path: Path, payload: Dict[str, Any]) -> None: ensure_data_dir() path.write_text(json.dumps(payload, ensure_ascii=False, indent=2), encoding="utf-8") ``` ### Technical Analysis The setup workflow exposes the AirKorea API key through three channels: 1. The key is accepted as a command-line argument, making it potentially visible in shell history and process listings. 2. The key is stored in plaintext in `data/config.json`. 3. When `--json` is used, the complete configuration object, including the unredacted key, is printed to standard output. Although `cmd_show_config()` separately redacts the key, the setup command does not apply the same protection. Standard output is commonly captured by agent transcripts, terminal logs, automation systems, and job runners, increasing the likelihood of unintended credential retention. The generic JSON writer does not explicitly enforce owner-only file permissions. Actual accessibility therefore depends on the process umask and preexisting file permissions. ### Attack Path 1. A user follows the documented setup command and supplies a valid ...[truncated 1024 chars]
Remediation
View remediation

T09 · Insecure Skill Coding Practices

Warning
Location
scripts/air_quality.py:584
Finding

Identity-linked precise location data is stored in plaintext without explicit access controls

Content
View full analysis
int: prefs = load_preferences() users = prefs.setdefault("users", {}) info = users.setdefault(args.user, {}) info["default_location"] = {"lat": args.lat, "lon": args.lon, "label": args.label} save_preferences(prefs) print(f"기본 위치 저장 완료: {args.user} -> ({args.lat}, {args.lon})" + (f" / {args.label}" if args.label else "")) return 0 def cmd_show_default(args: argparse.Namespace) -> int: prefs = load_preferences() info = prefs.get("users", {}).get(args.user, {}) payload = {"user": args.user, "default_region": info.get("default_region"), "default_location": info.get("default_location")} print(json.dumps(payload, ensure_ascii=False, indent=2) if args.json else (json.dumps(payload, ensure_ascii=False) if info else "저장된 기본 설정이 없습니다.")) return 0 ``` The storage helper writes the data using inherited filesystem permissions: ```python def ensure_data_dir() -> None: DATA_DIR.mkdir(parents=True, exist_ok=True) def _read_json(path: Path, default: Dict[str, Any]) -> Dict[str, Any]: ensure_data_dir() if not path.exists(): return default return json.loads(path.read_text(encoding="utf-8")) def _write_json(path: Path, payload: Dict[str, Any]) -> None: ensure_data_dir() path.write_text(json.dumps(payload, ensure_ascii=False, indent=2), encoding="utf-8") ``` ### Technical Analysis The Skill stores exact latitude and longitude values together with a user-controlled identifier and optional human-readable label. The README demonstrates identifiers such as channel-specific Telegram IDs, which can link coordinates to a particular account. The data is written as plaintext JSON. The im ...[truncated 1631 chars]
Remediation
View remediation
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • 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 (19)

Tp4

High
Category
MCP Tool Poisoning
Confidence
94% confidence
Finding

The declared description presents an air-quality query and briefing skill, but the referenced behavior also includes provider/API-key configuration storage and cron job draft generation. That mismatch can mislead users and reviewers about the real authority of the skill, making it easier to smuggle in persistence or scheduled execution capabilities with broader security implications.

Content

No source excerpt is available for this finding.

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
87% confidence
Finding

The skill describes capabilities that imply file reads/writes, network access, and possibly environment/config handling, but it does not declare any explicit tool scope or permissions. This weakens reviewability and least-privilege enforcement, increasing the risk that the skill can access or persist more data than users or operators expect.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill instructs storing a user's default region or coordinates in a local file without explicitly warning that location data will persist. Persistent storage of location information is privacy-sensitive and can expose home/work patterns or enable unintended retention beyond the user's expectations.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The document’s operational instructions and examples are entirely in Korean, which can impose a specific language on users without any stated opt-in or justification. The policy allows locale constraints when explicitly documented and justified, but this file does not indicate that the skill is intended only for Korean-speaking or Korea-specific users.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The document uses Korean to define the skill's objective and behavior, and states the skill queries South Korea air quality, but does not indicate any user language choice or opt-in for locale/language behavior. Under the policy rule, forcing a specific language without user opt-in is a natural-language policy concern.

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.

External Transmission

Medium
Category
Data Exfiltration
Confidence
60% confidence
Finding

Data is being sent to an external URL. This could be legitimate telemetry or data exfiltration. Manual review is recommended.

Content

Scanner excerpt · scripts/air_quality.py (reported line 25)May include surrounding context.

python
OPENMETEO_GEOCODING_URL = "https://geocoding-api.open-meteo.com/v1/search"
OPENMETEO_AIR_URL = "https://air-quality-api.open-meteo.com/v1/air-quality"
OPENMETEO_WEATHER_URL = "https://api.open-meteo.com/v1/forecast"

REGION_ALIASES = {
    "서울": "서울특별시",

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The geocoding requests hard-code "language": "ko", and the script’s user-facing output and generated cron messages are also fixed in Korean. This is a natural-language locale policy issue because the skill enforces a specific language without any user opt-in or configurable language selection.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
97% confidence
Finding

The manifest explicitly describes a workflow priority of current location first, then saved default region, then manual region input. In code, after checking explicit latitude/longitude, the function next uses args.region before consulting stored user defaults, so the implemented fallback order diverges from the described behavior.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill generates agent-turn payloads that contain explicit local filesystem paths and shell-like execution instructions. In an agent ecosystem, embedding operational instructions and environment-specific paths can create an unintended command-construction surface, leak host environment details, and normalize downstream execution of generated text rather than treating it as data.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The skill stores per-user default regions and precise latitude/longitude on disk in plain JSON without any consent flow, retention control, access restriction, or encryption. This is sensitive location data, and if the host or workspace is shared or compromised, it enables privacy leakage and profiling of user habits and whereabouts.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

The README explicitly states that the skill stores user-specific preferences, location coordinates, alert rules, and alert history under local files, but it does not clearly warn that this data is privacy-sensitive or advise operators on handling, retention, access control, or backup exposure. In a skill that handles location-based lookups and notifications, undocumented privacy risks can lead to accidental leakage through file sharing, permissive filesystem access, logs, or inclusion in backups.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
86% confidence
Finding

The skill states that alert rules and deduplication state are stored locally, but it does not clearly disclose this persistence to users. While less sensitive than raw coordinates, ongoing monitoring preferences and notification history still reveal behavioral patterns and can create privacy surprises if retained silently.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
78% confidence
Finding

The file consistently frames the skill around Korean-region usage and Korean-language interaction examples, but does not state whether language is selectable or limited by design. Because policy violations include forcing a specific language or locale without user opt-in, this should be clarified unless the locale restriction is explicitly documented and justified.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

This markdown file explicitly proposes saving user preferences and alert rules in local JSON files, which affects user data persistence. Under the markdown criteria for missing warnings, the description should disclose that user location-related preferences and monitoring rules will be stored.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
93% confidence
Finding

Most of the operational notes are written in Korean, which effectively imposes a language requirement on readers without explicit opt-in or justification. Under the language/locale policy, natural-language content should not force a specific language unless the locale constraint is clearly documented or the user is given a choice.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
78% confidence
Finding

This markdown file documents reading AIRKOREA_API_KEY or a key from data/config.json, which involves access to credentials or sensitive configuration. While it is implementation-oriented, the notes do not include any warning or handling guidance about storing, exposing, or protecting the API key.

Content

No source excerpt is available for this finding.

Intent-Code Divergence

Low
Category
Not specified by scanner
Confidence
95% confidence
Finding

The priority list says saved default region is used before a region name found in the user's message (L10-L11), but the rationale later states that when the user directly says a region name, it should take precedence over saved information (L18). This is an active contradiction in the documentation about how location resolution should behave.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
Confidence
89% confidence
Finding

The manifest centers the skill on Korean air quality lookup, briefing, alerts, default-region handling, and comparisons. The code additionally calls a separate weather forecast API and incorporates temperature, precipitation probability, and weather conditions into the output, which is broader than the stated air-quality-only purpose.

Content

No source excerpt is available for this finding.