Back to skill

Security audit

SkillPulse

Security checks for vulnerabilities and agentic risk

Overview

The skill mostly does what it claims, but its HTML report generator can turn attacker-controlled sample data into active browser content.

Review before installing if you plan to process sample files from other people or automated systems. JSON and table output are lower risk, but HTML reports should only be generated from trusted samples or opened in a constrained environment until the renderer escapes dynamic values.

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

Warning
Location
src/index.js:207
Finding

Stored HTML Injection in Generated Reports

Content
View full analysis

Vulnerability Details

File Location: src/index.js, lines 207–221
Vulnerability Type: Stored HTML injection / cross-site scripting
Risk Level: Medium

Vulnerable Code

js
export function renderHtmlReport(report, title = 'Skill Profiler Report') {
  const rows = report.profile.skills
    .map((s) => `<tr><td>${s.skill}</td><td>${s.runs}</td><td>${s.avgLatencyMs}</td><td>${s.p95LatencyMs}</td><td>${s.avgCpuMs}</td><td>${s.peakMemoryMb}</td></tr>`)
    .join('');
  return `<!doctype html>
<html><head><meta charset="utf-8"/><title>${title}</title>
<style>body{font-family:Arial,sans-serif;padding:16px}table{border-collapse:collapse;width:100%}th,td{border:1px solid #ddd;padding:8px;text-align:left}</style>
</head><body>
<h1>${title}</h1>
<p>Total runs: ${report.profile.totalRuns} | Sessions: ${report.profile.sessions} | P95 latency: ${report.profile.p95LatencyMs}ms</p>
<h2>Bottlenecks (${report.analysis.bottlenecks.length})</h2>
<ul>${report.analysis.bottlenecks.map((b) => `<li>${b.skill}: ${b.reasons.join(', ')}</li>`).join('')}</ul>
<h2>Skill metrics</h2>
<table><thead><tr><th>Skill</th><th>Runs</th><th>Avg Latency</th><th>P95 Latency</th><th>Avg CPU</th><th>Peak Memory</th></tr></thead><tbody>${rows}</tbody></table>
</body></html>`;
}

Technical Analysis

The HTML report renderer directly interpolates dynamic values into HTML without context-appropriate encoding. In particular, s.skill and b.skill originate from the skill property of records in the input JSON file. The exported function also accepts a caller-controlled title.

An attacker can supply a skill name containing HTML or JavaScript, such as:

json
{
  "sessionId": "malicious",
  "skill": "</td></tr><script>/* attacker code */</script><tr><td>",
  "latencyMs": 2000,
  "cpuMs": 1200,
  "memoryMb": 600
}

Because metacharacters such as <, >, &, quotes, and apostrophes are not escaped, th ...[truncated 1600 chars]

Remediation
View remediation

Remediation Suggestions

  1. Apply HTML text-context escaping to every dynamic value before interpolation, including skill names, report titles, and bottleneck reason text. At minimum, encode:

    • & as &amp;
    • < as &lt;
    • > as &gt;
    • " as &quot;
    • ' as &#39;
  2. Prefer a maintained escaping package or a templating system that enables automatic escaping by default rather than constructing HTML through raw template literals.

  3. If retaining the current renderer, introduce a centralized helper and use it consistently:

    js
    function escapeHtml(value) {
      return String(value)
        .replaceAll('&', '&amp;')
        .replaceAll('<', '&lt;')
        .replaceAll('>', '&gt;')
        .replaceAll('"', '&quot;')
        .replaceAll("'", '&#39;');
    }
    
  4. Add a restrictive Content Security Policy to generated reports as defense in depth, for example disallowing scripts and remote resources:

    html
    <meta http-equiv="Content-Security-Policy"
          content="default-src 'none'; style-src 'unsafe-inline'; img-src data:">
    
  5. Add regression tests that generate reports containing payloads such as <script>, event-handler attributes, closing tags, ampersands, and quotes. Tests should verify that the original payload does not appear as active markup and that all metacharacters are encoded.

  6. Document that imported sample files are untrusted data and ensure future output formats use context-specific encoding rather than relying solely on input validation.

Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • 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 (3)

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
82% confidence
Finding

The file presents localized documentation in Korean and labels the current document as the Korean variant, but it does not explicitly state that language selection is optional for the user within this document. Under the policy, forcing a specific language without opt-in can be a natural-language locale violation.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
94% confidence
Finding

The file presents a Simplified Chinese README variant and labels it as such, which constitutes a locale-specific presentation. However, it also explicitly offers alternative language versions via links to English and Korean, so users are not forced into a single language or locale.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
81% confidence
Finding

This code creates directories and writes report content to disk via fs.mkdirSync and fs.writeFileSync, but the only disclosure is the CLI usage text showing --out; there is no explicit warning comment, prompt, or explanatory message before performing the write. For a code-file review under SQP-2, file writes are safety-relevant operations that should have some visible disclosure unless clearly warned elsewhere.

Content

No source excerpt is available for this finding.