GHSA-j658-c2gf-x6pq
HIGHGHSA-j658-c2gf-x6pq is a high-severity (CVSS 8.3) remote code execution vulnerability in velocityjs. O3 Security confirms whether GHSA-j658-c2gf-x6pq is actually reachable in your code before you act, and blocks exploitation at runtime until you patch.
Velocity.js has a Prototype Pollution vulnerability through #set path assignment
Blast Radius
velocityjsReal-time download stats are indexed for npm and PyPI packages. This vulnerability affects npm packages — download data is not available via public APIs for these ecosystems.
Description
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 Packages
| Ecosystem | Package | Vulnerable range | Fix |
|---|---|---|---|
| 📦npm | velocityjs | all versions | No fix |
Detection & mitigation playbook
Open-source dependencyDetect
Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for velocityjs. O3's reachability analysis confirms whether the vulnerable code path is actually invoked in your application, so you act on real exposure instead of every transitive match.
Remediation status
No patched version of velocityjs has shipped for GHSA-j658-c2gf-x6pq yet. Where your build allows, override or pin the dependency away from the vulnerable range, and apply any maintainer-recommended mitigation.
Mitigate without a patch
If you can't upgrade right away: gate or disable the affected feature, validate untrusted input at the boundary, and avoid passing attacker-controlled data into the vulnerable path. O3's runtime protection blocks exploitation in production as an interim safeguard until the upgrade lands.
How O3 protects you
O3 pinpoints whether GHSA-j658-c2gf-x6pq is reachable in your code and exactly where to fix it, then blocks exploitation in production at runtime until the patched version is deployed.
Tailored to GHSA-j658-c2gf-x6pq. Runtime protection reduces exposure until a permanent patch is applied and verified — it complements patching, it doesn't replace it.
Frequently Asked Questions
Is GHSA-j658-c2gf-x6pq in your dependencies?
O3 detects GHSA-j658-c2gf-x6pq across npm dependencies and uses function-level reachability to confirm whether the vulnerable code path is actually reachable — not just present. No false positives.