Code injection and privilege escalation through Linux capabilities
Node.js incorrectly exempted CAP_NET_BIND_SERVICE from its environment-variable filtering even when other capabilities were present, so an unprivileged user could inject code that ran with the process's elevated privileges.
- Triaged in 6 days
- Fixed in 3 months
- Disclosed after 3 months
Summary by the program
On Linux, Node.js ignores certain environment variables if those may have been set by an unprivileged user while the process is running with elevated privileges with the only exception of CAP_NET_BIND_SERVICE.
Due to a bug in the implementation of this exception, Node.js incorrectly applies this exception even when certain other capabilities have been set.
This allows unprivileged users to inject code that inherits the process's elevated privileges.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the capability check only tested for CAP_NET_BIND_SERVICE and did not verify that no other capabilities were set, so the environment-variable exception was applied too broadly.
Impact
An unprivileged user could inject code that inherits the process's elevated privileges, potentially escalating to those capabilities.
What the attacker needed
Node.js process runs with elevated capabilities; Attacker can set environment variables
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
Linux capabilities are fine-grained permissions that let a program do specific privileged things without being full root. Node.js normally ignores certain environment variables when it runs with extra privileges, because an unprivileged user could set them to inject code. A bug meant it still honoured them in some cases, so a normal user could get code to run with the program's higher privileges.
What is Access control?
A user can do something their role should not allow: reach an admin function, act on a feature they have not paid for, or skip a permission check. IDOR is the special case where the object belongs to someone else.