[THM][Note] Windows Event Logs
https://tryhackme.com/room/windowseventlogs
Task2
考え方)
- Windowsのログは、「C:\Windows\system32\winevt」に保存されている。
- 拡張子は、「evtx」もしくは「evt」。
- とにかく、イベントビューワの操作になれる感じでいろいろ触りながら進める。
- WindowsイベントにはイベントIDという、イベント固有のIDが事前に定義されているということを認識する。
Task3
How many log names are in the machine?
考え方)
- PowerShellの「Maesure-Object」を知っておく必要がある。linuxの「wc」コマンドの強化版のようなもの。
- wevtutil /? を実行してヘルプとにらめっこ。ログ名の一覧を出してくれそうなコマンドは何か?
- そのコマンドと、Measure-Objectを組合せて回答を導く。

What event files would be read when using the query-events command?
考え方)
- ヘルプコマンドをよく読む。
- 説明が書いてあるので、その部分から、回答のフォーマットに合わせて抜粋。

What is the VALUE for /q?
考え方)
同じくマニュアルをよく読み、回答フォーマットに合わせて抜粋。

Task4
例1、例8、例9のコマンドは、全てコチラのページの例を使用する。
Execute the command from Example 9. Use Microsoft-Windows-PowerShell as the log provider. How many event ids are displayed for this event provider?
考え方)
Task3でやった作業思い出す。
PS C:\Users\Administrator> (Get-WinEvent -ListProvider Microsoft-Windows-PowderShell).Events | Format-Table Id | Measure-Object
How do you specify the number of events to display?
考え方)
ドキュメントをよく読む。

When using the FilterHashtable parameter and filtering by level, what is the value for Informational?
考え方)
こんな感じで、それぞれのLogDisplayNameとLevelを確認。
PS C:\Users\Administrator> Get-WinEvent -FilterHashTable @{ LogName='Application' } | Format-Table Level, LevelDisplayName
Task5
Using the knowledge gained on Get-WinEvent and XPath, what is the query to find WLMS events with a System Time of 2020-12-15T01:09:08.940277500Z?
考え方)
- Event Viewerの詳細のXML Viewの構造と見比べながら勉強がてら、XPath構造を理解しながら勧めていく。
- 上記の設問の場合、-LogNameが何になるかを考える?(Application / System / Security)
Using Get-WinEvent and XPath, what is the query to find a user named Sam with an Logon Event ID of 4720?
考え方)
- Event Viewerの詳細のXML Viewの構造と見比べながら勉強がてら、XPath構造を理解しながら勧めていく。
- 上記の設問の場合、-LogNameが何になるかを考える?(Application / System / Security)
What is the Provider Name?
考え方)
- プロバイダ名は一番わかり易いところに表示されているので、場所を覚えておく。

Task7
- デスクトップ上の、merged.evtxファイルをダブルクリックで開いて、すべての質問をこのイベントログを使用して回答する。
What event ID is to detect a PowerShell downgrade attack?
考え方)
- PowerShellダウングレード攻撃についてググるとたくさん情報が出てくる。
- その中から、PowerShellがダウングレードして使用された場合の、イベントIDを調べて回答。
A Log clear event was recorded. What is the ‘Event Record ID’?
- EventID 「104」、Task Category 「Log clear」あたりで抽出。

What is the name of the computer?

What is the name of the first variable within the PowerShell command?
考え方)
- 今までの質問とコンテキストが変わっている。
- ログクリアなどから離れて、新たにPowerShellの最初の変数名を探す。
- Filterから、ログソースをPower Shellで検索して、一番最初のレコードを確認する。


What is the Group Security ID of the group she enumerated?
What C2 is the adve
次のお題を終わらせて、対象なるEventIDを確定させてからの方がやりやすい。

What is the event ID?
考え方)
Scenario 4 (Questions 8 & 9): A report came in that an intern was suspected of running unusual commands on her machine, such as enumerating members of the Administrators group. A senior analyst suggested searching for “C:\Windows\System32\net1.exe
“. Confirm the suspicion.
とあるので、以下の路線で調べる。
https://docs.datadoghq.com/ja/security/default_rules/windows-event-net-cmd-local-admin-enumeration/
what event is enumerated administrators group
で、検索。調べると同じようなEvent idが見つかる。
4798 | ユーザーアカウントのローカルグループメンバーシップが列挙された場合に記録されるイベント。 |
4799 | セキュリティグループのメンバーシップが列挙された場合に記録されるイベント。 |
シナリオには以下のように書いてある。
Scenario 4 (Questions 8 & 9): A report came in that an intern was suspected of running unusual commands on her machine, such as enumerating members of the Administrators group. A senior analyst suggested searching for “C:\Windows\System32\net1.exe
“. Confirm the suspicion.
管理者グループのメンバーが列挙されたとなっているので答えは1つ。