실습> ping of death
1. 와이어샤크 덤프
Victim1(Windows XP)에서 패킷을 덤프 받는다.
2. ping of death 전송
# --rand-source (랜덤 소스 옵션)
Attacker# hping3 --icmp 192.168.108.105 -d 65000 --flood
3. 패킷 확인
Victim1(Windows XP)에서 패킷을 덤프 받는다.
실습> iptables 에서 icmp 프로토콜 정책 추가하기
형식 : -p icmp --icmp-type 번호
8 : echo request
0 : echo reply
5 : redirect
Victim2# iptables -F
Victim2# iptables -A INPUT -p icmp --icmp-type 8 -j DROP
Victim2# iptables -A INPUT -p icmp --icmp-type 0 -j DROP
Victim2# iptables -A INPUT -p icmp --icmp-type 5 -j DROP
Victim2# iptables -nvL INPUT
Chain INPUT (policy ACCEPT 6 packets, 432 bytes)
pkts bytes target prot opt in out source destination
0 0 DROP icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 8
0 0 DROP icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 0
0 0 DROP icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 5
Attacker# vi icmpType.sh
#!/bin/sh
# 파일명 : icmpType.sh
# 프로그램 설명 : icmpType.sh
# -1 --icmp ICMP mode
# -c --count packet count
# -C --icmptype icmp type (default echo request)
hping3 192.168.108.100 -c 1 -1 -C 8
hping3 192.168.108.100 -c 1 -1 -C 0
Attacker# chmod 755 icmpType.sh
Attacker# ./icmpType.sh
Attacker# iptables -nvL INPUT
Chain INPUT (policy ACCEPT 13 packets, 1266 bytes)
pkts bytes target prot opt in out source destination
1 28 DROP icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 8
1 28 DROP icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 0
0 0 DROP icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 5
Attacker# hping3 192.168.108.100 -c 1 -1 -C 5
Victim2# iptables -nvL INPUT
Chain INPUT (policy ACCEPT 17 packets, 1554 bytes)
pkts bytes target prot opt in out source destination
1 28 DROP icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 8
1 28 DROP icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 0
1 56 DROP icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 5
type과 상관없이 모든 icmp 프로토콜의 패킷을 버린다.
Victim2# iptables -I INPUT -p icmp -j DROP
Victim2# iptables -nvL INPUT
Chain INPUT (policy ACCEPT 6 packets, 432 bytes)
pkts bytes target prot opt in out source destination
0 0 DROP icmp -- * * 0.0.0.0/0 0.0.0.0/0
1 28 DROP icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 8
1 28 DROP icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 0
1 56 DROP icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 5
192.168.108.100 으로 icmp echo request 패킷을 1개 날린다.
Attacker# hping3 192.168.108.100 -c 1 -1 -C 8
Victim2# iptables -nvL INPUT
Chain INPUT (policy ACCEPT 6 packets, 432 bytes)
pkts bytes target prot opt in out source destination
1 28 DROP icmp -- * * 0.0.0.0/0 0.0.0.0/0
1 28 DROP icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 8
1 28 DROP icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 0
1 56 DROP icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 5
192.168.108.100 으로 icmp echo reply 패킷을 1개 날린다.
Attacker# hping3 192.168.108.100 -c 1 -1 -C 0
Victim2# iptables -nvL INPUT
Chain INPUT (policy ACCEPT 17 packets, 1477 bytes)
pkts bytes target prot opt in out source destination
2 56 DROP icmp -- * * 0.0.0.0/0 0.0.0.0/0
1 28 DROP icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 8
1 28 DROP icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 0
1 56 DROP icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 5
192.168.108.100 으로 icmp ICMP redirect 패킷을 1개 날린다.
Attacker# hping3 192.168.108.100 -c 1 -1 -C 5
Victim2# iptables -nvL INPUT
Chain INPUT (policy ACCEPT 21 packets, 1765 bytes)
pkts bytes target prot opt in out source destination
3 112 DROP icmp -- * * 0.0.0.0/0 0.0.0.0/0
1 28 DROP icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 8
1 28 DROP icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 0
1 56 DROP icmp -- * * 0.0.0.0/0 0.0.0.0/0 icmptype 5
방화벽에 설정된 icmp 룰을 icmpFireRule.txt 파일에 저장한다.
Victim2# iptables-save > icmpFireRule.txt
Victim2# cat icmpFireRule.txt
# Generated by iptables-save v1.4.21 on Mon Aug 16 14:45:55 2021
*filter
:INPUT ACCEPT [123:9501]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [74:10200]
-A INPUT -p icmp -j DROP
-A INPUT -p icmp -m icmp --icmp-type 8 -j DROP
-A INPUT -p icmp -m icmp --icmp-type 0 -j DROP
-A INPUT -p icmp -m icmp --icmp-type 5 -j DROP
COMMIT
# Completed on Mon Aug 16 14:45:55 2021
'Linux > 모의해킹' 카테고리의 다른 글
| TCP SYNflooding (씬플러딩) (0) | 2022.01.11 |
|---|---|
| LAND Attack (0) | 2022.01.11 |
| ICMP Redirect 활성화/비활성화 테스트 (0) | 2022.01.11 |
| ICMP Redirect 공격하기 (0) | 2022.01.11 |
| ARP 정적 변경하기 (0) | 2022.01.11 |