Loading...
Skip to main content

CVE-2026-32304 — Vulnerability in locutus — CVE Details

CRITICAL

Locutus vulnerable to RCE via unsanitized input in create_function()

Published March 13, 2026Updated March 16, 2026Source: osv

Summary

## 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`: ```typescript return new Function(...params, code) ``` Zero input validation on either parameter. ## PoC ```javascript 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.

Advisory Timeline

  • First published March 13, 2026 (213 days ago).
  • Last revised March 16, 2026 — 3 days after initial publication.

Remediation

Upgrade to the fixed version using your package manager.

npm
Update locutus to 3.0.14 or later
npm install locutus@3.0.14

After upgrading, run your dependency scanner again to confirm the vulnerability is resolved.

Affected Packages (1)

Affects 1 ecosystem: npm (1).

PackageEcosystemAffectedFixed In
locutus
npm
All versions3.0.14

Vulnerability Classification

Common Weakness Enumeration (CWE) identifiers for this vulnerability type.

CVSS Score Breakdown

What the CVSS (Common Vulnerability Scoring System) 9.8 score means for each attack dimension.

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Frequently Asked Questions

What is CVE-2026-32304?
Locutus vulnerable to RCE via unsanitized input in create_function() This vulnerability has been assigned a severity rating of CRITICAL (CVSS score: 9.8/10).
How do I check if my project is affected by CVE-2026-32304?
CVE-2026-32304 affects locutus. Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-32304 and 200,000+ other known vulnerabilities.

Severity & Exploitability

CVSS Score
9.8

Exploitation is straightforward and causes maximum impact. Patch immediately.

Also Known As

GHSA-vh9h-29pq-r5m8

Related CVEs

Check if you're affected

Scan your dependencies to see if this vulnerability affects your projects.

Scan Your Dependencies