Hacked by a .gif - نوشته شده در (1769 Views)
Average Member
Panhandler
مطلب: 783
783
I have a asp operated photo gallery that permitted .gif files to be uploaded (that's been changed!)
A hacker uploaded and used a file named zor.asp;.gif to get in.
Here's a text copy for anyone interested: link Original file was named: zor.asp;.gif

 پیش‌فرض مرتب‌سازی برای تاریخ DESC به معنی جدیدترین است  
 تعداد در صفحه 
نوشته شده در
Snitz Forums Admin
ruirib
مطلب: 26364
26364
Disabling gifs won't help it, as any other extensions are prone to the same problem. You will need to change the upload code to remove any ';' characters from the file name used to save the file.
نوشته شده در
Development Team Leader
Classicmotorcycling
مطلب: 2085
2085
Sometimes when you go to Google images and just click on those images, be it .jpg, .gif, .png and others they are not in actual fact images, but scripts that install stuff and then redirect you to this wonderful page that tells you that you have a virus installed and you need to purchase their software to remove it.
The point is that you need to know it is not restricted to .gif's and the only way to avoid it in the future is to disable uploads (or as Ruirib says).
Cheers,

David Greening
نوشته شده در
Retired Support Moderator
MarcelG
مطلب: 2625
2625
Is this a new one?! We already had the null-attack a while ago, which we fixed in the upload code....didn't we also take out the other possible attacks?
نوشته شده در
Retired Support Moderator
MarcelG
مطلب: 2625
2625
Crap...confirmed that this works: http://oxle.com/uploaded/18/9/hello.asp;.gif
Seems to be an IIS loophole... All Snitz sites that allow people to upload even avatars are possibly vulnerable....ouch.
I fixed it by adding a line to the upload code (uploadengine.asp if I recall correctly).
where I first had only this:
Code:
		faname 			=  Replace(objUpload.Files.Item(0).FileName,vbNullChar,"")
I now have this:
Code:
		faname 			=  Replace(objUpload.Files.Item(0).FileName,vbNullChar,"")
faname = Replace(objUpload.Files.Item(0).FileName,";","")
If I now try to upload a file using the semicolon trick, I get a nice error.
نوشته شده در
Snitz Forums Admin
ruirib
مطلب: 26364
26364
That depends on the mod that you are using. The versions I have seen with Mike's attachment mod, use a function IsValidString that won't allow file names with characters such as ";". I am not sure whether this was added by me, though.
نوشته شده در
Forum Moderator
AnonJr
مطلب: 5768
5768
Random thought, but would checking the MIME type sent by the browser help?
The only issue I know of is that Chrome has a disappearing/reappearing bug where it will/won't send the MIME type information with the upload. It's an interesting mix of funny/sad to see the same bug report get opened and closed like that...
نوشته شده در
Snitz Forums Admin
ruirib
مطلب: 26364
26364
The problem is not when you upload the file, as that brings no issues. However, if you try to view a file with a name of .asp;.gif, seems IIS uses just the part of the name until the semicolon and executes the file as an asp script. So I have to agree with Marcel when he says this must be an IIS issue.
نوشته شده در
Forum Admin
HuwR
مطلب: 20611
20611
this issue affects Apache as well, so is not just an IIS issue. and mimetypes can be spoofed so checking mimetype wouldn't help, the only way to ensure it is an image is to read the file header and check that.
نوشته شده در
Snitz Forums Admin
ruirib
مطلب: 26364
26364
Didn't know about Apache. I think the main concern is to avoid the execution of any script. For that purpose, restricting characters that can be used in filenames seems to work well.
نوشته شده در
Forum Admin
HuwR
مطلب: 20611
20611
would need to check what happens with say something like file.asp.gif no illegal characters in that. so a check for multiple . would probably also be a good idea
شما باید یک متن وارد کنید