php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78200 php-fpm doesn't prevent bogus Status-Line header to be send
Submitted: 2019-06-23 15:03 UTC Modified: 2019-06-27 12:05 UTC
From: vnsavage at gmail dot com Assigned:
Status: Verified Package: *General Issues
PHP Version: 7.2.19 OS: Debian
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2019-06-23 15:03 UTC] vnsavage at gmail dot com
Description:
------------
PHP-FPM will not validate that the HTTP status line set in PHP is correct as described in rfc2616. Thus it will forward an incorrect CGI "Status:" response (which doesn't conform to rfc3875).

Test script:
---------------
Set this incorrect header from PHP: 

header( 'HTTP/1.1 Service Unavailable', true, 503 );

Then in sapi/fpm/fpm/fpm_main.c we have

                len = slprintf(buf, sizeof(buf), "Status:%s\r\n", s);

which results in "Status: Service Unavailable" sent to the CGI socket.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-06-27 12:01 UTC] sjon@php.net
-Status: Open +Status: Verified
 [2019-06-27 12:01 UTC] sjon@php.net
nginx responds with "502 Bad Gateway" and logs

> upstream sent invalid status "Service Unavailable" while reading response header from upstream,

While this is documented as such, maybe the header should validated before being send out
 [2019-06-27 12:05 UTC] sjon@php.net
-Summary: php-fpm status parsing +Summary: php-fpm doesn't prevent bogus Status-Line header to be send
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon Nov 18 13:01:38 2019 UTC