picoCTF 2025 Writeup - Forensics

2025/03/18に公開

Ph4nt0m 1ntrud3r - 50pt

Description

A digital ghost has breached my defenses, and my sensitive data has been stolen! 😱💻 Your mission is to uncover how this phantom intruder infiltrated my system and retrieve the hidden flag.
To solve this challenge, you'll need to analyze the provided PCAP file and track down the attack method. The attacker has cleverly concealed his moves in well timely manner. Dive into the network traffic, apply the right filters and show off your forensic prowess and unmask the digital intruder!
Find the PCAP file here Network Traffic PCAP file and try to get the flag.

Hints

  1. Filter your packets to narrow down your search.
  2. Attacks were done in timely manner.
  3. Time is essential

パケットキャプチャファイルが渡される。TCPのパケットであり、ヒントから時系列に並び替えて読んでいく。

payloadにbase64っぽいデータが入っており、No.5のパケットからpicoCTFのbase64になっていたので、その部分を取得する。

cGljb0NURg==
ezF0X3c0cw==
bnRfdGg0dA==
XzM0c3lfdA==
YmhfNHJfZQ==
NWU4Yzc4ZA==
fQ==

これをbase64デコードするとフラグが得られる。

picoCTF{1t_w4snt_th4t_34sy_tbh_4r_e5e8c78d}

RED - 100pt

Description

RED, RED, RED, RED
Download the image: red.png

Hints

> 1. The picture seems pure, but is it though?
> 2. Red?Ged?Bed?Aed?
> 3. Check whatever Facebook is called now.

ヒント2からRed/Green/Blue/Alphaのそれぞれからデータを抽出すれば良さそう。

青空白猫などでred/green/blue/alphaのLSBを抽出すると以下の文字列が抽出できる

cGljb0NURntyM2RfMXNfdGgzX3VsdDFtNHQzX2N1cjNfZjByXzU0ZG4zNTVffQ==

base64デコードすると

picoCTF{r3d_1s_th3_ult1m4t3_cur3_f0r_54dn355_}

flags are stepic - 100pt

Description

A group of underground hackers might be using this legit site to communicate. Use your forensic techniques to uncover their message
Additional details will be available after launching your challenge instance.

Hints

  1. In the country that doesn't exist, the flag persists

インスタンスを起動してリンク先にアクセスすると以下のような国旗の一覧が表示される。

ヒント1から存在しない国の国旗を探す。以下のUpanziというのが国ではない。

この画像(upz.png)をダウンロードするとファイルサイズがデカく怪しい。問題のタイトルからstepicというツールを使って隠されたファイルを抽出する。

$ stepic --decode --image-in=upz.png --out=output.txt
$ cat output.txt
picoCTF{fl4g_h45_fl4g00518d32}

Bitlocker-1 - 200pt

Description

Jacky is not very knowledgable about the best security passwords and used a simple password to encrypt their BitLocker drive. See if you can break through the encryption!
Download the disk image here

Hints

  1. Hash cracking

Bitlockerで暗号化したドライブをddしたイメージからパスワードを抽出する。

bitlocker2johnでハッシュを抽出

/opt/homebrew/Cellar/john-jumbo/1.9.0_1/share/john/bitlocker2john -i bitlocker-1.dd > bitlocker_hash.txt
$ cat bitlocker_hash.txt
$bitlocker$0$16$cb4809fe9628471a411f8380e0f668db$1048576$12$d04d9c58eed6da010a000000$60$68156e51e53f0a01c076a32ba2b2999afffce8530fbe5d84b4c19ac71f6c79375b87d40c2d871ed2b7b5559d71ba31b6779c6f41412fd6869442d66d

このハッシュをhashcatで辞書攻撃する

$ hashcat -m 22100 bitlocker_hash.txt ~/.dict/rockyou.txt
...
$bitlocker$0$16$cb4809fe9628471a411f8380e0f668db$1048576$12$d04d9c58eed6da010a000000$60$68156e51e53f0a01c076a32ba2b2999afffce8530fbe5d84b4c19ac71f6c79375b87d40c2d871ed2b7b5559d71ba31b6779c6f41412fd6869442d66d:jacqueline

パスワード(jacqueline)がわかったので、linux上でマウントする。

dislockerとntfs-3gをインストール

$ sudo apt install dislocker
$ sudo apt install ntfs-3g

ループバックデバイスのセットアップ

$ sudo losetup -Pf bitlocker-1.dd

/dev/loop0にマウントされたので、dislockerで暗号化解除。ここでパスワードを入力する

$ sudo mkdir -p /mnt/bitlocker /mnt/unlocked
$ sudo dislocker -V /dev/loop0 -u -- /mnt/bitlocker
Enter the user password: # jacquelineを入力

/mnt/bitlocker/dislocker-fileに暗号化解除されたイメージが作成されるので、/mnt/unlockedにマウントする

$ sudo mount -o loop,ro /mnt/bitlocker/dislocker-file /mnt/unlocked

/mnt/unlocked/flag.txtが存在するので表示する。

$ cat /mnt/unlocked/flag.txt
picoCTF{us3_b3tt3r_p4ssw0rd5_pl5!_3242adb1}

Event-Viewing - 200pt

Description

One of the employees at your company has their computer infected by malware! Turns out every time they try to switch on the computer, it shuts down right after they log in. The story given by the employee is as follows:

  1. They installed software using an installer they downloaded online
  2. They ran the installed software but it seemed to do nothing
  3. Now every time they bootup and login to their computer, a black command prompt screen quickly opens and closes and their computer shuts down instantly.

See if you can find evidence for the each of these events and retrieve the flag (split into 3 pieces) from the correct logs!
Download the Windows Log file here

Hints

  1. Try to filter the logs with the right event ID
  2. What could the software have done when it was ran that causes the shutdowns every time the system starts up?

イベントログの関係ありそうなログにbase64で出力されている

  • イベントID 1033 2024/07/16 0:55:57
    • インストーラによるインストールの製造元がcGljb0NURntFdjNudF92aTN3djNyXw==
    • base64デコードすると、picoCTF{Ev3nt_vi3wv3r_
  • イベントID 4657 2024/07/16 0:56:19
    • レジストリ\REGISTRY\MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Runの値の変更
    • オブジェクト値名がImmediate shutdown (MXNfYV9wcjN0dHlfdXMzZnVsXw==)
    • base64デコードすると、1s_a_pr3tty_us3ful_
  • イベントID 1074 2024/07/16 2:02:35
    • シャットダウン時のコメントがdDAwbF84MWJhM2ZlOX0=
    • base64デコードすると、t00l_81ba3fe9}

これらをつなげるとフラグになる。

picoCTF{Ev3nt_vi3wv3r_1s_a_pr3tty_us3ful_t00l_81ba3fe9}

Bitlocker-2 - 300pt

Description

Jacky has learnt about the importance of strong passwords and made sure to encrypt the BitLocker drive with a very long and complex password. We managed to capture the RAM while this drive was opened however. See if you can break through the encryption!
Download the disk image here and the RAM dump here

Hints

  1. Try using a volatility plugin

bitlockerで暗号化したドライブのddのダンプからフラグを取得する問題その2。

ヒント1を参考に、メモリダンプからvolatility2を使って情報を取得する

まずは、適切なプロファイルを探す。

> python.exe \Python27\Scripts\vol.py -f memdump.mem imageinfo
Volatility Foundation Volatility Framework 2.6.1
INFO    : volatility.debug    : Determining profile based on KDBG search...
          Suggested Profile(s) : Win10x64_19041
                     AS Layer1 : SkipDuplicatesAMD64PagedMemory (Kernel AS)
                     AS Layer2 : FileAddressSpace (C:\Users\tetsu\ctf\picoctf\454\memdump.mem)
                      PAE type : No PAE
                           DTB : 0x1ad000L
                          KDBG : 0xf8006340eb20L
          Number of Processors : 2
     Image Type (Service Pack) : 0
                KPCR for CPU 0 : 0xfffff800617eb000L
                KPCR for CPU 1 : 0xffffb98179e67000L
             KUSER_SHARED_DATA : 0xfffff78000000000L
           Image date and time : 2025-03-10 02:58:56 UTC+0000
     Image local date and time : 2025-03-09 22:58:56 -0400

Win10x64_19041を提案される。

volatilityのbitlockerプラグインを利用して、FVEKファイルを抽出する。--dislockerオプションをつけることでdislocker向けFVEKファイルを出力することができる。

\Python27\python.exe \Python27\Scripts\vol.py -f memdump.mem bitlocker --profile=Win10x64_19041 --dislocker .\dump
Volatility Foundation Volatility Framework 2.6.1

[FVEK] Address : 0x8087865bead0
[FVEK] Cipher  : AES-XTS 128 bit (Win 10+)
[FVEK] FVEK: 4f79d4a00d5e9b25965b89581a6a599c
[DISL] FVEK for Dislocker dumped to file: .\dump\0x8087865bead0-Dislocker.fvek

dislockerでfvekファイルを-kオプションに渡す

$ sudo losetup -Pf bitlocker-2.dd
$ sudo mkdir -p /mnt/bitlocker /mnt/unlocked
$ sudo dislocker -V /dev/loop0  -k ./dump/0x8087865bead0.fvek -- /mnt/bitlocker

マウントにはなぜか失敗したので、hexdumpで直接探してみた。

$ sudo hexdump -C /mnt/bitlocker/dislocker-file | grep pico
0425e940  2b 00 00 00 18 00 00 00  70 69 63 6f 43 54 46 7b  |+.......picoCTF{|

0x0425e940にあるようなので、hexdumpを再度実行してその周辺を確認するとフラグを抽出できる

picoCTF{B1tl0ck3r_dr1v3_d3crypt3d_9029ae5b}

Discussion