Back to skill

Security audit

GOG Cleanup

Security checks for vulnerabilities and agentic risk

Overview

This skill does what it says: it finds stale GOG games, emails a digest, and creates Apple Reminders, with no evidence of hidden persistence or unrelated behavior.

Install only if you are comfortable with a script reading your workspace GOG and mail config, sending an HTML email through your personal Himalaya account, and adding Apple Reminders. Use EMAIL_TO, SKIP_EMAIL, or SKIP_REMINDERS for tighter control, and avoid scheduled runs unless you trust the GOG metadata source or the email HTML escaping is fixed.

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/gog-cleanup.sh:65
Finding
Unescaped GOG Metadata Allows HTML Injection into Email Digests<![CDATA[ ## Vulnerability Details **File Location**: `scripts/gog-cleanup.sh`, lines 65-79 **Vulnerability Type**: HTML injection caused by missing output encoding **Risk Level**: Medium ### Vulnerable Code ```bash email_subject="🧹 GOG Cleanup: ${game_count} game(s) to consider uninstalling" email_body="<html><body style='font-family:system-ui,sans-serif;color:#333;max-width:600px;margin:0 auto;padding:20px;'>" email_body+="<h2 style='color:#8b5cf6;'>🧹 GOG Game Cleanup Report</h2>" email_body+="<p>You have <strong>${game_count} installed game(s)</strong> that haven't been played in ${STALE_DAYS}+ days:</p>" email_body+="<table style='width:100%;border-collapse:collapse;margin:16px 0;'>" email_body+="<tr style='background:#f3f4f6;text-align:left;'><th style='padding:8px;border:1px solid #e5e7eb;'>Game</th><th style='padding:8px;border:1px solid #e5e7eb;'>Last Played</th><th style='padding:8px;border:1px solid #e5e7eb;'>Install Path</th></tr>" for line in "${lines[@]}"; do IFS=$'\t' read -r id name last_played install_path <<< "$line" email_body+="<tr><td style='padding:8px;border:1px solid #e5e7eb;'>${name}</td><td style='padding:8px;border:1px solid #e5e7eb;'>${last_played}</td><td style='padding:8px;border:1px solid #e5e7eb;font-size:0.85em;'>${install_path}</td></tr>" done ``` ### Technical Analysis The values `name`, `last_played`, and `install_path` originate from `config/gog_library.json`. They are interpolated directly into an HTML document without context-appropriate HTML encoding. Consequently, a metadata value containing HTML markup is interpreted as part of the message rather than displayed as text. For example, a crafted game name could introduce an external image, deceptive link, or modified table content. Whether scripts or other active elements execute depends on the recipient's email client, and most modern clients restrict JavaScript. However, remote resources, misleading links, and HTML-based content spoofing may remain effective ...[truncated 2296 chars]
Remediation
<![CDATA[ ## Remediation Suggestions Apply HTML output encoding to every dynamic value before inserting it into the message body. At minimum, encode `&`, `<`, `>`, `"`, and `'`. A shell helper can perform the required escaping: ```bash html_escape() { local value=$1 value=${value//&/&amp;} value=${value//</&lt;} value=${value//>/&gt;} value=${value//\"/&quot;} value=${value//\'/&#39;} printf '%s' "$value" } ``` Escape each field immediately before constructing the table row: ```bash safe_name=$(html_escape "$name") safe_last_played=$(html_escape "$last_played") safe_install_path=$(html_escape "$install_path") email_body+="<tr><td style='padding:8px;border:1px solid #e5e7eb;'>${safe_name}</td><td style='padding:8px;border:1px solid #e5e7eb;'>${safe_last_played}</td><td style='padding:8px;border:1px solid #e5e7eb;font-size:0.85em;'>${safe_install_path}</td></tr>" ``` Additional hardening measures: 1. Prefer a structured HTML-generation library or template engine that escapes interpolated values by default. 2. Consider sending a plain-text digest if rich HTML formatting is not essential. 3. Validate the expected types and formats of all fields in `gog_library.json` before processing them. 4. Restrict write access to the library file and secure any process that generates or imports it. 5. Add tests containing characters such as `<`, `>`, `&`, quotes, and sample HTML elements to verify that metadata is rendered strictly as text. 6. Ensure temporary email files retain restrictive permissions and are removed reliably with an `EXIT` trap, including when Himalaya or the script terminates unexpectedly. ]]>
Vulnerability Patterns
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • 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 (3)

Tp4

High
Category
MCP Tool Poisoning
Confidence
95% confidence
Finding
The skill declares a benign cleanup purpose, but the documented behavior includes outbound email, Apple Reminders modification, and reading local configuration/data files without any explicit permission model or user-consent declaration. Even if the behavior matches the prose description, these actions cross trust boundaries by accessing local data and triggering external side effects, which can expose personal information or perform unintended actions when the skill is run in an agent ecosystem.

Context-Inappropriate Capability

Medium
Confidence
91% confidence
Finding
The manifest says the skill should find stale GOG games, email the list, and add reminders. Sending email is in scope, but directly inspecting a separate Himalaya mail configuration file to extract account details is a credential/configuration access capability not obviously required by that purpose, especially since the recipient can be supplied explicitly via EMAIL_TO.

Context-Inappropriate Capability

Medium
Confidence
95% confidence
Finding
Lines L083-L085 and L092 parse the personal mail account configuration to recover email addresses. For a backlog cleanup skill, this capability goes beyond the core task of identifying stale games and creating reminders, and introduces access to external personal account configuration not clearly justified by the manifest description.

Static analysis

No suspicious patterns detected.