|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2016-02-09 12:49 UTC] setbanned at gmail dot com
Description: ------------ Built-pool HTTP Downlaod Exploit. Exploit By : TaWaN (2600 Thailand , KissShot - Studio , Tawan Naultang , Phitchayaphong Tantikul) Software : PHP Built-in HTTP server Version : 5.4.x , 5.6.x , 7.0.x Os : Windows only How to Exploit put . (dot) attach type in url example : http://locahost:8000/index.php. we can download file in Web and look code in file. Test script: --------------- image1 : http://www.mx7.com/i/680/lsaMUF.png image2 : http://www.mx7.com/i/a49/RzFIyT.png image3 : http://www.mx7.com/i/54b/2BjHvz.png image4 : http://www.mx7.com/i/ee5/O2YHsc.png Actual result: -------------- we can downlaod file of the web. PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 22:00:01 2025 UTC |
Anatol, you have an idea? - This seems to be Windows-specific. In php_cli_server_dispatch() we see that the extension is not "php" (which is correct, as the file extension is empty) so it dispatches a static file. In php_cli_server_begin_send_static() we do 1953 if (client->request.path_translated && strlen(client->request.path_translated) != client->request.path_translated_len) { 1954 /* can't handle paths that contain nul bytes */ 1955 return php_cli_server_send_error_page(server, client, 400); 1956 } 1957 1958 fd = client->request.path_translated ? open(client->request.path_translated, O_RDONLY): -1; Which succeeds and opens "foo.php" when "foo.php." is requested.Hi, There is an easy way to fix the "dot" security issue. You can just make a router.php to check the REQUEST_URI before the response: <?php // router.php $rcuri = explode("?",$_SERVER["REQUEST_URI"]); if (substr($rcuri[0],-1) != ".") { return false; } else { header("HTTP/1.0 404 Not Found"); ?> This will show you a blank 404 page if there is a dot in the end of URL (if there are any params i exclude them with explode...) If you want to "fake" the default 404 page, you can just echo it: <?php // router.php $rcuri = explode("?",$_SERVER["REQUEST_URI"]); if (substr($rcuri[0],-1) != ".") { return false; } else { header("HTTP/1.0 404 Not Found"); echo '<!doctype html><html><head><title>404 Not Found</title><style> body { background-color: #fcfcfc; color: #333333; margin: 0; padding:0; } h1 { font-size: 1.5em; font-weight: normal; background-color: #9999cc; min-height:2em; line-height:2em; border-bottom: 1px inset black; margin: 0; } h1, p { padding-left: 10px; } code.url { background-color: #eeeeee; font-family:monospace; padding:0 2px;} </style> </head><body><h1>Not Found</h1><p>The requested resource <code class="url">'.$_SERVER["REQUEST_URI"].'</code> was not found on this server.</p></body></html>'; } ?> You can put the router.php in the same dir with php.exe and run the server with: php.exe -S 127.0.0.1:80 router.php If you want to specify the document root, you must put -t param before -S param: php.exe -t "C:\vbserver\www_uncompress" -S 192.168.123.100:80 router.php C. Paschalidis Software Developer / DBA