Velocity.js has a Prototype Pollution vulnerability through #set path assignment
Summary
A prototype pollution vulnerability was discovered in Velocity.js <= 2.1.5. This issue occurs during the processing of #set directives in Velocity templates. If an application renders a template controlled by an attacker, it is possible to modify Object.prototype, potentially leading to Denial of Service (DoS) or Remote Code Execution (RCE) depending on the server environment.
Details
The root cause is located in the #set path assignment logic within the source code:
- File: /src/compile/set.ts
- Issue: The engine accepts arbitrary path keys and performs assignments using the logic
(baseRef as Record<string, unknown>)[key] = val.
Because there is no validation or filtering to block sensitive keys such as __proto__, constructor, or prototype, an attacker can traverse the prototype chain and pollute the global Object.prototype.
PoC
const {render} = require('velocityjs');
delete Object.prototype.polluted;
console.log({}.polluted); // ""
render('#set($__proto__.polluted = "hacked")', {});
console.log({}.polluted); // "hacked"
delete Object.prototype.polluted;
Impact
- Vulnerability Type: Prototype Pollution
- Who is impacted: Any application that renders Velocity templates where the template content can be influenced or controlled by untrusted users.
- Severity: High. Prototype pollution can often be used to bypass security controls, cause application crashes (DoS), or be chained with other vulnerabilities to achieve code execution.
Affected software
Click a technology to see all vulnerabilities affecting it.
| Platform | Package | Vulnerable versions | Fixed in |
|---|---|---|---|
| npm package | velocityjs | <= 2.1.5 | no fix |
References
- CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:L/I:L/A:L- Weakness (CWE)
CWE-1321- Platform
- npm
- Package
velocityjs- Disclosed
- 09.05.2026
- Updated
- 11.10.2026 10:22
Sources and licenses
OSV / GitHub Advisory Database - GHSA-j658-c2gf-x6pq - CC BY 4.0
Vulnerability history: velocityjs
All published vulnerabilities of this package (npm package), newest first. Shows whether this is a one-off slip or a package that needs watching.
- Total entries
- 2
- First → latest
- 05.2026 07.2026
- Without a fix
- 1
- Exploited in attacks
- 0
Severity breakdown
- Critical 1
- High 1
Disclosures per year
- 2026: 2
-
Velocity.js has a Prototype Pollution vulnerability through #set path assignment this entry
Know which vulnerabilities affect your application
With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.