Web渗透——web服务器指纹识别

摘要:
通过掌握不同服务器对于不同命令的响应,并把这些信息保存在web服务器的指纹数据库中,渗透测试人员可以向web服务器发送这些命令,分析响应并与数据库中的已知签名相匹配。请注意,由于不同版本的服务器对于同一个请求可能有同样的响应,所以可能需要多个命令请求才能准确识别web服务器。协议行为更好的方法是从web服务器的不同特征上入手。

1、概述

Web服务器指纹识别是渗透测试人员非常重要的一个任务。了解正在运行的web服务器类型和版本能让测试者更好去测试已知漏洞和大概的利用方法。

目前市场上存在几种不同的web服务器提供商和软件版本,了解被测试的web服务器的类型,将会在渗透测试过程中有很大的帮助,甚至会改变测试的路线。

你可以通过发送web服务器特定的命令并分析输出结果来得到这些信息,因为不同版本的web服务器软件可能对这些命令有着不同的响应。通过掌握不同服务器对于不同命令的响应,并把这些信息保存在web服务器的指纹数据库中,渗透测试人员可以向web服务器发送这些命令,分析响应并与数据库中的已知签名相匹配。请注意,由于不同版本的服务器对于同一个请求可能有同样的响应,所以可能需要多个命令请求才能准确识别web服务器。

2、测试目标

发现正在运行的web服务器的版本和类型,确定其已知漏洞,并选择合适的漏洞利用代码,以备在测试期间使用

3、如何测试

黑盒测试

最简单也是最基本的方法来鉴别web服务器就是查看HTTP响应头中的"Server"字段。下面实验中我们使用Netcat

考虑如下HTTP请求响应:

$ nc 202.41.76.251 80

HEAD / HTTP/1.0

HTTP/1.1 200 OK

Date: Mon, 16 Jun 2003 02:53:29 GMT

Server: Apache/1.3.3 (Unix) (Red Hat/Linux)

Last-Modified: Wed, 07 Oct 1998 11:18:14 GMT

ETag: "1813-49b-361b4df6"

Accept-Ranges: bytes

Content-Length: 1179

Connection: close

Content-Type: text/html 

从Server字段,我们可以发现服务器可能是Apache,版本1.3.3,运行在Linux系统上。

下面展示了4个不同的HTTP响应头示例:

1、Apache 1.3.23 服务器:

HTTP/1.1 200 OK
Date: Sun, 15 Jun 2003 17:10: 49 GMT

Server: Apache/1.3.23

Last-Modified: Thu, 27 Feb 2003 03:48: 19 GMT

ETag: 32417-c4-3e5d8a83

Accept-Ranges: bytes

Content-Length: 196

Connection: close

Content-Type: text/HTML

2、Microsoft IIS 5.0 服务器:

HTTP/1.1 200 OK
Server: Microsoft-IIS/5.0

Expires: Yours, 17 Jun 2003 01:41: 33 GMT

Date: Mon, 16 Jun 2003 01:41: 33 GMT

Content-Type: text/HTML

Accept-Ranges: bytes

Last-Modified: Wed, 28 May 2003 15:32: 21 GMT 

ETag: b0aac0542e25c31: 89d

Content-Length: 7369

3、Netscape Enterprise 4.1 服务器:

HTTP/1.1 200 OK
Server: Netscape-Enterprise/4.1

Date: Mon, 16 Jun 2003 06:19: 04 GMT

Content-type: text/HTML

Last-modified: Wed, 31 Jul 2002 15:37: 56 GMT

Content-length: 57

Accept-ranges: bytes

Connection: close 

4、SunONE 6.1 服务器:

HTTP/1.1 200 OK
Server: Sun-ONE-Web-Server/6.1

Date: Tue, 16 Jan 2007 14:53:45 GMT

Content-length: 1186

Content-type: text/html

Date: Tue, 16 Jan 2007 14:50:31 GMT

Last-Modified: Wed, 10 Jan 2007 09:58:26 GMT

Accept-Ranges: bytes

Connection: close

但是,这种测试方法并不是很精确。因为存在多种方法可以让网站模糊或修改服务器旗帜字符串。例如我们可能得到如下结果:

403 HTTP/1.1 Forbidden
Date: Mon, 16 Jun 2003 02:41: 27 GMT

Server: Unknown-Webserver/1.0

Connection: close

Content-Type: text/HTML; charset=iso-8859-1 

在这个例子中,Server字段已经被混淆,测试者并不能从中得到服务器的信息。

协议行为

更好的方法是从web服务器的不同特征上入手。下面是一些常见web服务典型响应头:

1、HTTP头字段顺序

第一个方法通过观察响应头的组织顺序。每个服务器都有一个内部的HTTP头排序方法,考虑如下例子:

Apache 1.3.23 响应

$ nc apache.example.com 80
HEAD / HTTP/1.0

HTTP/1.1 200 OK

Date: Sun, 15 Jun 2003 17:10: 49 GMT

Server: Apache/1.3.23

Last-Modified: Thu, 27 Feb 2003 03:48: 19 GMT

ETag: 32417-c4-3e5d8a83

Accept-Ranges: bytes

Content-Length: 196

Connection: close

Content-Type: text/HTML 

2、IIS 5.0 响应

$ nc iis.example.com 80
HEAD / HTTP/1.0

HTTP/1.1 200 OK

Server: Microsoft-IIS/5.0

Content-Location: http://iis.example.com/Default.htm

Date: Fri, 01 Jan 1999 20:13: 52 GMT

Content-Type: text/HTML

Accept-Ranges: bytes

Last-Modified: Fri, 01 Jan 1999 20:13: 52 GMT

ETag: W/e0d362a4c335be1: ae1

Content-Length: 133 

3、Netscape Enterprise 4.1 响应

$ nc netscape.example.com 80
HEAD / HTTP/1.0

HTTP/1.1 200 OK

Server: Netscape-Enterprise/4.1

Date: Mon, 16 Jun 2003 06:01: 40 GMT

Content-type: text/HTML

Last-modified: Wed, 31 Jul 2002 15:37: 56 GMT

Content-length: 57

Accept-ranges: bytes

Connection: close 

4、SunONE 6.1 响应

$ nc sunone.example.com 80
HEAD / HTTP/1.0

HTTP/1.1 200 OK

Server: Sun-ONE-Web-Server/6.1

Date: Tue, 16 Jan 2007 15:23:37 GMT

Content-length: 0

Content-type: text/html

Date: Tue, 16 Jan 2007 15:20:26 GMT

Last-Modified: Wed, 10 Jan 2007 09:58:26 GMT

Connection: close

我们注意到Date和Server字段在Apache、Netscape Enterprise和IIS中是有所区别的。

畸形的请求测试

另一个有用测试是发送畸形的请求或者不存在的页面请求,考虑如下HTTP响应:

1、Apache 1.3.23

$ nc apache.example.com 80
GET / HTTP/3.0

HTTP/1.1 400 Bad Request

Date: Sun, 15 Jun 2003 17:12: 37 GMT

Server: Apache/1.3.23

Connection: close

Transfer: chunked

Content-Type: text/HTML; charset=iso-8859-1

2、IIS 5.0

$ nc iis.example.com 80
GET / HTTP/3.0

HTTP/1.1 200 OK

Server: Microsoft-IIS/5.0

Content-Location: http://iis.example.com/Default.htm

Date: Fri, 01 Jan 1999 20:14: 02 GMT

Content-Type: text/HTML

Accept-Ranges: bytes

Last-Modified: Fri, 01 Jan 1999 20:14: 02 GMT

ETag: W/e0d362a4c335be1: ae1

Content-Length: 133 

3、Netscape Enterprise 4.1

$ nc netscape.example.com 80
GET / HTTP/3.0

HTTP/1.1 505 HTTP Version Not Supported

Server: Netscape-Enterprise/4.1

Date: Mon, 16 Jun 2003 06:04: 04 GMT

Content-length: 140

Content-type: text/HTML

Connection: close

4、SunONE 6.1

$ nc sunone.example.com 80
GET / HTTP/3.0

HTTP/1.1 400 Bad request

Server: Sun-ONE-Web-Server/6.1

Date: Tue, 16 Jan 2007 15:25:00 GMT

Content-length: 0

Content-type: text/html

Connection: close

我们发现每个服务器都有不同的方式响应请求,而且不同版本也有所不同响应。类似的结果也能通过构造不存在的HTTP方法/谓词来获得。考虑如下例子:

1、Apache 1.3.23

$ nc apache.example.com 80
GET / JUNK/1.0

HTTP/1.1 200 OK

Date: Sun, 15 Jun 2003 17:17: 47 GMT

Server: Apache/1.3.23

Last-Modified: Thu, 27 Feb 2003 03:48: 19 GMT

ETag: 32417-c4-3e5d8a83

Accept-Ranges: bytes

Content-Length: 196

Connection: close

Content-Type: text/HTML

2、IIS 5.0

$ nc iis.example.com 80
GET / JUNK/1.0

HTTP/1.1 400 Bad Request

Server: Microsoft-IIS/5.0

Date: Fri, 01 Jan 1999 20:14: 34 GMT

Content-Type: text/HTML

Content-Length: 87

3、Netscape Enterprise 4.1

$ nc netscape.example.com 80
GET / JUNK/1.0

<HTML><HEAD><TITLE>Bad request</TITLE></HEAD>

<BODY><H1>Bad request</H1>

Your browser sent to query this server could not understand.

</BODY></HTML> 

4、SunONE 6.1

$ nc sunone.example.com 80
GET / JUNK/1.0

<HTML><HEAD><TITLE>Bad request</TITLE></HEAD>

<BODY><H1>Bad request</H1>

Your browser sent a query this server could not understand.

</BODY></HTML>

免责声明:文章转载自《Web渗透——web服务器指纹识别》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇【C++ 异常】error: jump to case label [fpermissive]ORA-00604的解决方法下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

maven全局配置文件settings.xml详解

概要 settings.xml有什么用? 如果在Eclipse中使用过Maven插件,想必会有这个经验:配置settings.xml文件的路径。settings.xml文件是干什么的,为什么要配置它呢?从settings.xml的文件名就可以看出,它是用来设置maven参数的配置文件。并且,settings.xml是maven的全局配置文件。而pom.xm...

oracle-linux下挂载"移动硬盘" NTFS类型

环境: ORACLE-LINUX 5.7 全新移动硬盘(未使用过) 移动硬盘空间3T 在默认情况下,Linux系统不支持NTFS分区挂载 1、服务器: A服务器和B服务器为一套ORACLE-RAC,移动硬盘插在A服务器上; 2、下载ntfs-3g包,在A服务器上安装: [root@rac1 ~]#tar -xvf ntfs-3g_ntfsprogs-201...

解决layui数据表格Date日期格式的回显Object的问题

有属性: private Date createtime; 但是回显的时候,显示{ Object object },想要转换成字符串格式显示。 怎么解决? 首先:数据库中时间的定义:    datetime和timestamp有什么区别? (一)范围不同。 “datetime” 以'YYYY-MM-DD HH:MM:SS'格式检索和显示DATETIME值。...

shiro启用注解方式

shiro验证权限方式一种是基于url配置文件: 例如: <bean id="shiroFilter" class="org.apache.shiro.spring.web.ShiroFilterFactoryBean"> <property name="securityManager" ref="securityMan...

一文读懂MQTT协议

1  概述MQTT(Message Queuing Telemetry Transport,消息队列遥测传输协议),是一种基于发布/订阅(publish/subscribe)模式的“轻量级”通讯协议,该协议构建于TCP/IP协议上,由IBM在1999年发布。MQTT最大优点在于,可以以极少的代码和有限的带宽,为连接远程设备提供实时可靠的消息服务。作为一种低...

Windows Server 2012/2012 R2:安装和配置 SMTP 服务器

Windows Server 2012/2012 R2:安装和配置 SMTP 服务器 安装 SMTP 服务器 以下是安装 SMTP 服务器功能的步骤: 打开“服务器管理器”:单击键盘上的 Windows 按钮。输入“服务器管理器”。在“结果”窗口中,单击“服务器管理器”。。 单击左窗格中的“仪表板”。。 单击“添加角色和功能”。也可以从右上角的“管理”...