Back to skill

Security audit

Cement Heat Balance Visualization

Security checks for vulnerabilities and agentic risk

Overview

The skill is a coherent cement heat-balance HTML report generator, but it renders untrusted input into browser-opened HTML without escaping, which could run injected JavaScript if the input data is malicious.

Install only if you will generate reports from data you trust or can sanitize first. Avoid opening or sharing generated HTML reports made from third-party JSON until the script escapes HTML values and validates fields such as stage type, temperatures, percentages, labels, and descriptions.

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
scripts/generate_heat_balance_viz.py:61
Finding
Stored HTML and JavaScript Injection in Generated Visualization Reports<![CDATA[ ## Vulnerability Details **File Location**: `scripts/generate_heat_balance_viz.py:61-86` **Vulnerability Type**: Unescaped user-controlled data in generated HTML **Risk Level**: High The report generator inserts values from an input JSON document directly into HTML text, an HTML attribute, and inline CSS without contextual escaping or validation. ### Vulnerable Code ```python # Generate process flow HTML process_flow_items = "" for stage in process_stages: process_flow_items += f''' <div class="process-unit {stage['type']}"> <div>{stage['name']}</div> <div class="temp-display">{stage['temp']}°C</div> <div class="temp-label">{stage['label']}</div> </div>''' # Generate energy distribution table energy_table_rows = "" for item in energy_distribution: energy_table_rows += f''' <tr> <td>{item['item']}</td> <td>{item['percentage']}%</td> <td>{item['description']}</td> </tr>''' # Generate KPI cards kpi_cards = "" for kpi in kpis: kpi_cards += f''' <div class="kpi-card"> <div class="kpi-value">{kpi['value']}</div> <div class="kpi-label">{kpi['label']}</div> </div>''' ``` ### Technical Analysis The `process_stages`, `energy_distribution`, and `kpis` collections originate from JSON supplied through either `--input` or `--data`. Their fields are interpolated into the resulting HTML through Python f-strings without HTML encoding. Most values are inserted into HTML text contexts, where a payload containing closing tags and event-handler markup can terminate the intended element and introduce executable content. For example, a stage name could contain: ```html </div><img src=x onerror="alert(document.domain)"><div> ``` The `stage['type']` field is especially sensitive because it is inserted inside a quoted `class` attribute. An ...[truncated 1881 chars]
Remediation
<![CDATA[ ## Remediation Suggestions 1. Escape every value inserted into HTML text or attribute contexts: ```python from html import escape def html_text(value: Any) -> str: return escape(str(value), quote=True) ``` Apply this function to stage names, labels, energy-distribution text, KPI values, and all other text fields. 2. Do not treat `stage['type']` as arbitrary text. Validate it against an explicit allowlist: ```python allowed_stage_types = {"cold", "normal", "hot"} stage_type = str(stage.get("type", "normal")) if stage_type not in allowed_stage_types: stage_type = "normal" ``` 3. Enforce data types and reasonable ranges for numeric fields before rendering: ```python temperature = float(stage["temp"]) percentage = float(item["percentage"]) if not -273.15 <= temperature <= 3000: raise ValueError("Temperature is outside the permitted range") if not 0 <= percentage <= 100: raise ValueError("Percentage must be between 0 and 100") ``` 4. Prefer a mature template engine configured with automatic HTML escaping rather than assembling markup through raw f-strings. 5. Add regression tests containing characters such as `<`, `>`, `"`, `'`, and `&`, as well as complete event-handler payloads. Verify that the resulting report contains encoded text and no attacker-created elements or attributes. 6. If reports are hosted by a web application, apply a restrictive Content Security Policy that disallows inline scripts and event handlers. This should be defense in depth and must not replace output encoding and input validation. ]]>
Vulnerability Patterns
  • 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
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
Findings (4)

Lp3

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding
Without declared permissions the skill's intent is opaque and cannot be validated.

Natural-Language Policy Violations

Medium
Confidence
95% confidence
Finding
The generated document hard-codes `lang="zh"`, and the surrounding UI text is also fixed in Chinese. For a general-purpose visualization generator, this imposes a specific language/locale without offering user opt-in or documenting a region-specific requirement.

Context-Inappropriate Capability

Low
Confidence
77% confidence
Finding
The script accepts an arbitrary --output path and writes to it without validation, so a caller can overwrite any file writable by the current user. In an agent or automated execution context, this broad file-write capability can be abused for unintended file clobbering or persistence outside the expected visualization workspace.

Description-Behavior Mismatch

Low
Confidence
85% confidence
Finding
The manifest frames the skill as generating cement heat-balance visualizations, which is consistent with producing HTML content, but the code additionally persists that content to disk. Writing files is a behavioral side effect beyond a purely generative description and is not mentioned in the manifest text.

Static analysis

No suspicious patterns detected.