T03 · Remote Payload Retrieval and Execution
Warning
- Location
- src/index.js:805
- Finding
- Exported Visualization Executes Unpinned Remote JavaScript## Vulnerability Details **File Location**: `src/index.js:805` **Vulnerability Type**: Unpinned runtime dependency loaded from a third-party CDN **Risk Level**: Medium ### Vulnerable Code ```html <script src="https://unpkg.com/vis-network/standalone/umd/vis-network.min.js"></script> ``` ### Technical Analysis The HTML generated by `kc visualize` loads and executes `vis-network` directly from `unpkg.com` without 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 1. A user imports local notes or documents into Knowledge Connector. 2. The user runs `kc visualize --format html`, optionally writing the result to an HTML file. 3. The generated file contains the unversioned `unpkg.com` script reference and embeds the user's graph data. 4. The user opens the generated HTML file in a browser with network access. 5. The browser retrieves the current remote JavaScript payload from the CDN. 6. If the CDN, upstream package, publishing account, or delivery path has been compromised, attacker-controlled JavaScript executes in the visualization page. 7. 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
- ## Remediation Suggestions 1. Bundle a reviewed version of `vis-network` with the package and reference the local asset so exported visualizations do not retrieve executable code at runtime. 2. If remote hosting is unavoidable, pin an exact dependency version using an immutable URL rather than a floating package path. 3. Add a verified Subresource Integrity hash and `crossorigin="anonymous"` to the script element. 4. Add a restrictive Content Security Policy that permits scripts only from explicitly trusted sources and limits outbound connections with `connect-src`. 5. Prefer generating a fully self-contained visualization so opening an export does not cause undeclared network traffic. 6. Document any unavoidable external requests and warn users before local document-derived data is placed in a page that executes third-party code. 7. Add a regression test asserting that generated HTML contains no unversioned external script references.
