Top Related Projects
Open Source Security Events Metadata (OSSEM)
Windows Events Attack Samples
Main Sigma Rule Repository
Loki - Simple IOC and YARA Scanner
Super timeline all the things
Quick Overview
DeepBlueCLI is a PowerShell module for threat hunting and log analysis. It processes various Windows event logs and other data sources to detect potential security threats and malicious activities. The tool is designed to assist blue teams and security analysts in identifying suspicious patterns and behaviors in Windows environments.
Pros
- Comprehensive analysis of multiple Windows log types (Security, System, PowerShell, etc.)
- Easy to use with pre-built detection rules for common attack techniques
- Customizable and extensible for specific organizational needs
- Lightweight and can be run directly on Windows systems without installation
Cons
- Limited to Windows environments and PowerShell
- Requires access to Windows event logs, which may not always be available or complete
- False positives may occur, requiring manual review and tuning
- Limited visualization capabilities compared to more advanced SIEM solutions
Code Examples
- Basic usage to analyze Security event logs:
.\DeepBlue.ps1 -log security
- Analyzing PowerShell logs with custom output:
.\DeepBlue.ps1 -log powershell -output csv
- Processing a specific event log file:
.\DeepBlue.ps1 -file C:\Logs\Security.evtx
Getting Started
-
Clone the repository:
git clone https://github.com/sans-blue-team/DeepBlueCLI.git
-
Navigate to the DeepBlueCLI directory:
cd DeepBlueCLI
-
Run DeepBlue.ps1 with desired parameters:
.\DeepBlue.ps1 -log security
Note: Ensure you have the necessary permissions to read Windows event logs. For best results, run the script with administrative privileges.
Competitor Comparisons
Open Source Security Events Metadata (OSSEM)
Pros of OSSEM
- Comprehensive data model for security events and logs
- Extensive documentation and community support
- Flexible and adaptable to various security use cases
Cons of OSSEM
- Steeper learning curve due to its complexity
- Requires more setup and configuration time
- May be overkill for smaller organizations or simpler use cases
Code Comparison
OSSEM (YAML format for data dictionaries):
- name: process_id
type: integer
description: Process ID of the process
sample_value: 4732
references:
- https://docs.microsoft.com/en-us/windows/win32/procthread/process-and-thread-functions
DeepBlueCLI (PowerShell script for log analysis):
if ($EventID -eq 4732) {
$ProcessID = $Event.ProcessID
Write-Output "Process ID: $ProcessID"
}
While both projects deal with security event analysis, OSSEM focuses on standardizing data models, whereas DeepBlueCLI provides ready-to-use scripts for immediate log analysis. OSSEM offers a more comprehensive approach to security event management, while DeepBlueCLI is more straightforward for quick investigations.
Windows Events Attack Samples
Pros of EVTX-ATTACK-SAMPLES
- Provides a comprehensive collection of Windows Event Log samples for various attack techniques
- Includes detailed metadata and descriptions for each sample, aiding in understanding and analysis
- Regularly updated with new samples, reflecting current attack trends
Cons of EVTX-ATTACK-SAMPLES
- Lacks built-in analysis tools, requiring external tools for log parsing and investigation
- May overwhelm users with the sheer volume of samples without guided analysis paths
- Focuses solely on providing raw data, without offering detection rules or automated analysis
Code Comparison
While a direct code comparison isn't applicable due to the nature of these repositories, we can compare their content structure:
EVTX-ATTACK-SAMPLES:
/Execution
/T1059_001_Command_and_Scripting_Interpreter
/CMD
event.evtx
metadata.yaml
DeepBlueCLI:
function Find-CommandLine {
param ($EventID, $CommandLine, $CreationUtcTime, $LogFile, $Message)
# Function logic...
}
EVTX-ATTACK-SAMPLES provides organized event log samples, while DeepBlueCLI offers PowerShell functions for log analysis.
Main Sigma Rule Repository
Pros of Sigma
- Broader scope: Sigma is a generic signature format for various log sources, while DeepBlueCLI focuses primarily on Windows event logs
- Larger community and wider adoption: Sigma has more contributors and is used by many security tools and platforms
- Extensive rule set: Sigma offers a vast collection of detection rules covering various attack techniques and scenarios
Cons of Sigma
- Steeper learning curve: Sigma requires understanding its specific syntax and rule structure
- More complex setup: Implementing Sigma rules often requires additional tools or converters for specific SIEM platforms
Code Comparison
Sigma rule example:
title: Suspicious PowerShell Download
detection:
selection:
EventID: 4104
ScriptBlockText|contains:
- 'Net.WebClient'
- 'DownloadFile'
condition: selection
DeepBlueCLI PowerShell command:
.\DeepBlue.ps1 -log security
Both tools aim to detect suspicious activities, but Sigma provides a more flexible and standardized approach for creating detection rules across various log sources, while DeepBlueCLI offers a simpler, Windows-focused solution for quick analysis of event logs.
Loki - Simple IOC and YARA Scanner
Pros of Loki
- Multi-platform support (Windows, Linux, macOS)
- Extensive set of pre-defined YARA rules for threat detection
- Regular updates and community contributions
Cons of Loki
- Requires more setup and configuration
- Can be resource-intensive for large-scale scans
- Steeper learning curve for customizing rules
Code Comparison
DeepBlueCLI (PowerShell):
$events = Get-WinEvent -FilterHashtable @{LogName='Security';ID=4624}
foreach ($event in $events) {
# Process login events
}
Loki (Python):
for root, dirs, files in os.walk(startpath):
for file in files:
if file.endswith(tuple(FILENAME_IOCS.keys())):
# Check file against YARA rules
While DeepBlueCLI focuses on analyzing Windows event logs using PowerShell, Loki scans file systems for indicators of compromise using Python and YARA rules. DeepBlueCLI is more specialized for Windows environments, while Loki offers broader platform support and flexibility in threat detection.
Super timeline all the things
Pros of plaso
- More comprehensive timeline analysis tool, supporting a wide range of log sources and file formats
- Highly scalable and suitable for large-scale investigations
- Actively maintained with regular updates and a large community
Cons of plaso
- Steeper learning curve and more complex setup process
- Requires more system resources and processing time for large datasets
- Less focused on specific Windows event log analysis compared to DeepBlueCLI
Code Comparison
plaso:
parser = argparse.ArgumentParser(description='Process some files.')
parser.add_argument('files', metavar='FILE', nargs='+', help='Files to process')
args = parser.parse_args()
storage_writer = storage_factory.StorageFactory.CreateStorageWriter('sqlite')
knowledge_base = knowledge_base.KnowledgeBase()
DeepBlueCLI:
$events = Get-WinEvent -FilterHashtable @{LogName='Security';ID=4624}
foreach ($event in $events) {
$eventXML = [xml]$event.ToXml()
$ip = $eventXML.Event.EventData.Data | Where-Object {$_.Name -eq 'IpAddress'} | Select-Object -ExpandProperty '#text'
}
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
DeepBlueCLI
DeepBlueCLI - a PowerShell Module for Threat Hunting via Windows Event Logs
Eric Conrad, Backshore Communications, LLC
deepblue at
backshore dot
net
Twitter: @eric_conrad
Sample EVTX files are in the .\evtx directory
Note If your antivirus freaks out after downloading DeepBlueCLI: it's likely reacting to the included EVTX files in the .\evtx directory (which contain command-line logs of malicious attacks, among other artifacts). EVTX files are not harmful. You may need to configure your antivirus to ignore the DeepBlueCLI directory.
Table of Contents
- Usage
- Windows Event Logs processed
- Detected events
- Examples
- Output
- Logging setup
- See the DeepBlue.py Readme for information on DeepBlue.py
- See the DeepBlueHash Readme for information on DeepBlueHash (detective safelisting using Sysmon event logs)
Usage:
.\DeepBlue.ps1 <event log name> <evtx filename>
See the Set-ExecutionPolicy Readme if you receive a 'running scripts is disabled on this system' error.
Process local Windows security event log (PowerShell must be run as Administrator):
.\DeepBlue.ps1
or:
.\DeepBlue.ps1 -log security
Process local Windows system event log:
.\DeepBlue.ps1 -log system
Process evtx file:
.\DeepBlue.ps1 .\evtx\new-user-security.evtx
Windows Event Logs processed
- Windows Security
- Windows System
- Windows Application
- Windows PowerShell
- Sysmon
Command Line Logs processed
See Logging setup section below for how to configure these logs
- Windows Security event ID 4688
- Windows PowerShell event IDs 4103 and 4104
- Sysmon event ID 1
Detected events
- Suspicious account behavior
- User creation
- User added to local/global/universal groups
- Password guessing (multiple logon failures, one account)
- Password spraying via failed logon (multiple logon failures, multiple accounts)
- Password spraying via explicit credentials
- Bloodhound (admin privileges assigned to the same account with multiple Security IDs)
- Command line/Sysmon/PowerShell auditing
- Long command lines
- Regex searches
- Obfuscated commands
- PowerShell launched via WMIC or PsExec
- PowerShell Net.WebClient Downloadstring
- Compressed/Base64 encoded commands (with automatic decompression/decoding)
- Unsigned EXEs or DLLs
- Service auditing
- Suspicious service creation
- Service creation errors
- Stopping/starting the Windows Event Log service (potential event log manipulation)
- Mimikatz
lsadump::sam
- EMET & Applocker Blocks
...and more
Examples
Event | Command |
---|---|
Event log manipulation | .\DeepBlue.ps1 .\evtx\disablestop-eventlog.evtx |
Metasploit native target (security) | .\DeepBlue.ps1 .\evtx\metasploit-psexec-native-target-security.evtx |
Metasploit native target (system) | .\DeepBlue.ps1 .\evtx\metasploit-psexec-native-target-system.evtx |
Metasploit PowerShell target (security) | .\DeepBlue.ps1 .\evtx\metasploit-psexec-powershell-target-security.evtx |
Metasploit PowerShell target (system) | .\DeepBlue.ps1 .\evtx\metasploit-psexec-powershell-target-system.evtx |
Mimikatz lsadump::sam | .\DeepBlue.ps1 .\evtx\mimikatz-privesc-hashdump.evtx |
New user creation | .\DeepBlue.ps1 .\evtx\new-user-security.evtx |
Obfuscation (encoding) | .\DeepBlue.ps1 .\evtx\Powershell-Invoke-Obfuscation-encoding-menu.evtx |
Obfuscation (string) | .\DeepBlue.ps1 .\evtx\Powershell-Invoke-Obfuscation-string-menu.evtx |
Password guessing | .\DeepBlue.ps1 .\evtx\smb-password-guessing-security.evtx |
Password spraying | .\DeepBlue.ps1 .\evtx\password-spray.evtx |
PowerSploit (security) | .\DeepBlue.ps1 .\evtx\powersploit-security.evtx |
PowerSploit (system) | .\DeepBlue.ps1 .\evtx\powersploit-system.evtx |
PSAttack | .\DeepBlue.ps1 .\evtx\psattack-security.evtx |
User added to administrator group | .\DeepBlue.ps1 .\evtx\new-user-security.evtx |
Output
DeepBlueCLI outputs in PowerShell objects, allowing a variety of output methods and types, including JSON, HTML, CSV, etc.
For example:
Output Type | Syntax |
---|---|
CSV | .\DeepBlue.ps1 .\evtx\psattack-security.evtx | ConvertTo-Csv |
Format list (default) | .\DeepBlue.ps1 .\evtx\psattack-security.evtx | Format-List |
Format table | .\DeepBlue.ps1 .\evtx\psattack-security.evtx | Format-Table |
GridView | .\DeepBlue.ps1 .\evtx\psattack-security.evtx | Out-GridView |
HTML | .\DeepBlue.ps1 .\evtx\psattack-security.evtx | ConvertTo-Html |
JSON | .\DeepBlue.ps1 .\evtx\psattack-security.evtx | ConvertTo-Json |
XML | .\DeepBlue.ps1 .\evtx\psattack-security.evtx | ConvertTo-Xml |
Logging setup
Security event 4688 (Command line auditing):
Enable Windows command-line auditing: https://support.microsoft.com/en-us/kb/3004375
Security event 4625 (Failed logons):
Requires auditing logon failures: https://technet.microsoft.com/en-us/library/cc976395.aspx
PowerShell auditing (PowerShell 5.0):
DeepBlueCLI uses module logging (PowerShell event 4103) and script block logging (4104). It does not use transcription.
See: https://www.fireeye.com/blog/threat-research/2016/02/greater_visibilityt.html
To get the PowerShell commandline (and not just script block) on Windows 7 through Windows 8.1, add the following to \Windows\System32\WindowsPowerShell\v1.0\profile.ps1
$LogCommandHealthEvent = $true
$LogCommandLifecycleEvent = $true
See the following for more information:
- https://logrhythm.com/blog/powershell-command-line-logging/
- http://hackerhurricane.blogspot.com/2014/11/i-powershell-logging-what-everyone.html
Thank you: @heinzarelli and @HackerHurricane
Sysmon
Install Sysmon from Sysinternals: https://docs.microsoft.com/en-us/sysinternals/downloads/sysmon
DeepBlue and DeepBlueHash currently use Sysmon events, 1, 6 and 7.
Log SHA256 hashes. Others are fine; DeepBlueHash will use SHA256.
Top Related Projects
Open Source Security Events Metadata (OSSEM)
Windows Events Attack Samples
Main Sigma Rule Repository
Loki - Simple IOC and YARA Scanner
Super timeline all the things
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot