T08 · Insecure Dependencies
- Location
package-lock.json:18- Finding
Dependencies Are Retrieved from a Third-Party Mirror over Plaintext HTTP
- Content
View full analysis
Vulnerability Details
File Location:
package-lock.json:18,package-lock.json:24,package-lock.json:39,package-lock.json:54,package-lock.json:65,package-lock.json:72,package-lock.json:96,package-lock.json:108, andpackage-lock.json:115
Vulnerability Type: Insecure dependency transport and third-party package source
Risk Level: MediumVulnerable Code
Representative locked dependency entry:
json "node_modules/ethers": { "version": "6.16.0", "resolved": "http://mirrors.tencentyun.com/npm/ethers/-/ethers-6.16.0.tgz", "integrity": "sha512-U1wulmetNymijEhpSEQ7Ct/P/Jw9/e7R1j5XIbPRydgV2DjLVMsULDlNksq3RQnFgKoLlZf88ijYtWEXcPa07A==", "funding": [ { "type": "individual", "url": "https://github.com/sponsors/ethers-io/" }, { "type": "individual", "url": "https://www.buymeacoffee.com/ricmoo" } ], "license": "MIT", "dependencies": { "@adraffy/ens-normalize": "1.10.1", "@noble/curves": "1.2.0", "@noble/hashes": "1.3.2", "@types/node": "22.7.5", "aes-js": "4.0.0-beta.5", "tslib": "2.7.0", "ws": "8.17.1" }, "engines": { "node": ">=14.0.0" } }All packages recorded in the lockfile use the same plaintext third-party mirror pattern.
Technical Analysis
The lockfile directs npm to retrieve executable JavaScript dependencies from
mirrors.tencentyun.comusing unencrypted HTTP rather than the official npm registry over HTTPS. Plaintext transport does not authenticate the package server and provides no transport confidentiality or integrity. A network-positioned attacker can therefore intercept, redirect, block, or alter package download responses.The SHA-512
integrityfields materially limit arbitrary package substitution: npm should reject an altered archive when its digest does not match the lockfile. Consequently, a simple man-in-the-middle attacker cannot ...[truncated 2189 chars]- Remediation
View remediation
Remediation Suggestions
- Regenerate
package-lock.jsonusing the official npm registry over HTTPS:bash npm config set registry https://registry.npmjs.org/ rm -rf node_modules package-lock.json npm install - Verify that every
resolvedpackage URL in the regenerated lockfile uses an authenticated HTTPS source. - Use
npm ciin automated and production installation workflows so dependency versions and integrity values must match the reviewed lockfile. - Pin
ethersto an exact reviewed version instead of the range"^6.16.0"to reduce unreviewed dependency changes when the lockfile is regenerated. - Retain SHA-512 integrity metadata and fail installation if integrity verification reports any mismatch.
- Add CI checks that reject lockfile entries using
http://or unapproved package registries. - Periodically audit dependencies and review changes to package source URLs, versions, integrity hashes, and transitive dependency graphs.
- Regenerate
