apache + php + basic auth => password theft => solutions?

apache + php + basic auth => password theft => solutions?

Post by Rahul Dhe » Tue, 16 Mar 1999 04:00:00



The use of php allows a user's web pages to require basic
authentication, and then grab and save the password presented by the
user.  This bypasses Apache's normal security mechanism, which otherwise
never supplies a basic auth password to any cgi-bin program.

Scenario:

   Web site A's web pages use a realm 'xxx'.

   Client C connects to web site A, presents username and password for
   realm 'xxx.

   Client C later connects to web site B hosted on same machine.  Web site
   B sends a WWW-Authenticate header that also specifies realm xxx.
   C's browser sends saved username and password that was used to visit
   web site A.  Web site B grabs this username and password.

Offhand I don't know of any existing solutions.  The php documentation
says that a web site can protect itself by sending a 401 status code,
which will cause some web browsers to clear any saved username and
password.  But (a) not all browsers will do this and (b) not all web
site owners will do this or even know how to do this.

Here is a possible partial solution:  Apache could always require that
the realm in use begin with the username of the directory owner and a
separating character.  E.g., if a directory being protected is owned by
'dhesi', then the realm must begin with 'dhesi.', and this prefix string
could be inserted by Apache if not already present in the real.

This would prevent different web site owners hosted on a set of machines
from stealing one another's passwords, so long as the machines share a
common set of UNIX usernames.

Does anybody have a better solution?
--

 
 
 

apache + php + basic auth => password theft => solutions?

Post by Rasmus Lerdo » Tue, 16 Mar 1999 04:00:00



says...

Quote:> The use of php allows a user's web pages to require basic
> authentication, and then grab and save the password presented by the
> user.  This bypasses Apache's normal security mechanism, which otherwise
> never supplies a basic auth password to any cgi-bin program.

> Scenario:

>    Web site A's web pages use a realm 'xxx'.

>    Client C connects to web site A, presents username and password for
>    realm 'xxx.

>    Client C later connects to web site B hosted on same machine.  Web site
>    B sends a WWW-Authenticate header that also specifies realm xxx.
>    C's browser sends saved username and password that was used to visit
>    web site A.  Web site B grabs this username and password.

> Offhand I don't know of any existing solutions.  The php documentation
> says that a web site can protect itself by sending a 401 status code,
> which will cause some web browsers to clear any saved username and
> password.  But (a) not all browsers will do this and (b) not all web
> site owners will do this or even know how to do this.

> Here is a possible partial solution:  Apache could always require that
> the realm in use begin with the username of the directory owner and a
> separating character.  E.g., if a directory being protected is owned by
> 'dhesi', then the realm must begin with 'dhesi.', and this prefix string
> could be inserted by Apache if not already present in the real.

> This would prevent different web site owners hosted on a set of machines
> from stealing one another's passwords, so long as the machines share a
> common set of UNIX usernames.

> Does anybody have a better solution?

Well, I actually thought of this quite a while ago.  You will notice that
if you turn on PHP's safe-mode then the numerical unix user id is
prepended to any realm sent by a PHP script running in safe mode.  PHP
has been doing this since early version 2.

Safe mode isn't extremely well documented though.  Other than the realm
mungeing it checks functions that manipulate files by making sure that
the file in question is owned by the same user id as the current php
script being parsed.  And it also restricts any of the exec() family of
functions to only execute things located in a designated safe mode exec
directory.  

-Rasmus

 
 
 

apache + php + basic auth => password theft => solutions?

Post by Rahul Dhe » Tue, 16 Mar 1999 04:00:00



Quote:(Rasmus Lerdorf) writes:
>You will notice that
>if you turn on PHP's safe-mode then the numerical unix user id is
>prepended to any realm sent by a PHP script running in safe mode.  PHP
>has been doing this since early version 2.

Excellent!  That substantially solves the problem.  I just tried it
and it worke.
--

 
 
 

1. Apache Rewrite domain.com->index.php domain.org->index2.php

Hello

is it possible to make something like this

the domain.com and domain.org "shows" to the same file index.php
on the server.

But i want somethingh like this

domain.com -> /index.php
domain.org -> /index2.php

and this should be done in .htaccess

can anybody help me?

thanx in advance
Thomas Bosshard

2. Errors running up2date on RH8.0

3. Apache --> Tomcat Auth Basic header forwarding

4. Looking for Mod editor that will run under Linux

5. <><><> MOUNTING EXTENDED PARTITION <><><>

6. status of xntp on ibm rs/6000?

7. Wanted: <><><> Unix Specialist <><><>

8. VxD and Linux?

9. LILO help <><><><><><>

10. >>---> Software Jobs! >>--->

11. Apache->PHP-mail()->sendmail problem Debian 3.1

12. Help with "Apache User Auth" -> user/password mod_auth_external.c

13. <<<A XXX Password>>>