<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/ DTD/wml_1.1.xml">

<wml>
<head>
<meta http-equiv="cache-control" content="max-age=180,private" />
</head>
<card title="ROS防御内网攻击">
<p>
作者:<a href="index.php?action=showuser&amp;userid=1&amp;hash=">熊茂祥</a><br />时间:2014-10-08 12:23<br />分类:<a href="index.php?action=list&amp;cid=3&amp;hash=">ROS</a><br />标签:<a href="index.php?action=tags&amp;item=ros&amp;hash=">ros</a>, <a href="index.php?action=tags&amp;item=%E5%86%85%E7%BD%91&amp;hash=">内网</a>, <a href="index.php?action=tags&amp;item=%E6%94%BB%E5%87%BB&amp;hash=">攻击</a>, <a href="index.php?action=tags&amp;item=udp&amp;hash=">udp</a>, <a href="index.php?action=tags&amp;item=%E6%B5%81%E9%87%8F&amp;hash=">流量</a><br />内容:
本策略适用于防范UDP流量攻击（比如阿拉丁UDP攻击器）。TCP连接数攻击限制下单机连接数就行了，我就不多说了。


首先要新建一个网桥，将自己内网卡加入到桥接。


ROS防火墙脚本


    /interface bridge settings set use-ip-firewall=yes

    /ip firewall filter add  action=add-src-to-address-list address-list=att address-list-timeout=10m  chain=input connection-rate=10M-4294967295 protocol=udp  src-address=192.168.0.0/24

    /ip firewall mangle add  action=add-src-to-address-list address-list=att address-list-timeout=10m  chain=postrouting connection-rate=10M-4294967295 protocol=udp  src-address=192.168.0.0/24

    





修改IP为自己的内网IP地址范围。


ROS计划任务脚本


    :global attip

    

    :global defint

    

    :global taa 0

    

    :global nowmonth

    

    :global allmonth jan,feb,mar,apr,may,jun,jul,aug,sep,oct,nov,dec

    

    :foreach lizi in=[$allmonth] do={

    

    :if ([:pick [/system clock get date] 0 3]=$lizi) do={

    

    :set nowmonth ($taa+1)}

    

    :set taa ($taa + 1)}

    

    :global atttime ([:pick [/system clock  get date] 7 11].$nowmonth.[:pick [/system clock get date] 4  6].&quot;-&quot;.[/system clock get time]);

    

    :foreach fatt in=[/ip firewall address-list find list=att] do={

    

    :set attip [/ip firewall address-list get $fatt address]

    

    :if ([/interface bridge nat find arp-dst-address=($attip.&quot;/32&quot;)]=&quot;&quot;) do={

    

    /interface bridge nat add action=src-nat  arp-dst-address=($attip.&quot;/32&quot;) chain=srcnat mac-protocol=arp  comment=(&quot;att-&quot;.$atttime)}}

    

    :foreach fattd in=[/interface bridge nat find] do={

    

    :if ([/ip firewall address-list find  list=att address=[:pick [/interface bridge nat get $fattd  arp-dst-address] 0 ([:len [/interface bridge nat get $fattd  arp-dst-address]]-3)]]=&quot;&quot;) do={

    

    /interface bridge nat remove $fattd}}

    





设置为定时循环执行，建议间隔时间为3-5秒左右为宜。


本策略原理是将攻击者的IP记录下来，加入攻击者的IP到桥防火墙，攻击者的 IP将在ARP缓存超时后（WIN7系统5次测试计算后得到平均值为20秒左右。）无法和ROS通讯，因为找不到ROS的MAC，包括流量攻击也打不上 来，因为找不到目标。（进入桥防火墙后即使攻击者再手工绑定路由MAC也无法成功。）

缺点：若客户机在攻击前已绑定路由MAC，则防御无法生效。因为ARP缓存不会超时。
</p><p>
<a href="index.php?action=comments&amp;articleid=169&amp;hash=">查看评论</a><br />
<a href="index.php?action=login&amp;hash=">立即登陆发表评论</a><br />
</p>
<p><a href="index.php?action=list&amp;hash=">返回日志列表</a><br /><a href="index.php?action=index&amp;hash=">返回主页</a></p>
</card>
</wml>
