Node.js 安全工程手册:服务端基线、供应链防护与事件复盘
本文目录
把 Node.js 安全从扫描器清单落到请求边界、身份授权、上传与 SSRF、依赖发布链、生产日志和可演练的事件处置。
本文围绕 lirantal/awesome-nodejs-security 做原创安全实践整理。项目来自 腾讯新闻前端团队 2022 年的 25 个 Awesome 项目推荐;README 固定到 commit 70d4d24e8f42a5120c6423267d1262f42962b4ba;资源链接引用当时的仓库快照,目标网站和软件版本可能继续变化。 下方保留固定版本入口与资源快照。
仓库内容地图
- 服务入口:框架与代理加固、CI/CD、静态与动态测试
- 应用层:校验、输出编码、安全组合、CSRF、限流与路径/上传防护
- 情报与复盘:Node 版本/CVE 数据源、npm 与 JavaScript 供应链事件
- 学习资源:文章、论文、书籍、路线图、公司和授权靶场
- 本文固定快照:309 个外链引用、89 条事故记录,按原仓库主题归档
怎么读才有收获
先按请求数据流画出资产、信任边界与权限,再选择能验证某个控制的工具。本文另外补充现代服务端实践,并附上固定上游快照的全部资源链接;目录条目不等于仍在维护或适合直接安装。
实战章节:Node.js 服务端安全基线
1. 先画数据流,再选扫描器
安全评审从边界开始:请求从哪里进入、哪些值来自访客、在哪些层完成身份验证和授权、哪些代码能访问数据库/文件/外网/子进程、敏感数据最后落在哪里。把“校验了输入”与“验证了权限”分开记录:格式正确的用户 ID 仍然可能属于别的用户,合法文件名也不意味着当前用户能读取它。
建议标出浏览器到反向代理(TLS、体积、超时、限流)、代理到 Node(真实代理链)、API 到数据层(租户范围与对象级权限)、服务到外网/磁盘/命令(白名单和资源上限)、构建链到生产(依赖、CI 身份、发布凭据)等边界。每个风险都写成“资产、威胁、控制、验证证据”。工具扫描结果只是线索;没有请求路径、权限规则和可复现测试,不能把绿色报告当作安全结论。
2. HTTP、代理与请求校验
Express 官方建议启用安全响应头,并明确配置代理信任。代理拓扑配错会影响客户端 IP、HTTPS 判断和安全 Cookie;trust proxy = true 不应作为复制粘贴式默认值。下面只是配置骨架,代理跳数、源站访问限制和允许域名必须按实际部署改写:
import express from 'express';
import helmet from 'helmet';
import cors from 'cors';
const app = express();
const allowedOrigins = new Set(['https://www.example.com']);
app.disable('x-powered-by');
// 仅在请求必定经过一个受控入口代理时才使用一跳配置。
app.set('trust proxy', 1);
app.use(helmet());
app.use(express.json({ limit: '64kb' }));
app.use(cors({
origin(origin, callback) {
callback(null, !origin || allowedOrigins.has(origin));
},
credentials: true,
}));
这不是完整授权方案。CORS 只决定浏览器是否把跨源响应交给网页读取,不阻止 curl、脚本或服务器直接访问 API;敏感路由仍必须检查会话、角色和资源归属。带 Cookie 的跨域请求要使用精确 Origin 白名单,不能与通配符组合。Node 端口应只允许受控代理访问,并核对 Host、X-Forwarded-For、X-Forwarded-Proto 的写入策略。参考:Express 代理信任说明与Express 生产安全建议。
外部输入至少校验类型、长度、枚举、格式和业务约束;请求体、数组数量、分页大小、正则输入、压缩文件展开量和处理时长都要有上限。超大 JSON、复杂正则回溯和同步压缩会占住事件循环;Node 官方指出,单个回调或线程池任务运行太久会拖慢其他请求,甚至放大成拒绝服务。
推荐顺序:传输层限制 -> schema 校验 -> 身份认证 -> 对象级授权 -> 业务不变量 -> 参数化读写 -> 按输出上下文编码。HTML、属性、URL、JavaScript、SQL 和 Shell 是不同上下文,没有一种通用 escape 能安全覆盖所有输出。富文本使用成熟的白名单净化;普通文本作为文本渲染,不拼成 HTML。SQL 使用参数化语句;动态表名、字段名和排序方向通过服务端枚举映射。外部程序使用固定命令和分离的参数数组,避免 shell: true;参数仍按业务白名单限制。
3. 登录、授权与对象级访问
先明确接口使用 Cookie 会话还是 Bearer Token。Cookie 设置 HttpOnly、Secure 和适当 SameSite;跨站业务确实需要带 Cookie 时,增加 CSRF token 或严格的 Origin/Fetch Metadata 校验。登录、验证码、密码重置和高权限操作需要独立限流与审计,错误文案不应泄露账号是否存在。
密码只存专门密码 KDF 的摘要(例如按 OWASP 当前指南配置 Argon2id 或 scrypt),不能用普通 SHA 哈希代替。访问令牌最小化声明、设置短有效期并设计撤销/轮换;角色、封禁状态和资源所有权在服务端判断,不能只隐藏前端按钮。账号改权、封禁或凭据轮换后,还要决定已有会话何时失效。
授权测试至少区分未登录、已登录但无权限、拥有权限三种状态。对阅读书籍、下载附件、编辑文档等接口,验证对象 ID 替换不会越权;列表页过滤正确,不代表详情、导出和签名下载接口也正确。
4. SSRF、路径与文件上传
服务端抓取用户给出的 URL 时,使用结构化 URL parser,再限制协议、主机、端口、用户名/密码字段、重定向次数、响应字节数和总耗时。仅检查 hostname 字符串不够:还要处理 DNS 解析结果、IPv4/IPv6 私网地址、DNS rebinding 和重定向后的目标;网络出口策略是重要的纵深防线。不要让抓取服务默认访问本机、云元数据地址或任意内网。
上传内容一律不可信。扩展名与浏览器 MIME 都可伪造;检查格式签名/解析结果、压缩炸弹和资源上限,为存储生成随机文件名,隔离在静态 Web 根目录之外,下载时经授权接口提供。图片、PDF、EPUB 等复杂格式的缩略图和转换放在受限队列,限制 CPU、内存、临时空间、并发和时长。转换器失败后清理临时文件并让队列可恢复;不让转换进程读取不相关的环境密钥。
用户指定路径还要处理 ..、绝对路径、编码差异、符号链接和并发替换。一次字符串前缀判断不足以证明文件仍在安全目录;优先使用随机内部标识、目录句柄/文件描述符和最小权限,避免客户端决定实际磁盘路径。
5. 依赖、CI 与发布身份
提交可信 lockfile,CI 按锁文件安装;审查依赖变更的包名、维护者、发布来源、传递依赖和生命周期脚本。npm audit 报告的是已知公告与受影响依赖范围,不会检测所有恶意代码,也不替代人工判断。升级前在分支检查破坏性变更、测试和运行时支持,不盲目自动修复后直接部署。参阅 npm audit 官方说明。
将信号分开处理:SCA 看已知漏洞、许可证政策和传递路径;SAST 看危险 API、注入和动态执行;secret scan 看提交历史、CI 日志和构建产物;发布来源核对仓库、包版本、签名与 Provenance;工作流则为每个 job 设最小权限,发布凭据只在受保护任务中短时获得,第三方 Action 固定到已审查的完整提交 SHA。
签名或来源证明增加可追溯性,但不保证代码没有恶意行为。引入依赖时问清必要性、平台 API 替代方案、安装脚本动作和凭据可见范围。--ignore-scripts 也非万能:某些原生包需要构建脚本;应在受控 runner 有意识地决定,而不是假设跳过脚本后产物等价。
6. 运行时、日志和故障边界
生产服务使用仍受维护的 Node.js LTS,并记录升级节奏;运行用户、文件权限、容器能力和云凭证只给服务必需范围。对外请求设置超时、并发上限和取消信号;队列设置重试上限、退避和死信处置。多实例限流不能只依赖每个进程的内存计数器。
结构化日志记录请求 ID、路由模板、状态码、耗时和错误类别,不记录密码、验证码、Cookie、Authorization、原始上传内容或敏感 URL。错误返回稳定的用户信息,详细堆栈进入受控日志;测试嵌套对象、数组和异常序列化路径的脱敏。为日志设访问权限与保留期。
优雅关闭应停止接入新流量,限时等待在途请求,停止队列消费,再关闭数据库/Redis/文件流。不要在异步日志和事务清理之前硬退出;定期演练重启、依赖不可用、磁盘不足、队列重复投递和连接泄漏。
7. 把供应链事故变成演练
固定快照收录 2016—2026 年的 89 条 npm/JavaScript 事件,涉及维护者账号失陷、钓鱼、拼写相似包、安装脚本、发布令牌泄漏、传递依赖投毒、恶意 MCP/工具服务和依赖混淆。复盘每条事件时检查:入口包与受影响版本、恶意行为阶段、可能暴露的凭据、受影响的构建/运行环境、发现与撤回时间,以及能提前阻断的控制。
季度依赖演练可以按这条路径执行:
- 锁定依赖图和生产实际版本,确认直接与传递依赖。
- 通过受信公告源确认范围,不从新闻标题推断受影响版本。
- 暂停自动部署与相关凭据,保存锁文件、构建日志、制品哈希和时间线。
- 从干净环境撤销/轮换可能暴露的令牌,必要时清缓存并重建制品。
- 根据发布者公告升级或回滚,在隔离环境验证后分阶段恢复流量。
- 将教训变成 lockfile 审查、发布身份保护、最小 CI 权限、网络隔离和异常版本告警。
Provenance 不能替代对账号、发布工作流、依赖脚本和运行权限的审查。不要把事故报道中的恶意包安装到主力电脑;确需分析样本时,只能使用隔离、可销毁且没有真实凭据和网络出口的授权实验环境。
8. 项目验收清单
- 管理接口按角色和目标资源做服务端授权;匿名、普通用户、只读、编辑者、管理员均有测试。
- 请求体、查询、上传、转换、导出、正则和分页有明确资源上限与超时。
- 外部 URL 抓取有协议/域名/解析 IP/重定向校验及网络出口控制。
- SQL 参数化,HTML 按上下文输出,子进程使用固定命令和受限参数。
- 登录、验证码、重置和高风险写操作有速率限制、审计和凭据轮换。
- lockfile、依赖变更、Action 固定版本、发布权限和 secret scan 接入 CI。
- 上传隔离于公开目录;格式解析、压缩展开、转换边界和失败清理经过测试。
- 日志脱敏;告警覆盖 5xx、异常登录、队列积压、事件循环延迟、磁盘和数据库连接。
- 备份恢复、密钥轮换、依赖回滚和进程退出有实操记录。
- 生产修复经过小范围部署、健康检查、日志检查与明确回滚点。
对每项保留测试名、CI 结果或配置位置;暂时做不到时记录风险负责人、临时控制和复查日期。不要用“已安装安全工具”代替证据。
9. 学习与落地顺序
先读 OWASP Node.js Security Cheat Sheet 和 Node.js 官方安全指南,拿自己维护的 API 画出身份、数据、文件和外网边界;再挑一条请求链,把输入校验、授权、参数化查询、输出编码和审计测完整。第二轮把 lockfile、发布身份与密钥扫描接入 CI。最后从固定快照选三起不同类型事件,练习“版本确认 -> 影响范围 -> 凭据轮换 -> 干净重建 -> 回滚验证”。工具名会变化或停止维护;先确定风险和验收标准,再选误报可处理、能融入发布门禁的工具。
动手路线
- 为一个 Node API 画出代理、认证、授权、数据库、文件与外网调用边界。
- 把匿名/越权、请求体上限、SSRF 重定向、上传转换超时和密钥泄漏变成可重复测试。
- 从索引选三起不同年代的 npm 事件,按影响版本、凭据、隔离、重建和回滚写复盘。
使用边界
快照中的工具与事故链接没有逐项做当前维护/漏洞背书;双用途资源仅限自有系统和授权靶场。本站以防御为主,不下载或运行恶意样本。
完整资源索引
以下是固定快照 README 中的外部资源标题与链接目录。为便于离线阅读,目录保留了原分类、每条资源的可识别标题、供应链事故日期/名称及来源链接;目标网站正文仍由其作者维护。共收录 309 个链接引用(306 个不同的精确 URL,保留原文重复引用),包括事故案例的 89 条记录。采集快照固定在 commit 70d4d24e8f42a5120c6423267d1262f42962b4ba,不是对每个工具当前维护状态的背书。
Contents
Tools
Web Framework Hardening
- Helmet
- koa-helmet
- blankie
- hapi
- fastify-helmet
- fastify
- nis2-express-middleware
- nuxt-security
- reporting-api
GitHub Actions and CI/CD Security
Static Code Analysis
- eslint-plugin-security
- tslint-plugin-security
- safe-regex
- vuln-regex-detector
- regolith
- git-secrets
- DevSkim
- ban-sensitive-files
- NodeJSScan
- NodeSecure CLI
- Trust But Verify
- lockfile-lint
- pkgsign
- semgrep
- npm-scan
- js-x-ray
- cspscanner
- eslint-plugin-anti-trojan-source
- sdc-check
- fix-lockfile-integrity
- Bearer
- GuardDog
- repolyze
Dynamic Application Security Testing
Input Validation & Output Encoding
- node-esapi
- escape-html
- js-string-escape
- validator
- xss-filters
- DOMPurify
- envalid
- data-guardian
- OWASP Protect Data everywhere
- is-path-inside-secure
- is-path-inside
- spotlighting-datamarking
- Spotlighting paper’s techniques
- promptpurify
Secure Composition
- pug-plugin-trusted-types
- automagic
- safesql
- Postgres
- MySQL
- SQL injection
- sh-template-tag
- shell injection
CSRF
Vulnerabilities and Security Advisories
- npq
- snyk
- node-release-lines
- auditjs
- OSSIndex
- npm-audit
- npm-audit-resolver
- gammaray
- Node.js Security Working Group vulnerability data
- patch-package
- check-my-headers
- clawsearch-guard
- is-website-vulnerable
- joi-security
- confused
- Dependency Confusion: How I Hacked Into Apple, Microsoft and Dozens of Other Companies
- nodejs-cve-checker
- zizmor
- releaserun
- CVE PoC Search
- cve-lite-cli
Security Hardening
- hijagger
- snync
- NopPP - No Prototype Pollution
- anti-trojan-source
- express-limiter
- limits
- rate-limiter-flexible
- tor-detect-middleware
- express-enforces-ssl
- bourne
- sigcli
- fastify-rate-limit
- secure-json-parse
- express-brute
- allowed-scripts
- ses
- lavamoat
- moddable
- is-my-node-vulnerable
- @lavamoat/preinstall-always-fail
- FCaptcha
- are-scripts-enabled
- @w-r-l/verify
- pompelmi
- verifyfetch
Data Sources
Security Incidents
Protestware supply chain security issues
- PyPI package author of atomicwrites deletes his own code
- left-pad
- node-ipc
- nestjs-pino
- Open Souce Peace
- 2022's Techcrunch protestware review
- 2022's Snyk protestware types
npm and JavaScript specific security incidents and supply chain security issues
-
2026 Aug 4 — keyv, cacheable, flat-cache and file-entry-cache compromised via maintainer account takeover, spreading to over 400 packages and publishing malicious versions that carried valid provenance;来源:Snyk、Wiz
-
2026 May 11 — TanStack Npm Packages Compromised via Shai-Hulud campaign;来源:Snyk、StepSecurity、Socket
-
2026 Apr 29 — Bun based Stealer hits SAP @cap-js npm package;来源:Snyk
-
2026 Mar 31 — Axios npm Package Compromised: Supply Chain Attack Delivers Cross-Platform RAT;来源:Snyk、Axios post-mortem on GitHub issue、Mandaint report on UNC1069 involvement in Axios compromise
-
2025 Sep 25 — Malicious MCP Server on npm postmark-mcp Harvests Emails;来源:Snyk
-
2025 Sep 15 — Shai-Hulud npm package malware;来源:Snyk、ReversingLabs、Aikido
-
2025 Sep 8 — Qix maintainer compromised via phishing campaign causing malware in debug chalk and many other packages;来源:Snyk
-
2025 Aug 27 — Nx package malicious version compromise and AI coding tools weaponization of LLM and agents;来源:Snyk
-
2025 Jul 25 — Toptal packages were compromised leading to GitHub Token theft and systems destroyed;来源:Arstechnica
-
2025 Jul 19 — ESLint Config Prettier maintainers get compromised, spread malware and infect other maintainers too;来源:Snyk、Socket、Safedep
-
2025 Jun 25 — BeaverTail North Korean group drops 35 npm malware packages;来源:Socket
-
2025 Jun 12 — npm package @react-native-aria/focus and other @react-native-area namespace packages were found to be malicious;来源:Aikido、Bleeping Computer
-
2025 May 15 — os-info-checker-es6 npm package leverages unicode steganography in Google calendar as command and control;来源:Veracode
-
2025 May 8 — Package rand-user-agent with 45,000 downloads compromised in supply chain attack for malicious RAT;来源:Aikido
-
2025 May 7 — Malicious npm Packages Infect 3,200+ Cursor Users With Backdoor;来源:Socket
-
2025 May 2 — Typosquatting popular .NET, Python and other package names;来源:Socket
-
2025 Apr 15 — Russian hackers typosquat express-exp;来源:Safety
-
2025 Apr 10 — pdf-to-office malicious npm package;来源:ReversingLabs
-
2025 Apr 5 — North Korean Hackers Deploy BeaverTail Malware via 11 Malicious npm Packages;来源:socket
-
2025 Mar 26 — Malicious packages ethers-provider2 and ethers-providerz;来源:ReversingLabs
-
2025 Mar 11 — North Korean Lazarus group targets npm packages is-buffer-validator, yoojae-validator, event-handle-package, array-empty-validator, react-event-dependency, and auth-validator;来源:socket
-
2025 Feb 26 — Malicious Code Hidden in NPM Packages;来源:cycode
-
2025 Jan 14 — npm command confusion;来源:Checkmarx
-
2025 Jan 13 — Typosquatted packages for Chalk and Chokidar harbor backdoor trojans;来源:socket
-
2024 Dec 20 — @rspack/core and @rspack/cli at 400k weekly downloads were compromised due to npm token theft and used to publish malicious packages for monero cryptocurrency mining;来源:rspack release notes、sonatype、Socket
-
2024 Dec 11 — Malicious npm Package @typescript-eslint/eslint-plugin exfiltrates data in typosquatting attack;来源:Socket
-
2024 Dec 3 — Supply Chain Attack Detected in Solana's web3.js Library @solana/web3.js;来源:Socket
-
2024 Nov 12 — "node-request-ip", "request-ip-check" and "request-ip-validator" are fake IP checker utilities on npm target cryptocurrency and install trojans;来源:sonatype
-
2024 Oct 31 — Lottie Player npm package compromised for crypto wallet theft;来源:Snyk
-
2024 Oct 31 — Typosquat campaign targeting Puppeteer, Bignum.js, and some 137 other cryptocurrency libraries;来源:Phylum
-
2024 Oct 28 — Dependency confusion campaign used in an npm supply chain security leveraged to breach Fortune 500 company;来源:https://www.landh.tech/blog/20241028-hidden-supply-chain-links/
-
2024 Oct 4 — lodasher, them4on, laodasher counterfeit npm packages aimed to backdoor Windows users with a modified AnyDesk binary;来源:Sonatype
-
2024 Jul 16 — string-width-cjs and other Suspicious Maintainer Unveils Threads of npm Supply Chain Attack;来源:Snyk
-
2024 Jul 11 — noblox-ts starjacking and QuasarRAT on npm;来源:stacklok
-
2024 Jun 17 — ua-parser-js switches to AGPL+commercial in "rug pull" move;来源:Adventures in Nodeland
-
2024 Jun 11 — cors-parser npm package hides cross-platform backdoor in PNG files;来源:Sonatype
-
2024 Jun 03 — npm regsitry cache poisoning attack;来源:landh.tech
-
2024 Apr 26 — Fake job interviews target developers with new Python backdoor;来源:Bleeping Computer
-
2024 Apr 16 — Tea tokens and developers abusing OSS infrastructure for monetization;来源:Sonatype
-
2024 Feb 6 — noblox.js-proxy-server malicious npm Package Masquerades as Noblox.js, Targeting Roblox Users for Data Theft;来源:Socket
-
2024 Jan 25 — npm flooded with 748 packages that store movies;来源:Sonatype
-
2024 Jan 3 — An everything package with a registry-wide dependencies prevents from packages to be unpublished;来源:SC Media
-
2023 Dec 14 — Ledger supply chain security attack introducing crypto drainer malware (@ledgerhq/connect-kit);来源:Sonatype、1、2、3、4、5、6、7、8
-
2023 Sep 27 — Spoofed Dependabot commits steal GitHub tokens and inject malware to JavaScript files;来源:Checkmarx
-
2023 Jun 27 — Manifest Confusion - a new publicly disclosed bug with the npm package manager demonstrating package metadata inconsistency;来源:Darcy Clarke's blog
-
2023 Jun 23 — North Korean attackers exploit social engineering and supply chain attacks on npm;来源:Phylum
-
2023 Jun 15 — Supply Chain Attack Exploits Abandoned S3 Buckets to Distribute Malicious Binaries for bignum npm package;来源:bignum npm package、The Hacker News、Checkmarx
-
2023 Jun 06 — Recommended packages by ChatGPT may be exploited for supply chain security attack vector;来源:Vulcan
-
2023 Feb 16 — Researchers Hijack Popular NPM Package with Millions of Downloads;来源:Illustria on The Hacker News
-
2023 Feb 10 — Researchers Uncover Obfuscated Malicious Code in PyPI Python Packages, affiliated npm ecosystem evidence too;来源:The Hacker News
-
2023 Jan 29 — Phylum Identifies 137 Malicious npm Packages;来源:phylum
-
2022 Nov 29 — Invisible npm malware may hide in crafted versions and bypass npm audit's security checks;来源:JFrog
-
2022 Nov 24 — Phylum team captures captures malicious npm package imagecompress-mini claims to be an image compress tool;来源:Louisw Lang on Twitter
-
2022 Oct 12 — Aqua security discovers flaw in npm that allows disclosing of privately hosted npm packages on the registry;来源:Aqua
-
2022 Oct 07 — LofyGang Distributed ~200 Malicious NPM Packages to Steal Credit Card Data;来源:TheHackerNews
-
2022 Sep 23 — Popular Cryptocurrency Exchange dYdX Has Had Its NPM Account Hacked;来源:Mend
-
2022 Jul 29 — malicious packages small-sm, pern-valids, lifeculer, and proc-title target stealing credit card information and discord tokens;来源:darkreading
-
2022 May 26 — stolen oAuth GitHub tokens lead to npm security breach, compromised user accounts metadata, private packages, and plain-text passwords in logs;来源:GitHub
-
2022 May 24 — malicious npm packages exploiting dependency confusion attacks;来源:Snyk、Snyk
-
2022 May 23 — npm packages hijacked due to expired domains;来源:TheRegister
-
2022 Apr 05 — New npm Flaws Let Attackers Better Target Packages for Account Takeover;来源:Aqua
-
2022 Apr 26 — npm package planting;来源:Aqua、The Hacker News
-
2022 Mar 31 — More protestware from styled-components;来源:Checkmarx Security blog
-
2022 Mar 18 — More protestware from es5-ext and event-source-pollyfill;来源:Snyk advisory for event-source-pollyfill、es5-ext commit、ArsTechnica
-
2022 March 16 — peacenotwar module sabotages npm developers in the node-ipc package to protest the invasion of Ukraine;来源:Snyk blog、Darkreading、SC Magazine
-
2022 Mar 7 — Malicious packages caught exfiltrating data via legit webhook services;来源:Checkmarx Security blog
-
2022 Feb 22 — 25 Malicious JavaScript Libraries due to typosquatting attacks;来源:TheHackerNews
-
2022 Feb 11 — 2,818 npm accounts use email addresses with expired domains;来源:TheRecord
-
2021 Dec 08 — 17 JavaScript libraries contained malicious code to collect and steal Discord access tokens and environment variables from users’ computers -;来源:TheRecord
-
2021 December 01 — The Bladabindi trojan and RAT malware;来源:Sonatype
-
2021 November 04 — coa and rc packages - Popular npm library 'coa' was hijacked today with malicious code injected into it, ephemerally impacting React pipelines around the world;来源:Bleepingcomputer、the record、npm tweet、npm tweet for rc
-
2021 October 27 — noblox.js-proxy and noblox.js - typosquatted npm package that target users of official roblox API and SDK npm package (noblox.js);来源:the register
-
2021 October 22 — ua-parser-js - Versions of a popular NPM package named ua-parser-js was found to contain malicious code;来源:Cybersecurity and Infrastructure Security Agency (CISA)、github issue、IOCs、portswigger、theregister
-
2021 September 02 — pac-resolver - can enable threat actors on the local network to run arbitrary code within your Node.js process whenever it attempts to make an HTTP request;来源:arstechnica.com
-
2021 August 07 — npm package ownership process firing back and exposing potential vectors for supply chain security risks.;来源:Twitter
-
2021 April 13 — New Linux, macOS malware hidden in fake Browserify NPM package: web-browserify;来源:Bleepingcomputer
-
2020 December 02 — jdb.js - db-json.js - malicious npm packages caught installing remote access trojans.;来源:zdnet.com、Bleepingcomputer
-
2020 November 09 — discord malicious npm package - Npm package caught stealing sensitive Discord and browser files;来源:sonatype、zdnet
-
2020 November 03 — twilio-npm - malicious npm package opens backdoors on programmers' computers.;来源:zdnet
-
2020 August 29 — fallguys - malicious package stealing sensitive files.;来源:zdnet
-
2020 April 27 — is-promise - one-liner library breaks an ecosystem.;来源:Forbes Lindesay - Maintainer post-mortem、snyk's postmortem
-
2019 August 22 — bb-builder - malicious package targeting Windows systems to exfiltrate information and send to a remote service.;来源:Snyk、Reversing Labs、Bleeping Computer
-
2019 June 05 — EasyDEX-GUI - malicious code found in npm package event-stream.;来源:npm、snyk、komodo announcement
-
2018 November 27 — event-stream - malicious code found in npm package event-stream.;来源:github issue、snyk、snyk's postmortem、schneid、intrinsic、npm、jayden、hillel wayne's postmortem
-
2018 July 12 — eslint - malicious packages found in npm package eslint-scope and eslint-config-eslint.;来源:github issue、eslint tweet、eslint's postmortem、nodesource's postmortem、npm's statement
-
2018 May 02 — getcookies - malicious package getcookies gets embedded in higher-level express related packages.;来源:GitHub issue、npm、bleepingcomputer.com、Snyk’s getcookies vulnerability page、Hacker News
-
2018 Feb 13 — maintainer account with access to conventional-changelog npm package compromised and published malware for 1 day and 11 hours;来源:conventional-changelog repository update
-
2017 August 02 — crossenv - malicious typosquatting package crossenv steals environment variables.;来源:CJ blog on typosquat packages、Typosquatting research paper、bleepingcomputer.com、Snyk’s crossenv vulnerability page、Hacker News
-
2016 March 22 — left-pad - how one developer broke Node, Babel and thousands of projects in 11 lines of JavaScript.;来源:left-pad.io、The Register、qurtaz
Educational
Newsletters
Articles
- A Roadmap for Node.js Security
- https://nodesecroadmap.fyi/
- #42
- 10 npm security best practices
- OWASP Cheat Sheet Series - Node.js Security Cheat Sheet
- What is a backdoor? Let’s build one with Node.js
- The Anatomy of a Malicious Package
- Why npm lockfiles can be a security blindspot for injecting malicious modules
- GitHub Actions to securely publish npm packages
- Top 11 Node.js security best practices | Sqreen.com
- A Tale of (prototype) Poisoning
- Securizing your GitHub org
- Research Case Study: Supply Chain Security at Scale – Insights into NPM Account Takeovers
- npm Security Best Practices
- The Documentation Attack Surface: How npm Libraries Teach Insecure Patterns
Research Papers
Books
- Secure Your Node.js Web Application: Keep Attackers Out and Users Happy
- Essential Node.js Security
- Securing Node JS Apps
- Web Developer Security Toolbox
- Thomas Gentilhomme
- Become a Node.js Developer
- Node.js Secure Coding: Defending Against Command Injection Vulnerabilities
- Node.js Secure Coding: Prevention and Exploitation of Path Traversal Vulnerabilities
- Node.js Secure Coding: Mitigate and Weaponize Code Injection Vulnerabilities
Roadmaps
Companies
Hacking Playground
Contributing
License
索引使用边界
该目录是一个有日期的发现清单,不是当前安全认证。涉及安装或部署前,应到项目主页核对维护者、发行包来源、发布签名/Provenance、许可证、依赖树、漏洞记录、Node.js 版本兼容性和权限范围。事故报道用于复盘防守,不要下载或运行其中的恶意样本。
原始入口
Live Notes
留言提交后会先进入审核,审核通过后对其他读者公开。