<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Velocityjs - CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/tags/velocityjs/</link><description>Trending threats, MITRE ATT&amp;CK coverage, and detection metadata. Fed continuously.</description><generator>Hugo</generator><language>en</language><managingEditor>hello@craftedsignal.io</managingEditor><webMaster>hello@craftedsignal.io</webMaster><lastBuildDate>Fri, 24 Jul 2026 16:31:34 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/tags/velocityjs/feed.xml" rel="self" type="application/rss+xml"/><item><title>Velocity.js Remote Code Execution via Function Constructor Bypass</title><link>https://feed.craftedsignal.io/briefs/2026-07-velocityjs-rce-bypass/</link><pubDate>Fri, 24 Jul 2026 16:31:34 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2026-07-velocityjs-rce-bypass/</guid><description>Velocity.js versions up to 2.1.6 are vulnerable to Remote Code Execution (RCE) through an incomplete fix for a previous prototype pollution vulnerability, enabling attackers to craft malicious Velocity templates to leverage unfiltered property-read expressions and execute arbitrary JavaScript code on the server, leading to full server compromise.</description><content:encoded><![CDATA[<p>A critical Remote Code Execution (RCE) vulnerability (GHSA-7gfh-x38p-prh3) has been identified in <code>velocityjs</code> versions up to 2.1.6, impacting applications that render attacker-controlled Velocity templates. This flaw represents a bypass of the previously issued fix for GHSA-j658-c2gf-x6pq, which addressed prototype pollution but incompletely mitigated the underlying issue. The vulnerability allows an attacker to manipulate unfiltered property-read expressions to invoke the JavaScript <code>Function</code> constructor with arbitrary code. This can lead to the execution of arbitrary shell commands on the server, enabling full system compromise, data exfiltration, and lateral movement. This exploit is particularly dangerous because it stems from a fix that was incomplete, leaving a critical attack vector open.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>An attacker crafts and submits a malicious Velocity template containing an RCE payload to a vulnerable application.</li>
<li>The vulnerable <code>velocityjs</code> template engine begins processing the malicious template, specifically evaluating the expression <code>$x.constructor.constructor(...)</code>.</li>
<li>During template evaluation, the <code>getAttributes()</code> function in <code>references.cjs</code> is called for <code>$x.constructor</code>, which, due to a lack of filtering, resolves to the <code>Object</code> constructor.</li>
<li>Subsequently, the second <code>.constructor</code> lookup on the <code>Object</code> constructor is processed, also via <code>getAttributes()</code>, resolving to the JavaScript <code>Function</code> constructor.</li>
<li>The attacker's arbitrary JavaScript string payload, such as <code>&quot;return process.mainModule.require('child_process').execSync('whoami').toString()&quot;</code> from the PoC, is passed as an argument to the <code>Function</code> constructor.</li>
<li>This action dynamically creates a new JavaScript function object containing the attacker's supplied code, which includes a call to <code>child_process.execSync</code> for command execution.</li>
<li>The newly created malicious function is then assigned to a Velocity template variable (e.g., <code>$f</code>) using the <code>#set</code> directive.</li>
<li>The Velocity template subsequently invokes this variable (<code>$f()</code>), triggering the execution of the embedded system command (<code>whoami</code> in the PoC) on the underlying operating system and allowing the attacker to receive its output.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>Applications using <code>velocityjs</code> versions &lt;= 2.1.6 are at severe risk of full server compromise. A successful exploitation allows an attacker to execute arbitrary shell commands with the privileges of the vulnerable application, potentially leading to the theft of sensitive data, access to cloud credentials, and the ability to pivot to other systems within the internal network. The vulnerability's nature as an RCE means direct control over the host system, making it a critical threat to any organization deploying affected <code>velocityjs</code> applications. The previous fix for prototype pollution (GHSA-j658-c2gf-x6pq) was bypassed, making this a more severe RCE rather than just data manipulation.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Upgrade all instances of <code>velocityjs</code> to version 2.1.7 or later immediately to apply the patch mentioned in the references.</li>
<li>Deploy the provided Sigma rule to detect suspicious process creation patterns indicative of RCE attempts originating from Node.js applications.</li>
<li>Enable comprehensive <code>process_creation</code> logging for all Node.js application servers to capture details such as parent process, image path, and command line arguments.</li>
<li>Block the malicious Velocity template syntax identified in the IOCs at application input layers if immediate patching is not feasible.</li>
</ul>
]]></content:encoded><category domain="severity">critical</category><category domain="type">advisory</category><category>velocityjs</category><category>rce</category><category>nodejs</category><category>vulnerability</category><category>server-side</category></item></channel></rss>