Chmod

Discussions of secure PHP coding. Security in software is important, so don't be afraid to ask. And when answering: be anal. Nitpick. No security vulnerability is too small.

Moderator: General Moderators

Post Reply
Shendemiar
Forum Contributor
Posts: 404
Joined: Thu Jan 08, 2004 8:28 am

Chmod

Post by Shendemiar »

This must be utterly stupid...

If i chmod something +777, how could "other" edit my files?

Not actually a Php question, but i need to know this as a prelude to my main concern, that is php related.
rehfeld
Forum Regular
Posts: 741
Joined: Mon Oct 18, 2004 8:14 pm

Post by rehfeld »

lets say your website is
Shendemiar.com
and im on the same host as you with the website
rehfeld.com

assuming you doc root was

/usr/path/to/Shendemiar.com/public_html/

and mine

/usr/path/to/rehfeld.com/public_html/

Code: Select all

$fp = fopen('/usr/path/to/Shendemiar.com/public_html/script.php', 'w');
if php's open_basedir is being used, that will prob fail. but i could still prob use cgi to do it.

by doing that, i could prob look at all your code, and get your db passwords, and if your also maybe doing a login and using sessions, see what session vars your setting, then write my own session file to the session.save_path dir, and then your website would grant me access.
User avatar
hawleyjr
BeerMod
Posts: 2170
Joined: Tue Jan 13, 2004 4:58 pm
Location: Jax FL & Spokane WA USA

Post by hawleyjr »

What if your on a dedicated server?
rehfeld wrote:lets say your website is
Shendemiar.com
and im on the same host as you with the website
rehfeld.com

assuming you doc root was

/usr/path/to/Shendemiar.com/public_html/

and mine

/usr/path/to/rehfeld.com/public_html/

Code: Select all

$fp = fopen('/usr/path/to/Shendemiar.com/public_html/script.php', 'w');
if php's open_basedir is being used, that will prob fail. but i could still prob use cgi to do it.

by doing that, i could prob look at all your code, and get your db passwords, and if your also maybe doing a login and using sessions, see what session vars your setting, then write my own session file to the session.save_path dir, and then your website would grant me access.
Shendemiar
Forum Contributor
Posts: 404
Joined: Thu Jan 08, 2004 8:28 am

Post by Shendemiar »

My php runs on a safe mode/with different credentials than my unix username, preventing it do create directories. I can make directories by ftp, but then i cant upload to them by php, since a different "user" made them. For this, i just gave all rights to everyone to branch of folders that have various documents like pdf's and pictures. There's no php or passwords at all in it, so i guess there's no huge risk involved?
Post Reply