T03 · Remote Payload Retrieval and Execution
- Location
src/index.js:805- Finding
Exported Visualization Executes Unpinned Remote JavaScript
- Content
View full analysis
Vulnerability Details
File Location:
src/index.js:805
Vulnerability Type: Unpinned runtime dependency loaded from a third-party CDN
Risk Level: MediumVulnerable Code
html <script src="https://unpkg.com/vis-network/standalone/umd/vis-network.min.js"></script>Technical Analysis
The HTML generated by
kc visualizeloads and executesvis-networkdirectly fromunpkg.comwithout an exact version, Subresource Integrity hash, or restrictive Content Security Policy. The effective JavaScript payload can therefore change after the skill package has been reviewed.The generated page embeds graph nodes and edges in its JavaScript context. These values can contain information derived from imported local documents, including concept names, descriptions, and source excerpts. A malicious or compromised CDN response would execute in the same page context and could read that embedded information.
This behavior also causes an external network request whenever the user opens the generated visualization, despite the application's otherwise local data-processing model.
Attack Path
- A user imports local notes or documents into Knowledge Connector.
- The user runs
kc visualize --format html, optionally writing the result to an HTML file. - The generated file contains the unversioned
unpkg.comscript reference and embeds the user's graph data. - The user opens the generated HTML file in a browser with network access.
- The browser retrieves the current remote JavaScript payload from the CDN.
- If the CDN, upstream package, publishing account, or delivery path has been compromised, attacker-controlled JavaScript executes in the visualization page.
- The malicious script reads the embedded graph nodes and edges and may transmit them to an attacker-controlled endpoint.
Impact Assessment
Successful exploitation provides arbitrary JavaScript execution in the generated visualization's browser context. The attacker could ac ...[truncated 563 chars]
- Remediation
View remediation
Remediation Suggestions
- Bundle a reviewed version of
vis-networkwith the package and reference the local asset so exported visualizations do not retrieve executable code at runtime. - If remote hosting is unavoidable, pin an exact dependency version using an immutable URL rather than a floating package path.
- Add a verified Subresource Integrity hash and
crossorigin="anonymous"to the script element. - Add a restrictive Content Security Policy that permits scripts only from explicitly trusted sources and limits outbound connections with
connect-src. - Prefer generating a fully self-contained visualization so opening an export does not cause undeclared network traffic.
- Document any unavoidable external requests and warn users before local document-derived data is placed in a page that executes third-party code.
- Add a regression test asserting that generated HTML contains no unversioned external script references.
- Bundle a reviewed version of
