En muchas ocasiones, especialmente en servidor de producción, una de las formas de proteger los equipos es la ocultación. Si un atacante no sabe qué versión del software estamos empleando, no podrá atacar directamente los posibles fallos que la versión tenga. Aunque no es para nada efectivo, sí puede resultar de ayuda para entorpecer los ataques, ya que tendrá que probar varios exploits y así tenemos más posibilidades de que nuestro IDS detecte y nos alerte del ataque.
Por defecto, un equipo con el servidor apache arrancado, al pedir información del servidor nos indica lo siguiente, por ejemplo.
shell> curl -I http://192.168.1.69 HTTP/1.1 403 Forbidden Date: Thu, 07 Jun 2012 10:24:35 GMT Server: Apache/2.2.15 (CentOS) Accept-Ranges: bytes Content-Length: 5039 Connection: close Content-Type: text/html; charset=UTF-8
Y lo que nos interesa es justamente ocultar la información referente a la versión de apache. Para ello, hay que editar el fichero de configuración httpd.conf (generalmente en /etc/httpd/conf/httpd.conf) y establecer las variables ServerSignature y ServerTokens a Off y Prod, respectivamente.
# Optionally add a line containing the server version and virtual host # name to server-generated pages (internal error documents, FTP directory # listings, mod_status and mod_info output etc., but not CGI generated # documents or custom error documents). # Set to "EMail" to also include a mailto: link to the ServerAdmin. # Set to one of: On | Off | EMail ServerSignature Off # Don't give away too much information about all the subcomponents # we are running. Comment out this line if you don't mind remote sites # finding out what major optional modules you are running ServerTokens Prod
Tras ello, reiniciamos el servicio.
shell> /etc/init.d/httpd restart
Y ahora al consultar la información del servicio observamos la diferencia,
shell> curl -I http://192.168.1.69 HTTP/1.1 403 Forbidden Date: Thu, 07 Jun 2012 10:25:35 GMT Server: Apache Accept-Ranges: bytes Content-Length: 5039 Connection: close Content-Type: text/html; charset=UTF-8
Directamente relacionado con apache y su versión está también php. Para ver cómo ocultar la versión de php, pinche aquí.
Los posibles valores de ServerTokens pueden ser:
ResponderEliminarServerTokens Prod Server: Apache
ServerTokens Min Server: Apache/1.3.0
ServerTokens OS Server: Apache/1.3.0 (Unix)
ServerTokens Full Server: Apache/1.3.0 (Unix) PHP/3.0 MyMod/1.2