# T1654 - Log Enumeration

## Description from ATT&CK

> Adversaries may enumerate system and service logs to find useful data. These logs may highlight various types of valuable insights for an adversary, such as user authentication records ([Account Discovery](https://attack.mitre.org/techniques/T1087)), security or vulnerable software ([Software Discovery](https://attack.mitre.org/techniques/T1518)), or hosts within a compromised network ([Remote System Discovery](https://attack.mitre.org/techniques/T1018)).
> 
> Host binaries may be leveraged to collect system logs. Examples include using `wevtutil.exe` or [PowerShell](https://attack.mitre.org/techniques/T1059/001) on Windows to access and/or export security event information.(Citation: WithSecure Lazarus-NoPineapple Threat Intel Report 2023)(Citation: Cadet Blizzard emerges as novel threat actor) In cloud environments, adversaries may leverage utilities such as the Azure VM Agent’s `CollectGuestLogs.exe` to collect security logs from cloud hosted infrastructure.(Citation: SIM Swapping and Abuse of the Microsoft Azure Serial Console)
> 
> Adversaries may also target centralized logging infrastructure such as SIEMs. Logs may also be bulk exported and sent to adversary-controlled infrastructure for offline analysis.
> 
> In addition to gaining a better understanding of the environment, adversaries may also monitor logs in real time to track incident response procedures. This may allow them to adjust their techniques in order to maintain persistence or evade defenses.(Citation: Permiso GUI-Vil 2023)

[Source](https://attack.mitre.org/techniques/T1654)

## Atomic Tests

- [Atomic Test #1: Get-EventLog To Enumerate Windows Security Log](#atomic-test-1-get-eventlog-to-enumerate-windows-security-log)
- [Atomic Test #2: Enumerate Windows Security Log via WevtUtil](#atomic-test-2-enumerate-windows-security-log-via-wevtutil)

### Atomic Test #1: Get-EventLog To Enumerate Windows Security Log

Uses the built-in PowerShell commandlet Get-EventLog to search for 'SYSTEM' keyword and saves results to a text file.

This technique was observed in a [TheDFIRReport case](https://thedfirreport.com/2023/04/03/malicious-iso-file-leads-to-domain-wide-ransomware/) 
where the threat actor enumerated the Windows Security audit log to determine user accounts and associated IPv4 addresses.

Successful execution will save matching log events to the users temp folder.

**Supported Platforms:** Windows

**auto_generated_guid:** `a9030b20-dd4b-4405-875e-3462c6078fdc`

#### Attack Commands: Run with `powershell`! Elevation Required (e.g. root or admin)

```powershell
powershell -c {get-eventlog 'Security' | where {$_.Message -like '*SYSTEM*'} | export-csv $env:temp\T1654_events.txt}
```

#### Cleanup Commands

```powershell
powershell -c "remove-item $env:temp\T1654_events.txt -ErrorAction Ignore"
```
### Atomic Test #2: Enumerate Windows Security Log via WevtUtil

WevtUtil is a command line tool that can be utilised by adversaries to gather intelligence on a targeted Windows system's logging infrastructure. 

By executing this command, malicious actors can enumerate all available event logs, including both default logs such as Application, Security, and System
as well as any custom logs created by administrators. 

This information provides valuable insight into the system's logging mechanisms, potentially allowing attackers to identify gaps or weaknesses in the logging configuration

**Supported Platforms:** Windows

**auto_generated_guid:** `fef0ace1-3550-4bf1-a075-9fea55a778dd`

#### Attack Commands: Run with `command_prompt`!

```cmd
wevtutil enum-logs
```