Back to skill

Security audit

ppt-generator-smb

Security checks for vulnerabilities and agentic risk

Overview

The skill is a real presentation generator, but it needs Review because it can automatically install an unpinned Python package and can generate HTML that executes untrusted slide content.

Review before installing. This skill should be run only in a constrained workspace or virtual environment, with dependencies installed explicitly from trusted pinned sources. Avoid feeding it untrusted JSON or web-sourced slide data unless the HTML generator is fixed to escape content, and do not expose the preview server beyond the local machine.

Vulnerability Patterns
  • Insecure DependenciesIntroduces malicious components through unsafe dependency sources
  • 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
Findings (2)

T09 · Insecure Skill Coding Practices

Error
Location
scripts/gen_html.py:73
Finding
Unescaped Presentation Data Allows Stored HTML and JavaScript Injection<![CDATA[ ## Vulnerability Details **File Location**: `scripts/gen_html.py`, lines 73–143 **Vulnerability Type**: Stored HTML/JavaScript injection **Risk Level**: High ### Vulnerable Code ```python def make_title_slide(title, subtitle): content = f''' <div style="font-size:5rem;margin-bottom:20px">🦞</div> <h1>{title}</h1> <p class="subtitle">{subtitle}</p>''' return content def make_content_slide(title, items): if isinstance(items, list): items_html = ''.join(f'<li>{item}</li>' for item in items) return f'\n <h2>{title}</h2>\n <ul>{items_html}</ul>\n' return f'\n <h2>{title}</h2>\n <p>{items}</p>\n' def make_cards_slide(title, cards): cards_html = '' for card in cards: cards_html += f'<div class="card"><h4>{card["icon"]} {card["title"]}</h4><p>{card["content"]}</p></div>\n' return f'\n <h2>{title}</h2>\n <div class="cards">{cards_html}</div>\n' def make_chart_slide(title, data): bars = '' for item in data: h = item.get("height", 100) bars += f'''<div class="bar"> <div class="bar-value">{item["value"]}</div> <div class="bar-fill" style="height:{h}px"></div> <div class="bar-label">{item["label"]}</div> </div>\n''' return f'\n <h2>{title}</h2>\n <div class="bar-chart">{bars}</div>\n' def make_swot_slide(title, strengths, weaknesses): s_items = ''.join(f'<li>{s}</li>' for s in strengths) w_items = ''.join(f'<li>{w}</li>' for w in weaknesses) return f''' <h2>{title}</h2> <div class="grid-2"> <div class="swot"><h4>💪 Strengths 优势</h4><ul>{s_items}</ul></div> <div class="swot" style="border-color:rgba(255,149,0,.35);background:rgba(255,149,0,.06)"><h4>⚠️ Weaknesses 劣势</h4><ul>{w_items}</ul></div> </div>\n''' ``` The resulting fragments are subsequently inserted into the final document without escaping: ```python total = len(data.get("slides", [])) + 1 html = HTML_TEMPLATE.format(title=args.title, slides=slides_html, to ...[truncated 2661 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Apply contextual HTML escaping to every untrusted text value before inserting it into the template. At minimum, use `html.escape(value, quote=True)` for titles, subtitles, list entries, card fields, labels, and displayed values. 2. Use a template engine with automatic escaping enabled instead of constructing HTML through f-strings. 3. Treat chart dimensions as data rather than markup: - Parse heights as integers or finite floating-point values. - Reject nonnumeric values. - Enforce a reasonable range such as `0` through `220`. 4. Avoid inserting untrusted content into inline style attributes. Prefer predefined CSS classes or set validated values through safe DOM APIs. 5. If limited formatting must be supported, sanitize it with a strict allowlist that excludes scripts, event-handler attributes, dangerous URL schemes, embedded objects, and unsafe CSS. 6. Add regression tests covering element-breaking payloads, `<script>` elements, event handlers, quoted attribute breakers, CSS-breaking values, and encoded variants. 7. Consider deploying generated presentations with a restrictive Content Security Policy that disallows inline and remote scripts. This should be defense in depth and must not replace output encoding. ]]>

T08 · Insecure Dependencies

Warning
Location
scripts/gen_pptx.py:8
Finding
Automatic Installation of an Unpinned Runtime Dependency<![CDATA[ ## Vulnerability Details **File Location**: `scripts/gen_pptx.py`, lines 8–15 **Vulnerability Type**: Insecure runtime dependency installation **Risk Level**: Medium ### Vulnerable Code ```python def install_pptx(): try: from pptx import Presentation return True except ImportError: import subprocess subprocess.check_call(['pip', 'install', 'python-pptx', '-q']) return True ``` The installation function is invoked automatically during normal execution: ```python install_pptx() if args.data and os.path.exists(args.data): with open(args.data, 'r', encoding='utf-8') as f: data = json.load(f) ``` ### Technical Analysis If the `pptx` module is unavailable, the generator automatically invokes `pip install python-pptx` without a pinned version, cryptographic hash, controlled package index, isolated environment, or explicit user confirmation. The package selected at runtime depends on the active `pip` configuration and package-index state. Consequently, execution is not reproducible and trusts whichever compatible release the configured index returns. A compromised package index, altered local `pip` configuration, malicious mirror, or compromised future dependency release could introduce attacker-controlled installation or import-time code. Using the bare `pip` executable also risks installing into a Python environment different from the interpreter running the script. Automatic installation unexpectedly changes the active environment and may interfere with other applications. ### Attack Path 1. The user runs `gen_pptx.py` in an environment where the `pptx` module is absent. 2. The script automatically executes `pip install python-pptx -q`. 3. The active `pip` configuration resolves the package from its configured index or mirror without enforcing an audited version or hash. 4. If that source or selected release is compromised, attacker-controlled package code is downloaded and installed. ...[truncated 910 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Remove automatic package installation from the generator. If the dependency is unavailable, terminate with a clear message describing the explicit setup command. 2. Declare `python-pptx` and its transitive dependencies in a reviewed dependency manifest and lockfile. 3. Pin exact versions and verify downloaded artifacts with cryptographic hashes, such as through `pip install --require-hashes -r requirements.txt`. 4. Install dependencies during a separate, explicit setup phase inside a dedicated virtual environment or container. 5. Use `python -m pip` with the intended interpreter during setup rather than invoking an ambiguous bare `pip` executable. 6. Configure a trusted package index and prevent unreviewed fallback to external or user-controlled mirrors. 7. Integrate dependency vulnerability and integrity scanning into release workflows, and update pinned versions through a reviewed process. 8. Run document generation under a least-privileged account with restricted filesystem and network access where practical. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Excessive AgencyUnrestricted Tool Access, Autonomous Decision Making, Scope Creep
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Behavioral ASTexec() Call, eval() Call, Dynamic Import
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (13)

Tp4

High
Category
MCP Tool Poisoning
Confidence
96% confidence
Finding
Undisclosed behavior such as automatically installing Python dependencies is security-relevant because it causes unexpected code retrieval and execution beyond the stated presentation-generation purpose. Hidden installation steps expand supply-chain and execution risk, especially when users are not warned that external packages may be fetched and run.

Tp4

High
Category
MCP Tool Poisoning
Confidence
92% confidence
Finding
Undisclosed behavior such as automatically installing Python dependencies is security-relevant because it causes unexpected code retrieval and execution beyond the stated presentation-generation purpose. Hidden installation steps expand supply-chain and execution risk, especially when users are not warned that external packages may be fetched and run.

Lp3

Medium
Category
MCP Least Privilege
Confidence
92% confidence
Finding
The skill describes shell execution, file reads/writes, and running local services, but it does not declare any explicit tool scope or permissions boundary. This creates unnecessary capability ambiguity and can allow the skill to execute broader actions than users or the platform expect.

Vague Triggers

Medium
Confidence
94% confidence
Finding
The manifest description says the skill triggers when users need to make PPTs, slides, market analysis reports, or product introductions. Terms like '市场分析报告' and '产品介绍' are broad, common requests that may arise in many contexts, and the file does not define clear activation boundaries or exclusions.

Vague Triggers

Medium
Confidence
96% confidence
Finding
The trigger section lists keywords such as '市场分析', '产品介绍', '竞品分析', and 'SWOT' without specifying that they must be requests for slide creation. Those terms commonly occur in ordinary analytical conversations, so the activation rule could invoke the skill unintentionally.

Context-Inappropriate Capability

Medium
Confidence
87% confidence
Finding
The manifest describes a presentation generator that outputs HTML and PPTX slides with specific design and visualization features. In SKILL.md, Step 2 explicitly adds external web searching for market data and competitor information, which is a separate research capability not stated in the manifest description.

Missing User Warnings

Medium
Confidence
93% confidence
Finding
Failing to warn that the skill will start a local HTTP server conceals a meaningful runtime side effect that changes the host's exposure profile. Users may not expect a content-generation skill to open a listening service, and hidden service startup can increase risk if the server is reachable, misconfigured, or serves more content than intended.

Natural-Language Policy Violations

Medium
Confidence
91% confidence
Finding
The script's natural-language strings and generated HTML explicitly use Chinese language/locale conventions, including the HTML lang attribute set to zh-CN and Chinese-only CLI descriptions. This appears to impose a specific language/locale on users without opt-in, which matches the language policy violation category.

Context-Inappropriate Capability

Medium
Confidence
97% confidence
Finding
Automatically installing a package from pip at runtime is a genuine security issue here because it causes unreviewed external code to be fetched and installed during document generation. If the package source, index configuration, or dependency resolution is influenced, this can lead to supply-chain compromise or unexpected code execution under the agent's privileges.

subprocess module call

Medium
Category
Dangerous Code Execution
Content
return True
    except ImportError:
        import subprocess
        subprocess.check_call(['pip', 'install', 'python-pptx', '-q'])
        return True

def create_pptx(title, subtitle, slides_data, output):
Confidence
94% confidence
Finding
The script executes pip in a subprocess at runtime when python-pptx is missing. This introduces external code retrieval and execution during normal use, which is risky in an agent skill because dependency installation should not occur implicitly inside application logic. In a skill context, this expands the trust boundary from local presentation generation to network/package-supply-chain behavior.

Missing User Warnings

Low
Confidence
86% confidence
Finding
The markdown instructs the skill to use `web_search` to gather market data, industry reports, and competitor information, but it does not warn users that external/network retrieval will be performed. For markdown files, externally affecting behaviors that may have privacy or data-handling implications should be disclosed clearly.

Context-Inappropriate Capability

Low
Confidence
86% confidence
Finding
Starting a local HTTP server introduces an unnecessary service exposure surface for a content-generation skill, especially when not clearly justified or disclosed. Even if bound locally, it increases attack surface, can expose generated content or local files if misconfigured, and normalizes shell-based service startup for a simple preview task.

Natural-Language Policy Violations

Low
Confidence
95% confidence
Finding
This file contains user-facing natural-language strings such as the module docstring, argument descriptions, and status output exclusively in Chinese. Under the policy, forcing a specific language without user opt-in is a natural-language policy violation.

Static analysis

No suspicious patterns detected.