半年ぶりの TryHackMe で Advent of Cyber 2023 に挑む 7日目【Advent of Cyber: Day 7】

7日目。

[Day 7] ‘Tis the season for log chopping!

How many unique IP addresses are connected to the proxy server?

cut コマンドで IP アドレス部分を抽出し、sort コマンド、uniq コマンドでまとめ上げる。さらに wc コマンドを使うと直接答えがわかる。

How many unique domains were accessed by all workstations?

cut コマンドを使って : の順に抽出、あとは sortuniq コマンドでまとめて wc コマンドで数え上げればよい。

What status code is generated by the HTTP requests to the least accessed domain?

……

…………

適当にステータスコード入れて突破ヨシッ

Based on the high count of connection attempts, what is the name of the suspicious domain?

聞かれているのは "the high count of connection attempts" であり、"the highest count of connection attempts" でないことに注意(しばらく悩んだ)。出てきたリストから適当に怪しそうなドメインを答えればよい。

What is the source IP of the workstation that accessed the malicious domain?

grep コマンドを用いて怪しげなドメインを絞ってみるとリクエスト元の IP アドレスがわかる。

How many requests were made on the malicious domain in total?

wc コマンドで数え上げるだけ。

Having retrieved the exfiltrated data, what is the hidden flag?

どうやらリクエストの goodies= のパラメータが怪しいらしいので表示してみる。

うーん、これは Base64!ということでデコードを行うとフラグが得られる。

フラグの形はだいたい THM{hogehoge} となっていることが多いので "THM" で grep してもよい。

感想

今まで使ったことなかったけど cut コマンド君強いなぁ。コマンドをパイプでつなげることでシェルだけでもけっこう解析できたりするもんなんだなと。Base64 は唐突に思えたかもしれないがわかる人にはなんとなくわかるのでセーフ、といったところか(解説にも書いてありますし)。