9.8critical
Locutus: RCE via unsanitized input in create_function()
- Severity
- 9.8critical CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.54% (higher than 46% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-vh9h-29pq-r5m8
Description
Locutus brings stdlibs of other programming languages to JavaScript for educational purposes. Prior to 3.0.14, 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 which was call_user_func_array using eval() in v2.x. This finding affects create_function using new Function() in v3.x. This vulnerability is fixed in 3.0.14.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| locutusjs locutus | < 3.0.14 | CVE List |
| openshift-logging/elasticsearch6-rhel9 | Not specified | CVE List |
| openshift-logging/elasticsearch-operator-bundle | Not specified | CVE List |
| openshift-logging/elasticsearch-proxy-rhel9 | Not specified | CVE List |
| openshift-logging/elasticsearch-rhel9-operator | Not specified | CVE List |
| openshift-logging/kibana6-rhel8 | Not specified | CVE List |
| openshift-logging/logging-curator5-rhel9 | Not specified | CVE List |
| locutus (npm) | before 3.0.14 | GitHub Advisory Database |
| locutus locutus | before 3.0.14 | NVD |
All scores
| GitHub_M | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| redhat-SADP | 7.5high CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:H/I:H/A:H |
| GitHub | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
Classification
What each source says
CVE List
Locutus brings stdlibs of other programming languages to JavaScript for educational purposes. Prior to 3.0.14, 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 which was call_user_func_array using eval() in v2.x. This finding affects create_function using new Function() in v3.x. This vulnerability is fixed in 3.0.14.
GitHub Advisory Database
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.
Impact
Full RCE when an attacker can control either argument to create_function(). 597K weekly npm downloads.
Suggested Fix
Remove create_function or replace new Function() with a safe alternative. PHP itself deprecated create_function() in PHP 7.2 for the same reason.
Response
Thanks for the report.
We confirmed that php/funchand/create_function was still present through locutus@3.0.13 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 locutus@3.0.14 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:
locutus@3.0.14 - GitHub release: https://github.com/locutusjs/locutus/releases/tag/v3.0.14
Credit to @ByamB4 for the report.
NVD (es)
Locutus trae bibliotecas estándar de otros lenguajes de programación a JavaScript con fines educativos. Antes de la versión 3.0.14, la función create_function(args, code) pasa ambos parámetros directamente al constructor Function sin ninguna sanitización, permitiendo la ejecución de código arbitrario. Esto es distinto de CVE-2026-29091, que era call_user_func_array usando eval() en v2.x. Este hallazgo afecta a create_function usando new Function() en v3.x. Esta vulnerabilidad está corregida en 3.0.14.
References
| https://github.com/locutusjs/locutus/security/advisories/GHSA-vh9h-29pq-r5m8 | exploit, mitigation, patch, vendor-advisory, web | |
| https://github.com/locutusjs/locutus/releases/tag/v3.0.14 | product, release-notes, web | |
| https://access.redhat.com/security/cve/CVE-2026-32304 | vdb-entry | |
| https://bugzilla.redhat.com/show_bug.cgi?id=2447200 | issue-tracking | |
| https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-32304.json | ||
| https://nvd.nist.gov/vuln/detail/CVE-2026-32304 | advisory | |
| https://github.com/locutusjs/locutus | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-32304 changed 2026-07-15 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-vh9h-29pq-r5m8 changed 2026-03-16 | CC-BY-4.0 |
| NVD | CVE-2026-32304 changed 2026-07-15 | Public domain |