File tree Expand file tree Collapse file tree 4 files changed +75
-5
lines changed
Expand file tree Collapse file tree 4 files changed +75
-5
lines changed Original file line number Diff line number Diff line change 22|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33?? ??? ????, PHP 7.1.33
44
5-
5+ - FPM:
6+ . Fixed bug #78599 (env_path_info underflow in fpm_main.c can lead to RCE).
7+ (CVE-2019-11043) (Jakub Zelenka)
68
7929 Aug 2019, PHP 7.1.32
810
Original file line number Diff line number Diff line change @@ -1209,8 +1209,8 @@ static void init_request_info(void)
12091209 path_info = script_path_translated + ptlen ;
12101210 tflag = (slen != 0 && (!orig_path_info || strcmp (orig_path_info , path_info ) != 0 ));
12111211 } else {
1212- path_info = env_path_info ? env_path_info + pilen - slen : NULL ;
1213- tflag = (orig_path_info != path_info );
1212+ path_info = ( env_path_info && pilen > slen ) ? env_path_info + pilen - slen : NULL ;
1213+ tflag = path_info && (orig_path_info != path_info );
12141214 }
12151215
12161216 if (tflag ) {
Original file line number Diff line number Diff line change 1+ --TEST--
2+ FPM: bug78599 - env_path_info underflow - CVE-2019-11043
3+ --SKIPIF--
4+ <?php include "skipif.inc " ; ?>
5+ --FILE--
6+ <?php
7+
8+ require_once "tester.inc " ;
9+
10+ $ cfg = <<<EOT
11+ [global]
12+ error_log = {{FILE:LOG}}
13+ [unconfined]
14+ listen = {{ADDR}}
15+ pm = dynamic
16+ pm.max_children = 5
17+ pm.start_servers = 1
18+ pm.min_spare_servers = 1
19+ pm.max_spare_servers = 3
20+ EOT ;
21+
22+ $ code = <<<EOT
23+ <?php
24+ echo "Test Start \n";
25+ var_dump( \$_SERVER["PATH_INFO"]);
26+ echo "Test End \n";
27+ EOT ;
28+
29+ $ tester = new FPM \Tester ($ cfg , $ code );
30+ $ tester ->start ();
31+ $ tester ->expectLogStartNotices ();
32+ $ uri = $ tester ->makeSourceFile ();
33+ $ tester
34+ ->request (
35+ '' ,
36+ [
37+ 'SCRIPT_FILENAME ' => $ uri . "/ " . str_repeat ('A ' , 35 ),
38+ 'PATH_INFO ' => '' ,
39+ 'HTTP_HUI ' => str_repeat ('PTEST ' , 1000 ),
40+ ],
41+ $ uri
42+ )
43+ ->expectBody (
44+ [
45+ 'Test Start ' ,
46+ 'string(0) "" ' ,
47+ 'Test End '
48+ ]
49+ );
50+ $ tester ->terminate ();
51+ $ tester ->close ();
52+
53+ ?>
54+ Done
55+ --EXPECT--
56+ Done
57+ --CLEAN--
58+ <?php
59+ require_once "tester.inc " ;
60+ FPM \Tester::clean ();
61+ ?>
Original file line number Diff line number Diff line change @@ -513,7 +513,7 @@ class Tester
513513 return new Response (null , true );
514514 }
515515 if (is_null ($ uri )) {
516- $ uri = $ this ->makeFile ( ' src.php ' , $ this -> code );
516+ $ uri = $ this ->makeSourceFile ( );
517517 }
518518
519519 $ params = array_merge (
@@ -538,7 +538,6 @@ class Tester
538538 ],
539539 $ headers
540540 );
541-
542541 try {
543542 $ this ->response = new Response (
544543 $ this ->getClient ($ address , $ connKeepAlive )->request_data ($ params , false )
@@ -944,6 +943,14 @@ class Tester
944943 return $ filePath ;
945944 }
946945
946+ /**
947+ * @return string
948+ */
949+ public function makeSourceFile ()
950+ {
951+ return $ this ->makeFile ('src.php ' , $ this ->code );
952+ }
953+
947954 /**
948955 * @param string|null $msg
949956 */
You can’t perform that action at this time.
0 commit comments