|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2018-09-18 07:41 UTC] lijianxin at 360 dot net
[2018-09-18 15:30 UTC] cmb@php.net
-Assigned To:
+Assigned To: stas
[2018-09-18 15:30 UTC] cmb@php.net
[2018-10-09 03:05 UTC] lijianxin at 360 dot net
[2018-10-09 19:47 UTC] stas@php.net
-Assigned To: stas
+Assigned To: bukka
[2018-10-09 19:47 UTC] stas@php.net
[2018-10-14 15:38 UTC] bukka@php.net
-Status: Assigned
+Status: Duplicate
-Type: Security
+Type: Feature/Change Request
[2018-10-14 15:38 UTC] bukka@php.net
[2018-10-14 15:38 UTC] bukka@php.net
-Type: Feature/Change Request
+Type: Bug
[2018-10-14 15:46 UTC] bukka@php.net
[2018-10-14 15:53 UTC] bukka@php.net
[2018-10-22 02:27 UTC] lijianxin at 360 dot net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 16 04:00:02 2025 UTC |
Description: ------------ When using system() (or other functions) to execute a program, the child process inherits the FPM's file descriptors, which led to some security issues such as hijacking some requests to the FPM using the leaked socket file descriptor. Test script: --------------- <?php system("sleep 60"); // and go check the sleep process's fd Expected result: ---------------- [root@localhost html]# ls -al /proc/20928/fd // php-fpm's FDs total 0 dr-x------ 2 root root 0 Aug 27 22:46 . dr-xr-xr-x 9 82 82 0 Aug 27 22:46 .. lrwx------ 1 root root 64 Aug 27 22:46 0 -> /dev/null l-wx------ 1 root root 64 Aug 27 22:46 1 -> pipe:[372386] l-wx------ 1 root root 64 Aug 27 22:46 2 -> pipe:[372387] l-wx------ 1 root root 64 Aug 27 22:46 4 -> /dev/pts/0 lrwx------ 1 root root 64 Aug 27 22:46 9 -> socket:[372385] // FPM process containing socket and other sensitive FDs [root@localhost html]# ls -al /proc/ChildPID/fd // child process's FDs total 0 dr-x------ 2 root root 0 Aug 27 22:46 . dr-xr-xr-x 9 82 82 0 Aug 27 22:46 .. lrwx------ 1 root root 64 Aug 27 22:46 0 -> blablalba l-wx------ 1 root root 64 Aug 27 22:46 1 -> blablalba l-wx------ 1 root root 64 Aug 27 22:46 2 -> blablalba // Child process should only contain STDIN,STDOUT,STDERR or other irrelevant FDs Actual result: -------------- [root@localhost html]# ps -ef|grep sleep 82 1886 1881 0 22:56 pts/0 00:00:00 sleep 60 root 1890 1568 0 22:56 pts/0 00:00:00 grep --color=auto sleep [root@localhost html]# ls -al /proc/1881/fd // php-fpm's FDs total 0 dr-x------ 2 root root 0 Aug 27 22:55 . dr-xr-xr-x 9 82 82 0 Aug 27 22:55 .. lrwx------ 1 root root 64 Aug 27 22:56 0 -> /dev/null l-wx------ 1 root root 64 Aug 27 22:56 1 -> pipe:[26529] lrwx------ 1 root root 64 Aug 27 22:56 10 -> socket:[26526] l-wx------ 1 root root 64 Aug 27 22:55 2 -> pipe:[26530] lrwx------ 1 root root 64 Aug 27 22:56 3 -> socket:[29022] l-wx------ 1 root root 64 Aug 27 22:56 4 -> /dev/pts/0 lr-x------ 1 root root 64 Aug 27 22:56 5 -> pipe:[27765] [root@localhost html]# ls -al /proc/1886/fd // child process's FDs total 0 dr-x------ 2 82 82 0 Aug 27 22:56 . dr-xr-xr-x 9 82 82 0 Aug 27 22:56 .. lrwx------ 1 82 82 64 Aug 27 22:56 0 -> /dev/null l-wx------ 1 82 82 64 Aug 27 22:56 1 -> pipe:[27765] lrwx------ 1 82 82 64 Aug 27 22:56 10 -> socket:[26526] // FD LEAKAGE l-wx------ 1 82 82 64 Aug 27 22:56 2 -> pipe:[26530] lrwx------ 1 82 82 64 Aug 27 22:56 3 -> socket:[29022] // FD LEAKAGE