zoukankan      html  css  js  c++  java
  • 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>
  • 相关阅读:
    UVA307Sticksdfs+剪枝
    UVA 10382 Watering Grass 贪心+区间覆盖问题
    H265网页视频播放器播放H265编码录像视频文件如何减缓卡顿情况?
    RTMP/RTSP/GB28181协议视频平台授权页面配置完成后,控制台出现报错如何解决?
    通过私有化部署自建一套视频流媒体服务器平台,如何解决视频播放延时卡顿问题?
    RTSP/RTMP/HTTP/HLS协议视频流媒体播放器EasyPlayerRTSP安卓版本,切换视频流黑屏怎么办?
    【解决方案】设备众多/品牌不一/协议复杂的需求下如何搭建智慧工地视频集中管控平台,实现建筑工程新形态?
    RTMP/RTSP/GB28181协议视频平台授权页面开发中数字框输入字母BUG解决方法
    国标GB28181流媒体协议EasyGBS视频平台集成第三方平台播放器,显示logo水印如何去除?
    通过私有化部署自建视频流媒体服务器,不同视频流延时说明
  • 原文地址:https://www.cnblogs.com/charon1937/p/13717934.html
Copyright © 2011-2022 走看看