Node.js Prototype Pollution

Cybersecurity Glossary APIs & Server-Side Security

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-intrinsics flag (Node.js 12+)
  • Filter __proto__, constructor, prototype keys

See Also