1
marcan
mainfile.php in read only but still can write in it ...
  • 2004/4/14 14:41

  • marcan

  • Just can't stay away

  • Posts: 824

  • Since: 2003/10/8


Hello fellow Xoopsers !

Hi have a pretty complex situation here and I would like your advises. As it is complex, I'll have to clearly described the context.

I developped a web site for a company and I'm now ready to put it online. Everything works find : uploaded the files, created the database, populated it, chmod the necessary filders and chmod mainfile.php in 444. Perfect

When accessing the admin section for the first time, I get the message that mainfile.php is writable. I double check the attributes of mainfile.php :

Here is a screen shot of the mainfile.php attributes in the File Manager of the host :
Resized Image

As you can see, it was supposed to be in 444. Nevertheless, I seaked more proofs. Here is the attributes of the file, read via an FTP client :
Resized Image

Still in 444. Yet again, here is with anoter FTP client :
Resized Image

So, as you can see, everywhere I look, mainfile.php seems to be in 444, as it should. However, in admin.php, it won't let me continue because mainfile.php is writable.

Just to be sure, I uploaded everything on another host and everything worked find, so it seems not to be XOOPS.

I did further testing. I uploaded the install folder from the XOOPS official package, as well as mainfile.php of that same package. Again, I chmoded mainfile.php in 444, and got all the previous images for confirmation.

I launch the installation and, with no surprises what so ever, XOOPS successfully wrote the configuration informations in mainfile.php, while it should have been in Read Only.

I emailed the host company to notify them of what I see as a secrurity problem. First question to you after all this bla bla : Can it be a security problem from the host ?

The answered me something that I thinks does not solve the problem :
Quote:
The permissions on a linux system are different from the permissions on a windows system. For example if the folder the file resides in is read write and execute enabled and the file is read only you are still able to delete and modify the file under the linux file system this is due to the fact that unix system is based on files and the files under a folder are considered to be the content of that particular folder, hence you can delete and modify the name of the files under the directory because you as owner have rights to modify the public directory (file's contents.) If you require further assistance please contact us.

In other words, you should put the entire folder of mainfile.php in Read Only in order for the files inside it to be Read Only.


What do you think of this answer? Is it true? All Linux dudes out there, do what they say is legitimate? Am I missing something here?

Thanks for help on that !

2
Mithrandir
Re: mainfile.php in read only but still can write in it ...

Doesn't sound all that far fetched for me.

Perhaps you could try setting the entire XOOPS root folder to read-only and then the cache, templates_c and uploads folders to writable.

I am not an expert on permissions and CHMOD, though - but it's worth the try.

3
marcan
Re: mainfile.php in read only but still can write in it ...
  • 2004/4/14 15:03

  • marcan

  • Just can't stay away

  • Posts: 824

  • Since: 2003/10/8


Thanks Mith !

However, the prblematic host, as well as the other host where I successfully installed the site are both using Linux. Why does on one of them I would have to set the entire root in read ony and on the other not?

Also, on the problematic host, I can't set the root in 444. If I do that I get a message telling me that this folder is necessary for the site to work, thought it can not be set in read only.

Any ideas people ?

Thanks !

4
studioC
Re: mainfile.php in read only but still can write in it ...
  • 2004/4/14 15:10

  • studioC

  • Friend of XOOPS

  • Posts: 922

  • Since: 2003/12/7


hello marcan, i think that it is not the solution ,.. but i had same things on an other server too... he seems to hate this 444... Setting this to 644 lets XOOPS admin hide this "error" messages on my server...

try it !

michael


edit: and hopefully mainfile isn't writeable by others...

5
pdaddict
Re: mainfile.php in read only but still can write in it ...
  • 2004/4/14 15:15

  • pdaddict

  • Friend of XOOPS

  • Posts: 106

  • Since: 2003/4/6 1


Quote:
For example if the folder the file resides in is read write and execute enabled and the file is read only you are still able to delete and modify the file under the linux file system this is due to the fact that unix system is based on files and the files under a folder are considered to be the content of that particular folder, hence you can delete and modify the name of the files under the directory because you as owner have rights to modify the public directory (file's contents.)


Quote:
Again, I chmoded mainfile.php in 444, and got all the previous images for confirmation.
I launch the installation and, with no surprises what so ever, XOOPS successfully wrote the configuration informations in mainfile.php, while it should have been in Read Only.


Something's wrong here. YOU are the owner of public_html, not the server (usual usernames: www, wwwrun, apache, server,...), often apache isn't even part of the usergroup 'users'. If you visit the install trough the web, it is apache who writes in mainfile.php, not you. My conclusion here is that your public_html is chmodded (777) (or 77* if apache is part of 'users') if the first quote is true.
If your public_html is (777) either you chmodded it that way, or your host did something wrong, because public_html isn't supposed to be writable by anyone, not even ppl in the same usergroup.

6
Dave_L
Re: mainfile.php in read only but still can write in it ...
  • 2004/4/14 15:18

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


On Linux, if a directory is writable, I think the files within the directory can be deleted or renamed, but the files can only be overwritten if the files themselves have write permission.

If you want to make a directory read-only, the permission would have to be 5, not 4, since a directory has to be "executable". So instead of 444, use 555.

7
marcan
Re: mainfile.php in read only but still can write in it ...
  • 2004/4/14 17:04

  • marcan

  • Just can't stay away

  • Posts: 824

  • Since: 2003/10/8


Thanks for your answers !

The root folder is chmoded 555. What do you suggest?

Thanks !

8
marcan
Re: mainfile.php in read only but still can write in it ...
  • 2004/4/14 17:07

  • marcan

  • Just can't stay away

  • Posts: 824

  • Since: 2003/10/8


Also, is it possible to answer by Yes or No to the following question :

If a maifile.php is chmoded 444, there is NO WAY a script like the installation of XOOPS could write into it.

Thanks !

9
Mithrandir
Re: mainfile.php in read only but still can write in it ...

No, it should rather be
Quote:

If a maifile.php is chmoded 444, the ONLY WAY a script like the installation of XOOPS could write into it would be if the webserver USER is also the file OWNER and has some chmod code to make it writable before the write.

10
marcan
Re: mainfile.php in read only but still can write in it ...
  • 2004/4/14 17:25

  • marcan

  • Just can't stay away

  • Posts: 824

  • Since: 2003/10/8


Yet again, Thanks Mith !

Now, allow me another affirmative question. Would it be corret to say the folowing :

Quote:
If the webserver USER is also the file OWNER, this could lead to serious security issues, as the web site could be intruded for malicious behavior...


Thanks !

Login

Who's Online

223 user(s) are online (144 user(s) are browsing Support Forums)


Members: 0


Guests: 223


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Apr 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits