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 8906691
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T02:43:14+00:00 2026-06-15T02:43:14+00:00

Using a simple firefox addon, a hacker can change the mime type of any

  • 0

Using a simple firefox addon, a hacker can change the mime type of any file they want to upload, bypassing your file type checker.

Hackers can then use a program like GIMP to embed a php script inside the binary data of an image, audio or any other file.

How can I check for this, and prevent it?

  • 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-06-15T02:43:16+00:00Added an answer on June 15, 2026 at 2:43 am

    You can use mime_content_type() to get the actual mime type of the file instead of the value transmitted by the client browser.

    Then you can use a library such as php-ClamAV that allows to perform virus-scans in PHP.

    You can discard any file extension except those you expect (eg .png, .jpg, etc if you’re expecting images).
    In the specific case of images, you could also neutralize images by modifying them (eg slightly resize them, modify the compression rate, something that would modify the data and neutralize any executable).

    Finally of course, take of not giving the execution right to the file. But contrary to what is said in the comments, this will not really protect you. If the hacker finds a way to run php file though an injection for instance, he’ll be able to chmod the file and get the execution right (and even run it).

    A good practice is also to always rename the file in an unpredictable way. If it is not meant to be accessed by clients after upload, send the files in a folder where directory browsing is disabled.

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

Sidebar

Related Questions

I want to build a FireFox addon that can capture a webpage as an
I just started using the FireFox Builder to build a simple addon. I realised
I made an addon to Dektop Firefox using addon-sdk. now i want to launch
Update : Added simple test example http://jsfiddle.net/7UhrW/1/ using normalize.css. Chrome/WebKit and Firefox have different
Using simple type like class A { public int X, Y; } with object
im using simple vector push_back to object of Type A and getting this error
I am using simple CSS with modern browsers: IE 9 and Firefox 10. <link
I'm using simple close browser javascript statement window.close(); but it doesn't work with any
I have built a Firefox extension using the Addon SDK that opens up a
I am trying to develop an addon for Firefox (using the latest version of

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.