Node.js Prototype Pollution
Prototype pollution in Node.js, where polluting Object.prototype can lead to remote code execution via child_process or template engines.
Node.js Prototype Pollution is a JavaScript vulnerability particularly impactful in server-side Node.js applications, where polluting Object.prototype can affect application behavior, bypass security checks, or achieve remote code execution.
Server-Side Impact
Unlike browser-based prototype pollution, Node.js pollution persists for the entire process lifetime, affecting all subsequent requests and operations.
Prevention
- Use
Object.create(null)for dictionaries - Validate input types before merging
- Use
--frozen-intrinsicsflag (Node.js 12+) - Filter
__proto__,constructor,prototypekeys