Skip to content

v3.2.7

Latest

Choose a tag to compare

@jogoossens jogoossens released this 12 Nov 15:20
· 1 commit to main since this release

Status on 12 November: PHP has not shipped a fix for any of the three issues below yet. The latest PHP releases are still 8.5.12, 8.4.27, 8.3.36 and 8.2.35 from 21 October. PHP has fixed the unserialize() use-after-free and the SimpleXML double free in its source code; they will arrive with the next releases. CVE-2026-115560 (session upload progress) is still covered only by the recommended setting session.upload_progress.enabled=0, which this module enforces by default. Keep the module installed, also after you upgrade PHP.

A PHP extension that mitigates php2shell (CVE-2026-109618 / CVE-2026-109619) on PHP 5.4 to 8.5, for Linux (x86_64, arm64) and Windows (x64, x86), without rebuilding PHP. On PHP builds without the official fix it mirrors that fix component by component; on builds that have it, those layers step aside. Install the official PHP release where you can. This module protects the hosts that cannot be upgraded yet, and adds protections PHP itself does not ship yet.

What it protects against

  • php2shell (CVE-2026-109618 / -109619): hardened multipart parser with a memory-headroom guard, immediate worker exit on an out-of-memory during request startup, request-state reset at request end, and the session upload-progress handler detached.
  • CVE-2026-115560, session upload progress (advisory): session.upload_progress.enabled forced to 0 and locked, on every PHP version, patched or not. No PHP release fixes it yet.
  • unserialize() use-after-free (php-src#24481, fixed in PHP's source on 30 October, not in a release yet), and the further routes to the same bug PHP has found since (php-src#24674: destructors run by the garbage collector, error handlers, __toString(), session_decode(), fibers; the fix is still under review and aimed at the next major PHP version): nested unserialize() / session_decode() calls get their own state. Since 3.2.0, per fiber since 3.2.6.
  • SimpleXML double free in the garbage collector, introduced by 8.4.27 and 8.5.12 (php-src#24488, fixed in PHP's source on 22 October, not released yet): PHP's fix applied from inside the module, on those two releases only. Since 3.2.1.

What's new in 3.2.7

Three fixes from a review by Vincent Schmalbach, thank you. Upgrade recommended, especially on PHP 8.1 and later and on hosts that use filter_input().

  • No more 413 for a small form on a busy worker (PHP 8.1 and later). PHP's allocator keeps memory from earlier requests cached and counts it in the usage figure the memory-headroom guard reads. After a few requests that used most of memory_limit, the guard refused even a tiny form, which stock PHP served from that cache. The guard now has PHP release the cached memory before it decides (PHP's own zend_set_memory_limit(), limit restored at once). On 7.x and 8.0, whose allocator cannot release it this way, nothing changes.
  • A refused form no longer survives in filter_input(). When the guard refused a request (413), $_POST and $_FILES were emptied, but ext/filter keeps its own copy, so filter_input(INPUT_POST, ...), filter_has_var() and filter_input_array() still returned the fields parsed before the stop. That copy is now emptied too.
  • session_start() and session_reset() get their own unserialize() state when they run inside another unserialize() (from a destructor, an error handler, __toString()), like unserialize() and session_decode() since 3.2.0. Before, they decoded the stored session with the outer call's state, the precondition for the use-after-free above.
  • Clearer README. Memory running out while a script runs is left to PHP's normal handling; the README no longer calls the coverage complete, and it explains the headroom guard's margin.

Tested before release: on PHP 8.3.35 with Apache and memory_limit=128M, a tiny form after four requests of about 120 MB got 413 with 3.2.6 and gets 200 now; a 40 MB body is still refused, and memory_limit stays exactly 128M afterwards (also on 7.4 and 8.0). After a refusal filter_input(), filter_has_var() and filter_input_array() return nothing, on 8.3 and 5.6 (NTS) and on thread-safe 5.6 under Apache mpm_event, where the concurrency test also passes. Nested session_start() / session_reset() no longer see the outer state; normal sessions and Serializable back-references behave as before. PHP's serialize, session, SPL and fiber test suites give the same results as with 3.2.6 on 8.3 and 8.5. Builds 5.4 to 8.5 for x86_64 and arm64 pass the glibc check, and all 42 Windows DLLs loaded into the official windows.php.net builds in CI.

Changes since 3.1.0

  • 3.2.7: cached memory released before the headroom guard decides (8.1+), ext/filter's copy emptied on a refusal, session_start() / session_reset() isolated (above).
  • 3.2.6: unserialize() state per fiber.
  • 3.2.5: parser fixes from @NewEraCracker (#25): per-thread stop flag on thread-safe PHP, stopped reads never processed, legacy parser hardening. Bundle refresh: install_guard.sh works on hosts with a noexec /tmp (#28).
  • 3.2.4: phpinfo status fixes (#18, #19); upload-progress detach on patched PHP documented (#17).
  • 3.2.3: on thread-safe PHP with a threaded SAPI (Apache mod_php with mpm_winnt, worker or event, which includes every Windows ts DLL), the multipart handler is now installed in every thread.
  • 3.2.2: PHP 5.4 to 5.6 thread-safe builds compile (Linux ZTS, Windows TS).
  • 3.2.1: SimpleXML double-free workaround for 8.4.27 and 8.5.12.
  • 3.2.0: unserialize() re-entrancy isolation.
  • New downloads: Windows DLLs for PHP 5.4 (VC9, x86) and 5.6 (VC11) and 32-bit DLLs for 7.2 to 8.5; install_guard.sh for Debian / Ubuntu.

Download

hp_uploadprogress_guard-3.2.7.zip (or .tar.gz, same content) holds everything: an INSTALL.txt with the steps per platform, the installer for Debian / Ubuntu, the ini files, the source, and a SHA256SUMS for all of it.

Folder Contents PHP
linux/ hp_uploadprogress_guard-<X.Y>.so (x86_64, glibc 2.3+) and -aarch64.so (arm64, glibc 2.17+) 5.4 to 8.5
windows/ php_hp_uploadprogress_guard-<X.Y>-<nts|ts>-<compiler>-<x64|x86>.dll 5.4 (vc9, x86), 5.6 (vc11), 7.2 to 7.4 (vc15), 8.0 to 8.3 (vs16), 8.4 and 8.5 (vs17)
ini/ ini for Debian / Ubuntu mods-available, and for cPanel / DirectAdmin php.d
src/ source, for anything not prebuilt

The Linux .so files are NTS builds, which is what php-fpm, CGI and almost every distribution and panel ship; thread-safe Linux builds compile from src/ in one step. The Windows DLL must match your PHP's version, thread safety, compiler and architecture: php -i shows all four.

Install

  • Debian / Ubuntu (Sury / Ondrej packages): tar xzf hp_uploadprogress_guard-3.2.7.tar.gz && sudo bash hp_uploadprogress_guard-3.2.7/install_guard.sh --reload installs the module for every PHP version on the host, from the bundle, with no download. It reloads PHP-FPM and Apache only with --reload, and then checks that the running services really loaded it. --remove undoes everything.
  • cPanel EA4, DirectAdmin, other Linux, Windows: see Install in the README.
  • Check through the web server: a phpinfo() page shows the hp_uploadprogress_guard block with version => 3.2.7. php --ri shows the command-line configuration, which is often not what the site runs with.

Upgrading from an earlier version: replace the file and reload PHP-FPM / Apache. No ini change is needed; the newer switches unserialize_isolation and simplexml_gc_fix default to on.