Splunk SOAR, sometimes affectionately referred to by its prior name, Phantom, comes bundled with a plethora of custom functions and API calls to make playbook development easier. These include the ability to add comments or notes to a container, set a label or set a status. One useful and, frankly, cool feature is the ability to add a pin to the HUD of the container. You can add little “post-it” style notes to the HUD to show some messages or pertinent field values.
This is achieved by using the “pin” utility function, shown below. It allows a Splunk SOAR developer to pin a piece of information and designate a color for the pin as well as a name for later reference in case the data needs to be updated.
While these pin cards can be very handy, the limited amount of real estate in the HUD can quickly constrain how many pins you can realistically display in the HUD before having to click arrows to scroll and see pins that are off-screen. However, did you know that these pin cards in Splunk SOAR can also contain lists of data?
As implied in the image above, let’s explore a situation where you want to display a list of field values that may be relevant to the container. There could be one or many fields to display. Instead of pinning up one card for each field/value combination, you could pin up one single card with a list of all of the field/value pairs that you want and only take up one card space in the HUD. So, how to achieve this? It can be done by leveraging a documented, but somewhat hidden, feature of the container_pin REST call in Splunk SOAR. The key input to notice is the input_type and input_choices parameter fields in the container¬_pin call. You can designate the input_type to be “text” or “select”. The “pin” function included with Splunk SOAR does not have an option to define what input_type is and only allows for “text” when generating a pin card using it.
There’s 2 ways to put this REST into effect:
Using the post_data¬ function of the HTTP SOAR app.
Using custom code to programmatically generate the REST API calls
For the purposes of this article, we will leverage the Splunk SOAR/Phantom HTTP app to make this call. If you don’t already have an asset configured for this app, it is a straightforward configuration. Simply configure a new asset of this app and you’ll need to configure the following:
Base URL
Your base SOAR URL with “/rest” at the end
Authentication Token
ph-auth-token
Value of authentication token
Token value of the automation user to be used for this asset
Once your asset is ready for use, create a new action block in your playbook and select the HTTP post_data action. Select the asset for your SOAR instance and populate the inputs.
For the location input, type in “container_pin” (no double-quotes). For the body, you’ll need to populate the JSON payload of the request. The following fields need to be passed in (or are at least recommended):
container_id
ID of the container for pin card
order
Number where pin card will slot in. Set to “1” if you just want it at the beginning
message
A bit misleading, but it is the title of the pin card (i.e. the label that shows up as the header of the pin card)
data
Leave as an empty string (i.e. “”)
pin_type
manual_card
pin_style
This is the color you want for the pin card. Valid options are blue, red, gray (default)
name
This is the identifier of the pin card. If you want to update the pin card later, you can use the reference name (i.e. “field_values”) to overwrite the existing card instead of inserting a new one in the HUD and cluttering it up.
input_choices
This is a JSON list of strings containing list items.
For example, for the pin card displayed above, the JSON payload to the container_pin REST call would look as follows:
{
"container_id":"<container_id>",
"order":1,
"message":"Multivalue Pin",
"data":"",
"pin_type":"manual card",
"pin_style":"blue",
"name":"FIELD_VALUES ",
"input_type":"select",
"input_choices":["Field 1: Value 1","Field 2: Value 2","Field 3: Value 3"]
}
One word of caution: please note that this request is very sensitive! If the input_choices parameter is not passed in as a valid JSON list of strings, it could cause your container view window to not load correctly. Should that happen, you’ll need to basically make a rest call again to post it correctly before the container will display as expected. For this reason, it is heavily advised to code this up inside a custom function that can be leveraged consistently and be augmented with proper error handling in case the input_choice string is not well-formed.
There you have it! An innovative way to pin lists to the HUD that should make your SOAR/Phantom playbook development that much more exciting!
Few things in Splunk are more annoying than running searches and finding weeks or months later that data is missing from the results. This can happen primarily when commands are used which are not scalable. They may work initially when your data set is small. But as time goes on and more and more events are getting ingested, bad things may happen and the worst is that you may not even know that you are losing data. Since data is missing, you may not be getting alerts and your dashboards somehow do not look quite right.
So what are these annoying SPL commands that can cause data to be lost? The three main ones are the sort, join and append commands. In this blog we will be going over each of these commands and how they can cause data loss. Fortunately, in Splunk there is usually more than one way to get things done and we will explore ways to not use these commands if you have large datasets or if you expect to have large data sets in the future.
Sort Command
One of the easiest traps to fall into as you start learning Splunk is to use the default limit for the sort command. Did you know that if you run the following sort command that Splunk truncates your events to a count of 10,000?
| sort ipAddress
This one is easy to fix once you find the problem. In this case, just use the limit argument to instruct Splunk how many events to pass through the sort command. So to pass 20,000 events you can do this…
| sort limit=20000 ipAddress
You do not need to preface the limit argument with the text “limit=” you can simply put any number after the sort command. So to pass the entire data set do the following …
| sort 0 ipAddress
This fix is pretty simple. Just remember to ALWAYS put a 0 after the sort command. This will make your life a lot easier. Of course, you can learn the hard way and wait until you see your event count strangely showing 10,000. This should get you thinking – “I keep running this search over and over, how is it possible that I always get EXACTLY 10,000 events?” So, unless you intentionally want to truncate your events to 10000 or some other number remember to ALWAYS put a 0 after the sort command.
Append and Join Commands
Issue 1 – Append and Join are used quite often but did you know that the append and join commands have a 50,000 event limit? This is because these commands use subsearches which Splunk limits to 50,000 events. This limit can be changed in the limits.conf but generally that is not a recommended solution. Now this one may be a little harder to find by just looking at the event count of your search results since the subsearch events are appended to the primary search. So the final result event count may be hundreds of thousands of events and you would never know your subsearch did not return its entire data set.
Issue 2 – Another problem with the Append and Join commands is that the subsearches timeout after 60 seconds and then auto-finalizes if you exceed this maximum execution time. You might not even realize that Splunk has auto finalized, but this is nonetheless why you could be losing LOTS of data.
Issue 3 – Append is a transforming command and Join is a centralized streaming command. Both of these commands are run on the search head as a result Splunk needs to send all the events from all the indexers to the search head when processing hits one of these commands. This is inefficient as there are other ways to keep processing the SPL on the indexers until a transforming command has been reached potentially much later and accomplishing the same results.
Now we know what the issues are, let’s see how to rewrite the SPL to not use the Append and Join Commands unless you are working with small data sets.
Removing Append From Your Searches
Removing the append command it is pretty much a matter of combining the append subsearch with the primary search. Sometimes this is easier said than done. But the general idea is as follows.
This is your original search with an append command:
index = main sourcetype = access_combined | append [search index = my_index sourcetype = apache_error ] | eval field1 = “These are distributable” | eval field2 = “streaming commands running on the search head”
| eval field3 = field1.” “.field2
| stats values(status) AS Status BY host
To remove the append command in this example would change the search to look like this:
(index = main sourcetype = access_combined) OR (index = my_index sourcetype = apache_error) | eval field1 = “These are distributable” | eval field2 = “streaming commands run on the indexers”
| eval field3 = field1.” “.field2
| stats values(status) AS Status BY host
The first example sends the results to the search head early on at the append command and then runs the eval commands on the search head. But in the second example, the results are sent to the search head at the stats command making the eval commands run on the indexers. So the second search is more efficient and less burdensome on the search head and returns the entire dataset which does not timeout after 60 seconds.
Removing Join From Your Searches
Here is a typical SPL example with a join command:
In this next example, the inner join is used since the join type is not defined and the default join type is the Inner join. This is shown in the below venn diagram.
Now let’s look at some ways to do the left join and inner join without using the join command. This search merely includes all events from both sourcetypes.
(index= main sourcetype=access_combined) OR (index=my_index sourcetype=apache_error) | stats sum(rows) sum(cputime) by pid
Now to include the events in both sourcetypes with the same pid you can do this:
(index= main sourcetype=access_combined) OR (index=my_index sourcetype=apache_error) | stats values(sourcetype) AS Sourcetype sum(rows) sum(cputime) by pid | eval Count = mvcount(Sourcetype) | search Count=2
In this example when the Count is 2 then the pid value is used in BOTH sourcetypes which is the same as the Inner join command in the diagram above.
The Left Join can be done this way:
(index= main sourcetype=access_combined) OR (index=my_index sourcetype=apache_error) | stats values(sourcetype) AS Sourcetype sum(rows) sum(cputime) by pid | eval Count = mvcount(Sourcetype) | search Count=2 OR (Count=1 AND Sourcetype=access_combined)
Another option is to find the events with a pid in one sourcetype that is not in the other sourcetype. So to find the events with a pid in the access_combined sourcetype and not in the apache_error sourcetype use this SPL:
(index= main sourcetype=access_combined) OR (index=my_index sourcetype=apache_error) | stats values(sourcetype) AS Sourcetype sum(rows) sum(cputime) by pid | eval Count = mvcount(Sourcetype) | search Count= 1 AND Sourcetype=access_combined
Distributable vs Transforming Commands
Remember to push transforming commands later in your SPL and do as much work on the indexers as possible BEFORE sending the events to the search head. This is one of the main advantages of using a distributed system. This allows the indexers to run in parallel on small quantities of the events. Then when a transforming command is used all the indexers send their events to the search head where the final wrapup is accomplished and both transforming and distributing commands can be used from that point on.
If you think about it, the indexers can easily run the distributable streaming commands on their small dataset without any issues. But the transforming commands actually need the entire dataset available on all the indexers to do their task. For example, to do a stats command or a sort command the search head needs ALL the events so it would make no sense to run the stats and sort commands on the indexer first then again on the search head.
Distributable Streaming commands (run these first):
eval
where
search
rename
fillnull
fields
mvexpand
etc...
Transforming Commands (run these later in your SPL):
So, there you go. Next time you feel the need to use the join and append commands, especially if you know you will be using large data sets, try writing your SPL in such a way to not use these commands. Good luck!
By Bryan Bollou, Team Lead, Cybersecurity Engineering
Purpose of TekStream Security Bulletins
With the TekStream Security Bulletin, we are presenting some specific detection use cases using everyone’s favorite SIEM, Splunk. We’ve cherry-picked vulnerabilities that are not only intriguing but also directly impactful for our valued clients. These vulnerabilities were chosen based on a multitude of factors, ranging from the technology in the crosshairs to the specific sectors being targeted. This is not a blog post to fully explain or give recommendations on remediating the vulnerability – this has been discussed at length by various resources. The goal here is to aggregate the detections to maximize your chances of detecting an attempt to exploit these vulnerabilities. A part of that is gathering the list of IOCs scattered in multiple locations on the internet and looking at activity that could point to the vulnerability being exploited. Here at TekStream, we have an amazing team of cybersecurity engineers armed with a deep knowledge of logs and the secrets they hold, ready to fortify your cyber resiliency.
Introduction
Confirmed to have been in use since September of 2023, the CVE-2023-3519 is an unpatched vulnerability exploited to capture credentials by inserting a malicious script into the HTML content of the authentication web page. This is vulnerability that could be exploited by doing the following; • A vulnerable NetScaler device is identified. • The script is appended to the index.html using the vulnerability. • This script then loads a remote JS file that creates a “Log On” button on the login page. • Once an authentication event occurs the username and password information are sent to a malicious remote server.
Threat Overview
The vulnerability has been acknowledged by Citrix and they have suggested various mitigation steps to prevent its exploitation. These steps include:
“Cloud Software Group strongly urges affected customers of NetScaler ADC and NetScaler Gateway to install the relevant updated versions as soon as possible. Note: NetScaler ADC and NetScaler Gateway version 12.1 is now End Of Life (EOL). Customers are recommended to upgrade their appliances to one of the supported versions that address the vulnerabilities.”
So far, we have seen many good options and would like to present a few more specific cases using everyone’s favorite SIEM Splunk. This is not a blog post to fully explain or give recommendations on remediating the vulnerability, this has been discussed at length by various resources such as: Citrix ADC and Citrix Gateway Security Bulletin.
The goal here is to aggregate the detections to maximize your chances of detecting this critical attack. A part of that is gathering the list of IOCs scattered in multiple locations on the internet and looking at activity that could point to the CVE-2023-3519 vulnerability being exploited. Here at TekStream, we have several security engineers that are intimate with cybersecurity knowledge and especially the logs of our clients.
In this blog post, we go through the various steps in CVE-2023-3519 vulnerability exploitation and detection. With this format, we are providing a more generic data model “tstats” command. This is taking advantage of the data model to quickly find data that may match our IOC list. We then provide examples of a more specific search that will add context to the first find. There will be a wide variety of specific searches as each client has their own specific technologies. To get help building detection for your specific client, fill in the form below and get access to our Splunk/security expertise.
Note: Something specific. Detecting this part is not covered in this blog post. Reach out to TekStream by filling out the form below if you’d like specific guidance on that aspect.
The following detection steps mirror the stages and TTP-related indicators used in the attack:
Detect the initial web request attackers use to append custom HTML code to the index.html hosted on a vulnerable NetScaler device
Detect the hashes and file names that point to malicious files and scripts injected into the vulnerable NetScaler device
Detect Ip Addresses associated with known ATP group that used this exploit as well as addresses seen associated with the attack
Detect connections to domains that hosted the malicious JS script file created by threat actors who exploited this vulnerability
Detect a possible spike in DNS traffic that could point to attempts to hit a command-and-control destination from a victim’s network
Threat Implication
A threat actor discovering an unpatched NetScaler Device on a victim machine can attempt this exploit. It involves injecting a malicious script that creates an element on a login page that directs user credentials upon login activity.
Attacked would first send a web request to trigger a memory corruption a write a PHP web shell on a NetScaler endpoint. This PHP web shell would then be used to append custom HTML code to the index.html that points to a malicious a JavaScript code on infrastructure controller by the attacker. This code would add a custom function with a “Log On” element that would harvest credentials entered by a victim.
Actions to Detect
A web request to your NetScaler servers with any of the following strings;
| tstats `summariesonly` sum("Web.bytes") as bytes,values("Web.http_content_type") as http_content_type,values("Web.http_method") as http_method,values("Web.http_user_agent") as http_user_agent,values("Web.status") as status from datamodel="Web"."Web" where (http_method = GET OR http_method = POST) AND Web.url IN ("*/gwtest/formssso? event=start&target=*","*/items/accounts/*","*/api/now/sp/widget/widget-simple-list*","*/api/now/sp/widget/5b255672cb03020000f8d856634c9c28*") by "Web.src", "Web.dest", "Web.user", "Web.url", _time | fields _time src, dest, user, url, http_content_type, http_method, http_user_agent, status, bytes | fieldformat Time = strftime(_time,"%m/%d/%Y %T")
Note: The destination IPs for the NetScaler devices can be added to filter down this search.
Step 2
As part of Step 1, new files would be introduced on the NetScaler server. This step would be used to detect the hashes and file names that point to malicious files and scripts injected into the vulnerable NetScaler device. These hashes and files were recorded from victims of this attack.
| tstats `summariesonly` latest(_time) as _time, latest(Filesystem.file_create_time) as file_create_time, latest(Filesystem.file_modify_time) as file_modify_time, latest(Filesystem.file_access_time) as file_access_time from datamodel="Endpoint"."Filesystem", values(Filesystem.dest) as dest, values(Filesystem.action) as action, values(Filesystem.file_name) as file_name, values(Filesystem.file_hash) as file_hash, values(Filesystem.file_path) as file_path, values(Filesystem.file_size) as file_size where Filesystem.file_name IN ("*Logouttm.php*","*pykeygen*","*info.php*",”*NPS*”,”*the*”) | fields _time, dest, action, file_name, file_hash, file_path, file_size, file_create_time, file_modify_time, file_access_time
| fieldformat Time = strftime(_time,"%m/%d/%Y %T")
SPL 2: Hashes
| tstats `summariesonly` latest(_time) as _time, latest(Filesystem.file_create_time) as file_create_time, latest(Filesystem.file_modify_time) as file_modify_time, latest(Filesystem.file_access_time) as file_access_time from datamodel="Endpoint"."Filesystem", values(Filesystem.dest) as dest, values(Filesystem.action) as action, values(Filesystem.file_name) as file_name, values(Filesystem.file_hash) as file_hash, values(Filesystem.file_path) as file_path, values(Filesystem.file_size) as file_size where Filesystem.file_hash IN ("3345ad8b43d6771532ca55acf7e95fe98aeadb27","b8f9258e9c7c882944e2b773557b49e5821517fe","55c83cb25be5c521e4874e22b1422c360abf0a29","ec17f7b3acb2334a062c37e0271c31c3c8b6879c","dec36a2aa4ecb86eafd01015e27c06f51d104317","47b8d29319a9e85aaf829f4f2f9c6c00","ee51f599d266be5fd89b423ca24521f1","c0b32901f9c6ce3f965b8552f7d058d4","9b6f12aed2369a99a1132edd2ede779d","b383c4ed6712a0a06fb85b1d8405e0f1") | fields _time, dest, action, file_name, file_hash, file_path, file_size, file_create_time, file_modify_time, file_access_time
| fieldformat Time = strftime(_time,"%m/%d/%Y %T")
Step 3
IP addresses have been associated with exploiting this NetScaler vulnerability. This includes source IP addresses of ATP groups that have been recorded with attempted exploitations and destination IP addresses of the malicious infrastructure. Any occurrence of these known bad IP addresses should be investigated if they appear in an environment.
Actions to Detect
Appearance of the following hashes in a client’s environment:
| tstats `summariesonly` latest(_time) as _time, sum("All_Traffic.bytes") as bytes, values("All_Traffic.src_port") as src_port, values("All_Traffic.transport") as transport, values("All_Traffic.dest_port") as dest_port from datamodel="Network_Traffic"."All_Traffic" where All_Traffic.src IN ("5.2.64.155","5.255.101.76","172.94.124.18","154.6.91.149","216.41.162.172","216.51.171.17") OR All_Traffic.dest IN ("5.2.64.155","5.255.101.76","172.94.124.18","154.6.91.149","216.41.162.172","216.51.171.17") by "All_Traffic.action", "All_Traffic.src", "All_Traffic.dest", "All_Traffic.user" | head 10000 | `drop_dm_object_name("All_Traffic")`| eval earliest_time = IF(isnum("$earliest_time$"),"$earliest_time$",strftime(relative_time(now(),"$earliest_time$"),"%s")) | eval latest_time = CASE(isnum("$latest_time$"),"$latest_time$","$latest_time$"="now",now(),1=1,strftime(relative_time(now(),"$latest_time$"),"%s")) | where _time >= earliest_time AND _time <= latest_time | head 10000 | table action, src, src_port, dest, transport, dest_port, user, bytes
Step 4
The smoking gun is connections out to the malicious domains for credential harvesting. Multiple domains have been identified as being used in this exploit. These domains were stood up by threat actors with their origins masked. The malicious JS script that would inject the fake login element on NetScaler index.html would be hosted here. The JS files were almost all identical. Credentials taken from victim users would also be redirected to these domains. The credential endpoint was a similar path for most of the malicious domains.
Actions to Detect
Any connections to the following domains from a client network:
jscloud[.]ink
jscloud[.]live
jscloud[.]biz
jscdn[.]biz
cloudjs[.]live
cloud-js[.]cloud
Any connections with the following URL string:
/items/accounts/
SPL#1 – Web: Malicious Domains + URL String
| tstats `summariesonly` sum("Web.bytes") as bytes,values("Web.http_content_type") as http_content_type,values("Web.http_method") as http_method,values("Web.http_user_agent") as http_user_agent,values("Web.status") as status from datamodel="Web"."Web" by "Web.src", "Web.dest", "Web.user", "Web.http_referrer", "Web.url", _time | `drop_dm_object_name("Web")` | where match(url, "(?i)(jscloud.ink)|(jscloud.live)|(jscloud.biz)|(jscdn.biz)|(cloudjs.live)|(cloud-js.cloud) | (/items/accounts/)") | fields _time src, dest, user, http_referrer, url, http_content_type, http_method, http_user_agent, status, bytes | eval ip_pair = src . " - " . dest | stats values(_time) as Time values(ip_pair) AS src_dest, values(user) as user, values(http_referrer) as http_referrer, values(http_user_agent) as http_user_agent, values(http_method) as http_method, values(status) as status, values(bytes) as bytes count by url | fieldformat Time = strftime(Time,"%m/%d/%Y %T")
SPL#2 – DNS: Malicious Domains
| tstats `summariesonly` latest(_time) as _time values("DNS.dest") as dest, values("DNS.query") as query, values("DNS.query_count") as query_count, values("DNS.message_type") as message_type, values("DNS.answer") as answer, values("DNS.reply_code") as reply_code from datamodel="Network_Resolution"."DNS" where DNS.query IN ("jscloud.ink","jscloud.live","jscloud.biz","jscdn.biz","cloudjs.live","cloud-js.cloud") | table _time, dest, query, query_count, message_type, answer, reply_code | fieldformat Time = strftime(_time,"%m/%d/%Y %T")
Step 5
In a compromised environment, it would be expected to see an increase in the amount of traffic to control and control destinations. Thus, detecting a possible spike in DNS traffic that could point to an attempt or successful attack on this NetScaler vulnerability.
Actions to Detect
A DNS Spike in an environment that may indicate attempts to connect to a C2C destination.
SPL
| tstats `summariesonly` count from datamodel="Network_Resolution"."DNS" by "DNS.query", _time | rename "DNS.query" as query | fieldformat Time = strftime(_time,"%m/%d/%Y %T")
Note: This is very simple SPL to look at the DNS resolutions by query destination and time. It needs to be tuned for each environment. It would take a Splunk professional to present the data in a more digestible form and cybersecurity professional to use this visualization to spot an anomaly. Reach out to TekStream using the form below to get in contact with both.
IOC List
Below is an aggregate of IOCs found related to the CVE-2023-3519 vulnerability. It has been presented here for you to have it consolidated in one spot and made easier to export to a lookup for notable detections.
Ideally, you could make scheduled searches like what is shown above with lookup tables for matching more specific and new detections. These can be set to run on a continuous schedule to ensure the monitoring of your assets from new vulnerabilities. Old vulnerabilities that have been patched (and applied) can also be aged out of this lookup table to ensure it is timely and efficient. For questions on how to build such a process that is dynamic and customizable for your environment, ask one of our consultants by filling in the form below. Also, subscribe to the TekStream blog to catch the next monthly security bulletin and apply the latest detections to protect your systems. Happy Splunking!
The approaches recommended herein have not been tested broadly across the TekStream customer base. They are preliminary in nature and come without any certification of efficacy.
Do you need a safe way to lower your Splunk license ingestion as well as get rid of any unwanted characters or text? Obviously, you could go back to the application team and see if they can remove the text that you no longer wish to index. The easiest and quickest way to achieve this goal is to use SEDCMD’s in Splunk!
The SEDCMD can be used to remove unwanted characters or text from your events and to replace certain data with other values; to possibly mask very important and sensitive data. With the increasing number of SVC based licenses, a lot of teams will just ingest everything in their logs. When I say everything, I mean all parts of any events (extremely large events, small events, junk events, etc.). If you currently have an SVC based license, remember, removing unwanted text or junk data, as well as creating accurate sourcetype settings, will help Splunk lower the number of SVCs used to parse your data. Which in turn lowers your SVC usage for ingestion, allowing more usage for searching. We will dive more into SEDCMD’s below!
Splunk is an effective data analytics and visualization platform that allows organizations to gain valuable insights from their machine-generated data. One of the key features of Splunk is its ability to process and transform data using numerous commands. In this blog post, we’ll dive into the world of SEDCMDs (SED-like stream editing commands) in Splunk and explore how they can be used to manipulate and transform data.
Understanding SEDCMD’s
SED (stream editor) is a Unix utility that allows you to perform basic text transformations on an input stream or a file. Splunk has borrowed the concept of SED and introduced SEDCMDs to modify events before indexing. SEDCMDs are applied to each event before it is indexed, enabling you to modify specific fields or manipulate the entire event payload if necessary.
Syntax and Usage
The syntax for SEDCMDs in Splunk follows a simple pattern:
SEDCMD-<name> = s/<pattern>/<replacement>/<flags>
<name>: A unique name for the SEDCMD, allowing you to reference it in your configuration.
<pattern>: A regular expression pattern that matches the text you want to replace.
<replacement>: The text you want to substitute for the matched pattern.
<flags>: Optional flags that control the behavior of the substitution (e.g., case-insensitive matching). Flags can wither be “g” to replace all matches (global), or a number to replace a specified match.
SED versus SEDCMDs
While SEDCMDs in Splunk are inspired by the traditional SED utility, there are some differences to note. Unlike SED, which operates on a file or a stream of data, SEDCMDs in Splunk are applied to individual events during indexing. This means that each event is processed independently, allowing you to apply different SEDCMDs to different events or fields. Let us dive into an example of getting rid of different segments of an event, and just for fun, an entire event leaving just one field and value. The data we are using for this post can be found here: Download Splunk Tutorial Files. We will be using the www2 access.log. Please see a sample of the log below:
As you can see we have masked the source IP address and removed the user agent and request type segments. Since this is an all-in-one instance, we do not have the UF props settings for EVENT BREAKER. For more information on creating efficient sourcetypes to successfully onboard your data, check out this TekStream Blog Post.
For the second test I will be removing every single segment, but will be keeping the JSESSIONID from the resource requested segment. It will look something like this JSESSIONID=SD10SL4FF4ADFF4976. Below is the sourcetype I created with the two SEDCMD’s that will allow us to achieve our goal.
The results from the second test are a success. The timestamp is being correctly extracted due to the sourcetype having the proper settings. My first SEDCMD removes the entire first part of the event including JSESSIONID= and we are replacing all that text with JSESSIONID=. My second SEDCMD removes every single character after the value of the JSESSIONID. With large amounts of data ingesting into Splunk, how can you tell exactly what unwanted data that should be removed? Please see below, some ways to point out unwanted logs in your data stream.
Identifying Unwanted Data
Unwanted data in Splunk can come in various forms, including irrelevant events, noisy logs, or redundant information. Here are some common scenarios where unwanted data can accumulate. Redundant Data: Duplicate events or log entries that offer no additional value and only consume storage space. Irrelevant Sources: Data sources or log files that are no longer needed for analysis or monitoring purposes. Noise and Low-Value Logs: Log messages that are excessive, verbose, or provide limited insights into system performance or security. Test and Development Data: Data generated during testing or development phases that may not be relevant for production analysis.
In conclusion, cleansing unwanted data from your Splunk environment is essential for optimizing performance, storage utilization, and data analysis. By implementing effective strategies and following best practices, you can streamline your data ingestion process, improve search efficiency, and ensure that your Splunk environment remains focused on delivering valuable insights. Regularly reviewing and refining your data cleansing approach will help you maintain a clean and efficient data ecosystem, enabling you to derive maximum value from your Splunk investment.
This blog proposes a comprehensive architecture for implementing Disaster Recovery (DR) in Splunk Enterprise running on AWS. This example includes setting up two multi-site SmartStore indexer clusters, and a single search head cluster stretched across two AWS regions. Our SmartStore objects will be s3 buckets in AWS. This 2-region solution ensures uninterrupted search and indexing capabilities in the case that one of the regions become unavailable.
Let’s start with our indexer tier.
For our indexer tier, we have two unique multi-site indexer clusters each belonging to a separate region. For the implementation stage, this means building TWO individual indexer clusters separate from each other. The “sites” will be the availability zones in each region, so region 1 will have 3 sites (AZ 1, AZ 2, and AZ 3) and likewise in region 2. Each cluster will also be SmartStore enabled, having their own external S3 bucket.
Note: Indexers with SmartStore enabled will offload Splunk buckets to S3 once they roll from hot to warm. From there, retention is managed within S3. Before enabling SmartStore, we first need to create an S3 bucket in AWS and ensure read/write capabilities from the splunk indexers. See AWS documentation for details on S3 bucket creation and permissions.
We first need to adjust server.conf on the Cluster Manager node. Because this is a multisite cluster, buckets being migrated need to be able to identify the origin and replicate across all sites. We can accomplish this by setting the following on the Cluster Manager node:
The first stanza [volume:smartstore] contains the configurations to point and authenticate to the S3 bucket. The [default] stanza configs here point the remote path to this SmartStore volume and sets the replication factor to auto to enable replication of Splunk buckets.
The above configuration additions need to happen on BOTH indexer clusters, as they are still technically separate, and unaware of each other. Before configuring the DR piece of the solution, we need to have 2 standalone multi-site indexer clusters with SmartStore enabled, in a healthy state.
Disaster Recovery
The DR solution comes into play by enabling AWS Cross Region Replication from the S3 in region 1 to region 2. Once data is offloaded from the Splunk indexers to the S3 bucket in region 1, AWS then replicates that data to the S3 bucket in region 2.
In region 2, the indexers will utilize S3 for searches that require warm data retrieval during search operations, which will now contain data that has been replicated from region 1 – up to a 15 min delay per AWS SLAs. This allows data to be highly searchable in the case that the indexer cluster and/or S3 bucket in region 1 becomes unavailable.
The idea here is that if region 1 becomes unavailable, users can query the indexers in region 2 and still see data that was indexed in region 1. Splunk SmartStore paired with AWS Cross Region Replication allows for this disaster recovery architecture.
Search Tier
For the search tier, we have a stretched search head cluster across both regions. The reason we want to have this as a single cluster, rather than broken out into 1 per region like the indexers, is to allow for easy replication of knowledge objects. This will ensure that user content created in region 1 is easily accessible in the case that users need to log into region 2.
From a technical standpoint, Splunk does not allow for members of a single search head cluster to have different search peers, the search peers must be consistent across all members. To ensure that search heads in region 1 are only peered to indexers region 1, and likewise for region 2, we can utilize DNS names for the indexers, so that each search head points to the same name but resolves to it’s local indexers per the DNS rules in each region.
This will satisfy the technical need for all Splunk Search Heads to have a consistent list of the same search peers across both regions, but behind the scenes only dispatching searches to the indexers in the same region as the search head.
Architecture
Overall, this is the high-level architecture that can be implemented to ensure HA between both Search Heads and Indexers.
We hope this has provided the overview that will help you build your own disaster recovery architecture. Contact us if you need additional information. Happy Splunking!
Today, Governor John Bel Edwards and LSU President William F. Tate IV cut the ribbon to the LSU and LONI Security Operations Center, or SOC, on the flagship campus in Baton Rouge, opening the doors to a new cybersecurity workforce development and protection model for Louisiana and LSU that is garnering national attention.
“Louisiana is setting a nationwide standard for cybersecurity because of our pioneering and proactive approach rooted in higher education,” said Governor Edwards. “Cyberattacks are becoming more sophisticated and are a constant threat to individuals, businesses and government entities. LSU is harnessing the collective power of our immensely talented students in order to protect citizens from cyber threats while also growing our workforce. Louisiana’s record low unemployment is proof that innovation leads to job creation, and the LSU SOC is exactly the type of forward-thinking project that will keep this momentum going.”
“When we declared our commitment to becoming the foremost cybersecurity program in the nation, we were resolute,” LSU President William F. Tate IV said. “A primary cybersecurity challenge our nation confronts today is the shortage of a skilled workforce. We require more well-trained cyber warriors. Through the SOC, we are enhancing the development of cyber talent while fulfilling our flagship mission to protect and serve our state.”
Through its new SOC, LSU and Louisiana are leading the nation in how to train and graduate students who can actively join the cyber fight and gain real-world, real-time experience working in direct service to the state. In the past three weeks, 94 LSU students have applied to receive training as professional cyber analysts to operate the SOC at the heart of the flagship campus. The students working at the SOC will be responsible for monitoring and analyzing the university’s network traffic as well as identifying and escalating potential threats.
The LSU SOC is the first node in an emerging statewide cybersecurity platform powered by the Louisiana Optical Network Infrastructure, or LONI, the state’s research and development network that connects Louisiana’s universities and community and technical colleges. By extending the SOC through LONI, every institution of higher education will have the ability to establish their own student-operated center and receive additional security services. This new model—educating students to provide services the university critically needs and then extending it into a platform to serve a greater purpose—has the immediate potential to change the security posture of the whole state.
To build its SOC platform, LSU turned to TekStream, an Atlanta-based technology services firm, and Splunk, one of the world’s leading data and security technology companies. TekStream supports SOC management and incident response, while Splunk provides the core analytic and monitoring technology.
Earlier this week, LSU announced $7.5 million in state investment to expand the LSU-LONI SOC model to more than 30 colleges and universities in the state, at no additional cost to each institution. Increased cybersecurity protection across higher education will come with broader impacts for Louisiana, offsetting the state’s need to respond to cyberattacks and limiting key attack vectors. Universities’ diverse data landscapes are often the first to pick up on new cyber threats, which then tend to cascade through critical infrastructure, industry and state and local government.
“The Governor tasked us to both strengthen our statewide cybersecurity and build a homegrown cyber workforce—today, we are doing just that,” Commissioner of Higher Education and Chair of Louisiana’s Cybersecurity Commission Kim Hunter Reed said. “The SOC model means every public institution is positioned to acquire and build the additional cybersecurity defense to meet its unique campus needs. We are grateful for the state, corporate and institutional support that has resulted in this integrated and innovative approach to data protection and student engagement in Louisiana.”
Besides the physical SOC on LSU’s flagship campus in Baton Rouge, LSU Shreveport operates its own. The Shreveport SOC is an extension of the LSUS Cyber Collaboratory and will also work seamlessly with industry partners Splunk as the platform and technology provider and TekStream on service and training.
“LSU is building one of the nation’s strongest whole-of-state plans for cybersecurity, and we’re starting to receive inquiries from all over about the ‘LSU and Louisiana model,’” Splunk Vice President of Public Sector Bill Rowan said. “Usually, we rely on talent to help us innovate, but this SOC flips that on its head: innovating to help produce talent, and Splunk couldn’t be more excited to be a part of this effort with TekStream.”
“Our model was always to provide SOC services by implementing Splunk technology, but we jumped at the opportunity to do something different with LSU,” TekStream CEO Rob Jansen said. “We essentially agreed to work our way out of business by helping to train students to do more and more advanced work. Why? Because we saw all of the amazing upsides of the partnership, since we all struggle to find and hire enough talent. That’s why the LSU-LONI model is groundbreaking; it’s a first in our industry and the number and caliber of talented student applicants we’ve already received is staggering.”
In my view, _time is the best way to filter in Splunk. Using the time picker can eliminate thousands if not millions of events from your results. That elimination can be a good or a bad thing.
So what if you want to see the events that come before and after so you can view the complete process in a dashboard? Well, that exact question was recently asked by a client. With a kicker …they wanted to paste the events timestamp into a field and have it automatically gather the surrounding events. They did not want to use time picker due to taking too long to calculate the surrounding times of the event, then find the correct setting in time picker for the surrounding events. They wanted to copy and paste directly from the original event. Challenge accepted!
First, I add all my inputs. I only need the one text input, but I also am going to show how to change the size of the range you are searching based on two dropdown inputs that allow you to add more time to before or after a search time.
Now let’s add a table to the dashboard and add a query. For this example, I will just use a simple search (index=_internal sourcetype=splunkd).
Now let’s add the additional time items to the search query. I am also using the %Y-%m-%dT%H:%M:%S time format.
Here is what I added to my search: [ | makeresults | eval earliest_time=relative_time(strptime(“$time$”,”%Y-%m-%dT%H:%M:%S”), “-10m”) | return earliest_time ] [ | makeresults | eval latest_time=relative_time(strptime(“$time$”,”%Y-%m-%dT%H:%M:%S”), “+10m”) | return latest_time ]
I use the token of time to fill in the strptime that the commands utilize, and they create a time for earliest and latest times.
Notice how my time is now restricted to 10 minutes after the time I input?
And that’s it! We have successfully restricted the times of the events to a range of 20 minutes around our time input. But, what if we want to use different time ranges?
Let’s add two more inputs that will be our before and after time. I added two dropdowns where we can list the different times we want to use. I called them Earliest and Latest then I used the token names earliest_tok and latest_tok.
Now let’s add the times we want to select from:
And all we have left to do is to replace the time change values in our search with these tokens. Our new search will be
Now you can see that our latest time is set to 15 minutes and our newest event time is 15 minutes after the set time I input.
There you have it! Add this to any search in a dashboard and you can find events from any time range around a certain time just by creating a few inputs. Contact us if you’d like to chat!
Oracle Content Management (OCM) is a robust tool that allows for content to be served to multiple third-party applications through publishing channels. This offers a single source content repository for all of your applications. When designing your content structure and architecture, there are very important things to keep in mind.
Architecture
Depending on the amount and types of content you need to store, and how it will support your applications, the number of OCM instances you will need may vary. For most headless implementations, OCM supports the application with business content. Two instances will suffice for that implementation: one instance for development and testing, and the second for production. In this architecture, the instances are independent and only development entities such as asset types, components, sites, or templates would be migrated from one instance to the other.
For headless implementations that serve most, if not all, of the content required by the application, three instances would be recommended. Independent instances for development, test/staging and production would move assets between the instances as well as development entities. To make the transfer of assets between instances simple, it is important to intelligently design the asset types and relations to allow flexibility while maintaining necessary dependencies.
Repository Structure
Each OCM instance can have multiple repositories. Contributors can have permissions to specific asset types or categorized assets within a single repository, but management permissions apply to all content within a repository. Multiple repositories allow different groups to manage different sets of content. When all content used to build an application is provided by OCM, there are assets used for UI design which would be managed by senior developers, and content provided by business users for news, blogs, events, or product information which is managed by marketing. As multiple repositories can publish content to a single channel, applications can access all content regardless of its repository.
A single asset once published to a channel, will provide the same content and data to all channels it has been published to. If asset changes need to be managed separately for each channel, multiple repositories should be used to keep assets independent for each application.
Asset Type Design
OCM offers many ways to link, categorize, tag, group and identify different sets of content with the same asset type. Developing multiple asset types with the same content structure does not offer any additional benefit and can negatively impact the implementation. Asset types should not be created to group assets, but to identify the type of data they contain.
When searching across asset types, content fields aren’t returned with the search results. If a single asset type is searched, content fields can be returned with the results. This reduces the number of API calls to get details for each asset being returned.
The fewer asset types you have, the easier maintenance and migration will be.
Related Assets
When creating a new asset type, it is easy to use the reference type field to link assets. This is typically used to link an image to a content item such as a news article.
These reference fields become a problem when any assets can be linked together using reference fields. Circular dependencies, where assets of the same type reference each other, can cause problems when migrating or changing content data. Indirect dependencies, where an asset is dependent on another asset that has dependencies to other assets, are difficult to manage.
Rather than using reference fields to link related assets, use taxonomy categorization to link the assets indirectly. AssetType field values as well as AssetTagscan also be used to identify related assets. Reference fields should only be used if an asset type directly relies on a referenced asset for functional purposes. They should not be used for related content.
As you can see, OCM offers many ways to define, organize, categorize, and relate your content. Design decisions made early on can have a long-lasting impact on your maintenance and management of the environment. Contact us for more tips and tricks for Oracle Content Management Development:
By Bryan Bollou, Team Lead, CyberSecurity Engineering
Purpose of TekStream Security Bulletins
With the TekStream Security Bulletin, we are presenting some specific detection use cases using everyone’s favorite SIEM, Splunk. We’ve cherry-picked vulnerabilities that are not only intriguing but also directly impactful for our valued clients. These vulnerabilities were chosen based on a multitude of factors, ranging from the technology in the crosshairs to the specific sectors being targeted. This is not a blog post to fully explain or give recommendations on remediating the vulnerability – this has been discussed at length by various resources. The goal here is to aggregate the detections to maximize your chances of detecting an attempt to exploit these vulnerabilities. A part of that is gathering the list of IOCs scattered in multiple locations on the internet and looking at activity that could point to the vulnerability being exploited. Here at TekStream, we have an amazing team of cybersecurity engineers armed with a deep knowledge of logs and the secrets they hold, ready to fortify your cyber resiliency.
Introduction
Starting from early April 2023, there have been documented instances of intrusions related to Cisco Adaptive Security Appliance (ASA) Virtual Private Networks (VPNs). In May, Sophos was the first to identify that the ransomware group “Akira” exploited default VPN accounts to infiltrate networks lacking MFA protection.
This threat primarily stems from the use of default accounts, weak credentials, and the absence of an additional authentication layer for all users. Typically, after a network intrusion, a ransomware attack follows, as researchers map Akira’s common attack pattern. Addressing this matter is crucial, given that numerous clients rely on CISCO ASA VPNs as their solution, and our utmost priority is to ensure their security.
Threat Overview
The vulnerability has been acknowledged by Cisco and they have suggested various mitigation steps to prevent its exploitation.
These steps include:
Disable default accounts or reset their passwords.
Enforce MFA for all VPN users, minimizing exceptions.
Enable VPN logging, following Cisco’s guidance for ASA and forensic evidence collection.
Monitor VPN logs for unauthorized authentication attempts.
Watch for failed authentications, detecting brute force or password spraying.
Stay up to date with security patches for VPNs, virtual desktop infrastructure, and gateway devices as a best practice.
So far, we have seen many good options and would like to present a few more specific cases using everyone’s favorite SIEM, Splunk.
This is not a blog post to fully explain or give recommendations on remediating the vulnerability, which has been discussed at length by various resources such as Rapid 7.
The goal here is to aggregate the detections to maximize your chances of detecting this critical attack. A part of that is gathering the list of IOCs scattered in multiple locations on the internet and looking at activity that could point to the Cisco ASA VPNs being exploited. Here at TekStream, we have several security engineers who are intimate with cybersecurity knowledge – especially the logs of our clients.
In this blog post, we go through the various steps in Akira’s (and other APTs) Cisco ASA VPN exploitation & detection. With this format, we are providing a more generic data model “tstats” command. This is taking advantage of the data model to quickly find data that may match our IOC list. We then provide examples of a more specific search that will add context to the first find. There will be a wide variety of specific searches as each client has their own specific technologies. To get help building detection for your specific client, fill in the form below and get access to our Splunk/security expertise.
Note: The follow-up of the initial access attack is normally the deployment of various ransomware to infect a victim’s system. Detecting this part is not covered in this blog post. Reach out to TekStream by filling out the form below if you’d like specific guidance on that aspect.
The following detection steps mirror the stages and TTP-related indicators used in the attack:
Connection attempts from malicious IPs to the Cisco ASA VPN
Connection attempts to hit the CISCO ASA VPN URL using a parameter string often seen with brute force attacks
Connection attempts to log in to the CISCO ASA VPN with often-used account names
Process execution of set.bat and nd.exe files to expose more credentials and enable lateral movement of the threat actor
Connection attempt to the domains of AnyDesk or RustDesk as a remote access tool for the threat actor to continue their exploitation of the victim network
Connection attempts to authenticate to/from Windows machines with a specific naming convention (“WIN-*”) on a client’s user VPN network
Threat Implication
Environments utilizing CISCO ASA VPNs become targets of interest for Akira and various APTs seeking unauthorized access. This is especially true for environments lacking MFA enforcement during VPN logins or having MFA exceptions for specific users.
Most adversaries employ tactics such as brute force, password spraying, and credential stuffing to exploit weak or default passwords. Additionally, other threat actors have been observed procuring exposed credentials from illicit online markets.
The APTs under scrutiny include the Akira and LockBit ransomware groups. Both have been noted for concluding their attacks with the deployment of ransomware.
Within the attack lifecycle, Akira and LockBit have leveraged legitimate, open-source remote access tools such as RustDesk and AnyDesk to navigate within compromised environments.
Threat Detection
Step 1 The exploitation of these vulnerability CISCO ASA VPNs has been conducted by known APTs and IP addresses related to them have been captured. The first step in detecting potential exploitation attempts would be connection attempts from these malicious IPs to the Cisco ASA VPN.
Note: This CSV file listing includes all the mentioned usernames, along with other Indicators of Compromise (IOCs), conveniently consolidated for streamlined export into a lookup for notable detections.
| tstats `summariesonly` latest(_time) as _time, sum("All_Traffic.bytes") as bytes, values("All_Traffic.src_port") as src_port, values("All_Traffic.transport") as transport, values("All_Traffic.dest_port") as dest_port from datamodel="Network_Traffic"."All_Traffic" where All_Traffic.src IN ("176.124.201.200","162.35.92.242","161.35.92.242","173.208.205.10","185.157.162.21","185.193.64.226","149.93.239.176","158.255.215.236","95.181.150.173","94.232.44.118","194.28.112.157","5.61.43.231","5.183.253.129","45.80.107.220","193.233.230.161","149.57.12.131","149.57.15.181","193.233.228.183","45.66.209.122","95.181.148.101","193.233.228.86","176.124.201.200","162.35.92.242","144.217.86.109","31.184.236.63","31.184.236.71","31.184.236.79","194.28.112.149","62.233.50.19","194.28.112.156","45.227.255.51","185.92.72.135","80.66.66.175","62.233.50.11","62.233.50.13","194.28.115.124","62.233.50.81","152.89.196.185","91.240.118.9","185.81.68.45","152.89.196.186","185.81.68.46","185.81.68.74","62.233.50.25","62.233.50.17","62.233.50.23","62.233.50.101","62.233.50.102","62.233.50.95","62.233.50.103","92.255.57.202","91.240.118.5","91.240.118.8","91.240.118.7","91.240.118.4","161.35.92.242","45.227.252.237","147.78.47.245","46.161.27.123","94.232.43.143","94.232.43.250","80.66.76.18","94.232.42.109","179.60.147.152","185.81.68.197","185.81.68.75") OR All_Traffic.dest IN "176.124.201.200","162.35.92.242","161.35.92.242","173.208.205.10","185.157.162.21","185.193.64.226","149.93.239.176","158.255.215.236","95.181.150.173","94.232.44.118","194.28.112.157","5.61.43.231","5.183.253.129","45.80.107.220","193.233.230.161","149.57.12.131","149.57.15.181","193.233.228.183","45.66.209.122","95.181.148.101","193.233.228.86","176.124.201.200","162.35.92.242","144.217.86.109","31.184.236.63","31.184.236.71","31.184.236.79","194.28.112.149","62.233.50.19","194.28.112.156","45.227.255.51","185.92.72.135","80.66.66.175","62.233.50.11","62.233.50.13","194.28.115.124","62.233.50.81","152.89.196.185","91.240.118.9","185.81.68.45","152.89.196.186","185.81.68.46","185.81.68.74","62.233.50.25","62.233.50.17","62.233.50.23","62.233.50.101","62.233.50.102","62.233.50.95","62.233.50.103","92.255.57.202","91.240.118.5","91.240.118.8","91.240.118.7","91.240.118.4","161.35.92.242","45.227.252.237","147.78.47.245","46.161.27.123","94.232.43.143","94.232.43.250","80.66.76.18","94.232.42.109","179.60.147.152","185.81.68.197","185.81.68.75") by "All_Traffic.action", "All_Traffic.src", "All_Traffic.dest", "All_Traffic.user"| `drop_dm_object_name("All_Traffic”)| table action, src, src_port, dest, transport, dest_port, user, bytes
Step 2 As observed by multiple researchers, APTs have been seen to make connection attempts to hit the CISCO ASA VPN portals using a specific parameter suited for brute forcing. Detecting the use of this parameter could help uncover an attempt to exploit the CISCO ASA VPN.
Actions to Detect:
Attempts to hit URLs ending in the following; +CSCOE+/logon.htm
SPL - Using Web Datamodel:
| tstats `summariesonly` sum("Web.bytes") as bytes,values("Web.http_content_type") as http_content_type,values("Web.http_method") as http_method,values("Web.http_user_agent") as http_user_agent,values("Web.status") as status from datamodel="Web"."Web" where Web.url = "*+CSCOE+/logon.htm*" by "Web.src", "Web.dest", "Web.user", "Web.url", _time | fields _time src, dest, user, url, http_content_type, http_method, http_user_agent, status, bytes
Step 3 Many attackers utilize strategies like brute force attacks, password spraying, and credential stuffing to exploit vulnerabilities associated with weak or default passwords. Detecting connection attempts to log in to the CISCO ASA VPN with often-used account names could be evidence of attempting exploitation.
Actions to Detect:
Note: This CSV file listing includes all the mentioned usernames, along with other Indicators of Compromise (IOCs), conveniently consolidated for streamlined export into a lookup for notable detections.
| tstats `summariesonly` latest(_time) as _time, values(Authentication.src_user_id) as src_user_id, values(Authentication.src_user_role) as src_user_role, values(Authentication.user_id) as user_id, values(Authentication.user_role) as user_role, values(Authentication.vendor_account) as vendor_account, values(Authentication.authentication_method) as authentication_method from datamodel="Authentication"."Authentication" where Authentication.src_user IN ("TEST","CISCO","SCANUSER","PRINTER","admin","adminadmin","backupadmin","kali","cisco","guest","accounting","developer","ftp user","training","test","printer","echo","security","inspector","test test","snmp") by "Authentication.action", "Authentication.app", "Authentication.src", "Authentication.src_user", "Authentication.dest", "Authentication.user"| `drop_dm_object_name("Authentication")` | fields _time, action, app, src, src_user, src_user_id, src_user_role, dest, user, user_id, user_role, vendor_account, authentication_method
Step 4 Upon successful internal authentication, threat actors deployed “set.bat,” installing and activating AnyDesk with a preset password, “greenday#@!”. They also executed “nd.exe” on some systems to access additional credentials. These actors then moved laterally and executed files on other systems, often concluding with the deployment of Akira or LockBit ransomware.
Actions to Detect: An attempt to execute the following processes; set.bat nd.exe
SPL – Using the Endpoint Data Model:
| tstats `summariesonly` latest(_time) as _time, values(Processes.user) as user, values(Processes.process) as process, latest(Processes.parent_process) as parent_process, latest(Processes.parent_process_exec) as parent_process_exec, latest(Processes.parent_process_guid) as parent_process_guid, latest(Processes.parent_process_id) as parent_process_id, latest(Processes.parent_process_path) as parent_process_path, latest(Processes.process_path) as process_path, latest(Processes.process_exec) as process_exec, latest(Processes.process_guid) as process_guid, latest(Processes.process_id) as process_id, latest(Processes.process_hash) as process_hash from datamodel="Endpoint"."Processes" where Processes. process IN ("set.bat", "nd.exe") by Processes.dest, Processes.process_name, Processes.parent_process_name | fields _time, dest, user, process_name, process, process_hash, process_path, process_exec, process_id, process_guid, parent_process, parent_process_name, parent_process_path, parent_process_exec, parent_process_guid, parent_process_id
Step 5 This step involves detecting outbound connection attempts to anydesk.com and/or rustdesk.com from the client’s environment. Such software is used by the APTs as a foothold in a client’s environment for further exploitation. This is especially important for environments that have strong application policies that don’t allow unapproved applications to be installed. This detection is not as useful if either of these products is used in a client’s environment.
Actions to Detect: Detect outbound connection attempts to the following URLs; anydesk.com rustdesk.com
SPL- Using the Web Data Model:
| tstats `summariesonly` sum("Web.bytes") as bytes,values("Web.http_content_type") as http_content_type,values("Web.http_method") as http_method,values("Web.http_user_agent") as http_user_agent,values("Web.status") as status from datamodel="Web"."Web" by "Web.src", "Web.dest", "Web.user", "Web.http_referrer", "Web.url", _time | `drop_dm_object_name("Web")` | where match(url, "(?i)(anydesk.com)|(rustdesk.com") | fields _time src, dest, user, http_referrer, url, http_content_type, http_method, http_user_agent, status, bytes | eval ip_pair = src . " - " . dest | stats values(_time) as Time values(ip_pair) AS src_dest, values(user) as user, values(http_referrer) as http_referrer, values(http_user_agent) as http_user_agent, values(http_method) as http_method, values(status) as status, values(bytes) as bytes count by url
SPL 2 – Using the Network Resolution Data Model:
| tstats `summariesonly` latest(_time) as _time values("DNS.dest") as dest, values("DNS.query") as query, values("DNS.query_count") as query_count, values("DNS.message_type") as message_type, values("DNS.answer") as answer, values("DNS.reply_code") as reply_code from datamodel="Network_Resolution"."DNS" where DNS.query IN ("anydesk.com", "rustdesk.com") | table _time, dest, query, query_count, message_type, answer, reply_code | fieldformat Time = strftime(_time,"%m/%d/%Y %T")
Step 6 Research has shown that a pattern Akira and other APTs followed getting into a Cisco VPN was to attempt to authenticate to internal machines for lateral movement. Common source machine names and destinations have been made aware. Thus, connection attempts to authenticate to/from Windows machines with a specific naming convention (“WIN-*”) on a client’s user VPN network may be evidence of this CISCO ASA VPN exploitation.
Actions to Detect: The following Windows Event Codes; 4626 – “An account was successfully logged on” 4625 – “An account failed to log on.”
The following machines names attempting authentication; WIN-* WIN-R84DEUE96RB
SPL – Using the Windows Event Log Data Source:
index=wineventlog EventCode IN ("4625","4626") ComputerName IN ("WIN-R84DEUE96RB", "WIN-*")
| table _time, name, Message, status, ComputerName, Display_Name, EventCode,
SPL 2 – Using the Authentication Data Model:
| tstats `summariesonly` latest(_time) as _time, values(Authentication.src_user_id) as src_user_id, values(Authentication.src_user_role) as src_user_role, values(Authentication.user_id) as user_id, values(Authentication.user_role) as user_role, values(Authentication.vendor_account) as vendor_account, values(Authentication.authentication_method) as authentication_method, values(Authentication.signature) as signature from datamodel="Authentication"."Authentication" where Authentication.signature IN ("4625","4626") AND "Authentication.dest" IN ("WIN-R84DEUE96RB", "WIN-*") by "Authentication.action", "Authentication.app", "Authentication.src", "Authentication.src_user", "Authentication.dest", "Authentication.user" | `drop_dm_object_name("Authentication")` | fields _time, action, app, src, src_user, src_user_id, src_user_role, dest, user, user_id, user_role, vendor_account, authentication_method
Ideally, you could make scheduled searches like what is shown above with lookup tables for matching more specific and new detections. These can be set to run on a continuous schedule to ensure the monitoring of your assets from new vulnerabilities. Old vulnerabilities that have been patched (and applied) can also be aged out of this lookup table to ensure it is timely and efficient. For questions on how to build such a process that is dynamic and customizable for your environment, ask one of our consultants by filling in the form below. Also, subscribe to the TekStream blog to catch the next monthly security bulletin and apply the latest detections to protect your systems. Happy Splunking!
The approaches recommended herein have not been tested broadly across the TekStream customer base. They are preliminary in nature and come without any certification of efficacy.
When working in Splunk, scheduled searches often skip or cannot execute for one reason or another. If a search got skipped, a scheduled job waits on the line for the search slot and the job sits in deferred status. If the scheduling window expires, the search does not run and the job resets to skipped status.
Reports, alerts, data models and many app dashboards like Enterprise Security (ES) depend on your scheduled searches. When these searches do not run in the scheduled time window, the overall Splunk environment becomes unreliable because of missing data or incorrect data in the dashboards and reports. This can cause you to miss crucial alerts and can slow the performance of dashboards.
How to Find Skipped Searches in Splunk Cloud
The below spls show any scheduled searches that are being skipped, the reason why and the savedsearch name. Time range of last 7 days is a good place to start, and can go back up to 30 days.
index=_internal sourcetype=scheduler status=”skipped” | stats values(savedsearch_name) count by reason
index=_internal sourcetype=scheduler savedsearch_Name=* status=skipped | stats count by reason
Skipped Search Reasons and Solutions
These are the most common reasons for skipped searches in any Splunk Cloud stack:
Reason 1: The maximum number of concurrent running jobs for historical scheduled searches on this instance or cluster has been reached.
Explanation: By default, only one instance of a given search is kept running at the same time. Therefore, if the search is already running for scheduled_time and when the next cron scheduled _time comes due for the next run, the scheduler will not execute the next job. So, the next scheduled search job is skipped now because the previous scheduled search job for the same saved search is still running. Example: The cron schedule configured to run the search every 5 minutes but the search itself takes 10 minutes to complete.
Solution: a. Tune the spl of the search job to run within the configured time window. If possible, shorten the earliest time for the job. b. If you cannot improve the search runtime, then increase the cron period to make sure it’s more than the search execution time.
Reason 2: The maximum number of concurrent historical scheduled search on this cluster has been reached or the maximum number of concurrent auto-summarization searches has been reached.
Explanation: Each Splunk cloud stack is configured to run a maximum number of concurrent searches. We can find it under Settings -> Search Preferences -> Limits set for scheduled searches and summarization searches. As a cloud customer, set these values in the backend in the limits.conf. When we change the percentage from 50% to 75%, we can see the number of search slots for the scheduled searches and summarization searches (DM) increased. Before increasing this concurrency limit, please make sure all the best practices listed in the below Solution section are implemented. Example: If a DM skipped for last 5 minutes acceleration then when it runs the next time it tries to run for last 10 minutes data. If that is also skipped, the next time it tries to run for last 15 minutes data and keeps accumulating.
Solution: a. Avoid scheduling search jobs at the top of the hour, like 10:00 am, 11:00 am or 10:30 pm, 11:30 pm, etc. It means we are scheduling too many searches at the same time. Tune the cron schedules of the scheduled jobs to fire on different minutes, which makes the load spread through the hour/day. b. Disable unused scheduled searches. Remove unused apps and TA’s. c. Not all the DMs need to be accelerated. Only if the summary data is more than 1GB is the acceleration useful. d. Consider workload management. The following rule limits the number of concurrent ad hoc searches to 50% of the total search concurrency limit, which in turn provides more search slots for scheduled searches and summarization searches: search_type=adhoc AND adhoc_search_percentage >50. e. Create WLM rule to place prioritized searches in the high priority pool to get them maximum resources and hence the search completes faster. f. Tune Datamodel to search only the indexes needed.
Best practice setup for search jobs can eliminate skipped searches and incomplete data. Following the quick tips here will ensure more thorough alert reporting and faster dashboards.