CVE-2026-82416

CVE-2026-82416 is a high-severity race condition vulnerability in github.com/dunglas/frankenphp (go), affecting versions <= 1.12.4. It is fixed in 1.12.5.

Does this CVE actually affect you?

Kodem shows which CVEs are reachable and running in your applications, so you fix what's exploitable, not just what's listed.

Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.

Runtime intelligence, not another scanner.

Summary

FrankenPHP: Cross-request PHP session ID leak in worker mode when the session extension is a shared module

In worker mode under concurrency, FrankenPHP can hand a PHP session id from one request to another when PHP's session extension is loaded as a shared module instead of being statically linked into the FrankenPHP binary. A request presenting Cookie: session=A can have session_id() resolve to B (a different concurrent client's id) or to a stale id from a previous request served by the same worker thread.

Affected / not affected

Exposure is determined by how the session extension is linked in the PHP build FrankenPHP is compiled against, not by the FrankenPHP release:

  • Affected: any build where the session extension is not visible to FrankenPHP at compile time, i.e. loaded as a shared / out-of-tree module (extension=session in an ini). This includes the RPM and Debian packages and other packaged php-zts distributions that ship session as a shared extension under conf.d.
  • Not affected: builds where session is statically compiled into the PHP that FrankenPHP links against, such as the official static binaries and Docker images. There, the reset code below is compiled in and clears the id every request.

The C session-reset code is unchanged across 1.11.x-1.12.x, so this is not a code regression between releases. A "1.12.2 works / 1.12.3 leaks" observation on the same host reflects two differently-built packages, not a source change. The persistent-zval helpers (#2366) are compiled only under FRANKENPHP_TEST and are unrelated.

Root cause

FrankenPHP resets per-request session state in frankenphp_reset_session_state(), which releases PS(id) so the next session_start() re-reads the request cookie. That whole function is guarded by #ifdef HAVE_PHP_SESSION, a macro defined only when the session extension headers are present at FrankenPHP compile time (session statically enabled in the PHP build). When session is a shared module, HAVE_PHP_SESSION is undefined, the reset is compiled out, and PS(id) survives the request boundary.

PHP's session_start() reads the request cookie only when PS(id) is NULL (ext/session/session.c, try_find_session_id_in_cookies(): if (!PS(use_cookies) || PS(id)) return;). With a stale PS(id), the cookie is ignored and the worker reuses the previous request's id, exposing it to whichever client is served next.

Reproduction

Minimal worker script (index.php):

<?php
$handler = static function () {
    session_start();
    $sent = $_COOKIE['session'] ?? '(none)';
    $id   = session_id();
    header('Content-Type: text/plain');
    echo ($sent === '(none)' || $sent === $id) ? "OK   sent=$sent id=$id\n"
                                               : "LEAK sent=$sent id=$id\n";
    session_write_close();
};
while (\frankenphp_handle_request($handler)) {}

Run under worker mode with num 2 (≥2 workers), session.use_strict_mode=1, on a PHP build where session is a shared module. Pre-create two valid sessions A and B, then fire concurrent requests alternating the two cookies:

seq 600 | xargs -P32 -I{} sh -c '
  c=$([ $(( {} % 2 )) -eq 0 ] && echo A || echo B);
  curl -s -H "Cookie: session=$c" http://127.0.0.1:8080/' | grep -c LEAK

On an affected build a large fraction of responses are LEAK (session_id() differs from the cookie sent, and A and B sometimes resolve to the same id). On a statically-linked build the count is always 0.

Workarounds

  • Use a FrankenPHP build with session statically compiled (official static binaries or Docker images).
  • Or, in the worker loop, after session_write_close() call session_id('') so the next session_start() re-reads the request cookie (with session.use_strict_mode=1).

Impact

  • Security: cross-user session exposure / session hijacking in worker mode. Same impact class as CVE-2026-24894.
  • Functional: users are intermittently logged out; their cookie's session is ignored and they receive a foreign or empty session.

Multiple concurrent operations access a shared resource without proper synchronization, producing unpredictable results depending on timing. Typical impact: TOCTOU exploits, data corruption, or privilege escalation.

CVE-2026-82416 has a CVSS score of 7.7 (High). 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 (1.12.5); upgrading removes the vulnerable code path.

Affected versions

github.com/dunglas/frankenphp (<= 1.12.4)

Security releases

github.com/dunglas/frankenphp → 1.12.5 (go)

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.

Already deployed Kodem?

See it in your environmentNew to Kodem? Get a demo →

Remediation advice

When HAVE_PHP_SESSION is undefined, FrankenPHP now resets the session module through the module registry on every worker request (its RSHUTDOWN releases PS(id), RINIT re-initialises the globals), so the per-request cleanup always runs regardless of how the extension is linked. Statically-linked builds are unchanged and keep using frankenphp_reset_session_state().

Verified on PHP 8.6-dev ZTS, 2 workers, session.use_strict_mode=1, 600 alternating-cookie concurrent requests: before the fix 519/600 leaked; after the fix 0/600. Statically-linked builds stayed at 0/600.

Frequently Asked Questions

  1. What is CVE-2026-82416? CVE-2026-82416 is a high-severity race condition vulnerability in github.com/dunglas/frankenphp (go), affecting versions <= 1.12.4. It is fixed in 1.12.5. Multiple concurrent operations access a shared resource without proper synchronization, producing unpredictable results depending on timing.
  2. How severe is CVE-2026-82416? CVE-2026-82416 has a CVSS score of 7.7 (High). 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.
  3. Which versions of github.com/dunglas/frankenphp are affected by CVE-2026-82416? github.com/dunglas/frankenphp (go) versions <= 1.12.4 is affected.
  4. Is there a fix for CVE-2026-82416? Yes. CVE-2026-82416 is fixed in 1.12.5. Upgrade to this version or later.
  5. Is CVE-2026-82416 exploitable, and should I be worried? Whether CVE-2026-82416 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
  6. What actually determines whether CVE-2026-82416 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.
  7. How do I fix CVE-2026-82416? Upgrade github.com/dunglas/frankenphp to 1.12.5 or later.

Other vulnerabilities in github.com/dunglas/frankenphp

Stop the waste.
Protect your environment with Kodem.