SOCC07 - User and Entity Behavior Analytics
UEBA
- User and Entity Behavior Analytics (UEBA) aggregates logs and analyses behavior.
- Works by assigning values to events, and sending alerts once a certain threshold is reached
- Example config:
- Successful user login is +1
- User logoff is -1
- Unsuccessful user login is +2
- Threshold is 6
- If a user logs in 6 times successfully or fails to login 3 times, an alert is generated
- Requires significant effort to tune and configure a baseline
- Sometimes has a bad-rap with sysadmins and defenders because it can be so effortful
baselining
- Baselining is the assessment of a system or network to establish a "normal use" definition
- Necessary when looking for anomalies and UEBA
- The amount of time it takes to establish a baseline depends on the size and complexity of an organization
- More time reduces the number of false positives, but if you're already compromised or compromised during the baseline, could lead to false negatives.
Log Analysis
- Logs are critical in understanding how users behave
- Logs can be found on hosts, network devices, servers, services, etc.
- LogonTracer
- AD integrated
- Track logins across systems and networks
- Important Event IDs
- Windows Security Log Encyclopedia is a great resource for understanding Windows Events
- Log on and log off events
- 4624 Logon
- 4634 Logoff
- ACL’d object access - Audit requirement
- 4662 - An operation was performed on an object
- Process launch and usage
- 4688 - A new process has been created
- Tasks
- 4698 - A scheduled task was created
- 4702 - A scheduled task was updated
- Acct Lockout + Source IP
- 4770 - A user account was locked out
- 4625 - An account failed to log on
- Firewall (noisy connections)
- 5152 - The Windows Filtering Platform has blocked a packet
- 5154 - The Windows Filtering Platform has permitted an application or service to listen on a port for incoming connections
- 5156 - The Windows Filtering Platform has permitted a connection
- 5157 - The Windows Filtering Platform has blocked a connection
- Special Privileges
- 4648 - A logon was attempted using explicit credentials
- "Explicit" means not going through the usual authentication process
- e.g., Scheduled Tasks or "RUNAS" commands
- 4672 - Special Privileges assigned to new logon
- 4673 - A privileged service was called
- Kerberoasting
6. 4769 - A Kerberos service ticket was requested
7. 4771 - Kerberos pre-authentication failed
- Network Shares
- e.g.,
\\C$\Users\JohnDoe
or \\*\IPC$
- 5140 - A network share object was accessed
- And many more...
- How many logs should you gather?
- Vendors often say "log everything"
- While not wrong, logs are only useful in preventing or responding to an attack if you can analyze them
- "Logging everything" without the ability to analyze them is only helpful in post-event reconstruction
- In my limited experience, I would say "more than you're logging right now."
- I was taking the BHIS DFIR Foundations course, and there were two critical things that resonated here:
- "Prevention is ideal, but detection is a must." - Dr. Eric Cole
- "Make sure that detection strategies cover all data and business process flows." - Derek Banks
- Command Line logging
- Microsoft makes it hard to audit the command line.
- Must enable Audit Process Creation auditing
- Enable "Include command line in process creation events"
- Confirm these settings are not overwritten by basic audit policy settings
- etc. etc.
- Sysmon is awesome.
- Easy to install and default config is incredible
- Logs are sent to its own subfolder in Microsoft's Event Viewer
- GitHub - SwiftOnSecurity/sysmon-config: Sysmon configuration file template with default high-quality event tracing