nmap (시스템 취약점(port정보, os정보등)알아내기
작성자 정보
- 웹관리자 작성
- 작성일
컨텐츠 정보
- 8,475 조회
- 0 추천
- 목록
본문
NMAP은 해커들이 주로 사용하는 툴로서 해킹을 시도하기 이전에 해킹대상시스템의 여러 가지 정보를 먼저 입수하기 위해서 사용하는 툴입니다. 하지만 이 툴은 시스템사용자들이 시스템의 취약점이나 포트정보들을 알아보기위해 사용하던 툴이었으나 Crack툴에서 설명드린 바와 마찬가지로 보안툴의 양면성으로 인하여 "보안툴은 해킹툴이다." 라는 명제에 역시나 부합되는 툴이라고 말씀드릴 수가 있습니다. 이 툴을 한번 사용해 보시면 그 유용성에 입이 쩌~억 벌어질(?) 것입니다.자~아, 그럼 시작해 보도록 합시다.
2-1. tar xvfpz nmap-2.12.tgz 2-2. ./configure 2-3. make 2-4. make install 2-5. 복사하기 여기까지 실행이 완료되었다면 nmap이라는 파일로 실행파일이 생성되었을 것입니다. 이제 이 파일을 적당한 곳에 복사를 해두시면 됩니다. 특정한 위치가 필요한 것은 아니지만 관리자(root)가 주로 사용하는 실행경로(예, /usr/bin 또는 /usr/local/bin)에 위치해두시면 됩니다.
3-1. nmap 실행파일 # ls -l /usr/local/bin/nmap -rwxr-xr-x 1 root root 350505 Aug 28 00:57 /usr/local/bin/nmap 위의 nmap파일이 실제로 실행할 실행파일입니다.
3-2. nmap 실행설정파일 [root@www nmap]# pwd /usr/local/lib/nmap [root@www nmap]# ls -l total 216 -rw-r--r-- 1 root root 20702 Sep 3 02:36 nmap-os-fingerprints -rw-r--r-- 1 root root 90073 Sep 3 02:36 nmap-services 위의 파일중 nmap-os-fingerprints 파일은 점검할 각종OS에 관한 정보가 수록되어 있으며, nmap-services파일에는 1968개의 점검할 tcp, udp 포트정보가 기록되어 있습니다.
# /usr/local/bin/nmap -sT -O webserver.jindong.net 위의 예와 같이 nmap 다음에 -sT 옵션과 -O 옵션을 준 다음 점검할 서버도메인이나 IP Address를 주시면 됩니다. 실제 실행예는 아래에 있습니다.
[root@hlxsvr c50a]# [root@hlxsvr c50a]# cd ~manager [root@hlxsvr manager]# cd nmap [root@hlxsvr nmap]# ls -al -rw-r--r-- 1 manager manager 329479 Aug 28 00:55 nmap-2.12.tgz [root@hlxsvr nmap]# [root@hlxsvr nmap]# tar xvfpz nmap-2.12.tgz nmap-2.12/ nmap-2.12/nmap.c nmap-2.12/targets.c nmap-2.12/tcpip.c nmap-2.12/error.c nmap-2.12/utils.c nmap-2.12/osscan.c nmap-2.12/charpool.c nmap-2.12/services.c nmap-2.12/nmap.h nmap-2.12/error.h nmap-2.12/targets.h nmap-2.12/osscan.h [root@hlxsvr nmap]# ls -al drwx------ 4 khani21 khani21 1024 Apr 5 1999 nmap-2.12 -rw-r--r-- 1 manager manager 329479 Aug 28 00:55 nmap-2.12.tgz [m[root@hlxsvr nmap]# cd nmap nmap-2.12 nmap-2.12.tgz [root@hlxsvr nmap]# cd nmap-2.12
[m[root@hlxsvr nmap-2.12]# ./configure creating cache ./config.cache checking for gcc... gcc checking whether the C compiler (gcc ) works... yes checking whether the C compiler (gcc ) is a cross-compiler... no checking whether we are using GNU C... yes checking whether gcc accepts -g... yes checking for a BSD compatible install... /usr/bin/install -c [root@hlxsvr nmap-2.12]# [root@hlxsvr nmap-2.12]# [root@hlxsvr nmap-2.12]# make Configuring libpcap creating cache ./config.cache checking host system type... i686-pc-linux-gnu checking target system type... i686-pc-linux-gnu checking if unaligned accesses fail... no checking for a BSD compatible install... /usr/bin/install -c updating cache ./config.cache creating ./config.status creating Makefile Compiling libpcap make[1]: Entering directory `/home/manager/nmap/nmap-2.12/libpcap-possiblymodified' gcc -O2 -I. -Ilinux-include -DHAVE_MALLOC_H=1 -DHAVE_ETHER_HOSTTON=1 -DHAVE_STRERROR=1 -DHAVE_NET_IF_ARP_H=1 -c ./pcap-linux.c gcc -O2 -I. -Ilinux-include -DHAVE_MALLOC_H=1 -DHAVE_ETHER_HOSTTON=1 -DHAVE_STRERROR=1 -DHAVE_NET_IF_ARP_H=1 -c ./pcap.c gcc -O2 -I. -Ilinux-include -DHAVE_MALLOC_H=1 -DHAVE_ETHER_HOSTTON=1 -DHAVE_STRERROR=1 -DHAVE_NET_IF_ARP_H=1 -c ./inet.c gcc -O2 -I. -Ilinux-include -DHAVE_MALLOC_H=1 -DHAVE_ETHER_HOSTTON=1 -DHAVE_STRERROR=1 -DHAVE_NET_IF_ARP_H=1 -c ./gencode.c gcc -O2 -I. -Ilinux-include -DHAVE_MALLOC_H=1 -DHAVE_ETHER_HOSTTON=1 -DHAVE_STRERROR=1 -DHAVE_NET_IF_ARP_H=1 -c ./optimize.c gcc -O2 -I. -Ilinux-include -DHAVE_MALLOC_H=1 -DHAVE_ETHER_HOSTTON=1 -DHAVE_STRERROR=1 -DHAVE_NET_IF_ARP_H=1 -c ./nametoaddr.c gcc -O2 -I. -Ilinux-include -DHAVE_MALLOC_H=1 -DHAVE_ETHER_HOSTTON=1 -DHAVE_STRERROR=1 -DHAVE_NET_IF_ARP_H=1 -c ./etherent.c gcc -O2 -I. -Ilinux-include -DHAVE_MALLOC_H=1 -DHAVE_ETHER_HOSTTON=1 -DHAVE_STRERROR=1 -DHAVE_NET_IF_ARP_H=1 -c ./savefile.c gcc -O2 -I. -Ilinux-include -DHAVE_MALLOC_H=1 -DHAVE_ETHER_HOSTTON=1 -DHAVE_STRERROR=1 -DHAVE_NET_IF_ARP_H=1 -c ./bpf_filter.c gcc -O2 -I. -Ilinux-include -DHAVE_MALLOC_H=1 -DHAVE_ETHER_HOSTTON=1 -DHAVE_STRERROR=1 -DHAVE_NET_IF_ARP_H=1 -c ./bpf_image.c flex -Ppcap_ -t scanner.l > $$.scanner.c; mv $$.scanner.c scanner.c bison -y -p pcap_ -d grammar.y mv y.tab.c grammar.c [root@hlxsvr nmap-2.12]#
[root@hlxsvr nmap-2.12]# make install
/usr/bin/install -c -d /usr/local/bin /usr/bin/install -c -d /usr/local/man /usr/bin/install -c -d /usr/local/man/man1 /usr/bin/install -c -d /usr/local/lib/nmap /usr/bin/install -c -m 755 nmap /usr/local/bin/nmap /usr/bin/install -c -m 644 docs/nmap.1 /usr/local/man/man1/nmap.1 /usr/bin/install -c -m 644 nmap-os-fingerprints /usr/local/lib/nmap/nmap-os-fingerprints /usr/bin/install -c -m 644 nmap-services /usr/local/lib/nmap/nmap-services which: no nmap in (/usr/sbin:/sbin:/usr/bin:/bin:/usr/X11R6/bin:/usr/kde/bin) [root@hlxsvr nmap-2.12]# [root@hlxsvr nmap-2.12]# [m[root@hlxsvr nmap-2.12]# ls -l /usr/local/bin/nmap [00m-rwxr-xr-x 1 root root 350505 Aug 28 00:57 [01;32m/usr/local/bin/nmap[00m* [m[root@hlxsvr nmap-2.12]# [root@hlxsvr nmap-2.12]#
[root@www nmap-2.12]# /usr/local/bin/nmap -sT -O webserver.jindong.net
WARNING! The following files exist and are readable: /usr/local/lib/nmap/nmap-os-fingerprints and ./nmap-os-fingerprints. I am choosing /usr/local/lib/nmap/nmap-os-fingerprints for security reasons. set NMAPDIR=. to give priority to files in your local directory
Starting nmap V. 2.12 by Fyodor (fyodor@dhp.com, www.insecure.org/nmap/) WARNING! The following files exist and are readable: /usr/local/lib/nmap/ nmap-services and ./nmap-services. I am choosing /usr/local/lib/nmap/nmap-services for security reasons. set NMAPDIR=. to give priority to files in your local directory Interesting ports on webserver.jindong.net (211.123.12.12): Port State Protocol Service 21 open tcp ftp 23 open tcp telnet 25 open tcp smtp 53 open tcp domain 80 open tcp http 110 open tcp pop-3 111 open tcp sunrpc 138 open tcp netbios-dgm 139 open tcp netbios-ssn 587 open tcp submission 635 open tcp unknown 1080 open tcp socks 1521 open tcp ncube-lm 6000 open tcp X11 6112 open tcp dtspc 6667 open tcp irc 12345 open tcp NetBus 12346 open tcp NetBus
TCP Sequence Prediction: Class=random positive increments Difficulty=97 (Medium) No OS matches for host (see http://www.insecure.org/cgi-bin/nmap-submit.cgi). TCP/IP fingerprint: TSeq(Class=RI%gcd=1%SI=64A2) TSeq(Class=RI%gcd=1%SI=64D4) TSeq(Class=RI%gcd=1%SI=61) T1(Resp=Y%DF=N%W=805C%ACK=S++%Flags=AS%Ops=MNW) T2(Resp=N) T3(Resp=Y%DF=N%W=805C%ACK=O%Flags=A%Ops=) T4(Resp=Y%DF=N%W=8000%ACK=O%Flags=R%Ops=) T5(Resp=Y%DF=N%W=0%ACK=S++%Flags=AR%Ops=) T6(Resp=Y%DF=N%W=0%ACK=O%Flags=R%Ops=) T7(Resp=Y%DF=N%W=0%ACK=S%Flags=AR%Ops=) PU(Resp=Y%DF=N%TOS=0%IPLEN=38%RIPTL=148%RID=E%RIPCK=E%UCK=0%ULEN=134%DAT=E) Nmap run completed -- 1 IP address (1 host up) scanned in 8 seconds [root@www nmap-2.12]#
[root@hlxsvr nmap-2.12]# /usr/local/bin/nmap -sT -O cdc.jindong.net WARNING! The following files exist and are readable: /usr/local/lib/nmap/nmap-os-fingerprints and ./nmap-os-fingerprints. I am choosing /usr/local/lib/nmap/nmap-os-fingerprints for security reasons. set NMAPDIR=. to give priority to files in your local directory
Starting nmap V. 2.12 by Fyodor (fyodor@dhp.com, www.insecure.org/nmap/) WARNING! The following files exist and are readable: /usr/local/lib/nmap/nmap-services and ./nmap-services. I am choosing /usr/local/lib/nmap/nmap-services for security reasons. set NMAPDIR=. to give priority to files in your local directory Interesting ports on (210.222.17.54): Port State Protocol Service 7 open tcp echo 9 open tcp discard 13 open tcp daytime 19 open tcp chargen 21 open tcp ftp 23 open tcp telnet 25 open tcp smtp 37 open tcp time 53 open tcp domain 79 open tcp finger 80 open tcp http 111 open tcp sunrpc 512 open tcp exec 513 open tcp login 514 open tcp shell 515 open tcp printer 540 open tcp uucp 1103 open tcp xaudio 4045 open tcp lockd 6000 open tcp X11 6112 open tcp dtspc 7100 open tcp font-service
TCP Sequence Prediction: Class=random positive increments Difficulty=34809 (Worthy challenge) Remote operating system guess: Solaris 2.6 - 2.7
Nmap run completed -- 1 IP address (1 host up) scanned in 11 seconds [root@hlxsvr nmap-2.12]#
위의 결과에서 보신 것처럼 점검한 시스템에 열려있는 포트(port)정보와 OS정보 및 버전을 알 수가 있습니다. 이들 정보가 왜 중요한가를 묻겠지요.. 당연합니다. 모든 OS는 아이러니하게도 버거가 존재합니다. 일반적으로 모든 운영체제에는 버전별로 버거리포트가 존재하며 이는 곧 해킹을 하기위한 해킹방법에 활용됩니다. 즉, 어떤 OS에 어떤 버전에 어떤 버거가 있으며 이들을 이용하여 침입할 수가 있다는 것입니다. 또한 위에서 볼 수 있는 포트(port)를 이용하여 열려있는 포트를 활용한다는 것입니다. 서버관리자는 자기가 관리하는 시스템에 이런 취약점을 사전에 탐지하여 불필요한 포트를 막아놓아야 할 것입니다. "유비무한"하지 않으면 "소잃고 외양간 고칩니다." |
관련자료
-
이전
-
다음