Proving Grounds Play : Stapler Walkthrough

Proving Grounds Play : Stapler Walkthrough


Foothold :

  • SAMBA 服務雖然跑在 139,用 enum4linux 列舉使用者名單
  • 製作使用者名單與密碼清單相同,hydra 後獲得一組帳號密碼

PE :

  • HOME 有多組使用者,使用 cat */.bash_history 獲取歷史指令資訊
  • 歷史指令中找到的密碼在 su peter 切換使用者成功
  • 直接 sudo -i 提權成功

注意事項 :

  • 遇到 SMB or SAMBA 一定要用 enum4linux
  • Hydra 一定要試試帳號與密碼都同一份清單
  • 遇到 linux 過多使用者可以用 cat */.bash_history 一次獲取歷史指令
  • 善用 su <使用者> sudo -i 提權


Rustscan,└─$ rustscan -a 192.168.159.148 --scripts none --ulimit 5000 | tee rustscan



snmp check,└─$ sudo nmap -sU -Pn -p 161 192.168.159.148 | tee snmp


nmap check,└─$ sudo nmap -sCV -A -Pn -p 21,22,53,80,139,666,3306,12380 192.168.159.148 | tee nmap




FTP 使用 ftp:ftp 登入,有個橫幅如下,看來有個使用者名稱為 Harry

"220-| Harry, make sure to update the banner when you get a chance to show who has access here |"



note 檔案裡面內容又列舉到兩個使用者名稱 Elly & John



80 /



80 /robots.txt



gobuster 找不到甚麼東西



mysql 登入測試無法登入



12380 /

Tital 發現另外一個名字 Tim



12380 /robots.txt


View Source 發現另外一個使用者名稱 Zoe


gobuster 12380 沒有發現其他路徑



└─$ enum4linux -a  192.168.159.148 | tee enum4linux




smbclient \\192.168.159.148\\kathy 底下有兩個資料夾
 - kathy_stuff 底下有個 todo-list.txt 檔案
 - backup 底下有兩個檔案 vsftpd.conf & wordpress-4.tar.gz


todo-list.txt 又發現一個人名 kathy



vsftpd.conf 設定檔沒有特別的地方
FTP Log 路徑 #xferlog_file=/var/log/vsftpd.log
rsa : rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa private key : rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key


wordpress 壓縮檔解開後疑似一組 MySQL 帳號密碼 username_here:password_here


MySQL 連線測試一樣失敗



列舉出一堆使用者名稱



將上述帳號存到一個檔案名稱為 users,然後使用以下指令

cat users | cut -d "\\" -f 2 | cut -d " " -f 1 > user-list.txt



製作 usernames.txt & passwords.txt 兩個檔案一樣如下



hydra 測試 22 Port,發現一組有用的憑證 SHayslett:SHayslett

這個帳號是 enum4linux 爬出來的



測試帳號密碼可以登入且獲得第一階段的 local.txt



cat /etc/passwd 發現許多帳號



/home 路徑底下也確實有超多帳號



cat */.bash_history 發現兩組帳號密碼

sshpass -p thisimypassword ssh JKanode@localhost --> JKanode:thisimypassword

sshpass -p JZQuyIN5 ssh peter@localhost --> peter:JZQuyIN5



因為有看到 "cat: peter/.bash_history: Permission denied",看來 peter 是個權限較大的帳號

su peter 輸入密碼試試看,成功切換成 peter 帳號



sudo -l 輸入密碼發現 peter 可以用 sudo 執行任意指令



直接 sudo su (或是使用 sudo -i)成功提權為 root



留言

這個網誌中的熱門文章

Challenge 0 - Secura(2)

濫用 Windows 庫文件(Library File)

Challenge 0 - Secura(1)