Summary
The create_function(args, code) function passes both parameters directly to the Function constructor without any sanitization, allowing arbitrary code execution.
This is distinct from CVE-2026-29091 (GHSA-fp25-p6mj-qqg6) which was call_user_func_array using eval() in v2.x. This finding affects create_function using new Function() in v3.x.
Root Cause
src/php/funchand/create_function.ts:17:
return new Function(...params, code)
Zero input validation on either parameter.
PoC
const { create_function } = require('locutus/php/funchand/create_function');
const rce = create_function('', 'return require("child_process").execSync("id").toString()');
console.log(rce());
// Output: uid=501(user) gid=20(staff) ...
Confirmed on locutus v3.0.11, Node.js v24.13.1.
Response
Thanks for the report.
We confirmed that php/funchand/create_function was still present through [email protected] and that it exposed dynamic code execution via new Function(...).
While this was intended behavior, create_function() inherently needs to be unsafe in order for it to work, create_function() was deprecated in PHP 7.2 and removed in PHP 8.0. Given that Locutus' parity target today is 8.3, this function shouldn't have been in Locutus at all anymore.
We fixed this in [email protected] by removing php/funchand/create_function entirely. That matches our PHP 8.3 parity target more closely: .
We also updated php/var/var_export so closures now export using the PHP 8-style \Closure::__set_state(array(...)) form instead of referencing the removed API.
Release:
- npm:
[email protected] - GitHub release: https://github.com/locutusjs/locutus/releases/tag/v3.0.14
Credit to @ByamB4 for the report.
Impact
Full RCE when an attacker can control either argument to create_function(). 597K weekly npm downloads.
Untrusted input is evaluated as executable code within the application's runtime environment. Typical impact: arbitrary code execution within the application's privilege context.
CVE-2026-32304 has a CVSS score of 9.8 (Critical). The vector is network-reachable, no privileges required, and no user interaction. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. A fixed version is available (3.0.14); upgrading removes the vulnerable code path.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Remediation advice
Remove create_function or replace new Function() with a safe alternative. PHP itself deprecated create_function() in PHP 7.2 for the same reason.
Frequently Asked Questions
- What is CVE-2026-32304? CVE-2026-32304 is a critical-severity code injection vulnerability in locutus (npm), affecting versions <= 3.0.13. It is fixed in 3.0.14. Untrusted input is evaluated as executable code within the application's runtime environment.
- How severe is CVE-2026-32304? CVE-2026-32304 has a CVSS score of 9.8 (Critical). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of locutus are affected by CVE-2026-32304? locutus (npm) versions <= 3.0.13 is affected.
- Is there a fix for CVE-2026-32304? Yes. CVE-2026-32304 is fixed in 3.0.14. Upgrade to this version or later.
- Is CVE-2026-32304 exploitable, and should I be worried? Whether CVE-2026-32304 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2026-32304 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.
- How do I fix CVE-2026-32304? Upgrade
locutusto 3.0.14 or later.