php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Sec Bug #69768 escapeshell*() doesn't cater to !
Submitted: 2015-06-07 18:01 UTC Modified: 2015-07-10 14:45 UTC
From: [email protected] Assigned: cmb (profile)
Status: Closed Package: Program Execution
PHP Version: 5.6.9 OS: Windows
Private report: No CVE-ID: None
 [2015-06-07 18:01 UTC] [email protected]
Description:
------------
When delayed variable substitution is enabled (can be set in the
Registry, for instance), !ENV! works similar to %ENV%, and the
value of the environment variable ENV will be subsituted.

Neither escapeshellcmd() nor escapeshellarg() handle ! as a
special character, so this can cause security issues.

I suggest to treat ! the same as %, i.e. escape it with ^ in
escapeshellcmd() and replace it with a space in escapeshellarg(),
like it's done in the attached patch.


Patches

escapeshell-exclamation-mark (last revision 2015-06-07 18:02 UTC by [email protected])

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-06-07 18:02 UTC] [email protected]
The following patch has been added/updated:

Patch Name: escapeshell-exclamation-mark
Revision:   1433700149
URL:        https://bugs.php.net/patch-display.php?bug=69768&patch=escapeshell-exclamation-mark&revision=1433700149
 [2015-06-22 10:43 UTC] [email protected]
-Status: Open +Status: Assigned -Assigned To: +Assigned To: cmb
 [2015-06-22 10:43 UTC] [email protected]
Seems fine to me, go ahead and commit it, should probably go all the way down to 5.4
 [2015-06-23 23:47 UTC] [email protected]
-Status: Assigned +Status: Closed
 [2015-06-23 23:47 UTC] [email protected]
Merged into 5.4, 5.5, 5.6 and master.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 28 05:00:03 2025 UTC