Nemetona
asked on
what is the danger in permitting members to upload documents to your database?
We permit members to upload certain file types; pdf, docs, xlms, jpg and some other image file types from our website into a database table where they are stored as a longblob (MySQL) and the documents/images can be viewed / downloaded by the member as well.
What is the danger of them introducing some malevolent code that would affect our database or our server? What steps could we take to mitigate this?
What is the danger of them introducing some malevolent code that would affect our database or our server? What steps could we take to mitigate this?
ASKER
Could you provide any pointers on "test the document to ensure it is of the claimed type. "
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thank you for that. We are using javascript.
We are using javascript.That is client side - what are you using to connect to MySQL?
ASKER
java
The danger is what you would expect from allowing content from untrusted sources onto your network.
Here are some things to consider
1. Assume all incoming documents are suspect and treat accordingly. Scan all incoming documents for malware
2. Store the documents outside of the webroot to prevent direct access to the documents
3. Store the path to the document in the database.
4. Limit uploads only to the document types you allow
5. Do not trust the extension or the mime type in the header - test the document to ensure it is of the claimed type.