Don’t let the 9.8 on this one panic you. It’s a real bug, but it’s about requests going to the wrong URL, not someone taking over your server.

At a glance

  • CVE: CVE-2025-1861
  • Severity: 9.8 (Critical) at NVD. PHP’s own advisory rates it medium (6.3 on CVSS 4.0), which fits the impact it describes much better.
  • Affected: PHP 8.1 before 8.1.32, 8.2 before 8.2.28, 8.3 before 8.3.19, and 8.4 before 8.4.5, when your code fetches URLs through PHP’s built-in HTTP stream wrapper.
  • Known exploited: No. It’s not on CISA’s KEV list.

What’s going on

PHP has a built-in way to fetch web pages: the HTTP stream wrapper. It’s what you’re using when you call something like file_get_contents('https://example.com/feed') or fopen() on a URL. When the remote server answers with a redirect, PHP reads the Location header and follows it for you.

The trouble is that PHP only had room for 1024 bytes of that location. RFC 9110 recommends supporting 8000, and browsers usually cope with about 2048, so a long redirect URL got silently chopped short. According to PHP’s advisory, that truncated URL can drop important parts (say, part of the query string), point the request at a different resource than intended, or trigger errors on the remote site that amount to a denial of service.

Who should care? Apps that fetch remote URLs with file_get_contents(), fopen() and friends and let PHP follow redirects, especially where those redirects can carry long URLs. The bug lives in the stream wrapper, so HTTP calls made through the cURL extension go through different code.

Timeline

  • Disclosed: 2025-03-13 (PHP’s advisory went public with the fixed releases)
  • Patch released: 2025-03-13 (PHP 8.1.32, 8.2.28, 8.3.19 and 8.4.5)
  • CVE published at NVD: 2025-03-30

== UPDATE ==

The fix has been out since March 2025, so an up-to-date PHP already has it.

  • Patch available: Yep.
  • Fixed in: PHP 8.1.32, 8.2.28, 8.3.19, 8.4.5. On the 8.3 branch it’s 8.3.19; PHP’s ChangeLog jumps from 8.3.17 straight to 8.3.19, so there’s no 8.3.18 to look for. PHP 8.5 came out later and isn’t listed as affected. And 8.1 reached end of life on 31 Dec 2025, so it’s time to move off it.
  • How to apply: Update PHP through your package manager (or PHP distribution) to the fixed release or anything newer on your branch, then restart your web server and any PHP-FPM pools. As of this write-up, the newest releases are 8.2.36, 8.3.37, 8.4.28 and 8.5.13. On a distro’s older PHP, look for its security update: Debian, for example, backported the fix to php7.4 on Debian 11 (bullseye) in version 7.4.33-1+deb11u8 (DLA-4088-1). NVD also lists NetApp ONTAP 9 as affected, so if you run that, check NetApp’s advisory below.
  • If you can’t patch yet: PHP’s advisory says there’s no real workaround, so upgrading is the fix.

References