MadTechie Posted September 26, 2009 Share Posted September 26, 2009 create .htaccess on the root, and put <Directory "public_html/site.com/uploadfolder"> php_admin_flag engine off </Directory> in it, replacing uploadfolder with the upload folder As a note Just ran some test's on folder permission set to 750 LAMP - CENTOS 5.3 / PHP 5.2.8 /Apache-2.0.63 - exploit failed WAMP - (wampserver) (WinXP / Apache-2.2.8 / PHP 5.2.6) (permission don't apply) - exploited (no surprise here) WAMP - (WinXP / Apache-2.2.11 / PHP Version 5.2.9) exploit failed I don't have IIS so can't test that Quote Link to comment https://forums.phpfreaks.com/topic/175562-solved-help-from-c99-shell-attack/page/2/#findComment-925505 Share on other sites More sharing options...
pdent1 Posted September 26, 2009 Author Share Posted September 26, 2009 well now i have the php_admin_flag off on all uploaded folders, if a file is uploaded with .php in the filename instead of replacing the .php string, it just deni's the whole file, plus the mime so maybe I can make them work harder for what they want next time Quote Link to comment https://forums.phpfreaks.com/topic/175562-solved-help-from-c99-shell-attack/page/2/#findComment-925506 Share on other sites More sharing options...
PFMaBiSmAd Posted September 26, 2009 Share Posted September 26, 2009 We have a question - what operating system, web server and version, and php version was exploited? Quote Link to comment https://forums.phpfreaks.com/topic/175562-solved-help-from-c99-shell-attack/page/2/#findComment-925507 Share on other sites More sharing options...
pdent1 Posted September 26, 2009 Author Share Posted September 26, 2009 # Apache HTTP Server: 2.2.6 # MySQL Database: 5.0.45 # PHP Processor: 5.2.4 I was banned from the server for "hacking" so I don't know if it actually WORKED for him nothing was changed in my database or my pages. But when i re-uploaded my files to my new servers I ran it on myself and I got access. Quote Link to comment https://forums.phpfreaks.com/topic/175562-solved-help-from-c99-shell-attack/page/2/#findComment-925508 Share on other sites More sharing options...
MadTechie Posted September 26, 2009 Share Posted September 26, 2009 well now i have the php_admin_flag off on all uploaded folders, if a file is uploaded with .php in the filename instead of replacing the .php string, it just deni's the whole file, plus the mime so maybe I can make them work harder for what they want next time add a normal php file to that folder to test it (keep the .php on), <?php phpinfo(); ?> Quote Link to comment https://forums.phpfreaks.com/topic/175562-solved-help-from-c99-shell-attack/page/2/#findComment-925512 Share on other sites More sharing options...
TeNDoLLA Posted September 26, 2009 Share Posted September 26, 2009 Worth to mention is also that you should never trust MIME type checks because the mime type can be spoofed. Meaning that you can upload a .php file with a mime type 'image/jpeg' for example. Best bet would be probably to rely on file extension check. Quote Link to comment https://forums.phpfreaks.com/topic/175562-solved-help-from-c99-shell-attack/page/2/#findComment-925518 Share on other sites More sharing options...
MadTechie Posted September 26, 2009 Share Posted September 26, 2009 It takes more to spoof mime then change an extension, and what about the poor Macintosh users ? IMHO: mime is better than extensions but I normally opt for 1 check mime, if that fails check extension, then I add *some code to verify it is what it is, and then put the renamed files in a safe zone should kill of most attacks *this can take up a lot of resource, but can probably be skipped if the other measures are followed Quote Link to comment https://forums.phpfreaks.com/topic/175562-solved-help-from-c99-shell-attack/page/2/#findComment-925521 Share on other sites More sharing options...
Daniel0 Posted September 27, 2009 Share Posted September 27, 2009 MIME type checks are fine, but you should figure out the MIME type yourself and not rely on the MIME type you're given by the client. http://php.net/fileinfo Quote Link to comment https://forums.phpfreaks.com/topic/175562-solved-help-from-c99-shell-attack/page/2/#findComment-925799 Share on other sites More sharing options...
knsito Posted September 27, 2009 Share Posted September 27, 2009 I thought I would try this out, but unfortunately my php ver is < 5.3.0 so I get Call to undefined function finfo_open() mime_content_type() seems unreliable, (getting text/plain for png and zip files...) Is there an alternative? MIME type checks are fine, but you should figure out the MIME type yourself and not rely on the MIME type you're given by the client. http://php.net/fileinfo Quote Link to comment https://forums.phpfreaks.com/topic/175562-solved-help-from-c99-shell-attack/page/2/#findComment-926101 Share on other sites More sharing options...
Daniel0 Posted September 28, 2009 Share Posted September 28, 2009 You can load the pecl extension. Quote Link to comment https://forums.phpfreaks.com/topic/175562-solved-help-from-c99-shell-attack/page/2/#findComment-926217 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.