Thursday, January 19, 2012

Apache httpd identification strings


The problem...

$ curl --verbose --user-agent "= ^ . ^ =" "http://localhost:80/info.php" > /dev/null
* About to connect() to localhost port 80 (#0)
* Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 80 (#0)
> GET /info.php HTTP/1.1
> User-Agent: = ^ . ^ =
> Host: localhost
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Thu, 19 Jan 2012 23:59:59 GMT
< Server: Apache/2.2.16 (Debian) PHP/5.3.3-7+squeeze3 with Suhosin-Patch mod_ssl/2.2.16 OpenSSL/0.9.8o
< X-Powered-By: PHP/5.3.3-7+squeeze3
< Vary: Accept-Encoding
< Transfer-Encoding: chunked
< Content-Type: text/html
<
{ [data not shown]
* Connection #0 to host localhost left intact
* Closing connection #0

The solution...

/etc/apache2/conf.d/security
  • ServerTokens Prod
  • ServerSignature Off
/etc/php5/apache2/php.ini
  • expose_php = Off
/etc/init.d/apache2 restart

$ curl --verbose --user-agent "= ^ . ^ =" "http://localhost:80/info.php" > /dev/null
* About to connect() to localhost port 80 (#0)
* Trying 127.0.0.1... connected
* Connected to localhost (127.0.0.1) port 80 (#0)
> GET /info.php HTTP/1.1
> User-Agent: = ^ . ^ =
> Host: localhost
> Accept: */*
>
< HTTP/1.1 200 OK
< Date: Thu, 20 Jan 2012 00:00:00 GMT
< Server: Apache
< Vary: Accept-Encoding
< Transfer-Encoding: chunked
< Content-Type: text/html
<
{ [data not shown]
* Connection #0 to host localhost left intact
* Closing connection #0

# rm -v /var/www/info.php

--
= ^ . ^ =

No comments:

Post a Comment