隐藏版本信息号返回服务器名,Apache服务器隐藏版本号和系统

一般情况下,软件的漏洞信息和特定版本是相关的,因此,软件的版本号对攻击者来说是很有价值的。

在默认情况下,Apache Httpd 系统会把Apache版本模块都显示出来(http返回头信息)。如果列举目录的话,会显示域名信息,服务器版本号,操作系统类型等。

隐藏Apache版本号的方法是修改Apache的配置文件:

vim /etc/httpd/conf/httpd.conf

返回客户端头信息:

[root@ithomer conf]# curl –head 127.0.0.1

HTTP/1.1 200 OK

Date: Thu, 22 Jan 2015 15:39:00 GMT

Server: Apache/2.2.26 (CentOS)

X-Powered-By: PHP/5.5.9

Vary: Cookie,Accept-Encoding,User-Agent

X-Pingback: http://blog.mimvp.com/xmlrpc.php

Cache-Control: max-age=600

Expires: Thu, 22 Jan 2015 15:49:00 GMT

Content-Type: text/html; charset=UTF-8

上面头信息中,会显示服务器类型和版本(Apache/2.2.26),以及操作系统(CentOS)

修改 ServerTokens

修改 ServerTokens OS 为 ServerTokens productonly

重启 Apache : /etc/init.d/httpd restart

再次返回头信息如下:

[root@ithomer conf]# curl –head 127.0.0.1

HTTP/1.1 200 OK

Date: Thu, 22 Jan 2015 15:40:53 GMT

Server: Apache

X-Powered-By: PHP/5.5.9

Vary: Cookie,Accept-Encoding,User-Agent

X-Pingback: http://blog.mimvp.com/xmlrpc.php

Cache-Control: max-age=600

Expires: Thu, 22 Jan 2015 15:50:53 GMT

Content-Type: text/html; charset=UTF-8

同时修改 ServerTokens 为 Prod 和 ServerSignature 为off 返回结果

[root@ithomer conf]# curl –head 127.0.0.1

HTTP/1.1 200 OK

Date: Thu, 22 Jan 2015 16:23:07 GMT

Server: Apache

Vary: Cookie,Accept-Encoding,User-Agent

X-Pingback: http://blog.mimvp.com/xmlrpc.php

Cache-Control: max-age=600

Expires: Thu, 22 Jan 2015 16:33:07 GMT

Content-Type: text/html; charset=UTF-8

到这里,我们还可以改变apache的版本,这就要修改apache的源代码了

在apache的源码包中找到ap_release.h将

#define AP_SERVER_BASEPRODUCT “Apache”

修改为

#define AP_SERVER_BASEPRODUCT “Microsoft-IIS/5.0”

或者

#define AP_SERVER_BASEPRODUCT “Microsoft-IIS/6.0”

然后找到os/unix下的os.h文件,将其

#define PLATFORM “Unix”