Skip to content
CVE-2026-129474

CVE-2026-129474

github.com • November 19, 2026

PHP can access freed memory when collecting the arguments of a method handled by __call() or __callStatic() for a backtrace. On PHP 8.5 and later, an unauthenticated attacker may be able to trigger this through a crafted request that causes a fatal error while the application enters such a method. Successful exploitation can execute arbitrary code with the privileges of the PHP worker.

The demonstrated remote attack requires fatal_error_backtraces=1 and zend.exception_ignore_args=0 . Fatal error backtraces are enabled by default in PHP 8.5. PHP's built-in default also includes arguments, but php.ini-production sets zend.exception_ignore_args=1 and prevents this attack path.

Applications and frameworks commonly use __call() and __callStatic() to forward method calls to another object, including logging facades, database interfaces and service proxies. Before PHP enters the actual magic method, it briefly represents the requested method as a separate call. A backtrace taken during this interval can collect values left behind by an earlier call instead of the current arguments. Some of those values can refer to memory that has already been freed.

The demonstrated attack submits crafted JSON to an import endpoint that processes the body and then logs it through a magic static method. The request is sized so that constructing a logging argument crosses memory_limit . PHP 8.5.12 introduced delayed handling of this allocation failure, allowing the fatal error to be reported while the magic method call is being entered. If fatal error backtraces include arguments, PHP can then treat request-controlled bytes in reused memory as live values. Processing or releasing the backtrace can corrupt memory or transfer control to an attacker-chosen address.

Fatal error backtraces were introduced in PHP 8.5.0. An execution time limit expiring during the same interval is another possible trigger. PHP 8.2–8.4 contain the underlying backtrace error, but reaching it requires a PCNTL signal handler or another component to inspect an interrupted call. No attacker-controlled remote trigger has been established for those branches. They are therefore outside this advisory’s affected version range.

Remote code execution has been confirmed on PHP 8.5 and later. Exploitation depends on the application and requires control over enough request data to influence memory allocation, a reachable magic method call, and a fatal error at the relevant point. The demonstrated code execution chain also requires knowledge of usable memory addresses despite address space randomisation. Other attempts can crash the worker or produce an ordinary resource limit error.

Potentially relevant paths include Laravel facades and Magento guest shipping estimation . These examples establish that existing applications reach magic method calls, but exploitation of a complete Laravel or Magento installation has not been demonstrated.

The presence of a framework, a magic method, or a large request body alone does not establish exploitability. The attacker does not need to upload PHP code or invoke a method name of their choosing if the application's existing request path reaches a suitable call. Authentication requirements depend on that path.

Upgrade to PHP 8.5.13 when it becomes available. As an immediate workaround for the fatal error attack, set zend.exception_ignore_args=1 in the configuration used by the affected PHP workers and restart them. On PHP 8.5 and later, setting fatal_error_backtraces=0 also prevents this attack path. Check the effective configuration, including FPM pool settings and application overrides. Changing only the CLI configuration is insufficient.

Setting display_errors=0 does not prevent PHP from constructing the backtrace. Request-size limits and avoiding expensive processing or logging of untrusted bodies can reduce exposure, but are not a complete substitute for the configuration workaround or update. Extensions that independently inspect interrupted calls should also be reviewed.

Extracted Entities