|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #15818 escapeshellarg does not escape characters for win32
Submitted: 2002-03-01 12:46 UTC Modified: 2002-08-09 01:00 UTC
From: ghopper at cox dot net Assigned:
Status: No Feedback Package: Program Execution
PHP Version: 4.1.1 OS: Win2k
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2002-03-01 12:46 UTC] ghopper at cox dot net
Windows NT 5.0 build 2195
php version 4.1.1 (the binary zip package for win32)
php is running cgi-mode (php.exe)

example script:

$arg = "junk && start cmd junk";
$arg = escapeshellarg($arg);
system("anycommand $arg",$output);

This starts a command shell running as the web server process.  This could be used as an exploit if the contents of $arg come from a form.

This also works with system(escapeshellcmd("anycommand $arg"));

As a suggestion, you might want to create a command to "removeshellchars" instead of just quoting them.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-07 20:55 UTC]
Thank you for taking the time to report a problem with PHP.
Unfortunately your are not using a current version of PHP -- 
the problem might already be fixed. Please download a new
PHP version from

If you are able to reproduce the bug with one of the latest
versions of PHP, please change the PHP version on this bug report
to the version you tested and change the status back to "Open".
Again, thank you for your continued support of PHP.

 [2002-08-09 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Mar 31 14:03:45 2023 UTC