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是可以登錄的!
 
12-2-2011 16:55:13 上傳下載附件 (88.13 KB)
在沒有任何限制的情況下,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正常登錄是包看看…
 
12-2-2011 16:55:14 上傳下載附件 (33.87 KB)
我們可以看到科來抓包很給力啊,把QQ相關的信息分門別類的都列好了只等我們去偷窺它,當然大家可以用其他sniffer,wireshark等去抓顯示爲OICQ協議。
好!繼續具體分析QQ信息
 
12-2-2011 16:55:16 上傳下載附件 (74.54 KB)
 

 
12-2-2011 16:55:17 上傳下載附件 (23.72 KB)
可以看到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
 
12-2-2011 16:55:18 上傳下載附件 (45.29 KB)
但是等個幾分鐘後QQ依然通過HTTP、HTTPS的方式登錄上去了。
看來果然很騰訊啊!
沒辦法我們也得把HTTP相關的QQ特徵信息也給過濾掉,繼續抓包分析……
 
12-2-2011 16:55:20 上傳下載附件 (73.25 KB)
可以看到在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
 
好在測試!!!
 
12-2-2011 16:55:21 上傳下載附件 (44.12 KB)
 
12-2-2011 16:55:22 上傳下載附件 (56 KB)
好可以看到網絡上有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
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章