はまやんはまやんはまやん

hamayanhamayan's blog

Hack The Box Sherlocks - OpTinselTrace-4 Writeup

https://app.hackthebox.com/sherlocks/OpTinselTrace-4
Hack The Box Sherlocksとは

Sherlock Scenario

Printers are important in Santa’s workshops, but we haven’t really tried to secure them! The Grinch and his team of elite hackers may try and use this against us! Please investigate using the packet capture provided! The printer server IP Address is 192.168.68.128
プリンターはサンタさんのワークショップでは重要ですが、私たちはプリンターを確保しようとしていませんでした。グリンチと彼のエリートハッカーチームがこれを利用して私たちを攻撃しようとするかもしれません! 提供されているパケット キャプチャを使用して調査してください。プリンターサーバーのIPアドレスは192.168.68.128です。

2023年のSherlocksクリスマスイベント問題の4問目。
ネットワークパケットを解析する問題。

Tasks

Task 1

The performance of the network printer server has become sluggish, causing interruptions in the workflow at the North Pole workshop. Santa has directed us to generate a support request and examine the network data to pinpoint the source of the issue. He suspects that the Grinch and his group may be involved in this situation. Could you verify if there is an IP Address that is sending an excessive amount of traffic to the printer server?
ネットワーク プリンター サーバーのパフォーマンスが低下し、北極の作業場でのワークフローが中断されました。サンタさんは、サポート リクエストを作成し、ネットワーク データを調べて問題の原因を特定するように私たちに指示しました。彼は、グリンチとそのグループがこの状況に関与しているのではないかと疑っています。プリンタ サーバーに過剰な量のトラフィックを送信している IP アドレスがあるかどうかを確認していただけますか?

プリンターサーバーのIPアドレスは192.168.68.128です。

とあるので、ここに大量のトラフィックを送信しているIPアドレスを探せばいい。
WireSharkの「統計 > 対話」のIPv4を見てみよう。
すると172.17.79.133と192.168.68.128で多くの通信が見られる。
172.17.79.133が答え。

Task 2

Bytesparkle being the technical Lead, found traces of port scanning from the same IP identified in previous attack. Which port was then targeted for initial compromise of the printer?
技術リーダーである Bytesparkle は、以前の攻撃で特定されたのと同じ IP からのポート スキャンの痕跡を発見しました。では、プリンタの最初の侵害の標的となったのはどのポートでしょうか?

(ip.src == 172.17.79.133 && ip.dst == 192.168.68.128) || (ip.src == 192.168.68.128 && ip.dst == 172.17.79.133)でフィルタリングして内容を見ていこう。
上から見ていくとpingの後、確かにポートスキャンっぽく複数ポートに接続している。
スキャンのあと9100/tcpで色々やっているので9100/tcpを攻撃することにしたのだろうと想像できる。
9100が答え。

Task 3

What is the full name of printer running on the server?
サーバー上で実行されているプリンターのフルネームは何ですか?

9100/tcpを調べると 9100番ポートはそのようなポート番号の一つで、コンピュータとネットワークプリンタがIPネットワーク上で通信するためのRAWプロトコルなどで利用される。 とのこと。
TCPストリーム28を追跡で見てみると、そこそこ視認できる情報がある。
プリンタ名っぽいやつを答えると正答 NorthPole HP LaserJet 4200n

Task 4

Grinch intercepted a list of nice and naughty children created by Santa. What was name of the second child on the nice list?
グリンチはサンタが作成した優しくていたずらな子供たちのリストを傍受しました。素敵なリストの 2 番目の子供の名前は何ですか?

Task 3を見てみるとリストが取得できている。

.%-12345X@PJL FSUPLOAD NAME="0:/christmas/2023/Nice-kids/list1.txt" OFFSET=0 SIZE=180
@PJL ECHO DELIMITER56482

.%-12345X@PJL FSUPLOAD FORMAT:BINARY NAME="0:/christmas/2023/Nice-kids/list1.txt" OFFSET=0 SIZE=180

    Jennifer Sanchez
    Douglas Price
    Joshua Ross
    Catherine Bailey
    Martha Clark
    Ruby Kelly
    Edward Parker
    Tammy James
    Lori Robinson
    Wayne Gonzales
@PJL ECHO DELIMITER56482

Rooting a Printer: From Security Bulletin to Remote Code Execution - Blog | Tenable®
これか、こういう攻撃があるのか。
2番目のDouglas Priceが答え。

Task 5

The Grinch obtained a print job instruction file intended for a printer used by an employee named Elfin. It appears that Santa and the North Pole management team have made the decision to dismiss Elfin. Could you please provide the word for word rationale behind the decision to terminate Elfin's employment?
グリンチは、エルフィンという名前の従業員が使用するプリンタを対象とした印刷ジョブ指示ファイルを入手しました。サンタと北極管理チームはエルフィンの解雇を決定したようだ。エルフィン氏の雇用終了の決定の根拠を一言一句説明していただけますか。

これもTask 3で得られた情報から答えることができる。

@PJL FSUPLOAD FORMAT:BINARY NAME="0:/saveDevice/SavedJobs/InProgress/Layoff-notice/Personal-Notice-Employee43.pcl" OFFSET=0 SIZE=696
<ESC>%-12345X@PJL JOB NAME="Elfin-Layoff"
@PJL ENTER LANGUAGE=PCL
<ESC>E                                      
<ESC>&l0E                                   
<ESC>(s1p12v0s3b16602T                      
<ESC>&a1L                                   
<ESC>*p150x300Y                             
<ESC>*c0t0b3T                               
Warning : This print is only meant for Elfin and higher management.

Reason for layoff : The addressed employee is confirmed to be working with grinch and team. According to Clause 69 , This calls for an immediate expulsion.

<ESC>&l2A                                      % Perform form feed to eject the page
@PJL EOJ NAME="MerryChristmasJob"
<ESC>%-12345X  @PJL ECHO DELIMITER19325

The addressed employee is confirmed to be working with grinch and team. According to Clause 69 , This calls for an immediate expulsion.が答え。

Task 6

What was the name of the scheduled print job?
スケジュールされた印刷ジョブの名前は何でしたか?

(ip.src == 172.17.79.133 && ip.dst == 192.168.68.128) || (ip.src == 192.168.68.128 && ip.dst == 172.17.79.133)にフィルタリングを戻して再度確認すると、
TCPストリーム46がポート9100/tcpで残っている。
追跡で確認してみると、ScheduledJobsを確認している。
JOB NAME="MerryChristmas+BonusAnnouncment"というのを見て取ることができる。
MerryChristmas+BonusAnnouncmentが答え。

Task 7

Amidst our ongoing analysis of the current packet capture, the situation has escalated alarmingly. Our security system has detected signs of post-exploitation activities on a highly critical server, which was supposed to be secure with SSH key-only access. This development has raised serious concerns within the security team. While Bytesparkle is investigating the breach, he speculated that this security incident might be connected to the earlier printer issue. Could you determine and provide the complete path of the file on the printer server that enabled the Grinch to laterally move to this critical server?
現在のパケット キャプチャの分析を継続している最中に、状況は驚くほどエスカレートしています。当社のセキュリティ システムは、SSH キーのみのアクセスで安全であるはずの非常に重要なサーバー上でエクスプロイト後のアクティビティの兆候を検出しました。この展開により、セキュリティ チーム内に深刻な懸念が生じました。Bytesparkle はこの侵害を調査中ですが、このセキュリティ インシデントが以前のプリンターの問題に関連しているのではないかと推測しました。グリンチがこの重要なサーバーに横方向に移動できるようにした、プリンター サーバー上のファイルの完全なパスを特定して提供していただけますか?

Task 6の箇所の続きを見ると、SSH鍵がやり取りされているのを見ることができる。

@PJL FSUPLOAD FORMAT:BINARY NAME="0:/Administration/securitykeys/ssh_systems/id_rsa" OFFSET=0 SIZE=1914
#This is a backup key for christmas.gifts server. Bytesparkle recommended me this since in christmas days everything gets mixed up in all the chaos and we can lose our access keys to the server just like we did back in 2022 christmas.
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEA2itnkTXlHEPgyuutXEm/vOWJCfRVt+VXhz0bLJaftUjl9phz
0cS+3qInP+JEkUyWOtkfDrxapQGOi1WASyup/Tk4HE+yQ6pPFSPCsFKZc4gPVIUF
SbhYAa+hw1FLRiWb3hXbLDjgvLXDySI39tq16jEvr/dRdIiajE4GJHGZ5/Pi+fum
LxwxKqSu4WS/LCAgC7kSIm7vgY2/bmf6sTgRC0uHHVJ68E6vDp2m+h38R3Kj/oL7
0x3VQNMgq835vH1nZkGIAwxy+7/bbXUccz+qeMOXBUHI1e3x7o5RpNwuW6JLhrDp
...

これより/Administration/securitykeys/ssh_systems/id_rsaと分かる。

Task 8

What is size of this file in bytes?
このファイルのサイズはバイト単位でいくらですか?

Task 7にSIZEも書いてあるので、それを答える 1914

Task 9

What was the hostname of the other compromised critical server?
侵害された他の重要なサーバーのホスト名は何でしたか?

Task 7のコメントに書いてある christmas.gifts

Task 10

When did the Grinch attempt to delete a file from the printer? (UTC)
グリンチはいつプリンターからファイルを削除しようとしましたか? (UTC

(ip.src == 172.17.79.133 && ip.dst == 192.168.68.128) || (ip.src == 192.168.68.128 && ip.dst == 172.17.79.133)にフィルタリングを戻して三度確認すると、
TCPストリーム71がポート9100/tcpで残っている。
追跡で確認してみると、@PJL FSDELETE NAME="0:/Administration/securitykeys/ssh_systems/id_rsa"という実行が見つかる。
これはパケットのNo.3676であり、この時間を見ると2023-12-08 12:18:14が答え。
(日本語版だとJST,UTC+9になっているので9時間戻してUTCで答えること)