• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Potential File Upload/Malicious File Execution

 
Ranch Hand
Posts: 225
Spring Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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)
 
Baseet Ahmed
Ranch Hand
Posts: 225
Spring Notepad Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic