快捷搜索:   nginx

Linux/FreeBSD 一定程度上对应ARP欺骗的一种被动方法(隐藏MAC)

文章作者:Helvin
信息来源:邪恶八进制信息安全团队(www.eviloctal.com)

首先对国内某些IDC不负责任的行为表示抗议

一般欺骗机器通过ARP Request获得网关的MAC,然后同样方法获得你服务器的MAC进行双向欺骗,然后sniffer密码,挂马之类。
国内几乎所有的IDC都是几百服务器公用一个网关的。然后上百个服务器总有几个有漏洞的,然后你就被ARP欺骗挂马或者抓密码了

下面介绍的是Linux 利用arptables来防止ARP Request获得你的MAC。这样攻击者会认为你的服务器是不存在的(本来很复杂的,需要patch编译内核什么的,上周才发现还有一个arptables,免编译内核,现在把方法写一下)

Debian/Ubuntu:(runas sudo)CentOS/RHAS 叫arptables_jf
引用:
apt-get install arptables
arptables -A INPUT --src-mac ! 网关MAC -j DROP
arptables -A INPUT -s ! 网关IP -j DROP

如果你有本网的内网机器要互联,可以 引用:
arptables -I INPUT --src-mac 你的其他服务器MAC ACCEPT

如果你的MAC已经被欺骗机器拿到,那只能ifconfig ethx hw ether MAC来修改了

有一定的危险性,请酌情测试,你也可以疯狂刷新网关+本机ARP绑定,看具体需要
还要注意这个时候不要发出ARP Request到除网关以外的其他IP,其后果可能是被其他机器拿到MAC

补充一个FreeBSD下的隐藏MAC的方法
首先sysctl net.link.ether.ipfw=1开启IPFW ether层过滤功能(网桥模式要使用sysctl net.link.ether.bridge_ipfw=1)
然后
ipfw add 00005 allow ip from any to any MAC 网关MAC any /* 打开你到网关的通信 */
ipfw add 00006 allow ip from any to any MAC any 网关MAC /* 打开网关到你的通信 */
/* ........中间你可以添加本网段内需要互联的IP地址MAC双向通信........ */
ipfw add 00010 deny ip from any to any MAC any any /* 关闭所有其他MAC的任何响应 */

如果服务器作为内网网关使用,可以在内网网卡界面
ifconfig em1 -arp /* 关闭ARP响应(假设em0是内网网卡) */
arp -f /etc/arp.list /* 设置静态ARP表 */
以下是ARP(8) 关于arp.list格式的描述,
   Cause the file filename to be read and multiple entries to be set
   in the ARP tables. Entries in the file should be of the form

      hostname ether_addr [temp] [pub]

   with argument meanings as given above. Leading whitespace and
   empty lines are ignored. A `#' character will mark the rest of
   the line as a comment.

顶(0)
踩(0)

您可能还会对下面的文章感兴趣:

最新评论