Windows Event Logs
Zero 2 Hero
Nate Guagenti -- @neu5ron�Adam Swan -- @acalarch
The 3 live presentations are here:��Derbycon:�https://www.youtube.com/watch?v=8AKxt-5RB6w�
Bloomcon:�https://youtu.be/H3t_kHQG1Js?t=1m44s��BSides Detroit:�https://www.youtube.com/watch?v=jiHP0nQoAfs
> ((((((((^W^h^Oa^mi /^A^L^l))))))))
Overview
Why Windows Event Logs?
#1 Most Important Prereq
Become acquainted/friends with your system & windows admins as well as….HELPDESK and even HR! Because they are:
Answering Customer’s: “But what’s in it for me”
Windows EIDs can be used to benefit the other IT departments.
Come up with some more ideas!
Windows Event Forwarding
Windows provides a framework to centralize log collection (it’s free!)
WEF Server
SIEM/Search
Group Policy
Windows Remote Management
Wecutil OR
Windows Event Viewer
Winlog eats�OR NXLog
Disclaimer
Environments Collected From...
We monitor events from five environments
How many logs (EPS) are we talking about?
Events Per 2 Hours Per Channel (no filtering 600+ hosts)
1 dot = 2 hours
10AM
10PM
Description of our Cuckoo Malware Lab
-malshare
-virusshare
-malwr
-virustotal
-samples from friends
Cuckoo
ELK
Python scripts submit 500 unique samples/day
https://github.com/cuckoosandbox/cuckoo
Host Configured with WEF�+ Special Sauce To Tag Cuckoo Submission ID to each Windows Event
https://github.com/elastic/elasticsearch�Elastic -- dynamic field generation & free.�2,000 keys/fields and counting
Alerting vs. Exploring
Some Windows Events can become automated alerts, however overall we’ve had more success “exploring” than alerting.
WTHeck do I do with what I found!?
An easy mistake to make while you are exploring the data is to discover an anomaly and escalate before doing some historical searches / sanity checks.
Keep in Mind: Logs Can Be Fragile
Anti-Forensics EID 1100 (also 1102 or System 104)
Stuff We Found
Event ID 4688 (Process Creation - Easy):
(Split up queries for system accounts by querying for activity associated with accounts ending with $)
https://github.com/arntsonl/calc_security_poc
Continued… enhance with “(reg OR regsvr OR msbuild OR netsh OR sdbinst.exe)” and much more!
Continued… (Deep Panda Dropper)
Adding Local Admin (4722, account creation)
Task Scheduling (4698 OR 106)
Aggregation on Unique Name
Bad Logins (4776)
Repeat Offenders / Probable Configuration Issue
Potentially Bad
WMI-Activity/Operational (Logs Errors Only)
Event Tracing for Windows (ETW)
Enabling ETW Log in Event Viewer
~Not real time~
~Verbosity is changed in registry~
WMI-Activity/Trace (Logs *all WMI)
Basic WMI Queries for Anti-Analysis
WMI-Activity/Trace (Continued)
Process Creation
EventConsumer Persistence (Powersploit)
WMI-Activity/Trace (Continued)
Remote WMI
Using WEF to subscribe to custom logs
Why not push script through GPO and log result to custom windows log? In a WEF enabled environment, the results will be securely sent back without you having to write supporting code..
PowerShell
Creating Scriptblock text (1 of 1):
#xgabjohcroansnh
sleep(15);try{
#iyiyzjv
function gdelegate{
#dsydimqnn
Param ([Parameter(Position=0,Mandatory=$True)] [Type[]] $Parameters,[Parameter(Position=1)] [Type] $ReturnType=[Void]);
#nxwrqscy
$TypeBuilder=[AppDomain]::CurrentDomain.DefineDynamicAssembly((New-Object System.Reflection.AssemblyName("ReflectedDelegate")),[System.Reflection.Emit.AssemblyBuilderAccess]::Run).DefineDynamicModule("InMemoryModule",$false).DefineType("XXX","Class,Public,Sealed,AnsiClass,AutoClass",[System.MulticastDelegate]);
#sedibjc
……………snip………………….
[Byte[]] $sc32 = 0x55,0x8B,0xEC,0x81,0xC4,<#ycf#>0x00,0xFA,0xFF,0xFF,0x53,0x56,0x57,0x53,0x56,0x57,0xFC,0x31,0xD2,<#koy#>0x64,0x8B,0x52,0x30,0x8B,0x52,0x0C,0x8B,0x52,0x14,0x8B,<#sml#>0x72,0x28,0x6A,<#zb#>0x18,0x59,0x31,<#eev#>0xFF,0x31,<#bv#>0xC0,0xAC,0x3C,0x61,0x7C,0x02,0x2C,0x20,0xC1,0xCF,0x0D,0x01,0xC7,0xE2,0xF0,0x81,0xFF,0x5B,0xBC,0x4A,0x6A,0x8B,0x5A,0x10,0x8B,0x12,0x75,0xDB,0x89,0x5D,0xFC,0x5F,0x5E,0x5B,0x8B,0x45,0xFC,0x89,0x45,0xD4,0x8B,0x45,0xD4,0x66,0x81,0x38,0x4D,<#vd#>0x5A,0x0F,0x85,0x0F,0x02,0x00,0x00,0x8B,0x45,0xFC,0x33,0xD2,0x52,0x50,0x8B,0x45,0xD4,0..
Kovter? Malware
AD: Right to Control All Users
Query = “EventID:4704 AND SeEnableDelegationPrivilege”
https://www.harmj0y.net/blog/activedirectory/the-most-dangerous-user-right-you-probably-have-never-heard-of/
AD: Enabling More Efficient Hash Cracking (ie: Kerberoast + more)
Query = “EventID:4738 AND (Preauth OR Encrypted OR DES)"
�https://adsecurity.org/?p=2053
https://www.harmj0y.net/blog/activedirectory/roasting-as-reps/
Using Other’s Creds -- detect any runas or using different credentials for shared drive or even logging into a hosts (guest) VM
Query = “EventID:4648” + some elbow grease (950,000 events down to 5,000 in a few seconds)�OR just look for target localhost to narrow down to very few events for a quick win..
AD: Backdoor Using ServicePrincipalName
Query = “EventID:5136 AND ObjectClass:user AND AttributeLDAPDisplayName:servicePrincipalName”
https://adsecurity.org/?p=3466
AD:Backdoor via Delegation (msDS-AllowedToDelegateTo)
Query = “EventID:4738 AND NOT AllowedToDelegateTo.raw:"-"”
Wireless Attacks & Misuse (WEP/Unauth, Evil Twin, Screen Bypass/Unlock)
Query = ‘Channel:”Microsoft-Windows-WLAN-AutoConfig\Operational” AND EventID:8001’
Few More Hunting Possibilities
SIGMA Framework! by @blubbfiction & @cyb3rops
https://github.com/Neo23x0/sigma
Monitor Your Monitoring
One-offs, Gotchas, and Recommendations
Recommended GPOs
Computer Configuration Settings under “Computer Configuration\Policies\Administrative Templates\System\Group Policy”:
Computer Configuration Settings under “Computer Configuration\Policies\Windows Settings\Security Settings\Local Policies\Security Options”:
Resources for WEF Transport
Resources for Additional/Recommended Auditing
Stay Up to Date!
HELP US! We have no idea what we are doing!
We have not even scratched the surface.... We need feedback and collaboration!
Questions?
Thanks 4 Listening!�@neu5ron�@acalarch
Resources & Credit (1 of 3)
Resources & Credit (2 of 3)
Resources & Credit (3 of 3)