T08 · Insecure Dependencies
Warning
- Location
- references/generation-guide.md:96
- Finding
- Unpinned Third-Party JavaScript Dependency Allows Mutable Remote Code Execution<![CDATA[ ## Vulnerability Details **File Location**: `references/generation-guide.md`, lines 96-101 **Vulnerability Type**: Unpinned executable CDN dependency **Risk Level**: Medium ### Vulnerable Code ```markdown ### 3D elements - Default to Three.js - Apply lighting, camera, materials from params - Handle resize with ResizeObserver - CDN: `https://cdn.jsdelivr.net/npm/three@latest/build/three.module.js` ``` ### Technical Analysis The generation guide directs the agent to use the mutable `@latest` version of Three.js from a third-party CDN. Because no exact package version or integrity hash is specified, the effective JavaScript payload can change after the Skill has been reviewed. If generated HTML imports this URL, every future page load may retrieve and execute whichever package version the CDN currently resolves as `latest`. A compromised package release, package registry account, CDN, or upstream distribution process could consequently introduce attacker-controlled JavaScript. This recommendation also conflicts with the Skill's stated preference for self-contained output. The remote dependency makes generated interfaces dependent on network availability and an external supply chain. ### Attack Path 1. The user requests UI generation involving 3D effects. 2. The agent follows the generation guide and imports Three.js from `https://cdn.jsdelivr.net/npm/three@latest/build/three.module.js`. 3. An attacker compromises the upstream package publication process, package maintainer account, or CDN distribution path. 4. The mutable `@latest` reference resolves to attacker-controlled JavaScript. 5. A user opens the generated page while connected to the network. 6. The browser downloads and executes the malicious module in the generated page's JavaScript context. ### Impact Assessment Successful exploitation permits arbitrary JavaScript execution in the context of the generated page. Depending on where the generated UI is deployed, malicious code could: ...[truncated 603 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions 1. Replace `@latest` with a reviewed, exact version, for example: ```text https://cdn.jsdelivr.net/npm/three@<exact-version>/build/three.module.js ``` 2. Prefer vendoring the reviewed dependency into the generated project so output remains self-contained and reproducible. 3. Record and review dependency updates explicitly rather than allowing automatic resolution to new releases. 4. Where the loading mechanism supports it, require Subresource Integrity and an appropriate `crossorigin` policy. 5. Apply a restrictive Content Security Policy that limits permitted script and network destinations. 6. Use a dependency lockfile and automated vulnerability scanning when generating a packaged application. 7. Prefer native CSS, SVG, or Canvas implementations when the requested effect does not require a large external library. 8. Update the generation quality checklist to reject mutable dependency specifiers such as `latest`, wildcard versions, and unreviewed remote scripts. ]]>
