Welcome to MobyThreads.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in
All support for the MobyThreads Threaded phpBB MOD can now be found on welsolutions at this forum

security with Apache & PHP

 
   Web Hosting and Web Master Forums (Home) -> Apache RSS
Next:  newbie with basic question  
Author Message
mono

External


Since: Mar 17, 2004
Posts: 14



(Msg. 1) Posted: Wed Mar 17, 2004 10:49 pm
Post subject: security with Apache & PHP
Archived from groups: alt>apache>configuration (more info?)

I really hope someone out there has the answer cause I'm a little worried
about this. Here's what is happening:

I have Apache with PHP running on a win2k box.

The Apache service logs on with a dummy user account (MYDOMAIN\apache).

The server is configured to look on a remote file server where everybody has
a file share. (\\FILESERVER\home\*\public_html).

The apache user account the service runs under originally has only
list/read/execute access to each person's public_html.

If a user (userA) decides he wants PHP to be able to write to a folder in
his public_html folder he can use windows security to grant the apache user
write access. (ex: opendir)

Now if another user (userB) knows what this folder is, this means he can
write to userA's folder with PHP.

ex of userB's script:
$fp = fopen("//FILESERVER/home/userA/public_html/opendir/test.txt",w);
if ($fp){
echo "created file";
}
fputs($fp,"this is a test file");
fclose($fp);

It also means that userB can delete anything in this folder.

How would I go about preventing this????

 >> Stay informed about: security with Apache & PHP 
Back to top
Login to vote
mono

External


Since: Mar 17, 2004
Posts: 14



(Msg. 2) Posted: Thu Mar 18, 2004 2:51 am
Post subject: Re: security with Apache & PHP [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Hello all,

seems I might of found a temporary fix. In the php.ini file I
configured the open_basedir directive like so:

open_basedir .

which effectively prevents users from touching any file in directories that
are higher than the one the script resides in. Of course this makes it a
little trickier for web designers but at least it take the security risk
away.

of course the best solution would be to have php running as a module so that
I can add the:

php_admin_value open_basedir "\FILESERVER\home\*\public_html"

directive to each vhost and directory. Anyone know if they fixed the php
module in apache 2.0.48 for windows???


"kogger" <mono DeleteThis @kog.ca> wrote in message
news:am66c.19218$E71.1293682@news20.bellglobal.com...
 > I really hope someone out there has the answer cause I'm a little worried
 > about this. Here's what is happening:
 >
 > I have Apache with PHP running on a win2k box.
 >
 > The Apache service logs on with a dummy user account (MYDOMAIN\apache).
 >
 > The server is configured to look on a remote file server where everybody
has
 > a file share. (\\FILESERVER\home\*\public_html).
 >
 > The apache user account the service runs under originally has only
 > list/read/execute access to each person's public_html.
 >
 > If a user (userA) decides he wants PHP to be able to write to a folder in
 > his public_html folder he can use windows security to grant the apache
user
 > write access. (ex: opendir)
 >
 > Now if another user (userB) knows what this folder is, this means he can
 > write to userA's folder with PHP.
 >
 > ex of userB's script:
 > $fp = fopen("//FILESERVER/home/userA/public_html/opendir/test.txt",w);
 > if ($fp){
 > echo "created file";
 > }
 > fputs($fp,"this is a test file");
 > fclose($fp);
 >
 > It also means that userB can delete anything in this folder.
 >
 > How would I go about preventing this????
 >
 ><!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: security with Apache & PHP 
Back to top
Login to vote
bastacoivirus

External


Since: Mar 14, 2004
Posts: 3



(Msg. 3) Posted: Thu Mar 18, 2004 12:05 pm
Post subject: Re: security with Apache & PHP [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

this is the same situation i have.
i think the solution is to use the "php_admin_value open_basedir"
directive to restrict users permissions per-directory.

that said, if you have some virtualhosts you can put the
"php_admin_value open_basedir" directive customized for every single
website.

if you want, you can also decide to put the "AddType
application/x-httpd-php .php" directive only to the Vhosts that uses php
and not to the other websites with simple html files.

bye
sp-
 >> Stay informed about: security with Apache & PHP 
Back to top
Login to vote
patpro1

External


Since: Nov 20, 2003
Posts: 40



(Msg. 4) Posted: Thu Mar 18, 2004 2:03 pm
Post subject: Re: security with Apache & PHP [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <ADd6c.61385$z23.2821626@news3.tin.it>,
spintop <bastacoivirus RemoveThis @virgilio.it> wrote:

 > that said, if you have some virtualhosts you can put the
 > "php_admin_value open_basedir" directive customized for every single
 > website.


that's definitively a good thing


 > if you want, you can also decide to put the "AddType
 > application/x-httpd-php .php" directive only to the Vhosts that uses php
 > and not to the other websites with simple html files.

if users have the ability to use .htaccess, they can add the AddType
directive them self on a per directory basis, so you'll fail preventing
them from using php in this case.

patpro

--
je cherche un poste d'admin UNIX/Mac
<a style='text-decoration: underline;' href="http://patpro.net/cv.php" target="_blank">http://patpro.net/cv.php</a><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: security with Apache & PHP 
Back to top
Login to vote
bastacoivirus

External


Since: Mar 14, 2004
Posts: 3



(Msg. 5) Posted: Thu Mar 18, 2004 2:03 pm
Post subject: Re: security with Apache & PHP [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

patpro ha scritto:

 > if users have the ability to use .htaccess, they can add the AddType
 > directive them self on a per directory basis, so you'll fail preventing
 > them from using php in this case.

how can i prevent this?

bye
sp-<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: security with Apache & PHP 
Back to top
Login to vote
patpro1

External


Since: Nov 20, 2003
Posts: 40



(Msg. 6) Posted: Thu Mar 18, 2004 2:58 pm
Post subject: Re: security with Apache & PHP [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

In article <vCe6c.76641$O31.3509938@news4.tin.it>,
spintop <bastacoivirus.TakeThisOut@virgilio.it> wrote:

 > patpro ha scritto:
 >
  > > if users have the ability to use .htaccess, they can add the AddType
  > > directive them self on a per directory basis, so you'll fail preventing
  > > them from using php in this case.
 >
 > how can i prevent this?

disallow the use of .htaccess files (put AllowOverride None in
httpd.conf) or forbid FileInfo by limiting the AllowOverride scope to
this (or to a part of this):

AllowOverride AuthConfig Indexes Limit Options

Only "AllowOverride FileInfo" or "AllowOverride All" will allow the use
of AddType directive in .htaccess file.


patpro

--
je cherche un poste d'admin UNIX/Mac
<a style='text-decoration: underline;' href="http://patpro.net/cv.php" target="_blank">http://patpro.net/cv.php</a><!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: security with Apache & PHP 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
security apache windows - Hello, could somebody give me some advice how so make a apache2 with php4.x and mysql secure under windows. The server will be on the internet and have also ftp access. So i must make sure that the apache+php+mysql configuration is secure when someone..

Apache 2.0.47 and Security Hole with nessus? - Hello... I have installed the Apache server 2.0.47 on a WINSERVER2000 machine. I am using it only to serve simple HMTL. I have not specifically installed or configured Tomcat. As a precautionary measure, I hit the box using a nessus client from Linux.....

CGI-BIN security - Hi ! I have a cgi-bin directory (OS=linux), defined as: <Directory "/myweb/cgi-bin"> AllowOverride AuthConfig Header set Cache-Control "no-cache" Header set Pragma "no-cache" Options None AuthName...

server security - Is there as set of directive/whatver posted somewhere to ket 2.0 as secure as possible? Any help would be greatly appreciated. Rich

Security Question - This might be a stupid question however I never refrain from asking them. The following lines were logged several times over with different clients logged. [error] [client 24.1.32.111] File does not exist: /usr/local/www/scripts/root.exe [error] [clien...
   Web Hosting and Web Master Forums (Home) -> Apache All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]