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

Published Oct 13, 2026
·
Updated

Summary 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 sessionid() resolve to B (a different concurrent client's id) or to a stale id from a previous request served by the same worker thread.

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.

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 FRANKENPHPTEST and are unrelated.

Root cause FrankenPHP resets per-request session state in frankenphpresetsessionstate(), which releases PS(id) so the next sessionstart() re-reads the request cookie. That whole function is guarded by #ifdef HAVEPHPSESSION, 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, HAVEPHPSESSION is undefined, the reset is compiled out, and PS(id) survives the request boundary.

PHP's sessionstart() reads the request cookie only when PS(id) is NULL (ext/session/session.c, tryfindsessionidincookies(): if (!PS(usecookies) || 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 <?php $handler = static function () { sessionstart(); $sent = $COOKIE['session'] ?? '(none)'; $id = sessionid(); header('Content-Type: text/plain'); echo ($sent === '(none)' || $sent === $id) ? "OK sent=$sent id=$id\n" : "LEAK sent=$sent id=$id\n"; sessionwriteclose(); }; while (\frankenphphandlerequest($handler)) {} Run under worker mode with num 2 (≥2 workers), session.usestrictmode=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: sh 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 (sessionid() 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.

Fix When HAVEPHPSESSION 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 frankenphpresetsessionstate().

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

Workarounds - Use a FrankenPHP build with session statically compiled (official static binaries or Docker images). - Or, in the worker loop, after sessionwriteclose() call sessionid('') so the next sessionstart() re-reads the request cookie (with session.usestrictmode=1).

Other sources

FrankenPHP is a modern application server for PHP. Prior to 1.12.5, FrankenPHP worker mode can retain PHP session state between requests when the session extension is loaded as a shared module and is unavailable through HAVEPHPSESSION at compile time. In this build configuration, frankenphpresetsessionstate() is compiled out, PS(id) can survive a request boundary, and a subsequent sessionstart() can ignore the new request's cookie because an identifier is already present. Under concurrent requests, sessionid() can therefore return another client's identifier or a stale identifier from a previous request on the same worker thread, causing cross-user session exposure, possible session hijacking, and intermittent logout behavior. Builds with the session extension statically linked, including the official static binaries and Docker images, are not affected. This issue is fixed in version 1.12.5.

— NVD

Affected Software

2 affected componentsFixes available
FrankenPHP FrankenPHP<1.12.5
go/github.com/dunglas/frankenphp<=1.12.4
1.12.5

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade go/github.com/dunglas/frankenphp to a version that resolves this vulnerability.

    Fixed in 1.12.5
  2. Upgrade

    Upgrade FrankenPHP to a version that resolves this vulnerability.

    Fixed in 1.12.5
  3. Configuration

    Enable session.use_strict_mode=1 and, in the worker loop, call session_id('') after session_write_close() so the next session_start() re-reads the request cookie.

    PHP session extension session.use_strict_mode = 1
  4. Compensating control

    Use a FrankenPHP build with the session extension statically compiled, such as the official static binaries or Docker images.

Event History

Oct 13, 2026
CVE Published
via MITRE·04:20 PM
Data Sourced
via MITRE·04:20 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·05:17 PM
DescriptionSeverityWeakness
Oct 15, 2026
Advisory Published
via GitHub·08:14 PM
Data Sourced
via GitHub·08:14 PM
DescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

Which deployments are affected?

Affected deployments use FrankenPHP worker mode with the PHP session extension loaded as a shared module, where HAVE_PHP_SESSION was unavailable at compile time. Official static binaries and Docker images, which statically link the session extension, are not affected.

2

What does an attacker need to exploit this issue?

No privileges or user interaction are required, but exploitation depends on requests being handled under the affected worker-mode build configuration. Concurrent requests can cause a worker thread to retain a prior session identifier and use it instead of the new request's cookie.

3

What should we do if we cannot patch immediately?

Use a build with the session extension statically linked, such as the official static binaries or Docker images, rather than an affected shared-module build. Upgrading to FrankenPHP 1.12.5 fixes the issue.

4

How might this appear in an affected application?

Applications may show intermittent logout behavior or return another client's session identifier from session_id(). These symptoms can occur when a stale session ID survives from a previous request on the same worker thread.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203