T08 · Insecure Dependencies
Warning
- Location
- SKILL.md:41
- Finding
- Persistent Redirection of npm to a Third-Party Package Registry<![CDATA[ ## Vulnerability Details **File Location**: `SKILL.md`, line 41 **Vulnerability Type**: Supply-chain trust boundary expansion through an unsafe dependency source **Risk Level**: Medium ### Vulnerable Code ```bash npm config set registry https://registry.npmmirror.com ``` ### Technical Analysis The command persistently changes npm's configured registry from the official npm registry to a third-party mirror. This setting affects subsequent npm operations beyond the immediate troubleshooting session and is not automatically reverted. Although the referenced mirror is not proven to be malicious, using a third-party package source expands the dependency supply-chain trust boundary. If the mirror is compromised, serves inconsistent content, or does not enforce the same package-integrity controls as the official registry, future package installations could retrieve stale, substituted, or malicious package artifacts. npm packages may execute lifecycle scripts during installation, so a compromised dependency can result in local code execution under the privileges of the user running npm. The documentation neither explains this persistent effect nor provides package pinning, integrity verification, or a command to restore the official registry. ### Attack Path 1. A user follows the network-timeout troubleshooting instruction. 2. npm persistently stores `https://registry.npmmirror.com` as its package registry. 3. At a later time, the user or an automated process installs or updates an npm package. 4. npm resolves and downloads that package through the third-party mirror. 5. If the mirror or a mirrored artifact has been compromised, npm retrieves attacker-controlled package content. 6. Package lifecycle scripts or imported package code execute with the permissions of the npm process. ### Impact Assessment Successful exploitation could execute arbitrary code with the privileges of the user or service account performing the npm installation. This could exp ...[truncated 319 chars]
- Remediation
- <![CDATA[ ## Remediation Suggestions - Prefer the official npm registry: ```bash npm config set registry https://registry.npmjs.org/ ``` - If a mirror is strictly required, scope it to a single command rather than modifying persistent configuration: ```bash npm install --registry=https://registry.npmmirror.com ``` - Clearly disclose that the mirror is a third-party service and explain the associated supply-chain risk. - Provide an explicit restoration command after temporary use. - Pin dependency versions and retain lockfiles. - Use npm integrity verification and review lifecycle scripts before installation. - Avoid running npm package installation commands with administrative privileges. ]]>
