Kali Linux渗透测试之服务扫描(三)——防火墙识别、负载均衡识别、WAF识别

一、防火墙识别

防火墙识别:

  • 目的:在尽量隐蔽的情况下,扫描出防火墙的过滤规则,开放哪些端口;
  • 我们的扫描行为,并不希望防火墙发现,所以扫描防火墙的目的就是通过发送的数据包,检查回包,识别防火墙过滤的端口;
  • 设备多种多样,结果存在一定误差;

可以根据如下四种情况判断防火墙的过滤规则;

在这里插入图片描述

1、nmap有系列防火墙过虑检测功能

在这里插入图片描述
1.1> 命令:nmap 192.168.85.147 -p25
# 默认发个SYN包,即-sS扫描

在这里插入图片描述在这里插入图片描述
1.2> 命令:nmap -sA 192.168.85.147 -p25
#发送tcp的ack包进行探测,可以探测主机是25号端口是否开放

在这里插入图片描述
在这里插入图片描述

1.3> 使用python脚本实现防火墙识别:firewall_detect.py

#脚本参考别人的,没有具体执行,有错误!!!

#!/usr/bin/python
#Author:橘子女侠
#Time:2019/04/15
#该脚本用于实现判断防火墙的过滤端口(注:脚本有点小问题,未解决)
 
from scapy.all import *
import sys
 
if len(sys.argv) != 3:
	print ("This script needs 2 args!\nExample:./firewall_detect.py 192.168.0.0 80")
	sys.exit()
 
ip = sys.argv[1]
port = int(sys.argv[2])
 
SYN_response = sr1(IP(dst = ip) / TCP(flags = "S", dport = port), timeout = 1, verbose = 0)
ACK_response = sr1(IP(dst = ip) / TCP(flags = "A", dport = port), timeout = 1, verbose = 0)
 
if (SYN_response == None) and (ACK_response == "None"):
	print("1. Port is filtered or host is down!")
elif (SYN_response[TCP].flags == "SA" or SYN_response[TCP].flags == "SR") and (ACK_response == None):
	print("2. Port is filtered!")
elif int(SYN_response[TCP].flags) == 18:
	print ("Port is unfiltered and open" )
elif int(SYN_response[TCP].flags) == 20:
	print ("Port is unfiltered and closed")
else:
	print ("4. Port is Closed!")

结果如下:

root@root:~# ./firewall_detect.py 192.168.37.128 25
Port is unfiltered and open
root@root:~# ./firewall_detect.py 192.168.37.128 80
Port is unfiltered and open
root@root:~# ./firewall_detect.py 192.168.37.128 9090
Port is unfiltered and closed

二、负载均衡识别

  • 负载均衡是建立在网络结构之上的,它提供了一种廉价有效透明的方法扩展网络设备和服务器的带宽,增加吞吐量,加强网络数据处理能力、提高网络的灵活性和可用性;
  • 负载均衡(Load Balance)其意思就是分摊到多个操作单元上进行执行,例如Web服务器、FTP服务器、企业关键应用服务器和其它关键任务服务器等,从而共同完成工作任务。
  • 负载均衡从其应用的地理结构上分为本地负载均衡(Local Load Balance)和全局负载均衡(Global Load Balance,也叫地域负载均衡):
    • 本地负载均衡:是指对本地的服务器群做负载均衡;
    • 全局负载均衡:全局负载均衡是指对分别放置在不同的地理位置、有不同网络结构的服务器群间作负载均衡。

.
.
即针对DNS:同一个域名对应多个IP地址(智能DNS,DNS轮询);
针对于web的服务负载均衡经常使用Nginx、Apache应用层负载均衡;

1、lbd工具
  • 大型网站为了解决海量访问问题,往往采用负载均衡技术,将用户的访问分配到不同的服务器上。网站的负载均衡可以从DNS和HTTP两个环节进行实施。在进行Web渗透测试的时候,需要先了解网站服务器结构,以确定后期的渗透策略。Kali Linux提供工具lbd来获取网站的负载均衡信息。该工具可以根据DNS域名解析、HTTP服务的header和响应差异,来识别均衡方式。
  • PS:由于用户所使用的线路不同,获取的输出结果不同。大家可以把运行结果和其他人的做比较,以发现目标网站的更多服务器。

命令:lbd www.baidu.com
命令:lbd mail.163.com

在这里插入图片描述
在这里插入图片描述

三、WAF识别

WAF:

  • WAF(Web Application Firewallweb:Web 应用防火墙)。利用国际上公认的一种说法:Web应用防火墙是通过执行一系列针对HTTP/HTTPS的安全策略来专门为Web应用提供保护的一款产品。
1、wafw00f -l——># 列出可检测的WAF
root@kali:~# wafw00f -l                   #列出可检测到的Web 应用防火墙

                                 ^     ^
        _   __  _   ____ _   __  _    _   ____
       ///7/ /.' \ / __7/ /,' \ ,' \ / __/
      | V V // o // _/ | V V // 0 // 0 // _/
      |_n_,'/_n_//_/   |_n_,' \_,' \_,'/_/
                                <
                                ...'

    WAFW00F - Web Application Firewall Detection Tool

    By Sandro Gauci && Wendel G. Henrique

Can test for these WAFs:

InfoGuard Airlock
Anquanbao
Barracuda Application Firewall
Better WP Security
BinarySec
BlockDoS
ChinaCache-CDN
Cisco ACE XML Gateway
CloudFlare
Comodo WAF
DenyALL WAF
Applicure dotDefender
Edgecast / Verizon Digital media
F5 BIG-IP APM
F5 BIG-IP ASM
F5 BIG-IP LTM
F5 FirePass
F5 Trafficshield
FortiWeb
Art of Defence HyperGuard
IBM Web Application Security
IBM DataPower
Imperva SecureSphere
Incapsula WAF
Microsoft ISA Server
Mission Control Application Shield
Trustwave ModSecurity
ModSecurity (OWASP CRS)
Naxsi
NetContinuum
Citrix NetScaler
AdNovum nevisProxy
NSFocus
PowerCDN
Profense
Radware AppWall
Safedog
eEye Digital Security SecureIIS
Sucuri WAF
Teros WAF
Microsoft URLScan
USP Secure Entry Server
Wallarm
Aqtronix WebKnight
Juniper WebApp Secure
West263CDN
360WangZhanBao
root@kali:~# 
2、wafwf00f http://www.baidu.com

在这里插入图片描述

3、wafw00f www.qq.com

在这里插入图片描述

4、WAF识别——nmap
root@kali:~# nmap www.qq.com --script=http-waf-detect.nse
Starting Nmap 7.70 ( https://nmap.org ) at 2019-08-18 16:17 CST
Nmap scan report for www.qq.com (61.151.166.146)
Host is up (0.011s latency).
Other addresses for www.qq.com (not scanned): 61.151.166.139 2402:4e00:8010::155 2402:4e00:8010::154
rDNS record for 61.151.166.146: 146.166.151.61.dial.xw.sh.dynamic.163data.com.cn
Not shown: 997 filtered ports
PORT    STATE SERVICE
80/tcp  open  http
443/tcp open  https
843/tcp open  unknown

Nmap done: 1 IP address (1 host up) scanned in 33.55 seconds

三、zenmap

打开nmap的图形界面

在这里插入图片描述

  • 0
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值