|
2 | 2 | /* PHP HTTP Tarpit |
3 | 3 | * Purpose: Confuse and waste bot scanners time. |
4 | 4 | * Use: Url rewrite unwanted bot traffic to this file. It is important you use Url rewrites not redirects as most bots ignore location headers. |
5 | | - * Version: 1.2.1 |
| 5 | + * Version: 1.3.1 |
6 | 6 | * Author: Chaoix |
7 | 7 | * |
8 | 8 | * Change Log: |
| 9 | + * -Added random content-length header to HEAD requests. (1.3.1) |
| 10 | + * -Added HEAD request handling to bait vulnerability scanners such as Jorgee (1.3.0) |
9 | 11 | * -Fixed Chained Redirection to bounceback requests that don't send HTTP_HOST. (1.2.1) |
10 | 12 | * -Added bounceback redirect defense. (1.2.0) |
11 | 13 | * -Changed default defense to Random by the minute. (1.1.6) |
|
25 | 27 |
|
26 | 28 | //Basic Options |
27 | 29 | $random_content_length = 2048; //In characters. Used to fill up the size of the scanner's log files. |
28 | | -$defense_number = 7; //1 is Blinding Mode, 2 is Ninja Mode, 3 is HTTP Tarpit, 4 is a Chained Redirection, 5 is a Bounceback Redirection, 6 is a Random defense for each request, 7 is a Random Defense by the minute. |
| 30 | +$defense_number = 1; //1 is Blinding Mode, 2 is Ninja Mode, 3 is HTTP Tarpit, 4 is a Chained Redirection, 5 is a Bounceback Redirection, 6 is a Random defense for each request, 7 is a Random Defense by the minute. |
29 | 31 | $responce_delay_min = 100; //Range of delay in microseconds before headers are sent. You want a range of delays so the introduced latentcy can not be detected by the scanner. |
30 | 32 | $responce_dalay_max = 300; |
31 | 33 | $times_redirected_max = 9; //Maximum number of times to redirect (0-9). |
@@ -99,6 +101,14 @@ function validate_integer ($numeric_string) { |
99 | 101 | //Delay for a random number of microseconds |
100 | 102 | usleep( mt_rand($responce_delay_min, $responce_dalay_max) ); |
101 | 103 |
|
| 104 | +//Entice vulnerability scanners to actually perform a GET request |
| 105 | +//Most vulnerability scanners, such as Jorgee, immediately follow a 200 responce on a HEAD request with a GET request |
| 106 | +if( 'HEAD' == $_SERVER['REQUEST_METHOD'] ) { |
| 107 | + header("HTTP/1.1 200 OK"); |
| 108 | + header("Content-Length: " . mt_rand( 0, $random_content_length - 1 )); |
| 109 | + die(); |
| 110 | +} |
| 111 | + |
102 | 112 | //Enforce Endless Redirection |
103 | 113 | $times_redirected = 0; |
104 | 114 | if( !empty($_SERVER['REQUEST_URI']) ) { |
|
0 commit comments