-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* update php to 8.1.29 * Update PHP-VERSION.conf * Revert main.c
- Loading branch information
Showing
16 changed files
with
999 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--TEST-- | ||
GHSA-w8qr-v226-r27w | ||
--EXTENSIONS-- | ||
filter | ||
--FILE-- | ||
<?php | ||
|
||
function test(string $input) { | ||
var_dump(filter_var($input, FILTER_VALIDATE_URL)); | ||
} | ||
|
||
echo "--- These ones should fail ---\n"; | ||
test("http://t[est@127.0.0.1"); | ||
test("http://t[est@[::1]"); | ||
test("http://t[est@[::1"); | ||
test("http://t[est@::1]"); | ||
test("http://php.net\\@aliyun.com/aaa.do"); | ||
test("http://test[@2001:db8:3333:4444:5555:6666:1.2.3.4]"); | ||
test("http://te[st@2001:db8:3333:4444:5555:6666:1.2.3.4]"); | ||
test("http://te[st@2001:db8:3333:4444:5555:6666:1.2.3.4"); | ||
|
||
echo "--- These ones should work ---\n"; | ||
test("http://test@127.0.0.1"); | ||
test("http://test@[2001:db8:3333:4444:5555:6666:1.2.3.4]"); | ||
test("http://test@[::1]"); | ||
|
||
?> | ||
--EXPECT-- | ||
--- These ones should fail --- | ||
bool(false) | ||
bool(false) | ||
bool(false) | ||
bool(false) | ||
bool(false) | ||
bool(false) | ||
bool(false) | ||
bool(false) | ||
--- These ones should work --- | ||
string(21) "http://test@127.0.0.1" | ||
string(50) "http://test@[2001:db8:3333:4444:5555:6666:1.2.3.4]" | ||
string(17) "http://test@[::1]" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
ext/standard/tests/general_functions/ghsa-9fcc-425m-g385_001.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
--TEST-- | ||
GHSA-9fcc-425m-g385 - bypass CVE-2024-1874 - batch file variation | ||
--SKIPIF-- | ||
<?php | ||
if( substr(PHP_OS, 0, 3) != "WIN" ) | ||
die('skip Run only on Windows'); | ||
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); | ||
?> | ||
--FILE-- | ||
<?php | ||
|
||
$batch_file_content = <<<EOT | ||
@echo off | ||
powershell -Command "Write-Output '%0%'" | ||
powershell -Command "Write-Output '%1%'" | ||
EOT; | ||
$batch_file_path = __DIR__ . '/ghsa-9fcc-425m-g385_001.bat'; | ||
|
||
file_put_contents($batch_file_path, $batch_file_content); | ||
|
||
$descriptorspec = [STDIN, STDOUT, STDOUT]; | ||
|
||
$proc = proc_open([$batch_file_path . ".", "\"¬epad.exe"], $descriptorspec, $pipes); | ||
proc_close($proc); | ||
$proc = proc_open([$batch_file_path . " ", "\"¬epad.exe"], $descriptorspec, $pipes); | ||
proc_close($proc); | ||
$proc = proc_open([$batch_file_path . ". ", "\"¬epad.exe"], $descriptorspec, $pipes); | ||
proc_close($proc); | ||
$proc = proc_open([$batch_file_path . ". ... ", "\"¬epad.exe"], $descriptorspec, $pipes); | ||
proc_close($proc); | ||
$proc = proc_open([$batch_file_path . ". ... . ", "\"¬epad.exe"], $descriptorspec, $pipes); | ||
proc_close($proc); | ||
$proc = proc_open([$batch_file_path . ". ... . .", "\"¬epad.exe"], $descriptorspec, $pipes); | ||
proc_close($proc); | ||
proc_open([$batch_file_path . ". .\\.. . .", "\"¬epad.exe"], $descriptorspec, $pipes); | ||
|
||
?> | ||
--EXPECTF-- | ||
'"%sghsa-9fcc-425m-g385_001.bat."' is not recognized as an internal or external command, | ||
operable program or batch file. | ||
%sghsa-9fcc-425m-g385_001.bat | ||
"¬epad.exe | ||
%sghsa-9fcc-425m-g385_001.bat. | ||
"¬epad.exe | ||
%sghsa-9fcc-425m-g385_001.bat. ... | ||
"¬epad.exe | ||
%sghsa-9fcc-425m-g385_001.bat. ... . | ||
"¬epad.exe | ||
'"%sghsa-9fcc-425m-g385_001.bat. ... . ."' is not recognized as an internal or external command, | ||
operable program or batch file. | ||
|
||
Warning: proc_open(): CreateProcess failed, error code: 2 in %s on line %d | ||
--CLEAN-- | ||
<?php | ||
@unlink(__DIR__ . '/ghsa-9fcc-425m-g385_001.bat'); | ||
?> |
66 changes: 66 additions & 0 deletions
66
ext/standard/tests/general_functions/ghsa-9fcc-425m-g385_002.phpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
--TEST-- | ||
GHSA-9fcc-425m-g385 - bypass CVE-2024-1874 - cmd.exe variation | ||
--SKIPIF-- | ||
<?php | ||
if( substr(PHP_OS, 0, 3) != "WIN" ) | ||
die('skip Run only on Windows'); | ||
if (getenv("SKIP_SLOW_TESTS")) die("skip slow test"); | ||
?> | ||
--FILE-- | ||
<?php | ||
|
||
$batch_file_content = <<<EOT | ||
@echo off | ||
powershell -Command "Write-Output '%0%'" | ||
powershell -Command "Write-Output '%1%'" | ||
EOT; | ||
$batch_file_path = __DIR__ . '/ghsa-9fcc-425m-g385_002.bat'; | ||
|
||
file_put_contents($batch_file_path, $batch_file_content); | ||
|
||
$descriptorspec = [STDIN, STDOUT, STDOUT]; | ||
|
||
$proc = proc_open(["cmd.exe", "/c", $batch_file_path, "\"¬epad.exe"], $descriptorspec, $pipes); | ||
proc_close($proc); | ||
$proc = proc_open(["cmd.exe ", "/c", $batch_file_path, "\"¬epad.exe"], $descriptorspec, $pipes); | ||
proc_close($proc); | ||
$proc = proc_open(["cmd.exe. ", "/c", $batch_file_path, "\"¬epad.exe"], $descriptorspec, $pipes); | ||
proc_close($proc); | ||
$proc = proc_open(["cmd.exe. ... ", "/c", $batch_file_path, "\"¬epad.exe"], $descriptorspec, $pipes); | ||
proc_close($proc); | ||
$proc = proc_open(["\\cmd.exe. ... ", "/c", $batch_file_path, "\"¬epad.exe"], $descriptorspec, $pipes); | ||
|
||
$proc = proc_open(["cmd", "/c", $batch_file_path, "\"¬epad.exe"], $descriptorspec, $pipes); | ||
proc_close($proc); | ||
$proc = proc_open(["cmd ", "/c", $batch_file_path, "\"¬epad.exe"], $descriptorspec, $pipes); | ||
proc_close($proc); | ||
$proc = proc_open(["cmd. ", "/c", $batch_file_path, "\"¬epad.exe"], $descriptorspec, $pipes); | ||
$proc = proc_open(["cmd. ... ", "/c", $batch_file_path, "\"¬epad.exe"], $descriptorspec, $pipes); | ||
$proc = proc_open(["\\cmd. ... ", "/c", $batch_file_path, "\"¬epad.exe"], $descriptorspec, $pipes); | ||
|
||
?> | ||
--EXPECTF-- | ||
%sghsa-9fcc-425m-g385_002.bat | ||
"¬epad.exe | ||
%sghsa-9fcc-425m-g385_002.bat | ||
"¬epad.exe | ||
%sghsa-9fcc-425m-g385_002.bat | ||
"¬epad.exe | ||
%sghsa-9fcc-425m-g385_002.bat | ||
"¬epad.exe | ||
|
||
Warning: proc_open(): CreateProcess failed, error code: 2 in %s on line %d | ||
%sghsa-9fcc-425m-g385_002.bat | ||
"¬epad.exe | ||
%sghsa-9fcc-425m-g385_002.bat | ||
"¬epad.exe | ||
|
||
Warning: proc_open(): CreateProcess failed, error code: 2 in %s on line %d | ||
|
||
Warning: proc_open(): CreateProcess failed, error code: 2 in %s on line %d | ||
|
||
Warning: proc_open(): CreateProcess failed, error code: 2 in %s on line %d | ||
--CLEAN-- | ||
<?php | ||
@unlink(__DIR__ . '/ghsa-9fcc-425m-g385_002.bat'); | ||
?> |
Oops, something went wrong.