Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 405183
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T17:22:37+00:00 2026-05-12T17:22:37+00:00

I am working on a kinda document management system. The end users are business

  • 0

I am working on a kinda document management system. The end users are business class users.

I currently check and allow files to be uploaded only if they are one of the followings:

"png|jpe?g|gif|xls|doc|docx|csv|ppt|txt|pdf|rtf"

my questions are –

  • If I add “xml” into the list? can they cause any security issue?

  • What other document types/extensions I can add into this?

Or

Should I check NOT IN "exe|bat|php|js" and allow all other types?

Thanks for suggestions.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T17:22:37+00:00Added an answer on May 12, 2026 at 5:22 pm

    Should I check NOT IN “exe|bat|php|js” and allow all other types?

    No. Whitelisting is better than blacklisting. There are many, many more dangerous filetypes than you are likely to know about. Those four barely scratch the surface.

    If I add “xml” into the list? can they cause any security issue?

    Yes it can, [X][HT]ML may contain scripting which operates in the security context of the site that served it. Which allows anyone who can upload documents to your site to inject JavaScript into your site (stealing cookies, request forgery etc).

    However… it doesn’t actually add any security issue you don’t already have. Because even whitelisting by filetype/extension is not secure, thanks to IE and its misbegotten type-sniffing. You can upload a .txt file, and serve it correctly using the Content-Type: text/plain header, but if it contains sequences that IE thinks look like HTML, IE will ignore you and render it as HTML — boom, XSS.

    (The same is true of any other type really, but .txt is the most openly vulnerable.)

    There are two approaches to fixing this mess:

    1. serve all user-uploaded files from a different hostname to the main application site, so that they are in different JS security contexts and do not share cookies or authentication data.

    2. serve all user-uploaded files with the Content-Disposition: attachment header so that they will always be downloaded and not displayed within the browser.

    (2) on its own should be watertight, but in practice in the past there have been ways around it due to browser and plugin exploits, so I’m not sure I’d completely trust in it. (1) on its own stops XSS, but it doesn’t stop other nasties like HTML files containing iframes to exploit sites.

    So it’s best to do both.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm kinda new to using Rails, and an app I am working on is
I'm currently working on porting an existing Delphi 5 application to Delphi 2010. It's
I am working on generating a document for printing. It should use a specific
I am working on an application which would take an XHTML. <documents> <document> <span
I'm currently working with an NSPersistentDocument subclass that uses NSOperation to import data in
I have some working Javascript code that generates an RDF/XML document using variables picked
I am thinking of working on an online homework submission system where students can
I'm working with lots of log files, and most log files have lots of
I want to document a Java project I'm working on. In the past I've
Using Visual Studio 2010 I believe it's working correctly, as in after any document

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.