|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patchesshell_exec.patch (last revision 2020-03-01 19:19 UTC by 64796c6e69 at gmail dot com)Pull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-03-21 17:02 UTC] cmb@php.net
-Status: Open
+Status: Verified
-Assigned To:
+Assigned To: stas
[2020-03-21 17:02 UTC] cmb@php.net
[2020-03-30 20:13 UTC] 64796c6e69 at gmail dot com
[2020-04-13 17:08 UTC] cmb@php.net
[2020-04-14 03:54 UTC] stas@php.net
[2020-04-14 04:10 UTC] stas@php.net
[2020-04-14 04:10 UTC] stas@php.net
-Status: Verified
+Status: Closed
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 22:00:01 2025 UTC |
Description: ------------ shell_exec() silently truncates anything after a null byte in the command it uses. This was tested on PHP 7.3, but all supported PHP versions have this bug. There's no issue if escapeshellarg() is used, but I thought it would be best to make this a security bug regardless. There may be some use case I haven't considered that creates a vulnerability. Checking for a null byte would also be consistent with exec() and other process functions. The backtick operator has the same problem, but there is less risk of that causing a vulnerability. Test script: --------------- <?php var_dump(shell_exec("echo before\0after")); Expected result: ---------------- Warning: shell_exec(): NULL byte detected. Possible attack in shell_exec.php on line 2 bool(false) Actual result: -------------- string(7) "before "