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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T00:05:16+00:00 2026-06-10T00:05:16+00:00

Suppose that our web-hosting is linux and php is installed: 1- What could be

  • 0

Suppose that our web-hosting is linux and php is installed:
1- What could be the worst that happens when a php code can be uploaded instead of an image.

2- Can the intruder somehow retrieve my database password ? suppose that the directory on which images get stored has 777 file permissions.

3- What if when the image directory has 644 permission?

The answer to my question can be combined with the ones given to these two: Security: How to validate image file uploads? and Security issues in accepting image uploads

  • 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-10T00:05:17+00:00Added an answer on June 10, 2026 at 12:05 am

    What could be the worst that happens when a php code can be uploaded instead of an image.

    Worst case: Intruder can execute arbitrary PHP code, maybe even arbitrary code on the server. If the attacker is clever enough while the sysadmins aren’t, he might even own the whole server/subnet/network/…

    Can the intruder somehow retrieve my database password ? suppose that the directory on which images get stored has 777 file permissions.

    If the attacker can execute PHP code (which of course depends on your security measures), he can definitely read files from the current user, so the answer is most probably yes.

    What if when the image directory has 644 permission?

    Unless you use PHP in CGI mode, the execute bit shouldn’t be necessary for the webserver to execute a script, so that alone doesn’t help.


    Of course those are not the questions you should ask. The question you should ask is how to prevent an attacker from uploading an executable PHP file in the first place. My answer to that is that you should check the file extension against a white list and drop everything else, for example:

    $pattern = "/\.(jpe?g|gif|png)$/iD";
    if (!preg_match($pattern, $filename))
        die("Please don't.");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Our organization provides a variety of services to our clients (e.g., web hosting, tech
Suppose you're the product manager for an internal enterprise web application that has 2000
Suppose user will upload doc or docx file through our asp.net web UI and
A user can POST a document to our web service. We stream it elsewhere.
Are we supposed to find workarounds in our web applications so that they will
Suppose that I have a database with student information: {'student_name' : 'Alen', 'subjects' :
Suppose that you have a function f: List a -> a such that f
Suppose that I click on a facebook link -- once clicked, the URL is
Suppose that I have a 2D array (matrix) in Java like this... int[][] MyMat
Suppose that we have following tables create table Employee( 2 EMPNO NUMBER(3), 3 ENAME

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.