홈페이지 취약점 분석 이야기 | 파일 지도 사진 깨알 |
---|
>> 목록보이기 웹해킹 훈련장(172.16.15.116:40080)에 대한 공개용 도구기반 취약점 점검실습순서 요약
점검대상 웹서버의 포트 스캔(Port Scan): 간략 스캔
kali@kali:~$ sudo nmap -p- -v 172.16.15.116 -oN 172.16.15.116-nmap-in-brief-all.txt Starting Nmap 7.70 ( https://nmap.org ) at 2020-05-07 11:23 KST Initiating Parallel DNS resolution of 1 host. at 11:23 Completed Parallel DNS resolution of 1 host. at 11:23, 0.01s elapsed Initiating SYN Stealth Scan at 11:23 Scanning 172.16.15.116 [65535 ports] Discovered open port 139/tcp on 172.16.15.116 Discovered open port 3389/tcp on 172.16.15.116 Discovered open port 22/tcp on 172.16.15.116 Discovered open port 111/tcp on 172.16.15.116 Discovered open port 80/tcp on 172.16.15.116 Discovered open port 445/tcp on 172.16.15.116 Discovered open port 39507/tcp on 172.16.15.116 Discovered open port 8200/tcp on 172.16.15.116 Discovered open port 40080/tcp on 172.16.15.116 Discovered open port 6566/tcp on 172.16.15.116 Discovered open port 51413/tcp on 172.16.15.116 Discovered open port 10080/tcp on 172.16.15.116 Discovered open port 43389/tcp on 172.16.15.116 Discovered open port 9091/tcp on 172.16.15.116 Completed SYN Stealth Scan at 11:23, 8.70s elapsed (65535 total ports) Nmap scan report for 172.16.15.116 Host is up (0.000015s latency). Not shown: 65521 closed ports PORT STATE SERVICE 22/tcp open ssh 80/tcp open http 111/tcp open rpcbind 139/tcp open netbios-ssn 445/tcp open microsoft-ds 3389/tcp open ms-wbt-server 6566/tcp open sane-port 8200/tcp open trivnet1 9091/tcp open xmltec-xmlmail 10080/tcp open amanda 39507/tcp open unknown 40080/tcp open unknown 43389/tcp open unknown 51413/tcp open unknown Read data files from: /usr/bin/../share/nmap Nmap done: 1 IP address (1 host up) scanned in 8.85 seconds Raw packets sent: 65580 (2.886MB) | Rcvd: 131174 (5.509MB) kali@kali:~$ 웹 서버를 대상으로 하는 해킹은 대개의 경우 자동화된 기계적 공격이다. 기계적인 해킹은 거의 대부분 특정 포트를 중심으로 IP주소를 횡적으로 스캔하는 방식으로 이루어진다 (예: XorDDOS.Botnet의 22/tcp (ssh) root 비밀번호 스캔; WordPress 대상의 80/tcp 및 443/tcp 포트 스캔; 8080/tcp 포트 대상 취약한 Apache Tomcat 관리자 비밀번호 공격 등). 반면, 다양한 기계적 공격이 가능할 수 있는 취약점을 찾기 위해서, 홈페이지 취약점점검은 특정 웹서버의 IP주소를 중심으로 서버의 포트를 종적으로 스캔하는 방식으로 수행한다. 점검대상 웹서버의 포트 스캔(Port Scan): 상세 스캔
kali@kali:~$ sudo nmap -p22,80,111,139,445,3389,6566,8200,9091,10080,39507,40080,43389,51413 -A -v 172.16.15.116 -oN 172.16.15.116-nmap-in-detail-all.txt Starting Nmap 7.70 ( https://nmap.org ) at 2020-05-07 11:27 KST NSE: Loaded 148 scripts for scanning. NSE: Script Pre-scanning. Initiating NSE at 11:27 Completed NSE at 11:27, 0.00s elapsed Initiating NSE at 11:27 Completed NSE at 11:27, 0.00s elapsed Initiating Parallel DNS resolution of 1 host. at 11:27 Completed Parallel DNS resolution of 1 host. at 11:27, 0.01s elapsed Initiating SYN Stealth Scan at 11:27 Scanning 172.16.15.116 [14 ports] Discovered open port 22/tcp on 172.16.15.116 Discovered open port 80/tcp on 172.16.15.116 Discovered open port 111/tcp on 172.16.15.116 Discovered open port 445/tcp on 172.16.15.116 Discovered open port 3389/tcp on 172.16.15.116 Discovered open port 139/tcp on 172.16.15.116 Discovered open port 43389/tcp on 172.16.15.116 Discovered open port 40080/tcp on 172.16.15.116 Discovered open port 6566/tcp on 172.16.15.116 Discovered open port 9091/tcp on 172.16.15.116 Discovered open port 39507/tcp on 172.16.15.116 Discovered open port 10080/tcp on 172.16.15.116 Discovered open port 51413/tcp on 172.16.15.116 Discovered open port 8200/tcp on 172.16.15.116 Completed SYN Stealth Scan at 11:27, 0.42s elapsed (14 total ports) Initiating Service scan at 11:27 Scanning 14 services on 172.16.15.116 Completed Service scan at 11:30, 151.09s elapsed (14 services on 1 host) Initiating OS detection (try #1) against 172.16.15.116 NSE: Script scanning 172.16.15.116. Initiating NSE at 11:30 Completed NSE at 11:31, 60.61s elapsed Initiating NSE at 11:31 Completed NSE at 11:31, 1.02s elapsed Nmap scan report for 172.16.15.116 Host is up (0.000043s latency). PORT STATE SERVICE VERSION 22/tcp open ssh OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0) | ssh-hostkey: | 2048 66:fa:54:c4:e9:92:c8:7c:0c:e5:00:e9:e2:e2:4b:b2 (RSA) | 256 72:da:a7:18:ef:b6:99:a8:f5:66:2c:cf:63:2e:cb:3c (ECDSA) |_ 256 85:0a:c2:d9:62:ba:ce:53:b7:68:1c:d3:14:04:72:df (ED25519) 80/tcp open http Apache httpd 2.4.38 | http-ls: Volume / | SIZE TIME FILENAME | 8.9G 2020-02-21 08:54 Windows%2010%20AP-GS.ova |_ | http-methods: |_ Supported Methods: GET POST OPTIONS HEAD |_http-server-header: Apache/2.4.38 (Debian) |_http-title: Index of / 111/tcp open rpcbind 2-4 (RPC #100000) | rpcinfo: | program version port/proto service | 100000 2,3,4 111/tcp rpcbind | 100000 2,3,4 111/udp rpcbind | 100024 1 39507/tcp status |_ 100024 1 44884/udp status 139/tcp open netbios-ssn Samba smbd 3.X - 4.X (workgroup: WORKGROUP) 445/tcp open netbios-ssn Samba smbd 4.9.5-Debian (workgroup: WORKGROUP) 3389/tcp open ms-wbt-server xrdp 6566/tcp open tcpwrapped 8200/tcp open upnp MiniDLNA 1.2.1 (OS: Debian; DLNADOC 1.50; UPnP 1.0) 9091/tcp open http Transmission BitTorrent management httpd (unauthorized) | http-auth: | HTTP/1.1 401 Unauthorized\x0D |_ Basic realm=Transmission | http-methods: |_ Supported Methods: GET HEAD POST |_http-server-header: Transmission |_http-title: Site doesn't have a title (text/html; charset=ISO-8859-1). 10080/tcp open http Apache httpd | http-cookie-flags: | /: | PHPSESSID: |_ httponly flag not set |_http-favicon: Unknown favicon MD5: 69C728902A3F1DF75CF9EAC73BD55556 | http-methods: |_ Supported Methods: GET HEAD POST OPTIONS | http-robots.txt: 1 disallowed entry |_/ |_http-server-header: Apache | http-title: Login :: Damn Vulnerable Web Application (DVWA) v1.9 |_Requested resource was login.php 39507/tcp open status 1 (RPC #100024) 40080/tcp open http Apache httpd 2.4.41 ((Win64) PHP/7.4.2) | http-methods: |_ Supported Methods: GET HEAD POST OPTIONS | http-robots.txt: 1 disallowed entry |_/admin/ |_http-server-header: Apache/2.4.41 (Win64) PHP/7.4.2 |_http-title: \xEC\xB7\xA8\xEC\x95\xBD\xED\x95\x9C \xEB\x88\x84\xEB\xA6\xAC\xEC\xA7\x91\xEC\x97\x90 \xEC\x98\xA4\xEC\x8B\xA0 \xEA\xB2\x83\xEC\x9D\x84 \xED\x99\x98\xEC\x98\x81\xED\x95\xA9\xEB\x8B\x88\xEB\x8B\xA4! - \xEC\xB7\xA8\xEC\x95\xBD... 43389/tcp open ssl/unknown | ssl-cert: Subject: commonName=DESKTOP-FV4LV36 | Issuer: commonName=DESKTOP-FV4LV36 | Public Key type: rsa | Public Key bits: 2048 | Signature Algorithm: sha256WithRSAEncryption | Not valid before: 2020-02-17T00:34:35 | Not valid after: 2020-08-18T00:34:35 | MD5: c9c1 6f55 090c 53e5 62d9 c9f0 691c 2e20 |_SHA-1: bced db31 0670 0497 c803 d1bd 23cc a932 ff2a 0862 |_ssl-date: 2020-05-07T02:30:12+00:00; 0s from scanner time. 51413/tcp open unknown | fingerprint-strings: | Kerberos: | w\x9b{ | SMBProgNeg: | (2g? | 1LVz@ | oe'|n | L@W| | \xd5E | TLSSessionReq: | 2ylr | CK~wZA | 9\xa7] | 4}"CqY | QnDo |_ .T7X 1 service unrecognized despite returning data. If you know the service/version, please submit the following fingerprint at https://nmap.org/cgi-bin/submit.cgi?new-service : SF-Port51413-TCP:V=7.70%I=7%D=5/7%Time=5EB37255%P=x86_64-pc-linux-gnu%r(TL SF:SSessionReq,205,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_\x84Nd\tw\x1f\x02\x1b\xed4}\"CqY\x01:\x97\xd2R\$\xd5`w\x1b SF:\xe8jX\xe2\xc2u\r\x0b\xd91\xcc\+\xe7\xd2ie\xae\xbc\x9dV\xbe\xde\xce\xf6 SF:\xeeP\xb5\x13\]\x94\xe8\x9cl\x13\xaa\x7f\xcf\x03O\x85\x958\xdd\xee\xe6\ SF:xc1\xbb\xb6y\x06\xf3\xa3\x1d\xb9\x9d\x1c\x10M\x9e3\x88\x053\xec\$\x18l\ SF:xaewU\xd7\x93\+w\xf3gOS\0QnDo\x834\xaa\.T7X\xde9{\xddY\x11tk\xf2\xb68\x SF:9b&\r\$F\x14:\x1d%\x07\x17i=\xb0x\x16\xe4\xad\xc4\$\x9c\xd0\x93}`\x84\$ SF:\xc0\x1f\xa9-\x17g\xfb")%r(Kerberos,72,"\xf7\xde\x1f\x1c\^C\xf7l\xcb\xa SF:7%\x9f\x0e\xe8\xe6\xed\x92\na\x82x\xb9\x20-\xcf\xcc\xc4w\\\x9b{\xf0
여기서 보여주는 Nikto 스캔
kali@kali:~$ nikto -port 40080 -host 172.16.15.116 -o 172.16.15.116-nikto-40080-in.txt - Nikto v2.1.5 --------------------------------------------------------------------------- + Target IP: 172.16.15.116 + Target Hostname: 172.16.15.116 + Target Port: 40080 + Start Time: 2020-05-07 15:45:52 (GMT9) --------------------------------------------------------------------------- + Server: Apache/2.4.41 (Win64) PHP/7.4.2 + Retrieved x-powered-by header: PHP/7.4.2 + The anti-clickjacking X-Frame-Options header is not present. + Server leaks inodes via ETags, header found with file /robots.txt, fields: 0x20 0x59eb27067bd57 + Uncommon header 'x-frame-options' found, with contents: SAMEORIGIN + File/dir '/admin/' in robots.txt returned a non-forbidden or redirect HTTP code (200) + "robots.txt" contains 1 entry which should be manually viewed. + DEBUG HTTP verb may show server debugging information. See http://msdn.microsoft.com/en-us/library/e8z01xdh%28VS.80%29.aspx for details. + OSVDB-877: HTTP TRACE method is active, suggesting the host is vulnerable to XST + OSVDB-3092: /sitemap.xml: This gives a nice listing of the site content. + OSVDB-3092: /admin/: This might be interesting... + OSVDB-3268: /data/: Directory indexing found. + OSVDB-3092: /data/: This might be interesting... + OSVDB-3092: /README.TXT: This might be interesting... + OSVDB-3092: /readme.txt: This might be interesting... + OSVDB-3093: /admin/index.php: This might be interesting... has been seen in web logs from an unknown scanner. + OSVDB-3233: /test.php: PHP is installed, and a test script which runs phpinfo() was found. This gives a lot of system information. + OSVDB-3092: /LICENSE.txt: License file found may identify site software. + OSVDB-3092: /Admin/: This might be interesting... + OSVDB-3092: /license.txt: License file found may identify site software. + OSVDB-3092: /LICENSE.TXT: License file found may identify site software. + OSVDB-3092: /test.php: This might be interesting... + 6544 items checked: 0 error(s) and 21 item(s) reported on remote host + End Time: 2020-05-07 15:46:17 (GMT9) (25 seconds) --------------------------------------------------------------------------- + 1 host(s) tested kali@kali:~$ OWASP-ZAP 스캐너
Zaproxy의 점검 결과는 도구를 이용한 스캔 결과 취합하기kali@kali:~$ ls -1 172.16.15.116-* 4 172.16.15.116-nikto-40080-in.txt 4 172.16.15.116-nmap-in-brief-all.txt 12 172.16.15.116-nmap-in-detail-all.txt 4 172.16.15.116-zaproxy-40080-in.session 20 172.16.15.116-zaproxy-40080-in.session.backup 65536 172.16.15.116-zaproxy-40080-in.session.data 4 172.16.15.116-zaproxy-40080-in.session.lck 4 172.16.15.116-zaproxy-40080-in.session.log 4 172.16.15.116-zaproxy-40080-in.session.properties 8 172.16.15.116-zaproxy-40080-in.session.script kali@kali:~$ Nmap, Nikto, OWASP-ZAP 점검 결과 파일은 위와 같다. 다른 파일에 비해서 Zaproxy의 세션 데이타가 매우 큰 것을 볼 수 있다. 이 훈련장이 매우 간단한 누리집이어서 65kb 정도 밖에 되지 않지만 실제 서비스에서는 수~수십 기가바이트에 달할 수 있다. Kali의 디스크를 30GB로 만들었을 때, 현장에서 점검을 진행하면서 Zaproxy 스캔만으로 디스크가 모자란 경험이 있다. 이 때부터 디스크를 60GB로 설정하여 쓰고 있는 데 아직까지는 실제 점검에서 저장공간이 꽉 찬 적은 없다.
점검 결과를 취합할 파일의 이름은
지금까지 결과를 취합하여 정리하면 다음과 같다.
공개용 취약점 점검 도구의 스캔 결과 요약
kali@kali:~$ curl http://172.16.15.116:40080/data/users/ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <html> <head> <title>Index of /data/users</title> </head> <body> <h1>Index of /data/users</h1> <ul><li><a href="/data/"> Parent Directory</a></li> <li><a href="admin%20-%20%eb%b3%b5%ec%82%ac%eb%b3%b8.xml"> admin - 복사본.xml</a></li> <li><a href="admin.xml"> admin.xml</a></li> </ul> </body></html> kali@kali:~$ curl http://172.16.15.116:40080/data/users/admin.xml <?xml version="1.0" encoding="UTF-8"?> <item><USR>admin</USR><NAME>관리자</NAME><PWD>264bc0768362a68984faea923efaa21f67f4d10a</PWD><EMAIL>admin@test.com</EMAIL><HTMLEDITOR>1</HTMLEDITOR><TIMEZONE>Asia/Seoul</TIMEZONE><LANG>en_US</LANG></item> kali@kali:~$
이제는 이 훈련장은 MS Windows 기반의 훈련장이므로 불특정 다수에게 배포할 수 없다. 경험을 원하는 경우에는 아래에 적힌 메일로 요청해주시길.
GetSimple은 실제로 다수의 누리집에서 사용하는 PHP 기반의 공개용 CMS이다.
이 훈련장은 인터넷에서 찾을 수 있는 설치 방법대로 Apache2, PHP, GetSimple을 설치한 상태이다.
보안에 신경쓰지 않을 경우에 어떤 위험성이 발생할 수 있는 지는 인터넷에서도 직접 확인할 수 있다.
Google 검색 엔진에서 [처음 작성한 날: 2020.05.07] [마지막으로 고친 날: 2020.05.09] > 다음 글 : Kali Linux 2020.1b 64bit 설치 설명서 (MS 윈도우 10, VMware 플레이어) (2020.03.25) 이 저작물은 크리에이티브 커먼즈 저작자표시 4.0 국제 라이선스에 따라 이용할 수 있습니다. 잘못된 내용, 오탈자 및 기타 문의사항은 j1n5uk{at}daum.net으로 연락주시기 바랍니다. 문서의 시작으로 컴퓨터 깨알지식 웹핵 누리집 대문 |