赞
踩
目录
1.3 在客户机用hping3对192.168.0.100:80发动land攻击:
$sudo vim /etc/sysctl.conf
修改为:(取消以下每行前的注释“#”)
net.ipv4.conf.default.rp_filter=0
net.ipv4.conf.all.rp_filter=0
net.ipv4.ip_forward=1
net.ipv4.conf.all.accept_redirects=1
net.ipv4.conf.all.send.-_redirects=1
重启网关:reboot
使网关将能够转发伪造的数据包。
在网关使用snort进行land攻击检测:
修改/etc/snort/snort.conf
使用下面命令(注意中间的空格)注释掉所有include语句:
$sudo sed -i 's/include \$RULE_PATH/#include \$RULE_PATH/' /etc/snort/snort.conf
然后,sudo vim /etc/snort/snort.conf 修改snort.conf
1、取消注释包含local.rules的命令行
2、ipvar HOME_NET 10.0.0.10/8
3、#ipvar EXTERNAL_NET any
4、ipvar EXTERNAL_NET !$HOME_NET
sudo vim /etc/snort/rules/local.rules
alert tcp HOME_NET any -> HOME_NET any 80 (msg:"land attack";sid:1000005;rev:1)
#启动snort
$sudo snort -A console -c /etc/snort/snort.conf -q -i enp0s3
#enp0s3为网关的客户端网卡接口
$sudo hping3 -S -p 80 10.0.0.10 -a 10.0.0.10 -s 80 --keep --faster
$sudo hping3 -c 1000 -S -p 80 --flood --rand-source 10.0.0.10
-c 1000=发送的数据包的数量
-p 80=目的地端口。这里可以使用其它开放端口
--flood=尽可能快的发送数据包。洪水攻击模式。
--rand-source=使用随机性的源头IP地址。
添加/etc/snort/rules/local.rules检测规则
$sudo vim /etc/snort/rules/local.rules
alert tcp any any -> $HOME_NET any (msg:"synflood";flags:S;threshold:type both,track by_dst,count 20,seconds 60;classtype:misc-attack;sid:1000006;rev:1;)
#启动snort
$sudo snort -A console -c /etc/snort/snort.conf -q -i enp0s3
默认情况下,Ubuntu不会响应广播ping。要启用针对网关的广播ping,你需要通过以下任一方法更改网关的设置:
$sudo echo 0 > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts
$sudo sysctl net.ipv4.icmp_echo_ignore_broadcasts 0
或者,你可以通过添加以下命令行来修改/etc/sysctl.conf:
net.ipv4.icmp_echo_ignore_broadcasts=0
#你可能需要重新启动节点。
sudo hping3 --icmp --icmptype 8 --icmpcode 0 192.168.0.255 -a 10.0.0.10 --flood
--icmp:icmp包类型
--icmptype 8:回应请求
--icmpcode 0:icmp代码
192.168.0.255:攻击子网的广播地址;
-a 10.0.0.10:被攻击者的IP;
-c 10:仅发送攻击报文10个;
--fast:alias for -i u10000(10 packets for second)
--faster:alias for - u1000(100 packets for second)
--flood:sent packets as fast as possible. Don't show replies
(1)建立检测规则:
$sudo vim /etc/snort/rules/local.rules
alert icmp $HOME_NET any -> $EXTERNAL_NET any (msg:"ICMP Smurf Attack"; itype:8; classtype:attempted-dos; sid:10000007; rev:1;)
(2)启动snort
$sudo snort -A console -c /etc/snort/snort.conf -q -i enp0s3
$sudo hping3 --udp -p 53 --flood --rand-source 10.0.0.10
网关上用snort检测:
$sudo vim /etc/snort/rules/local.rules
alert udp EXTERNAL_NET any -> HOME_NET 53 (msg:"UDP Flood Attack!"; classtype:attempted-dos; threshold: type both, track by_dst, count 10, second 60 ; sid:10000008; rev:1;)
$sudo snort -A console -c /etc/snort/snort.conf -q -i enp0s3
用 hping3部署从客户端到服务器的端口扫描。提示:在此攻击中,你需要将网关的 IP 地址锁定在客户端,即 192.168.0.100。
TCP ACK 扫描
TCP FIN 扫描
TCP Xmas 扫描
TCP Null 扫描(你可能会使用 nmap)。
UDP 扫描
实现 snort 规则以检测上述扫描。特殊阈值检测要求:你需要在 60 秒的时间间隔内记录此攻击的每 20 个事件。
(1)#网关 $sudo vim /etc/snort/rules/local.rules,添加以下规则
alert tcp $EXTERNAL_NET any -> $HOME_NET any (msg:"ACK PortScan!"; flags:A; threshold:type both,track by_dst,count 20,seconds 60; sid:10000009; rev:1;)
(2)启动snort
$sudo snort -A console -c /etc/snort/snort.conf -q -i enp0s3
(3)#客户端扫描:
$sudo hping3 10.0.0.10 --scan 1-1024 -A
检测结果:
(1)#网关 $sudo vim /etc/snort/rules/local.rules,添加以下规则
alert tcp $EXTERNAL_NET any -> $HOME_NET any (msg:"FIN PortScan!"; flags:F; threshold:type both,track by_dst,count 20,seconds 60; sid:10000010; rev:1;)
(2)启动snort
$sudo snort -A console -c /etc/snort/snort.conf -q -i enp0s3
(3)#客户端扫描:
$sudo hping3 10.0.0.10 --scan 1-1024 -F
检测结果:
(1)#网关 $sudo vim /etc/snort/rules/local.rules,添加以下规则
alert tcp $EXTERNAL_NET any -> $HOME_NET any (msg:"Xmas PortScan!"; flags:E; threshold:type both,track by_dst,count 20,seconds 60; sid:10000011; rev:1;)
(2)启动snort
$sudo snort -A console -c /etc/snort/snort.conf -q -i enp0s3
(3)#客户端扫描:
$sudo hping3 10.0.0.10 --scan 1-1024 -X
检测结果:
(1)#网关 $sudo vim /etc/snort/rules/local.rules,添加以下规则
alert tcp $EXTERNAL_NET any -> $HOME_NET any (msg:"Nmap Null PortScan!"; flags:0; threshold:type both,track by_dst,count 20,seconds 60; sid:10000012; rev:1;)
(2)启动snort
$sudo snort -A console -c /etc/snort/snort.conf -q -i enp0s3
(3)#客户端扫描:
$sudo nmap -sN 10.0.0.10
检测结果:
(1)#网关 $sudo vim /etc/snort/rules/local.rules,添加以下规则
alert udp $EXTERNAL_NET any -> $HOME_NET any (msg:"Nmap Udp PortScan!"; threshold:type both,track by_dst,count 20,seconds 60; sid:10000013; rev:1;)
(2)启动snort
$sudo snort -A console -c /etc/snort/snort.conf -q -i enp0s3
(3)#客户端扫描:
$sudo nmap -sU 10.0.0.10
检测结果:
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。