12일차
snort
local.rules: 아무것도 작성되어있지 않다 -> 정책을 직접 만들어서 쓰는 파일
hping3 10.0.2.15 -a 10.0.2.15 --icmp
tcpdump -i enp0s3 -e icmp
nano /etc/snort/snort.conf
include $RULE_PATH/local.rules
snort -A console -q -u snort -g snort -c /etc/snort/snort.conf
랜드 공격: 출발지 IP주소를 목적지 IP주소와 동일하게 설정
ping 탐지
공격
ping 10.0.2.15
탐지
alert icmp any any -> any any (msg:""; sid:1000001;) -> error
ICMP 플러딩 공격
공격
hping3 10.0.2.15 --icmp --flood
탐지
alert icmp any any -> any any (msg:"PingOfDeath";threshold:type both,track
by_src,count 10,seconds 2;sid:1000002;) -> error
2초 동안 10회 이상의 ICMP요청이 발생한다면 죽음의 핑 공격으로 판단하겠다!
공격
nmap 10.0.2.15 -p 22 -sT
탐지
alert tcp any any -> 10.0.2.15 22 (msg:"nmapScan";flags:S;sid:1000003;)
공격
ssh master@10.0.2.15
탐지
alert tcp any any -> 10.0.2.15 22 (msg:"sshAttack";content:"SSH";nocase;sid:1000004;) -> error
alert tcp 10.0.2.15 any -> any any (msg:sshAttack";content:"SSH";nocase;sid:1000004;rev:1;)
nocase : 대소문자를 구별하지 않겠다.
content:"";nocase랑 쌍으로 사용함
미션
IDS에 APM이 작동 되도록 설정한다.
기존 파일(레거지 파일)에 대한 버전 문제 발생(PHP5로 개발)
윈도우용 레거지 apm을 이용하면 가능함
하지만 리눅스에서 해결하고자 함
공격
hydra -L user.txt -P pass.txt -f 10.0.2.15 ssh
hydra -L user.txt -P pass.txt -f 10.0.2.15 ftp
hydra -L user.txt -P pass.txt -f 10.0.2.15 web
hydra -L user.txt -P passwd.txt 10.0.2.15 http-post-form "/login_chk.php:id=^USER^&pw=^PASS^:fail" -V
slowhttptest -H -g -o slowloris -c 4000 -r 100 -i 10 -t GET -p 3 -x 3 -u http://10.0.2.15
탐지
alert tcp any any -> 10.0.2.15 21 (msg:"ftpAttack";content:"user root";nocase;sid:1000005;)
alert tcp any any -> 10.0.2.15 22 (msg:"sshBruteForceAttack";content:"SSH";nocase;offset:0;depth:4;sid:1000006;)
alert tcp any any -> 10.0.2.15 80 (msg:"httpBruteForceAttack";content:"GET / HTTP/1.";nocase;offset:0;depth:4;sid:1000006;) -> error
alert tcp any any -> 10.0.2.15 80 (msg:"ToDetectSlowlowLorisAttack";flow:to_server,established;pcre:"/[^\x0d\x0a]\x0d\0a$/";threshold:type both,track by_src,count 10,seconds 2;sid:1000007;) -> error
pcre : (Perl Compatible Regular Expressions ) : 펄 호환 정규 표현식
offset/depth는 지정한 위치에서 문자열 검색을 하기 위함
nocase : 대소문자를 구별하지 않겠다.
content:"";nocase랑 쌍으로 사용함