本帖最后由 小马 于 12-20-2011 16:22 编辑
Cisco IOS禁用QQ实例 摘要:FPM(灵活包匹配)是思科推出的下一代ACL技术,可以实现精确到bit的包抓取能力,其方便,快速的布署,及对其他防护技术的支持,使其在SDN中占据了一席之地。 FPM就是一组class-map和policy-map。它们提供2-7层的深层包检测能力,并且提供在包头或负载内任意位置的offset.
FPM的工作原理
FPM就是使用class-map 和 policy-map的语句组合,来定义协议栈,比对项和要执行的动作。FPM加载PHDF 来定义协议头特征,并允许对包负载中的字符和字节做offset,size,keywords,和正则表达式的操作.
FPM只支持包负载开始256个字节深度的检测能力,你可以通过CLI和XML(TCDF)进行FPM的配置。
优势:
1.当现行的过滤工具像(ACL)不能阻止进化过的攻击手段时,可使用FPM应对
2.快速响应:当客户马上就要中止攻击流量时,厂商来不及提供还要开发的signature(IPS)
3.更精确:指定到位的抓取,最小化误丢包
限制:
1. FPM是无状态化的,也是就是说,它不支持追踪通过协议动态协商的端口
2. FPM 不能执行IP 分片和重组
3. PHDF 描述的协议只支持静态的字段和长度
4. 在12.4(15)T以后的版本中,FPM可以支持256个字节的深度检测
5.FPM 也不能追踪“连接状态”
FPM存在的意义:
FPM对ACLs ,IPS,NBAR等技术起到了补充作用,它给予用户bit级的过滤能力。FPM很有用,在一个需要单包过滤的环境下面,FPM完成了这个需求。你是不是还在等待IPS开发出对付Thwart worms,病毒和其他一些攻击流量的signature? 或者你可以自己建立几个FPM的策略和动作来阻止它们!
我们现在来个实验来感受一下FPM的强悍之处! 准备环境: QQ2011Beta3.exe(最新的QQ版本) 科来网络分析工具。 网关路由器是Cisco IOS Software, 2600 Software(C2691-ADVENTERPRISEK9_IVS-M), Version 12.4(9)T7, RELEASE SOFTWARE (fc3) 好了!开始测试! 在网络路由器上没有任何访问控制的情况下,QQ是可以登录的! 在没有任何限制的情况下,QQ使用UDP包进行数据通信,并且端口固定为4000和8000;然而受到限制以后,QQ会使用80和443发TCP包进行通信。所以我们的封锁也要从UDP到TCP,进行跟踪的限制。用常规的ACl来过滤QQ只能解决一时,如过滤UDP的4000 8000端口,他会用80,443端口,大家不可能把80和443给禁用了吧!也或者去过滤QQ的登录服务器的IP,这样太….. 腾讯随便加一个服务器就要再加ACL来过滤新的服务器IP,这样也很无助。所以我们来个一劳永逸的方法来过滤QQ登录。 下面我们来抓包看看QQ登录的相关特征代码,我们用FPM来过滤QQ登录相关的特征代码来过滤就可以一劳永逸了! 好了,开搞! 抓抓QQ正常登录是包看看… 我们可以看到科来抓包很给力啊,把QQ相关的信息分门别类的都列好了只等我们去偷窥它,当然大家可以用其他sniffer,wireshark等去抓显示为OICQ协议。 好!继续具体分析QQ信息
可以看到QQ登录信息里面的命令是186对应的十六进制是0x00BA,offset(偏移量)离IP包有31(45-14),大小size为2个字节。 所以要定义这个特征!过滤和并报警! class-map type access-control match-any QQ_UDP match start l3-start offset31 size 2 eq 0x00BA policy-map type access-control Drop_QQ class QQ_UDP log drop interface FastEthernet0/0 ip address 10.1.1.1255.255.255.0 service-policytype access-control input Drop_QQ 网关接口input方向应用! 好!看看想过UDP的是否过滤呢? 我们在网络上看到了过滤QQ UDP 的报警日志! *Mar 1 04:22:55.286: %SEC-6-IPACCESSLOGP: listQQ_UDP denied udp 10.1.1.2(4002) (FastEthernet0/0 ) -> 119.147.45.69(8000),1 packet 但是等个几分钟后QQ依然通过HTTP、HTTPS的方式登录上去了。 看来果然很腾讯啊! 没办法我们也得把HTTP相关的QQ特征信息也给过滤掉,继续抓包分析…… 可以看到在HTTP协议里面的二进制信息相同的信息为: 00 59 0222 转换成十六进制为0x590222 offset为40 ,大小size为4 配置 class-map typeaccess-control match-all QQ_TCP match start l3-start offset 40 size 4 eq0x590222 policy-map type access-control Drop_QQ class QQ_TCP drop log
好在测试!!! 好可以看到网络上有UDP和TCP的间接的不停报警,同时过几分钟后QQ登录超时!QQ终于缴械了!
好有如何过滤Web QQ呢? 大家可以自己考虑考虑这里可以举一反三比如禁用PPS,禁用pplive等等变态烦人的应用! Gateway#sh run Building configuration... Current configuration : 1720 bytes ! version 12.4 service timestamps debug datetime msec service timestamps log datetime msec no service password-encryption ! hostname Gateway ! boot-start-marker boot-end-marker ! ! no aaa new-model ! resource policy ! memory-size iomem 5 ip cef ! ! ! ! no ip domain lookup ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! ! class-map type access-control match-all QQ_TCP match start l3-start offset40 size 4 eq 0x590222 class-map type access-control match-any QQ_UDP match start l3-start offset31 size 2 eq 0xBA ! ! policy-map type access-control Drop_QQ class QQ_UDP log drop class QQ_TCP log drop ! ! ! ! ! ! ! interface FastEthernet0/0 ip address 10.1.1.1255.255.255.0 ip nat inside ip virtual-reassembly duplex auto speed auto service-policy typeaccess-control input Drop_QQ ! interface FastEthernet0/1 ip address 192.168.255.11255.255.255.0 ip nat outside ip virtual-reassembly duplex auto speed auto ! interface Serial1/0 no ip address shutdown serial restart-delay 0 ! interface Serial1/1 no ip address shutdown serial restart-delay 0 ! interface Serial1/2 no ip address shutdown serial restart-delay 0 ! interface Serial1/3 no ip address shutdown serial restart-delay 0 ! ip route 0.0.0.0 0.0.0.0 192.168.255.1 ! ! ip http server no ip http secure-server ip nat inside source list 100 interface FastEthernet0/1 overload ip nat inside source static tcp 10.1.1.2 3389 interfaceFastEthernet0/1 3389 ! access-list 100 permit ip any any ! ! ! ! ! ! control-plane ! ! ! ! ! ! ! ! ! ! ! gatekeeper shutdown ! ! line con 0 exec-timeout 0 0 password cisco logging synchronous login line aux 0 line vty 0 4 exec-timeout 0 0 password cisco logging synchronous login ! ! end |