Back to skill

Security audit

complex-causal-analysis

Security checks for vulnerabilities and agentic risk

Overview

The skill is a normal causal-graph visualizer, but its generated HTML can execute unsafe browser JavaScript from graph data or a remote D3 script.

Review generated HTML before opening it when graph data came from someone else, and prefer a version that escapes labels, validates colors and strengths, and bundles or pins D3 with integrity checking. This does not appear to steal data or persist on the system, but it should be treated carefully before installation or use with untrusted inputs.

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
template.html:317
Finding

DOM-Based HTML Injection Through Unescaped Causal Graph Data

Content
View full analysis
{ const div = document.createElement("div"); div.className = "node-item"; div.innerHTML = `
${node.id}`; div.onclick = () => showDetail(node); document.getElementById("node-list").appendChild(div); }); ``` ```javascript const causes = links.filter(l => l.target === d.id); document.getElementById("detail-causes").innerHTML = causes.length ? causes.map(l => `
${l.source} (${l.strength >= 8 ? "强" : "中"}${l.strength})
`).join("") : "
无直接原因
"; const results = links.filter(l => l.source === d.id); document.getElementById("detail-results").innerHTML = results.length ? results.map(l => `
${l.target} (${l.strength >= 8 ? "强" : "中"}${l.strength})
`).join("") : "
无直接结果
"; ``` ### Technical Analysis The application inserts graph fields such as `node.id`, `node.color`, `l.source`, and `l.target` into HTML strings and assigns those strings to `innerHTML`. No output encoding, sanitization, or strict input validation is performed before these values reach the HTML parser. The documented workflow accepts causal graph information from users and generates an HTML visualization. If attacker-controlled graph values are interpolated into the `nodes` or `links` structures, those values can break out of their expected text or style contexts and introduce arbitrary HTML elements or event-handler attributes. For example, a node identifier containing the following value would be interpreted as markup when the node list is constructed: ```html ``` This issue also affects link source and target na ...[truncated 1617 chars]
Remediation
View remediation
= 8 ? "Strong" : "Medium"} ${l.strength})`; ``` 3. Validate all generated graph data before rendering: - Require node IDs, types, descriptions, sources, and targets to be strings. - Enforce reasonable length limits. - Validate `layer` and `strength` as bounded integers. - Require every link source and target to reference an existing node. - Restrict colors to an allowlisted format such as `^#[0-9A-Fa-f]{6}$`. 4. If rich HTML is an explicit requirement, process it with a well-maintained HTML sanitizer configured to reject scripts, event-handler attributes, dangerous URLs, and unsafe SVG content. 5. Add a restrictive Content Security Policy as defense in depth. Avoid allowing inline scripts and inline event handlers so that injected markup cannot readily execute JavaScript. 6. Add security tests using payloads in every graph field, including HTML tags, quoted attribute-breaking values, event handlers, and malicious CSS values. ]]>

T08 · Insecure Dependencies

Warning
Location
template.html:7
Finding

Mutable Remote JavaScript Dependency Loaded Without Integrity Verification

Content
View full analysis
``` ### Technical Analysis The generated visualization loads executable JavaScript at runtime from the external `d3js.org` host. The URL refers generally to D3 major version 7 rather than an immutable, exact release artifact, and the script element does not provide a Subresource Integrity (`integrity`) hash. Consequently, the code that executes when a user opens the visualization is not fully represented by the audited project. A change to the remote resource, a compromise of the distribution infrastructure, or another supply-chain failure could cause different JavaScript to execute after the Skill package has been reviewed. This behavior also conflicts with the statement in `SKILL.md` that output has “No external dependencies.” The generated HTML requires network access to retrieve D3 and is not fully standalone. ### Attack Path 1. The Skill generates or distributes an HTML visualization containing the external script element. 2. A user opens the visualization while connected to the network. 3. The browser requests `https://d3js.org/d3.v7.min.js`. 4. If the remote resource or its delivery infrastructure has been compromised or unexpectedly modified, the browser receives altered JavaScript. 5. Because no integrity hash is present, the browser has no project-defined mechanism to reject the altered content. 6. The returned script executes in the visualization's page context before the local visualization logic runs. ### Impact Assessment A malicious dependency response could execute arbitrary JavaScript with the privileges of the visualization page. Depending on how the file is hosted and the browser context, this could permit: - Reading or modifying visualization content. - C ...[truncated 442 chars]
Remediation
View remediation
``` The placeholder URL, version, and hash must be replaced with a verified immutable artifact and its actual digest. 3. Add a Content Security Policy restricting scripts to the bundled application or a narrowly defined allowlist. 4. Document the dependency accurately in `SKILL.md` and `README.md`, including its exact version, source, integrity controls, and offline behavior. 5. Establish a dependency-review process that verifies downloaded artifacts, tracks security advisories, and updates the pinned build deliberately. ]]>
Vulnerability Patterns
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Output HandlingUnvalidated Output Injection, Cross-Context Output, Unbounded Output
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Privilege EscalationExcessive Permissions, Sudo/Root Execution, Credential Access
Findings (5)

Unvalidated Output Injection

High
Category
Output Handling
Confidence
80% confidence
Finding

Model output is used without validation or sanitization. Unvalidated output injected into downstream contexts (SQL, shell, HTML) enables injection attacks and arbitrary code execution.

Content

Scanner excerpt · template.html (reported line 347)May include surrounding context.

html
document.getElementById("detail-causes").innerHTML = causes.length ? causes.map(l => `<div class="cause-item">${l.source} (${l.strength >= 8 ? "强" : "中"}${l.strength})</div>`).join("") : "<div style='color:#666;font-size:12px;'>无直接原因</div>";
            
            const results = links.filter(l => l.source === d.id);
            document.getElementById("detail-results").innerHTML = results.length ? results.map(l => `<div class="result-item">${l.target} (${l.strength >= 8 ? "强" : "中"}${l.strength})</div>`).join("") : "<div style='color:#666;font-size:12px;'>无直接结果</div>";
        }
        
        function closeDetail() { document.getElementById("detail-panel").classList.remove("show"); resetHighlight(); }

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The README says only 'Activate the skill' without naming a specific trigger phrase, invocation method, or constraints on when the skill should be used. For a markdown file, this is an ambiguous activation condition that could lead to unintended or inconsistent invocation.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The skill states that it produces a standalone HTML file with embedded D3.js via CDN, but it does not clearly warn users that opening the file will load remote JavaScript from a third party. This creates a supply-chain and privacy risk: CDN compromise, version drift, or network requests from local file usage could expose users to unintended script execution or information leakage.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The activation section says only 'When you activate this skill' and then describes inputs to provide, but it does not specify concrete trigger phrases, invocation boundaries, or exclusion conditions. In a markdown skill description, this can cause unclear or overly broad activation because there is no explicit guidance on when the skill should or should not be used.

Content

No source excerpt is available for this finding.

Natural-Language Policy Violations

Low
Category
Not specified by scanner
Confidence
92% confidence
Finding

The document declares lang="zh-CN", and the visible UI text throughout the page is fixed in Simplified Chinese. This creates a language/locale constraint without any opt-in, switch, or stated region-specific requirement, which matches the policy-violation category for forced language or locale.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.