php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47116 Problem with .htaccess, high consumption of resources , probable DOS
Submitted: 2009-01-15 16:20 UTC Modified: 2009-01-15 19:23 UTC
From: kabute at gulo dot org Assigned:
Status: Not a bug Package: Apache2 related
PHP Version: 5.2.8 OS: GNU/Linux (Debian)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: kabute at gulo dot org
New email:
PHP Version: OS:

 

 [2009-01-15 16:20 UTC] kabute at gulo dot org
Description:
------------
If you create a directory with a .htaccess and a .htpassword inside (and Apache2 correctly configured), and you create a .php file with the next code:

<?php

$user = $_SERVER['PHP_AUTH_USER'];
$pass = $_SERVER['PHP_AUTH_PW'];

$validated = ($user=="user") && (($pass) == "pass");

if (!$validated) {
 header('WWW-Authenticate: Basic realm="Realm"');

 header('HTTP/1.0 401 Unauthorized');
 die ("Authentification failed.");


}


?>

In the second authetification the browser will start loading the page waiting for response. Looking at the apache's error log it will show an "user not found" error.

I've tried it with PHP 5.2.6 and PHP 5.2.7 .

Reproduce code:
---------------
<?php

//Remember to create .htaccess and .htpasswd

$user = $_SERVER['PHP_AUTH_USER'];
$pass = $_SERVER['PHP_AUTH_PW'];

$validated = ($user=="user") && (($pass) == "pass");

if (!$validated) {
 header('WWW-Authenticate: Basic realm="Realm"');

 header('HTTP/1.0 401 Unauthorized');
 die ("Authentification failed.");


}


?>

Expected result:
----------------
Resources comsuption, maybe DOS.

Actual result:
--------------
Very high memory load.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-01-15 19:23 UTC] jani@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 23:01:28 2024 UTC