NMAPport Scanning 툴로서 호스트나 네트워크를 스캐닝 할 때, 아주 유용한 시스템 보안툴인 동시에, 해커에게는 강력한 해킹툴로 사용될 수 있습니다. 서버를 운영하다 보면 관리자 스스로도 어떤 포트가 열려있고, 또 어떤 서비스가 제공중인지 잘 모를때가 있습니다. 기억력이 나빠서나, 게을러서가 아니라 필요에 의해 자주 변경되므로 수시로 파악해서 기록해두지 않으면 잊어버리게 됩니다. 또 크래킹에 의해 생성된 백도어는 파악하기가 어렵습니다.수 많은 포트와 서비스를 효과적으로 체크해서 관리하기 위해서 NMAP과 같은 포트 스캔 툴이 필요합니다. NMAP은 기존의 포트스캔툴에 비해 다양한 옵션과 방화벽 안쪽의 네트웍도 스캔할 수 있는 강력한 기능이 있습니다.

1. 설치 http://www.insecure.org/nmapnmap 의 홈페이지에서 소스파일을 내려 받습니다. 그 후에 설치할 디렉토리로 옮긴후에 압축을 풉니다. 그 후에 해당 디렉토리에서 ./configure 를 실행한 후에make, make install 을 실행합니다.

[root@gyn nmap-2.54BETA30]# ./configure [root@gyn nmap-2.54BETA30]# make; make install

설치가 끝났으면 몇 가지 스캔 타입을 알아봅시당.

    

    

-sT

일반적인 TCP 포트스캐닝.

-sS

이른바 'half-open' 스캔으로 추적이 어렵다.

-sP

ping 을 이용한 일반적인 스캔.

-sU

UDP 포트 스캐닝.

-PO

대상 호스트에 대한 ping 응답을 요청하지 않음 .log 기록과 filtering 을 피할 수 있다.

-PT

일반적이 ICMP ping이 아닌 ACK 패킷으로 ping 을 보내고RST 패킷으로 응답을 받는다.

-PI

일반적인 ICMP ping 으로 방화벽이나 필터링에 의해 걸러진다.

-PB

ping 을 할 때 ICMP ping TCP ping을 동시에 이용한다.

-PS

ping 을 할 때 ACK 패킷대신 SYN 패킷을 보내 스캔.

-O

대상 호스트의 OS 판별.

-p

대상 호스트의 특정 포트를 스캔하거나, 스캔할 포트의 범위를 지정.ex) -p 1-1024

-D

Decoy 기능으로 대상 호스트에게 스캔을 실행한 호스트의 주소를 속인다.

-F

/etc/services 파일 내에 기술된 포트만 스캔.

-I

TCP 프로세서의 identd 정보를 가져온다.

-n

IP 주소를 DNS 호스트명으로 바꾸지 않는다. 속도가 빠르다.

-R

IP 주소를 DNS 호스트명으로 바꿔서 스캔. 속도가 느리다.

-o

스캔 결과를 택스트 파일로 저장.

-i

스캔 대상 호스트의 정보를 지정한 파일에서 읽어서 스캔.

-h

도움말 보기

위의 스캔타입은 자주 쓰이는 내용이고 -h 옵션을 쓰거나 man page를 이용하면 아주 상세한 사용방법을 보실 수 있습니다.

[gyn@gyn gyn]$ man nmapNMAP(1) NMAP(1)

NAMEnmap - Network exploration tool and security scanner

SYNOPSISnmap [Scan Type(s)] [Options] <host or net #1 ... [#N]>..중략..[gyn@gyn gyn]$ nmap -hNmap V. 2.54BETA30 Usage: nmap [Scan Type(s)] [Options] <host or net list>Some Common Scan Types ('*' options require root privileges)-sT TCP connect() port scan (default)* -sS TCP SYN stealth port scan (best all-around TCP scan)* -sU UDP port scan..중략..

2. 사용.

몇가지 사용 예를 통해 nmap을 활용해 보시죠.

[root@gyn root]# nmap -sP xxx.xxx.xxx.xxx

Starting nmap V. 2.54BETA30 ( www.insecure.org/nmap/ )Host gyn (xxx.xxx.xxx.xxx) appears to be up.

Nmap run completed -- 1 IP address (1 host up) scanned in 0 seconds

-sP 옵션으로 대상호스트가 살아 있음을 알아냈습니다. 이젠 특정 포트(80)를 검색해 보겠습니다.

[root@ home]# nmap -sP -PT80 xxx.xxx.xxx.xxxTCP probe port is 80

Starting nmap V. 2.54BETA7 ( www.insecure.org/nmap/ )Host (xxx.xxx.xxx.xxx) appears to be up.Nmap run completed -- 1 IP address (1 host up) scanned in 1 second

지정된 포트가 아니라 대상호스트의 열린 포트를 모두 검색해 봅니다.

[root@ home]# nmap -sT xxx.xxx.xxx.xxx

Starting nmap V. 2.54BETA7 ( www.insecure.org/nmap/ )Interesting ports on (xxx.xxx.xxx.xxx):(The 1526 ports scanned but not shown below are in state: closed)Port State Service22/tcp open ssh 53/tcp open domain 80/tcp open http Nmap run completed -- 1 IP address (1 host up) scanned in 5 seconds

대상 호스트의 열린 포트를 알수는 있지만 로그가 남으므로 위험합니다. 스텔스 스캔으로 감시를 피해야 겠지요.

[root@webserver log]# nmap -sS xxx.xxx.xxx.xxx

Starting nmap V. 2.54BETA7 ( www.insecure.org/nmap/ )Interesting ports on (xxx.xxx.xxx.xxx):(The 1526 ports scanned but not shown below are in state: closed)Port State Service22/tcp open ssh 53/tcp open domain 80/tcp open http Nmap run completed -- 1 IP address (1 host up) scanned in 5 seconds

UDP port 스캔입니다. 시간이 많이 걸릴 수도 있습니다.

[root@gyn root]# nmap -sU localhost

Starting nmap V. 2.54BETA30 ( www.insecure.org/nmap/ )Interesting ports on gyn (127.0.0.1):(The 1450 ports scanned but not shown below are in state: closed)Port State Service53/udp open domain 699/udp open unknown Nmap run completed -- 1 IP address (1 host up) scanned in 3 seconds

이번에는 -O 옵션으로 운영체제를 알아보겠습니다.

[root@webserver /root]# nmap -sS -O xxx.xxx.xxx.xxx

Starting nmap V. 2.54BETA7 ( www.insecure.org/nmap/ )Interesting ports on db (xxx.xxx.xxx.xxx):(The 1530 ports scanned but not shown below are in state: closed)Port State Service22/tcp open ssh 113/tcp open auth 3306/tcp open mysql

TCP Sequence Prediction: Class=random positive incrementsDifficulty=2158992 (Good luck!)Remote operating system guess: Linux 2.1.122 - 2.2.16

Nmap run completed -- 1 IP address (1 host up) scanned in 2 seconds

몇가지 예를 통해 사용법을 알아 보았습니다. 마지막을 부탁드릴 말씀은 자신이 직접 관리하지 않는, 호스트나 네트웍에서 테스트를 하는 것은아주 무례한 행동이며, 관리가 엄격한 사이트의 경우 접속 제한은 당하는 경우도 있으므로바람직하지 않은 방법으로 사용하는 일이 없길 바랍니다.

2010/11/06 07:30 2010/11/06 07:30

Trackback Address :: https://youngsam.net/trackback/1408