NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page Hacker Help

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 08-21-2007, 02:28 PM THREAD STARTER               #1 (permalink)
NamePros Regular
 
John84's Avatar
Join Date: Apr 2006
Posts: 267
John84 is an unknown quantity at this point
 



Hacker Help


Not sure if this is the correct place to post this. Or even if this is allowed to be posted. If not, please delete this thread.

I found this upload script that is exactly what I was looking for. However, I found that it keeps getting hacked shortly after I put it up. Can someone please tell me what makes this script so easily hacked? Where are the security holes and how can it be fixed? Would a mandatory login function help? I know there are plenty other scripts out there but I really like this one.


Upload Script
John84 is offline  
Old 08-21-2007, 02:46 PM   #2 (permalink)
Traveller
 
-NC-'s Avatar
Join Date: Mar 2007
Location: Yet another city
Posts: 1,419
-NC- has a brilliant future-NC- has a brilliant future-NC- has a brilliant future-NC- has a brilliant future-NC- has a brilliant future-NC- has a brilliant future-NC- has a brilliant future-NC- has a brilliant future-NC- has a brilliant future-NC- has a brilliant future-NC- has a brilliant future
 


Animal Cruelty Animal Rescue Ethan Allen Fund Protect Our Planet
looks to me like you are allowing upload of .php files.

you should probably restrict upload of all executable files e.g. .php,.asp
i'm not familiar with this particular script, but they usually have a config file which sets file extensions to block.

edit:
having looked at this script, it appears to have no built in way to restrict the file types. ideally for security, i would recommend the script is modified to:

- upload files to a directory out of the webroot
- download files via a php file which pushes the file to the user's browser (no direct access to the file)
- block any file extensions you specify

????: NamePros.com http://www.namepros.com/programming/364678-hacker-help.html
None of these things are particularly complicated, maybe the script creator would do them if asked nicely?
__________________
NameCooler.com
Last edited by -NC-; 08-21-2007 at 03:12 PM.
-NC- is offline  
Old 08-21-2007, 03:15 PM   #3 (permalink)
cef
NamePros Regular
Join Date: May 2004
Location: NYC
Posts: 236
cef is a jewel in the roughcef is a jewel in the roughcef is a jewel in the rough
 


Animal Rescue
In addition to checking the extension as -NC- says, I also run the uploaded files through the "file" command, which takes further steps to verify the file type beyond merely looking at the extension:

file -b <filename>

This prints out something like "PHP script text" for a php script, even if it has an image extension (like .gif or .jpg). For a gif image, the command might print out something like "GIF image data, version 89a, 10 x 81", regardless of the file extension.
cef is offline  
Old 08-21-2007, 04:10 PM   #4 (permalink)
Senior Member
 
Eric's Avatar
Join Date: Mar 2005
Posts: 4,948
Eric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatnessEric Has achieved greatness
 

Member of the Month
MOTM September 2005
Save a Life Child Abuse 9/11/01 :: Never Forget Baby Health Marrow Donor Program AIDS/HIV Breast Cancer Animal Rescue Cystic Fibrosis Ethan Allen Fund Animal Cruelty Ethan Allen Fund Ethan Allen Fund Baby Health Cancer Alzheimer's Protect Our Planet Cancer Survivorship SIDS Child Abuse Diabetes Protect Our Planet Multiple Sclerosis Autism Adoption Special Olympics
Originally Posted by cef
In addition to checking the extension as -NC- says, I also run the uploaded files through the "file" command, which takes further steps to verify the file type beyond merely looking at the extension:

file -b <filename>

This prints out something like "PHP script text" for a php script, even if it has an image extension (like .gif or .jpg). For a gif image, the command might print out something like "GIF image data, version 89a, 10 x 81", regardless of the file extension.
Doesn't *always* work, I was able to fool it.
????: NamePros.com http://www.namepros.com/showthread.php?t=364678

But yes, it'd be a good idea to have the script restrict file types/extensions.
Eric is offline  
Old 08-21-2007, 04:13 PM   #5 (permalink)
cef
NamePros Regular
Join Date: May 2004
Location: NYC
Posts: 236
cef is a jewel in the roughcef is a jewel in the roughcef is a jewel in the rough
 


Animal Rescue
True, and you can put a payload in gif file headers as well. But the combination of extension + type check is effective 99% of the time.

And as mentioned, it's only part of a complete solution.
cef is offline  
Closed Thread


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools


Liquid Web Smart Servers  
All times are GMT -7. The time now is 07:42 AM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger