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

  • Home
  • SEARCH
  • 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 6818557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:11:35+00:00 2026-05-26T21:11:35+00:00

Is it possible for hackers ( or other ) to upload/write a php file

  • 0

Is it possible for hackers ( or other ) to upload/write a php file to a folder on my site that has chmod 777?

Example:

I have a folder that has chmod 777.
That folder contains images.
I use .htaccess to block indexing the folder.

Reformed question:
Can people write a .php file to my folder that has chmod 777 by using a PHP script on their website? For example , to list all the images in that folder

( I’m familiar with the right chmod for uploading folder etc .. , just asking it hypotheticaly )

  • 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-26T21:11:36+00:00Added an answer on May 26, 2026 at 9:11 pm

    Chances are very good that any legitimate user of that machine can write .php files, or anything else they want, to that wide-open directory. A 777 directory has almost no place on a shared host. (/tmp may sometimes be 1777, to set the sticky bit on the directory — that allows only a file owner to delete a file in the directory. Normally, 777 means anyone can delete any file from the directory. But /tmp has definitely fallen out of favor on shared hosting environments because it is inherently unsafe.)

    So: Are you the only user on the machine? Or is this machine shared with anyone else? Does this machine run any other services besides web server? If so, those other services might represent a possible attack vector as well.

    Furthermore, if your permissions are set to 777 on your directory I wonder just how safe the PHP files you’re running are — I’ve seen many cases of people running insecure PHP scripts that allow an attacker to modify every HTML file on the entire web server, to infect people browsing the site. (Yes. Many. More than a handful by a lot.)

    This is why whichever user account your web server runs as should not own any of the files of the website — both static pages and dynamic pages. The web server should have only enough write privileges to write its access.log, error.log, and talk with a database server. Any additional privileges beyond this makes it far to easy for an otherwise benign bug in one of your scripts to become an exploitable vulnerability that allows your site to be used for attacking others.

    777 is a bad idea. Fix that. Make sure your web server does not have write permission to any of the web content. Make sure no other service on the server has write permission to your web content. Make sure no other users on the server have write permission to your web content.

    Update

    This is easier than it sounds. Create a new webcontent user. If your web server already has a group of its own, lets use it and call it webgroup. If it doesn’t yet, create a new webgroup as well. (adduser(8) and addgroup(8) if your VPS doesn’t have its own mechanism.) Then set the owner for all your web content:

    chown -R webcontent:webgroup /path/to/web/content
    

    fix permissions:

    find /path/to/web/content -type d -print0 | xargs -0 chmod 750
    find /path/to/web/content -type f -print0 | xargs -0 chmod 640
    

    then make sure your web server is using the Group webgroup directive to ensure that it can still read all the files it needs.

    This will let your web server have read access to all your scripts and configuration, but if the web server itself is hacked, it can’t modify any of it.

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

Sidebar

Related Questions

So, ok. I have many php files and one index.php file. All files can't
In PHP it's possible to have arrays in $_GET , $_POST , $_COOKIE ,
The basics: I have a contact form that uses php to validate the forms.
Possible Duplicate: Site has been hacked via SQL Injection Looks like one of my
I have a question for those iPhone hackers. People using private apis know that
Possible Duplicate: C++ templates that accept only certain types For example, if we want
Possible Duplicate: How does the Google Did you mean? Algorithm work? Suppose you have
Is there any real sequence of characters that always compares greater than any other
Let's say file.txt.gz has 2GB, and I want to see last 100 lines or
Possible Duplicates: What security issues should I look out for in PHP What should

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.