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

Content
View full analysis
{stage['name']}
{stage['temp']}°C
{stage['label']}
''' # Generate energy distribution table energy_table_rows = "" for item in energy_distribution: energy_table_rows += f''' {item['item']} {item['percentage']}% {item['description']} ''' # Generate KPI cards kpi_cards = "" for kpi in kpis: kpi_cards += f'''
{kpi['value']}
{kpi['label']}
''' ``` ### 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
``` The `stage['type']` field is especially sensitive because it is inserted inside a quoted `class` attribute. An ...[truncated 1881 chars]
Remediation
View remediation
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)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
70% confidence
Finding

Without declared permissions the skill's intent is opaque and cannot be validated.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Medium
Category
Not specified by scanner
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.

Content

No source excerpt is available for this finding.

Context-Inappropriate Capability

Low
Category
Not specified by scanner
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.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Low
Category
Not specified by scanner
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.

Content

No source excerpt is available for this finding.