Back to skill

Security audit

Faq Forge

Security checks for vulnerabilities and agentic risk

Overview

FAQ Forge is a coherent local FAQ tool, but its generated HTML can execute untrusted FAQ content if imported or published without sanitization.

Install only if you are comfortable using it as a local, user-directed FAQ generator and will review imported content before publishing. Do not publish generated HTML from untrusted Markdown or JSON without escaping or sanitizing FAQ fields first, especially on the same domain as authenticated business applications. Keep backups before delete, import, template apply, or export operations.

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
faq_publish.py:47
Finding
Stored Cross-Site Scripting in Generated HTML FAQ Pages<![CDATA[ ## Vulnerability Details **File Location**: `faq_publish.py`, lines 47–49, 347, and 359–392 **Vulnerability Type**: Stored Cross-Site Scripting (XSS) through unescaped HTML and attribute interpolation **Risk Level**: High ### Vulnerable Code The page title is inserted directly into HTML: ```python html = f"""<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>{title}</title> ``` Categories are inserted into both HTML text and attribute contexts without escaping: ```python for category in sorted(by_category.keys()): cat_id = category.lower().replace(" ", "-") html += f' <li><a href="#{cat_id}">{category}</a></li>\n' ``` FAQ fields and related-question data are also inserted directly into the generated document: ```python for category in sorted(by_category.keys()): cat_id = category.lower().replace(" ", "-") html += f' <div class="category" id="{cat_id}">\n' html += f' <h2 class="category-title">{category}</h2>\n' for entry in by_category[category]: active_class = "" if collapsible else "active" html += f' <div class="faq-item {active_class}" data-id="{entry.id}">\n' html += ' <div class="faq-question">\n' html += f' <span>{entry.question}</span>\n' if entry.priority in ["critical", "high"]: html += f' <span class="priority-badge priority-{entry.priority}">{entry.priority.upper()}</span>\n' if collapsible: html += ' <span class="icon">▼</span>\n' html += ' </div>\n' html += ' <div class="faq-answer">\n' html += f' <p>{entry.answer}</p>\n' if entry.tags or entry.related: ...[truncated 3608 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Apply context-appropriate output encoding to every dynamic value inserted into HTML: ```python from html import escape safe_title = escape(str(title), quote=True) safe_category = escape(str(category), quote=True) safe_question = escape(str(entry.question), quote=True) safe_answer = escape(str(entry.answer), quote=True) safe_tag = escape(str(tag), quote=True) ``` 2. Escape attribute values with `quote=True`. Do not reuse raw display text as an HTML ID. 3. Generate IDs through a strict allowlist: ```python import re def safe_html_id(value: str) -> str: value = re.sub(r'[^A-Za-z0-9_-]', '-', value) value = re.sub(r'-+', '-', value).strip('-') return value or "section" ``` 4. Validate database fields when loading and importing them. In particular: - Require strings for questions, answers, categories, priorities, products, IDs, and tags. - Restrict priorities to `low`, `normal`, `high`, or `critical`. - Restrict identifiers used in attributes to a safe character set. - Reject malformed nested structures. 5. Treat FAQ answers as plain text by default. If rich HTML is an intended feature, process it through a maintained allowlist-based HTML sanitizer and prohibit scripts, event-handler attributes, unsafe URLs, embedded frames, and active SVG content. 6. Add a restrictive Content Security Policy to generated pages as defense in depth. For example, move the existing inline JavaScript to a separate static file and use a policy similar to: ```html <meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'self'; script-src 'self'; img-src 'self' data:; base-uri 'none'; form-action 'none'"> ``` Output encoding remains mandatory because a CSP can be weakened or omitted during deployment. 7. Add regression tests for every output context, including: - `</p><script>alert(1)</script>` - `<img src=x onerror=alert(1)>` - `" onmouseover="alert(1)` - Categories containi ...[truncated 249 chars]
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • MCP Tool PoisoningHidden Instructions, Unicode Deception, Parameter Description Injection
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (12)

Hidden Instructions

High
Category
Prompt Injection
Content
---
name: "FAQ Forge Customer Knowledge Base Builder"
description: "Build, maintain, and publish professional FAQ documentation. Create, organize, and publish customer-facing knowledge bases. Reduce support burden by answering common questions before they're asked."
author: "@TheShadowRose"
Confidence
60% confidence
Finding
Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Hidden Instructions

High
Category
Prompt Injection
Content
---
name: "FAQ Forge Customer Knowledge Base Builder"
description: "Build, maintain, and publish professional FAQ documentation. Create, organize, and publish customer-facing knowledge bases. Reduce support burden by answering common questions before they're asked."
author: "@TheShadowRose"
Confidence
60% confidence
Finding
Hidden instructions were detected in comments or invisible text. These could contain malicious directives. Manual review is recommended.

Missing User Warnings

Medium
Confidence
87% confidence
Finding
This markdown file instructs users to delete FAQ entries with `python faq_forge.py delete question-id` but gives no accompanying warning that the action may permanently remove data or should be used carefully. For markdown files, the skill description should disclose behaviors that can affect user data, and this section omits that caution.

Missing User Warnings

Medium
Confidence
95% confidence
Finding
This code path performs a destructive operation by deleting an entry and immediately saving the modified database. Although the CLI prints a success message afterward, there is no pre-action confirmation, warning, or other user disclosure before the irreversible change occurs.

Intent-Code Divergence

Medium
Confidence
95% confidence
Finding
The module docstring says "FAQ Forge - Import Tool" and describes importing Q&A pairs from markdown documentation, while the implementation also includes `export_to_json` and a CLI `export` command that writes database contents to a file. This is more than incomplete detail: the documentation frames the tool specifically as import-only, which contradicts the presence of an explicit export capability.

Missing User Warnings

Low
Confidence
86% confidence
Finding
This markdown file recommends adding Google Analytics for tracking, which introduces user-data collection and privacy implications. The surrounding text describes the capability but does not warn users about the privacy impact or need to disclose analytics/tracking to end users.

Scope Creep

Low
Category
Excessive Agency
Content
**USE AT YOUR OWN RISK.**

- The author(s) are NOT liable for any damages, losses, or consequences arising from 
  the use or misuse of this software — including but not limited to financial loss, 
  data loss, security breaches, business interruption, or any indirect/consequential damages.
- This software does NOT constitute financial, legal, trading, or professional advice.
- Users are solely responsible for evaluating whether this software is suitable for
Confidence
70% confidence
Finding
Skill's behavior or capabilities extend beyond its stated purpose. Scope creep allows an agent to perform actions unrelated to its documented functionality, increasing the attack surface.

Scope Creep

Low
Category
Excessive Agency
Content
**USE AT YOUR OWN RISK.**

- The author(s) are NOT liable for any damages, losses, or consequences arising from 
  the use or misuse of this software — including but not limited to financial loss, 
  data loss, security breaches, business interruption, or any indirect/consequential damages.
- This software does NOT constitute financial, legal, trading, or professional advice.
- Users are solely responsible for evaluating whether this software is suitable for
Confidence
70% confidence
Finding
Skill's behavior or capabilities extend beyond its stated purpose. Scope creep allows an agent to perform actions unrelated to its documented functionality, increasing the attack surface.

Missing User Warnings

Low
Confidence
76% confidence
Finding
The documentation encourages importing all markdown files from a directory, which can process large amounts of existing documentation and potentially pull in unintended content. Although the file later includes a general data disclaimer, this workflow section lacks a specific warning to review imported data before publishing or relying on it.

Intent-Code Divergence

Low
Confidence
80% confidence
Finding
At L643-L644, the disclaimer states that the software does not transmit data externally unless explicitly configured by the user. However, the same skill documentation includes multiple external URLs and contact endpoints at L652-L657, indicating externally reachable resources are part of the delivered skill context. While this is documentation rather than executable code, it is still an intent-level contradiction within the skill file.

Missing User Warnings

Low
Confidence
76% confidence
Finding
This code performs a file write that can overwrite or create the specified output file, but the only disclosure appears after the write completes. For a code-file warning check, there is no prior confirmation prompt or explicit warning comment/docstring about the overwrite risk at the write site or CLI command.

Missing User Warnings

Low
Confidence
81% confidence
Finding
This code file performs a data-modifying operation by adding entries to the FAQ database via `self.db.add(entry)`. Although the file prints informational messages, it does not explicitly ask the user to confirm before bulk-applying a template that may alter stored FAQ content.

Static analysis

No suspicious patterns detected.