且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Using CAR for Smurf Attack Mitigation,使用承诺速率控制预防smurf攻击

更新时间:2022-10-01 23:21:27

【实验说明】

配置路由器保护内部网络免受Smurf 攻击

 
【smurf攻击】

 
Smurf攻击以最初发动这种攻击的程序名“Smurf”来命名的。

 
攻击的过程是这样的:Woodlly 攻击者向一个具有大量主机和因特网连接的网络的广播地址发送一个欺骗性Ping分组(echo 请求),这个目标网络被称为反弹站点,而欺骗性Ping分组的源地址就是Woolly希望攻击的系统。
  这种攻击的前提是,路由器接收到这个发送给IP广播地址(如206.121.73.255)的分组后,会认为这就是广播分组,并且把以太网广播地址FF:FF:FF:FF:FF:FF:映射过来。这样路由器和因特网上接收到该分组,会对本地网段中的所有主机进行广播。
  读者肯定能够想到下面会发生什么情况。网段中的所有主机都会向欺骗性分组的IP地址发送echo响应信息。如果这是一个很大的以太网段,可以会有500个以上的主机对收到的echo请求进行回复。
  由于多数系统都会尽快地处理ICMP传输信息,Woodlly 攻击者把分组的源地址设置为目标系统,因此目标系统都很快就会被大量的echo信息吞没,这样轻而易举地就能够阻止该系统处理其它任何网络传输,从而引起拒绝为正常系统服务。
  这种攻击不仅影响目标系统,还影响目标公司的因特网连接。如果反弹站点具有T3连接(45Mbps),而目标系统所在的公司使用的是租用线路(56Kbps),则所有进出该公司的通讯都会停止下来。
  这种攻击现在已经很少见,大多数的网络已经对这种攻击免疫了。在cisco路由器上配置如下可以防止将包传递到广播地址上:Router(config-if)# no ip directed-broadcast

 
【实验拓扑】

 
IOS:c2691-advsecurityk9-mz.124-11.T2.bin

 

Using CAR for Smurf Attack Mitigation,使用承诺速率控制预防smurf攻击

【实验配置步骤】

 
  • 配置上图网络为 IP service 中的 “Configuring Static NAT”
  • smur攻击是 反射 ICMP echo 报文,因此,目标网络会出现大量的ICMP echo-relay 数据包
  • 在R4上创建扩展访问控制列表100,匹配icmp echo-relay 数据包
  • 创建rate-limit 规则,匹配到访问控制列表100中的流量,速率限制为64kbps
  • 选择BC和BE 值,以适应持续爆发长度1秒和1.5秒的流量率
  • Bc=64000*1/8=8000 bytes
  • Be=Be*1.5=12000 bytes.
  • 在R4上应用rate-limit 规则到网关的出口(串口)

 
【实验配置】

 
R4:
!创建访问控制列表匹配 icmp 的echo-relay 流量
access-list 100 permit icmp any any echo-reply
!
interface Serial 0/1
!设置icmp echo-relay 的流量速率为64kbps,并且将桶大小设为适应1秒-1.5秒的流量,超出的部分丢弃
rate-limit input access-group 100 64000 8000 12000 conform-action transmit exceed-action drop
!
interface Serial 0/0.1
rate-limit input access-group 100 64000 8000 12000 conform-action transmit exceed-action drop

 
Configuring Static NAT配置

R1:
interface FastEthernet0/0
ip address 10.0.0.1 255.255.255.0
ip route 0.0.0.0 0.0.0.0 10.0.0.4

 
R6:
interface FastEthernet0/0
ip address 10.0.0.6 255.255.255.0
ip route 0.0.0.0 0.0.0.0 10.0.0.4

R4:
interface Loopback0
ip address 150.1.4.4 255.255.255.0
ip ospf network point-to-point
!
interface FastEthernet0/0
ip address 10.0.0.4 255.255.255.0
ip nat inside
!
interface Serial0/0
en fram
no sh
!
interface Serial0/0.1 point-to-point
ip address 155.1.0.4 255.255.255.0
frame-relay interface-dlci 405
ip nat outside
!
interface Serial0/1
ip address 155.1.45.4 255.255.255.0
clock rate 2000000
ip nat outside
!
router ospf 1
router-id 150.1.4.4
network 150.1.4.4 0.0.0.0 area 0
network 155.1.0.4 0.0.0.0 area 0
network 155.1.45.4 0.0.0.0 area 0
!
router bgp 1
bgp router-id 150.1.4.4
neighbor 150.1.5.5 remote-as 2
neighbor 150.1.5.5 ebgp-multihop 255
neighbor 150.1.5.5 update-source Loopback0

 
ip nat inside source static 10.0.0.1 150.1.4.1
ip nat inside source static 10.0.0.6 150.1.4.6

R5:
interface Loopback0
ip address 150.1.5.5 255.255.255.0
ip ospf network point-to-point
!
interface Serial0/0
encapsulation frame-relay
!
interface Serial0/0.1 point-to-point
ip address 155.1.0.5 255.255.255.0
frame-relay interface-dlci 504
!
interface Serial0/1
ip address 155.1.45.5 255.255.255.0
clock rate 2000000
!
router ospf 1
router-id 150.1.5.5
network 150.1.5.5 0.0.0.0 area 0
network 155.1.0.5 0.0.0.0 area 0
network 155.1.45.5 0.0.0.0 area 0
!
router bgp 2
bgp router-id 150.1.5.5
neighbor 150.1.4.4 remote-as 1
neighbor 150.1.4.4 ebgp-multihop 255
neighbor 150.1.4.4 update-source Loopback0
neighbor 150.1.4.4 default-originate

【实验验证】

R4#ping 150.1.5.5 size 500 repeat 100

Type escape sequence to abort.
Sending 100, 500-byte ICMP Echos to 150.1.5.5, timeout is 2 seconds:
注意ping的过程中有丢包,证明策略已经生效,当然如果你把size大小设置的大一些会丢的更多
!!!!!!!!!!!!!!!!!!!!!!!!!!!!.!!!!!!!!!!!!!!!!!!!!!!!.!!!!!!!!!!!!!!!!!
!!!!!!!.!!!!!!!!!!!!!!!!!!!!!!
Success rate is 97 percent (97/100), round-trip min/avg/max = 4/11/64 ms

R4#show interfaces rate-limit
Serial0/0.1
Input
matches: access-group 100
params: 64000 bps, 8000 limit, 12000 extended limit
conformed 5 packets, 520 bytes; action: transmit
exceeded 0 packets, 0 bytes; action: drop
last packet: 113600ms ago, current burst: 40 bytes
last cleared 00:03:07 ago, conformed 0 bps, exceeded 0 bps
Serial0/1
Input
matches: access-group 100
params: 64000 bps, 8000 limit, 12000 extended limit
conformed 97 packets, 48888 bytes; action: transmit
显示超出规则的部分由3个数据包,动作为丢弃
exceeded 3 packets, 1512 bytes; action: drop
last packet: 6052ms ago, current burst: 8952 bytes
last cleared 00:00:59 ago, conformed 6000 bps, exceeded 0 bps

R4#show ip access-lists 100
Extended IP access list 100
10 permit icmp any any echo-reply (100 matches)


本文转自zcm8483 51CTO博客,原文链接:http://blog.51cto.com/haolun/991694