DHCP Spoof Attacks

技术原理——让三层交换机可以侦听DHCP报文内容,从而实现一系列安全特性,防御DHCP starvation和spoofing攻击等等

image.png

1、Attacker hosts a rogue DHCP server off a switch port.

2、Client broadcasts a request for DHCP configuration information.

3、The rogue DHCP server responds before the legitimate DHCP server,assigning attacker-defined IP configuration information.

4、Host packets are redirected to the attacker's address as it emulates a default gateway for the erroneous DHCP address provided to the client.

网络里面连接了一台非法的DHCP服务器;

当DHCP Client发送广播报文去DHCP Server申请IP地址时,非法DHCP服务器在合法的DHCP服务器响应前回应Client的请求,给Client分配一个非法的IP地址,并把网关指向自己;

当Client要访问其他网络时,流量被发往Attacker。

DHCP Snooping原理

image.png

DHCP Snooping详解

在DHCP snooping环境中(部署在交换机上),我们将端口视为trust或untrust两种安全级别,也就是信任或非信任接口。在交换机上,将连接合法DHCP服务器的接口配置为trust。只有trust接口上收到的来自DHCPserver的报文(如DHCPOFFER, DHCPACK, DHCPNAK, 或者DHCPLEASEQUERY)才会被放行,相反,在untrust接口上收到的来自DHCPserver的报文将被过滤掉,这样一来就可以防止非法的DHCPserver接入。

技术要点:

1、Trusted接口与Untrusted接口

启用DHCP Snooping后,所有接口默认是Untrusted接口,需手动设置方可改为Trusted交换机Untrusted接口只允许接收DHCP discovery消息,不允许发出discovery消息;允许发送offer消息,不允许接收offer消息Trust接口,无任何限制,也不做任何检测

——即,连接DHCP Server的接口和朝向DHCP Server的接口需要Trusted

DHC Prequests(discover)and responses(offer)are tracked.

Deny responses(offers)on untrusted interfaces to stop malicious or errant DHCP servers.

image.png

2.DHCP Snooping Binding表

开启DHCP Snooping后会在交换机上建立一个绑定表,通过侦听DHCP消息内容,为每一个分配的IP建立一个表项,其中包括客户端的IP地址、MAC地址、端口号、VLAN编号、租期和绑定类型等信息。也可以手动向这个绑定表中添加表项(该绑定表主要用于IP源保护和DAI)。这个DHCP snooping banding databse除了可以做一些基本的安全接入控制,还能够用于DAI等防ARP欺骗的解决方案。

一台支持DHCP snooping的交换机,如果在其untrust接口上,收到来自下游交换机发送的、且带有option82的DHCP报文,则默认的动作是丢弃这些报文。如果该交换机开启了DHCP snooping并且带有option82的DHCP报文是在trusted接口上收到的,则交换机接收这些报文,但是不会根据报文中包含的相关信息建立DHCP bingding databse表项。

为确保设备重启后binding表不丢失,建议设置永久存储

3.配置命令

ip dhcp snooping !!

总开关

ip dhcp snooping vlan 10  !!

侦听哪个VLAN

ip dhcp snooping database flash:dhcp.db   !!

binding表写入路径,不设的话保存在内存中

ip dhcp snooping trust  !!

设置Trust接口

int e0/0

ip dhcp snooping limit rate XX

//设定限速保护(pps)超出则err-disable端口

show ip dhcp snooping binding  !!

查看绑定表

show ip dhcp snooping database

如果交换机确实通过一个untrust接口连接了下游交换机,并且希望放行该接口收到的、下游交换机发送出来的带有option82的DHCP报文,则可使用全局命令:ip dhcp snooping information option allow-untrusted,同时由于是通过untust接口收到的DHCP报文,因此会根据侦听的结果创建DHCP snooping binding database表项。

原文来自:微思网络
原文地址:https://mp.weixin.qq.com/s/U0...


微思郭仔
31 声望2 粉丝

微思IT认证培训-思科、华为、红帽、oracle、VMware、PMP、CISP等,一切为了成为更好的自己,加油!!!