Splunk SIEM Use Cases Examples
Splunk SIEM Use Cases Examples
Dashboard:
In the Enterprise Security there is an in-built section which will allow to perform searches of
privileged actions. In the privilege user monitoring dashboard, there will be two different
sections like privileged accounts usage and privileged accounts in use, which shows different
types of details like how many time the user made the login attempts, how much time he has
spent while he was logged in etc.,
Splunk Use Cases
24 November 2021 - 72 mins read time
Tags: Splunk
Find large file uploads that could point to data exfiltration in your network.
index=__your_sysmon_index__ sourcetype=websense*
| where bytes_out > 35000000
index=__your_sysmon_index__ sourcetype=symantec:*
| where TimeRange>1800
Windows
Linux
index=web sourcetype=access_combined
| iplocation clientip
A slow loading web site can not only frustrate users, but can also hurt search
rankings.
index=main sourcetype=iostat
It simple to track disk I/O, helping you quickly discover storage issues on your
servers.
index=main sourcetype=iostat
| eval hostdevice=host+":"+Device
It’s easy to track memory utilization of your systems using Splunk Enterprise.
index=main sourcetype=vmstat
| where memused>80
Look for DNS requests that are not destined for the dedicated DNS server.
protocol=53 action!=Drop
Look for logs with commands that try to download external scripts/content or
bypass PowerShell.
index=windows source="WinEventLog:Microsoft-Windows-PowerShell/Operational"
EventCode=4104
*HKCU\\software\\microsoft\\windows\\currentversion\\run*) OR
(ScriptBlockText=*bypass* *-
Look for distinct count of destination ports within a short span of time.
| from datamodel:"Network_Traffic"."All_Traffic"
OR
index=__your_sysmon_index__ sourcetype=firewall*
Look for count of multiple failed login attempts where successful login is true.
| from datamodel:"Authentication"."Authentication"
| where like(app,"ssh")
| from datamodel:"Malware"."Malware_Attacks"
| stats dc("signature") as "infection_count" by "dest"
| where 'infection_count'>1
Adversaries may add their own root certificate to the certificate store, to
cause the web browser to trust that certificate and not display a security
warning when it encounters the previously unseen certificate. This action may
be the precursor to malicious activity.
While batch files are not inherently malicious, it is uncommon to see them
created after OS installation, especially in the Windows directory. This analytic
looks for the suspicious activity of a batch file being created within the
C:\Windows\System32 directory tree. There will be only occasional false
positives due to administrator actions.
This search looks for flags passed to bcdedit.exe modifications to the built-in
Windows error recovery boot configurations. This is typically used by
ransomware to prevent recovery.
| tstats count min(_time) as firstTime max(_time) as lastTime from
datamodel=Endpoint.Processes where Processes.process_name = bcdedit.exe
Processes.process="*recoveryenabled*" (Processes.process="* no*") by
Processes.process_name Processes.process Processes.parent_process_name Processes.dest
Processes.user
Certutil.exe may download a file from a remote destination using urlcache. This
behavior does require a URL to be passed on the command-line. In
addition, f (force) and split (Split embedded ASN.1 elements, and save to
files) will be used. It is not entirely common for certutil.exe to contact public IP
space. However, it is uncommon for certutil.exe to write files to world
writeable paths.\ During triage, capture any files on disk and review. Review
the reputation of the remote IP or domain in question.
CertUtil.exe may be used to encode and decode a file, including PE and script
code. Encoding will convert a file to base64 with ----BEGIN CERTIFICATE-----
and ----END CERTIFICATE----- tags. Malicious usage will include decoding a
encoded file that was downloaded. Once decoded, it will be loaded by a
parallel process. Note that there are two additional command switches that
may be used - encodehex and decodehex. Similarly, the file will be encoded in HEX
and later decoded for further execution. During triage, identify the source of
the file being decoded. Review its contents or execution behavior for further
analysis.
| tstats count min(_time) as firstTime max(_time) as lastTime from
datamodel=Endpoint.Processes where Processes.process_name=certutil.exe
Processes.process=*decode* by Processes.dest Processes.user Processes.parent_process
Processes.process_name Processes.process Processes.process_id
Processes.parent_process_id
This search looks for the creation of local administrator accounts using
net.exe.
Actors may create a remote thread into the LSASS service as part of a
workflow to dump credentials.
index=__your_sysmon_index__ source="XmlWinEventLog:Microsoft-Windows-
Sysmon/Operational" AND (
Threat actors often, after compromising a machine, try to disable User Access
Control (UAC) to escalate privileges. This is often done by changing the
registry key for system policies using “reg.exe”, a legitimate tool provided by
Microsoft for modifying the registry via command prompt or scripts. This
action interferes with UAC and may enable a threat actor to escalate
privileges on the compromised system, thereby allowing further exploitation
of the system.
Often, after a threat actor gains access to a system, they will attempt to run
some kind of malware to further infect the victim machine. These malware
often have long command line strings, which could be a possible indicator of
attack. Here, we use sysmon and Splunk to first find the average command
string length and search for command strings that stretch over multiple lines,
thus identifying anomalies and possibly malicious commands.
index=__your_sysmon_index__ sourcetype="xmlwineventlog" EventCode=4688 |eval
cmd_len=len(CommandLine) | eventstats avg(cmd_len) as avg by host| stats max(cmd_len)
as maxlen, values(avg) as avgperhost by host, CommandLine | where maxlen >
10*avgperhost
index=__your_sysmon_index__ (ParentImage="C:\\Windows\\System32\\services.exe"
Image="C:\\Windows\\System32\\cmd.exe" (CommandLine="*echo*" AND
CommandLine="*\\pipe\\*"))
Cyber actors frequently escalate to the SYSTEM account after gaining entry to
a Windows host, to enable them to carry out various attacks more effectively.
Tools such as Meterpreter, Cobalt Strike, and Empire carry out automated
steps to “Get System”, which is the same as switching over to the System user
account. Most of these tools utilize multiple techniques to try and attain
SYSTEM: in the first technique, they create a named pipe and connects an
instance of cmd.exe to it, which allows them to impersonate the security
context of cmd.exe, which is SYSTEM. In the second technique, a malicious DLL
is injected into a process that is running as SYSTEM; the injected DLL steals the
SYSTEM token and applies it where necessary to escalate privileges. This
analytic looks for both of these techniques.
index=__your_sysmon_index__ (ParentImage="C:\\Windows\\System32\\services.exe"
Image="C:\\Windows\\System32\\cmd.exe" (CommandLine="*echo*" AND
CommandLine="*\\pipe\\*"))
index=__your_sysmon_index__ (Image="C:\\Windows\\System32\\cmd.exe" OR
CommandLine="*%COMSPEC%*") (CommandLine="*echo*" AND CommandLine="*\pipe\*")
Adversaries may schedule software to run whenever a user logs into the
system; this is done to establish persistence and sometimes for lateral
movement. This trigger is established through the registry key
HKEY_CURRENT_USER\EnvironmentUserInitMprLogonScript. This signature
looks edits to existing keys or creation of new keys in that path. Users
purposefully adding benign scripts to this path will result in false positives;
that case is rare, however. There are other ways of running a script at startup
or login that are not covered in this signature. Note that this signature
overlaps with the Windows Sysinternals Autoruns tool, which would also show
changes to this registry path.
(index=__your_sysmon_index__ EventCode=1)
(Image="C:\\Windows\\SysWOW64\\mavinject.exe" OR
Image="C:\\Windows\\System32\\mavinject.exe" OR CommandLine="*\INJECTRUNNING*")
Adversaries may start legitimate processes and then use their memory space
to run malicious code. This analytic looks for common Windows processes
that have been abused this way in the past; when the processes are started
for this purpose they may not have the standard parent that we would expect.
This list is not exhaustive, and it is possible for cyber actors to avoid this
discepency. These signatures only work if Sysmon reports the parent process,
which may not always be the case if the parent dies before sysmon
processes the event.
((Image="C:\\Windows\System32\\smss.exe" AND
(ParentImage!="C:\\Windows\\System32\\smss.exe" AND ParentImage!="System")) OR
(Image="C:\\Windows\\System32\\csrss.exe" AND
(ParentImage!="C:\\Windows\\System32\\smss.exe" AND
ParentImage!="C:\\Windows\\System32\\svchost.exe")) OR
(Image="C:\\Windows\\System32\\wininit.exe" AND
ParentImage!="C:\\Windows\\System32\\smss.exe") OR
(Image="C:\\Windows\\System32\\winlogon.exe" AND
ParentImage!="C:\\Windows\\System32\\smss.exe") OR
(Image="C:\\Windows\\System32\\lsass.exe" and
ParentImage!="C:\\Windows\\System32\\wininit.exe") OR
(Image="C:\\Windows\\System32\\LogonUI.exe" AND
(ParentImage!="C:\\Windows\\System32\\winlogon.exe" AND
ParentImage!="C:\\Windows\\System32\\wininit.exe")) OR
(Image="C:\\Windows\\System32\\services.exe" AND
ParentImage!="C:\\Windows\\System32\\wininit.exe") OR
(Image="C:\\Windows\\System32\\spoolsv.exe" AND
ParentImage!="C:\\Windows\\System32\\services.exe") OR
(Image="C:\\Windows\\System32\\taskhost.exe" AND
(ParentImage!="C:\\Windows\\System32\\services.exe" AND
ParentImage!="C:\\Windows\\System32\\svchost.exe")) OR
(Image="C:\\Windows\\System32\\taskhostw.exe" AND
(ParentImage!="C:\\Windows\\System32\\services.exe" AND
ParentImage!="C:\\Windows\\System32\\svchost.exe")) OR
(Image="C:\\Windows\System32\\userinit.exe" AND
(ParentImage!="C:\\Windows\\System32\\dwm.exe" AND
ParentImage!="C:\\Windows\\System32\\winlogon.exe")))
Adversaries may use network shares to exfliltrate date; they will then remove
the shares to cover their tracks. This analytic looks for the removal of network
shares via commandline, which is otherwise a rare event.
Adversaries may hide malicious code in .chm compiled HTML files. When
these files are read, Windows uses the HTML help executable named hh.exe,
which is the signature for this analytic.
(index=__your_sysmon_index__ EventCode=1) (Image="C:\\Windows\\syswow64\\hh.exe" OR
Image="C:\\Windows\\system32\\hh.exe")
53- CMSTP
Adversaries may use screensaver files to run malicious code. This analytic
triggers on suspicious edits to the screensaver registry keys, which dictate
which .scr file the screensaver runs.
Monitoring logon and logoff events for hosts on the network is very important
for situational awareness. This information can be used as an indicator of
unusual activity as well as to corroborate activity seen elsewhere.
Powershell can be used to hide monitored command line execution such as:
• net use
• sc start
To survive the timeout, adversaries and red teams can create services that
direct to cmd.exe with the flag /c, followed by the desired command. The /c flag
causes the command shell to run a command and immediately exit. As a
result, the desired program will remain running and it will report an error
starting the service. This analytic will catch that command prompt instance
that is used to launch the actual malicious executable. Additionally, the
children and descendants of services.exe will run as a SYSTEM user by default.
Thus, services are a convenient way for an adversary to
gain Persistence and Privilege Escalation.
When entering on a host for the first time, an adversary may try
to discover information about the host. There are several built-in Windows
commands that can be used to learn about the software configurations,
active users, administrators, and networking configuration. These commands
should be monitored to identify when an adversary is learning information
about the system and environment. The information returned may impact
choices an adversary can make when establishing persistence, escalating
privileges, or moving laterally.
Because these commands are built in, they may be run frequently by power
users or even by normal users. Thus, an analytic looking at this information
should have well-defined white- or blacklists, and should consider looking at
an anomaly detection approach, so that this information can be learned
dynamically.
73- Squiblydoo
Squiblydoo was first written up by Casey Smith at Red Canary, though that
blog post is no longer accessible.
Credential dumpers like Mimikatz can be loaded into memory and from there
read data from another processes. This analytic looks for instances where
processes are requesting specific permissions to read parts of the LSASS
process in order to detect when credential dumping is occurring. One
weakness is that all current implementations are “overtuned” to look for
common access patterns used by Mimikatz.
index=__your_sysmon_data__ EventCode=10
TargetImage="C:\\WINDOWS\\system32\\lsass.exe"
(GrantedAccess=0x1410 OR GrantedAccess=0x1010 OR GrantedAccess=0x1438 OR
GrantedAccess=0x143a OR GrantedAccess=0x1418)
CallTrace="C:\\windows\\SYSTEM32\\ntdll.dll+*|C:\\windows\\System32\\KERNELBASE.dll+2
0edd|UNKNOWN(*)"
ProcDump may be used to dump the memory space of lsass.exe to disk for
processing with a credential access tool such as Mimikatz. This is performed
by launching procdump.exe as a privileged user with command line options
indicating that lsass.exe should be dumped to a file with an arbitrary name.
The Windows Task Manager may be used to dump the memory space
of lsass.exe to disk for processing with a credential access tool such as
Mimikatz. This is performed by launching Task Manager as a privileged user,
selecting lsass.exe, and clicking “Create dump file”. This saves a dump file to
disk with a deterministic name that includes the name of the process being
dumped.
The NTDSUtil tool may be used to dump a Microsoft Active Directory database
to disk for processing with a credential access tool such as Mimikatz. This is
performed by launching ntdsutil.exe as a privileged user with command line
arguments indicating that media should be created for offline Active
Directory installation and specifying a folder path. This process will create a
copy of the Active Directory database, ntds.dit, to the specified folder path.
The Windows Volume Shadow Copy Service is a built-in OS feature that can
be used to create backup copies of files and volumes.
Adversaries may delete these shadow copies, typically through the usage of
system utilities such as vssadmin.exe or wmic.exe, in order prevent file and
data recovery. This technique is commonly employed for this purpose by
ransomware.
Vssadmin.exe delete shadows
index=__your_sysmon_index__ EventCode=10
TargetImage="C:\\windows\\system32\\lsass.exe" (CallTrace="*dbghelp.dll*" OR
CallTrace="*dbgcore.dll*")| table _time host SourceProcessId SourceImage
This analytic takes all instances of LoLBAS execution and then looks for
instances of command lines that are not normal in the environment. This can
detect attackers (which will tend to need the binaries for something different
than normal usage) but will also tend to have false positives.
The analytic needs to be tuned. The 1.5 in the query is the number of standard
deviations away to look. It can be tuned up to filter out more noise and tuned
down to get more results. This means it is probably best as a hunting analytic
when you have analysts looking at the screen and able to tune the analytic
up and down, because the threshold may not be stable for very long.
References: