【发布时间】:2021-05-18 12:43:46
【问题描述】:
当我运行 npm install 时,它显示发现了 1596 个漏洞(20 个低、51 个中等、1525 个高)
运行npm audit fix 来修复它们,或者运行npm audit 了解详情
当我运行 npm audit 时,它会给我一个表列表,类似于:
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ High │ Arbitrary Code Execution │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ underscore │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in │ >=1.12.1 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ @alch/alchemy-web3 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ @alch/alchemy-web3 > web3 > web3-shh > web3-net > │
│ │ web3-core-method > underscore │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ https://npmjs.com/advisories/1674 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate │ Regular Expression Denial of Service │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ hosted-git-info │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in │ >=2.8.9 <3.0.0 || >=3.0.8 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ latest │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ latest > npm > npm-registry-client > normalize-package-data │
│ │ > hosted-git-info │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ https://npmjs.com/advisories/1677 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate │ Remote Memory Exposure │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ request │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in │ >=2.68.0 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ version │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ version > request │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ https://npmjs.com/advisories/309 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate │ ReDoS │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ brace-expansion │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in │ >=1.1.7 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ latest │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ latest > npm > fs-vacuum > rimraf > glob > minimatch > │
│ │ brace-expansion │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ https://npmjs.com/advisories/338 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Moderate │ Prototype Pollution │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ hoek │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in │ > 4.2.0 < 5.0.0 || >= 5.0.3 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ latest │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ latest > npm > node-gyp > request > hawk > hoek │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ https://npmjs.com/advisories/566 │
└───────────────┴──────────────────────────────────────────────────────────────┘
┌───────────────┬──────────────────────────────────────────────────────────────┐
│ Low │ Insecure Credential Storage │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Package │ web3 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Patched in │ No patch available │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Dependency of │ @alch/alchemy-web3 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ Path │ @alch/alchemy-web3 > web3 │
├───────────────┼──────────────────────────────────────────────────────────────┤
│ More info │ https://npmjs.com/advisories/877 │
└───────────────┴──────────────────────────────────────────────────────────────┘
【问题讨论】:
-
按照提到的补救措施here
-
我尝试了同样的方法,但仍然遇到任意代码执行漏洞。还有其他解决方案吗?但我依赖环回而不是 @alch/alchemy-web3
-
我删除了包锁并手动更改了 package.json 文件中的依赖项,然后点击-- npm install --。不知道这是否是正确的方法,但它奏效了。
标签: npm