Back to skill

Security audit

Gog Html Email

Security checks for vulnerabilities and agentic risk

Overview

The skill does what it advertises, but it tells agents to render and send Gmail HTML emails using unsafe shell substitutions without clear confirmation or escaping controls.

Review before installing if you plan to send real email. Only use it with explicit user-approved recipients and content, preview the final HTML before sending, avoid untrusted template values, and prefer a renderer that escapes HTML and passes arguments safely instead of interpolating values into sed commands.

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

Error
Location
SKILL.md:20
Finding
Shell Command Injection Through Unsafe Dynamic sed Substitution<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, lines 20–30 **Vulnerability Type**: Shell command injection caused by unsafe interpolation into generated `sed` commands **Risk Level**: High ### Vulnerable Code ```bash TEMPLATE=$(cat workspace/skills/gog-html-email/templates/basic.html) HTML=$(echo "$TEMPLATE" | sed 's/\[NAME\]/John/g' | sed 's/\[MESSAGE\]/Your message here/g' | sed 's/\[SIGNATURE\]/Your Name/g') gog gmail send --to recipient@example.com --subject "Subject" --body-html "$HTML" ``` The same dynamic `sed` construction pattern is repeated throughout `SKILL.md`, including the examples and customization instructions at lines 143–186 and 228–316. ### Technical Analysis The skill mandates constructing shell commands in which email fields are inserted directly into `sed` replacement expressions. It does not define a safe encoding procedure for shell syntax or `sed` replacement syntax. If an agent replaces the example values with attacker-controlled text while preserving this command structure, a single quote can terminate the quoted `sed` expression. The remaining input can then be interpreted as shell syntax. Even when shell injection is not achieved, replacement metacharacters such as `&`, backslashes, and the selected delimiter can modify or corrupt the generated HTML. This flaw crosses two parsing boundaries: 1. User-controlled data is embedded in a `sed` expression without `sed`-specific escaping. 2. That expression is embedded in shell source without shell-safe argument handling. Consequently, ordinary email content is treated partly as executable syntax rather than exclusively as data. ### Attack Path 1. An attacker supplies an email field such as a recipient name, message, signature, topic, or URL containing shell metacharacters and a single quote. 2. The agent follows the documented workflow and substitutes that value into a single-quoted `sed` command. 3. The malicious quote closes the intended `sed` argument. 4. T ...[truncated 1187 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Do not construct shell source by interpolating email fields into `sed` expressions. 2. Replace the shell-based rendering workflow with a dedicated renderer that: - Reads the template as data. - Accepts replacement values through structured arguments, standard input, or a JSON document. - Performs literal placeholder replacement. - Applies context-aware HTML escaping. - Invokes `gog` through an argument array rather than a generated command string. 3. If shell tooling must be retained: - Pass dynamic values through environment variables or files instead of embedding them in command text. - Escape all `sed` replacement metacharacters, including backslashes, ampersands, and delimiters. - Never use `eval`, `sh -c`, or equivalent secondary shell parsing. - Use `printf '%s'` rather than `echo` for arbitrary data. 4. Validate recipient addresses, subjects, URLs, and other structured fields before rendering. 5. Add tests containing single quotes, semicolons, command substitutions, backticks, ampersands, backslashes, and delimiter characters. 6. Run the email-sending process with minimum filesystem, credential, and network privileges. ]]>

T09 · Insecure Skill Coding Practices

Warning
Location
templates/button.html:1
Finding
Unescaped HTML and URL Placeholder Injection in Email Templates<![CDATA[ ## Vulnerability Details **File Location**: `templates/button.html`, line 1 **Vulnerability Type**: HTML and hyperlink attribute injection through unescaped placeholders **Risk Level**: Medium ### Vulnerable Code ```html <!DOCTYPE html><html><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"></head><body style="font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; line-height: 1.6; color: #333; max-width: 600px; margin: 0 auto; padding: 20px;"><p style="margin: 0 0 16px 0;">Hi [NAME],</p><p style="margin: 0 0 16px 0;">[MESSAGE]</p><div style="text-align: center; margin: 24px 0;"><a href="[BUTTON_URL]" style="display: inline-block; background-color: #007bff; color: #ffffff; text-decoration: none; padding: 12px 24px; border-radius: 6px; font-weight: 500;">[BUTTON_TEXT]</a></div><p style="margin: 0 0 16px 0;">Best regards,<br>[SIGNATURE]</p></body></html> ``` Equivalent raw placeholder insertion occurs across the template collection. URL-bearing examples include `templates/invoice.html` and `templates/welcome.html`, while text placeholders are used by all HTML templates. ### Technical Analysis Template values are inserted through literal text replacement without context-aware encoding. Text placeholders such as `[NAME]`, `[MESSAGE]`, `[BUTTON_TEXT]`, and `[SIGNATURE]` appear directly inside HTML element content. `[BUTTON_URL]` appears directly inside a quoted `href` attribute. An attacker-controlled text value can close an existing element and inject additional HTML. An attacker-controlled URL can close the attribute value and introduce additional attributes or markup. The templates also lack an explicit URL scheme allowlist, permitting deceptive or potentially unsafe URI schemes depending on the recipient’s email client. Although many email clients remove scripts, arbitrary HTML injection can still introduce: - Deceptive buttons and phishing links. ...[truncated 1912 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Apply context-aware escaping to every placeholder: - HTML-escape text-node values by encoding at least `&`, `<`, `>`, `"`, and `'`. - Attribute-escape values placed inside HTML attributes. - Do not treat ordinary message text as trusted HTML. 2. Validate URL placeholders before rendering: - Parse URLs with a well-tested URL parser. - Permit only explicitly approved schemes, preferably `https`. - Reject control characters, protocol-relative URLs, encoded scheme bypasses, and malformed URLs. - Optionally restrict destinations to approved domains for payment and onboarding templates. 3. Separate trusted rich HTML from ordinary text: - Use distinct parameter types for plain text and administrator-approved HTML. - Sanitize any explicitly allowed HTML with an email-compatible allowlist sanitizer. 4. Render templates with a maintained templating engine that enables automatic escaping rather than raw `sed` substitution. 5. Remove or reject remote image elements and other resource-loading markup unless explicitly authorized. 6. Add security tests covering element termination, quote injection, event attributes, remote images, deceptive links, and unsafe URI schemes. 7. Preview and validate the final rendered HTML before sending, and fail closed if unresolved placeholders or disallowed markup remain. ]]>
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 (2)

Missing User Warnings

Medium
Confidence
91% confidence
Finding
The skill explicitly instructs the agent to send emails through `gog gmail send`, which causes external transmission of potentially user-provided content. The dangerous part is not code execution but the lack of an explicit warning, confirmation step, or boundary around sending data off-system, which can lead to unintended disclosure, spam, or social-engineering abuse if an agent follows the workflow automatically.

Natural-Language Policy Violations

Low
Confidence
81% confidence
Finding
This HTML template contains fixed natural-language content such as "Eid Mubarak," "Taqabbal Allahu minna wa minkum," and "May Allah bless you," which imposes a specific religious/locale framing in the generated output. Under the policy rule for natural-language violations, forcing a specific language or cultural/religious expression without opt-in can be problematic when no user choice is indicated.

Static analysis

No suspicious patterns detected.