| Author |
Potential File Upload/Malicious File Execution
|
Baseet Ahmed
Ranch Hand
Joined: Dec 18, 2006
Posts: 223
|
|
Salaam,
We are having one application based on java/servlet/jsp technology, which allows users to upload files to the server through html file upload option.
But the weak point is that, it allows any file to be uploaded.
This could cause problem which may reach to malicious file execution.
Please help us in resolving this, so that we can save our application with Malicious file execution attack.
Any help and tips highly appreciated.
Thank you...
-------------------
Regards
Baseet Ahmed
[ UD: Removed non-English part ]
|
 |
Martijn Verburg
author
Bartender
Joined: Jun 24, 2003
Posts: 3268
|
|
|
You need to detect the file type on the server side and accept/reject based on whatever criteria you decide (file extension etc). It also helps to not allow executable rights on any file that is in that upload folder (chmod -x in *IX operating systems)
|
Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
|
 |
Baseet Ahmed
Ranch Hand
Joined: Dec 18, 2006
Posts: 223
|
|
Salaam,
We have added the code for restricting the file types based on file extension(by checking filename's ends with .exe etc.).
Are there any further steps we need to follow for making it smart enough to block Malicious file execution attack ?
Like, client side validation through javascript etc.
Thank you...
-------------------
Regards
Baseet Ahmed
[ B: Modified non-English part ]
"Pay wages of a labourer before his perspiration dries." - ISLAM
-------------------
|
 |
Martijn Verburg
author
Bartender
Joined: Jun 24, 2003
Posts: 3268
|
|
|
I think the other step I mentioned "making sure that the execute permissions on files that are uploaded are changed to non executable" should be sufficient.
|
 |
 |
|
|
subject: Potential File Upload/Malicious File Execution
|
|
|