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!
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.
This article will give Splunk admins a beginner’s guide to Splunk App/User Context Configuration Files. In a previous post, I went over several Splunk configuration files that one would find in a global context – independent of any apps or users. As a quick refresher, configuration files in Splunk (or “conf files”) dictate almost all settings in a Splunk environment. Splunk can have several of the same conf files in several directories, and “merge” via precedence rules. These rules differ depending on the context. Here, we will discuss Splunk conf files in the app/user context.
When is the App/User Context Applicable?
This context applies when editing conf files that pertain to a certain app or dealing with knowledge objects/actions owned by certain users. Search related activities is most common to this context, and most conf files discussed will have direct effects on search related processes.
App/User Context Conf File Precedence
Conf files can exist in default or local directories within apps or the overall system. Generally, local settings take precedence over default settings, and it is recommended users make changes in local directories. Further ordering depends on global or app/user context. For the app/user context, the baseline precedence order is as follows (taken from Splunk documentation):
User directories for current user (/opt/splunk/etc/users/) – local, then default
App directories for current running app (/opt/splunk/etc/apps/running_app_name)– local, then default
App directories for other apps (/opt/splunk/etc/apps/other_app_name/) – local, then default
System directories (/opt/splunk/etc/system/) – local, then default
For example, if I had savedsearches.conf files stored within:
The first settings to take precedence would be the ones set in the admin user directory, as they would have any options set per user. Then, any settings set locally within the running app (in this case, search) would take precedence, followed by the app’s default settings. That is followed by settings in any other app contexts, and finally settings in the system directories that would apply if not overridden by a higher precedence file.
App directory names can determine additional precedence. For app/user context, Splunk uses reverse-lexicographical order for priority. For example, a file that starts with the letter “Z” has a higher precedence than a file with the letter “A”.
Here are some common conf files found in the app/user context in Splunk:
ALERT_ACTIONS.CONF
alert_actions.conf provides settings for saved search actions. Different options exist for configuring alerts to send emails, RSS notifications, scripts, scheduled searches, and custom alert actions.
The [default] stanza dictates settings for all alert_actions within the conf file but can be overridden by individual alert_action stanzas.
Here are some settings commonly configured in [default]:
maxresults = <integer> – the max number of search results sent through alerts
hostname = [protocol]<host>[:<port>] – the hostname in the URL sent through alerts
maxtime = <integer>[m|s|h|d] – the allowed amount of time for an alert to execute before it’s aborted
command = <string> – the search command that executes the action
label = <string> – sets the label in the UI for custom alert actions
description = <string> – sets the description in the UI for custom alert actions
FIELDS.CONF
fields.conf provides settings for Splunk to handle indexed and extracted fields, multivalue fields, and how search time handles field values.
Again, the [default] stanza dictates settings for all fields that can be overwritten by individual field stanzas.
For local settings, the stanza name may be the field name itself, or a wildcard expression for a certain sourcetype formatted like this:
sourcetype::<sourcetype>::<wildcard>
Additional settings:
TOKENIZER = <regex> – indicates a field value is part of a larger token (pertinent to multivalue fields)
INDEXED = <Boolean> – specifies if the field is created at index or search time
INDEXED_VALUE = several options:
Set to “true” if the value is in the raw event text
Set to “false” if not
Can also set to a sed-cmd string to substitute a field value
Can also set to a simple substitution string
MACROS.CONF
macros.conf provides settings to configure search macros, or reusable pieces of SPL referred to by a name between two backticks. This makes it very easy to use the same search strings in several different searches. Arguments can be passed into macros for more flexibility, and macros can contain eval statements.
Each stanza in macros.conf is specific to each search macro, and its naming convention is the name of the macro unless specified otherwise.
Available settings:
Available settings:
args = <string>, <string>, … – any arguments passed into the macro
definition – the search terms referred by the macro. Any arguments must be separated by dollar signs.
validation = <string> – verifies that the macro has appropriate arguments. Should return NULL if valid, or a Boolean/string if false.
errormsg = <string> – the error message returned by the macro if passed bad arguments and the validation setting is a Boolean statement.
Iseval = true|false – specifies if the definition is an eval expression that returns a string of the expanded macro
description = <string> – optional setting to describe what the macro does
PROPS.CONF
I went over props.conf in the global context in my last post, but this file can exist in both the global and the app/user context, depending on what settings are being used.
Use the EXTRACT or REPORT settings in props.conf to create search time field extractions. Typically, EXTRACT is the setting to use, but REPORT can be used across multiple sources/sourcetypes/hosts, to apply multiple extractions, to set up delimiter extractions, multivalue fields, to extract fields that start with numbers or underscores, and to manage formatting.
Example formatting: EXTRACT-hostname = d{4}sHostName=(?<HostName>w{5})s
Use the rename = <string> setting to rename a sourcetype at search time.
SAVEDSEARCHES.CONF
savedsearches.conf provides possible setting/value pairs for saved searches. The standard settings, under each stanza representing a saved search, are:
disabled = <Boolean> – is the search enabled or not
search = <string> – the SPL for the saved search
dispatchAS = [user|owner] – who does the search run as?
There are settings for additional configurations of saved searches including scheduling, notifications, workload management, and event actions.
TRANSFORMS.CONF
This file is used in tandem with props.conf to enact more complex regex transformations at both index time (global context) and search time (app/user context).
In a global context, transforms.conf uses regex to override host and sourcetypes values, mask sensitive data, create index time field extractions, and set up fields from lookup tables.
The app/user context uses regex or delimiters to help create search time field extractions. When the extraction occurs depends on which Splunk instance includes the transforms.conf file – for the app/user context, put transforms.conf on a search head. Settings for search time extractions include:
REGEX = <regex> – the regular expression used
FORMAT = <string> – required for index time extractions, but optional for search time extractions. Specifies formatting, particularly using $<number> to specify the capture group to output the regex.
SOURCE_KEY = <string> – defines the field(s) where Splunk applies the regex – the default is _raw
DELIMS = <quoted string list> – only applicable for search time extractions, to extract fields based on a delimiter separating field values
FIELDS = <quoted string list> – gives the option to provide field names to extracted fields
For further reading, here is a full list of Splunk conf files, and once again, here is a list to my original blog post about global conf files. Happy Splunking!
The TimeChart function is one of most used visualizations of Splunk Dashboards, easily showing the volume of specific events, broken down by category over time. In certain situations, you may want to overlay additional data on top of your time chart to highlight certain events that correlate with the time chart. Luckily the masterminds at Splunk have already thought of a clever way on how we can flag certain search results and overlay it: Annotations!
It’s not as simple as clicking a few buttons on your dashboard. Don’t be worried though, it’s not difficult either! As long as looking at the XML source doesn’t scare you, you’ll be fine. Let’s continue.
Create a Chart Overlay
In this example we’ll be using the Simple XML Dashboard. The below data will show a count of events over the span of 2 months. They’re placed into 1-day buckets using the span argument.
Additionally, we’ll group these events by their action so we can distinguish the two different actions.
This gives us a TimeChart that will look like this:
Now, let’s stack our chart to reduce clutter across the TimeChart.
To give us more clarity in our data, we can also add an overlay to show the total of both groupings. We can do this with the addtotals command.
Now we can use the new field created by the addtotals command, to overlay in the Dashboard settings.
This gives us a Dashboard that looks like this. You’ll see the orange TOTAL line is now added to the TimeChart.
Now for the fun part. Let’s add in the Annotations, or flags, to highlight certain events.
In this example, I’ll just be using a unique timestamp value from 3 of the events, but in real world situations you could use a dynamic search to flag server reboots or critical errors on an application.
To add the Annotations:
1) Go into ‘Edit’ on your Dashboard and modify the XML source.
2) Find the <chart> for your TimeChart in the XML
3) Insert this annotation XML directly below the opening <chart> tag:
<search type="annotation">
<query>YOUR SPL QUERY HERE
| eval annotation_label = “ANNOTATION LABEL – FREE TEXT HERE (optional)”
| eval annotation_category = “SPECIFY A SPLUNK FIELD HERE (optional)”
</query></search>
After saving the XML, you’ll see your annotations display on your TimeChart if it found matching events. It may look something like this:
If you hover over the annotation label, you’ll see what we defined under the eval annotation commands.
Voila! You’ve got yourself a powerful visualization, able to show multiple data sources and correlate them together through the TimeChart command. Happy Splunking!
Today, I want to introduce you to a new way of simplifying configuration management with Splunk’s deployment server/deployment client architecture. The goal is to get you out of the business of constantly adding new hostnames to or removing hostnames from whitelists or csv files in your serverclass.conf file on your deployment server. You can put all that on automatic with this approach.
Overview
As an overview, a deployment server manages the configuration for multiple deployment clients, usually forwarders, via a model where clients connect to a deployment server, identify themselves and then, based on that identification, download app bundles from the deployment server which the deployment server has been configured for them to receive. This determination by the deployment server of which apps a client downloads is usually done by matching the hostname of the client or its IP address against a list of values defined in a configuration file called “serverclass.conf” on the deployment server. These lists are in the form of one or more whitelist or blacklist settings in a “serverClass” stanza and are typlically comprised of hostnames and IP addresses, either in whole or in part with the use of wildcards (*). Whenever a new deployment client is added or an old one retired, a change to these listings must be made and the deployment server’s configuration reloaded.
Auto-Scale AWS Heavy Forwarders
Let’s say, for example, you need to auto-scale heavy forwarders to handle increased AWS event traffic. You can’t be constantly adding and removing ec2 instance names to one or more serverclasses in serverclass.conf. You need a way to have the deployment client communicate to the deployment server, letting it know “I’m an AWS heavy forwarder” and have the deployment server recognize that and send the client a listing of apps to install and update based solely on its classification as an “AWS heavy forwarder” without needing to have the particular hostname or IP address or IP address range detailed anywhere in serverclass.conf.
The answer here is to add that designation to the deployment client when the universal forwarder software is installed. This way, when the deployment client connects to the deployment server for the very first time, it identifies itself properly. This designation is defined in a setting called “clientName” in deploymentclient.conf in the “[deploynent- client]” stanza. It is recommended this setting be added to the copy of deploymentclient.conf in $SPLUNK_HOME/etc/system/local as it is an identifier for that particular server and will remain untouched by any changes made by the deployment server in $SPLUNK_HOME/etc/apps. Unlike “hostname” or “DNS name”, multiple deployment clients can have the same clientName. It’s just a categorization, a tag, a label to say, “I’m a web server” or “I’m a database server” or, in our example, “I’m an AWS heavy forwarder.” The actual value you use for clientName by itself is unimportant. What is important is that the “clientName” in deploymentclient.conf matches against one or more server classes on the deployment server to determine which apps are to be retrieved by the client from the server.
So, a deploymentclient.conf file in $SPLUNK_HOME/etc/system/local might look like this:
[deployment-client] clientName = aws-idm
and the serverclass.conf file on the deployment server might contain something like this:
Notice that you use the “clientName” value in serverclass.conf in the same way you would use hostname or IP address. So, you could also have a configuration in serverclass.conf that looks like this:
This configuration could be used to address all AWS instances running a Linux OS to distribute the Unix/Linux TA to them.
Mix and Match Identifiers
You can also mix and match the use of clientName with the other identifiers such as hostname or IP address. So, this example is also possible using a wildcarded clientName of “:oracle:”:
Remember that the order of these various identifiers like “clientName”, “hostname” and “IP address” are evaluated by the deployment server. “clientName” takes precedence over “hostname” or “DNS name”. So, you can use a phased in approach if you want to introduce this categorization system into an existing Splunk deployment. Add the clientName values alongside the existing hostnames and other identifiers. As deployment clients are configured with their clientName value, it is that value that will take precedence and eventually, when all clients have a clientName, the hostname can be removed from serverclass.conf to clean up the file. Just be careful during the transition. Just because clientName is part of the client’s identification of itself doesn’t mean that hostname or IP address is ignored. They are still part of the identification. The precedence just means that, should both identifiers exist in a serverClass stanza, the clientName setting will be decisive in determining the client’s membership in that serverClass.
clientName Values
The clientName value can be anything. You don’t need to segment it with dashes or colons. It could be just a string like “weblogic” or “database”. However, I have found in implementing this approach with customers that using segmentation in the value allows these clientNames to have multiple dimensions in them. You could, for example, identify a host as being in “Production” versus “Development”, in the “Finance” department or the “Sales” department, in the “Seattle”, “Chicago” or “New York” offices, all within the same clientName. For example:
newyork:sales:sqlserver:prod
By evaluating the segments, different apps can be sent to different hosts simply distinguished only by the value of one particular segment. For example, a serverClass to configure the collection of database log events from all the Microsoft SQL Server hosts could, using the example hostname above, employ a simple whitelist like:
Or server classes could be configured to send prod hosts’ event data to a production indexer cluster while those in the development environment to the development cluster.
If you choose to take this approach, though, consider the nature of your infrastructure carefully and how Splunk is laid out in it. Then, design your “clientName” conventions to your best advantage.
In this article, you have seen how you can get out of the business of maintaining lists of server hostnames in serverclass.conf because of constantly onboarding new and removing decommissioned hostnames. With the “clientName” setting in deploymentclient.conf, you can put the management of configuring deployment clients on automatic.
Designation Recognizes TekStream Expertise in Unique Needs of Government Migration Projects and Maximizing AWS Funding Programs to Offset Client Migration Expenses
Atlanta, Georgia, July 24, 2023 – TekStream Solutions, LLC is pleased to announce its selection by Amazon Web Services (AWS) as an Advanced Technology Partner in the AWS Government Competency Program. This designation recognizes TekStream’s proven ability to help Government agencies migrate, modernize, and optimize their workloads on AWS.
As an AWS Government Services Competency Partner, TekStream is authorized to provide the full range of migration services, including assessment, planning, design, implementation, operation and optimization. Migration is a critical part of cloud adoption, and TekStream has the experience and expertise to ensure state, local and federal agencies successfully transition critical workloads to AWS.
“We are excited to be named an AWS Government Services Competency Partner,” says Troy Allen, Vice President, Cloud Services at TekStream. “This designation reflects our extensive technical experience migrating government workloads to the cloud and modernizing their applications. It is a rigorous selection process, and we are proud TekStream was recognized by AWS as being well equipped to provide our customers an enhanced level of service.”
“The AWS Government Services Competency Partner designation gives our teams access to exclusive AWS resources and incentives as well as unique partner programs,” says Judd Robins, EVP, Sales & Marketing at TekStream. “This combined with our experience and understanding of AWS toolsets uniquely positions our teams to create and implement cloud migration and transformation plans across a variety of industries and use cases.”
One of TekStream’s recent government customers to receive AWS funding was the Georgia Technology Authority (GTA). TekStream helped them migrate their on-premise datacenter to the AWS Cloud, improving resiliency and stability. GTA realized $1M annual savings by moving workloads to the cloud and leveraged $150k in AWS incentives to fund their migration. Access to AWS funding allowed them to launch the program without cost, avoiding the long budgeting process some government agencies face.
As an AWS Partner with awarded designations including Migration Services Competency, Oracle Migration Competency and now the Government Services Competency TekStream has unique access to special funding programs that subsidize costs to migrate to the cloud. TekStream experts have the know-how and training to take maximum advantage of these special funding sources as they help clients anticipate, plan, and activate cloud migration initiatives. For more information on these programs, visit www.tekstream.com/aws funding.
About TekStream:
TekStream, (www.tekstream.com) headquartered in Atlanta, Georgia, helps clients accelerate digital transformation by navigating complex technology environments with a combination of technical expertise and staffing solutions. TekStream provides battle-tested processes and methodologies to help companies with legacy systems get to the cloud faster, so they can become more agile, reduce costs and improve operational efficiencies. With hundreds of successful deployments, TekStream guarantees on-time and on-budget project delivery and is proud to have 98% customer retention.
Splunk’s dashboarding capabilities separate it from the rest of the pack. The ability to normalize and visualize data in a way that’s meaningful to all levels of an organization is one of the many reasons it has been widely adopted by businesses in nearly every industry. To achieve this level of versatility, Splunk dashboards come out-of-the-box with powerful features that allow users to create flexible and reusable templates. One of those features is the dynamic input.
Dynamic Inputs: Pros and Cons
Dynamic inputs let you pass one or more values to a panel by using a separate SPL search to populate a list of values. When a user loads a dashboard with dynamic inputs, the populating searches run automatically and return the list of values.
Pros
Dynamic inputs (by definition) are non static, which makes them good for data that changes frequently. That translates to less time reworking inputs to fit incoming data, making your dashboards more flexible.
Cons
It adds another search, and could eat up more resources. This is why we need to make it as performative as possible, and we’ll use tstats to do that.
What is tstats and How is it Used?
Tstats is a generating command that performs statistical queries on indexed fields (as opposed to search time fields). It works similarly to the stats command and even uses the same functions, with one key difference: tstats performs these operations on the tsidx files, as opposed to the raw data in the indexes. This makes tstats much faster than stats: it’s like looking at the table of the contents for information instead of flipping through the whole book.
Implementing tstats Into the Dashboard Inputs
Imagine a Classic dashboard panel showing the top sources by host for a given index. Perhaps this is shown through a piechart visualization. If the list of possible hosts changes frequently, or are too numerous to type by hand, a dynamic input token might be the right tool for the job.
In the dashboard while in Edit mode, select “Add Input” and choose the appropriate input type for your use case. In this example, the Dropdown option will do nicely. These are the important settings and their values:
Under “General” – set the appropriate label and make sure “Search on Change” is selected.
Under “Token Options” – give the “Token” field the name of the token to use for this input.
Under “Dynamic Options” – the “Search String” text box is where you’ll put the search that dynamically returns the values. This is where the tstats search will go. Two things to consider: make sure the search returns a list of values, and be sure to set the time range appropriately for your use case. With tstats you can look over longer time ranges without drastically impacting how long the search runs. Set the values for “Field for Label” and “Field for Value”, which can both be the name of the output field (in most cases). Below is a simple example:
| tstats values(host) where index=<your_index_name>
| rename values(host) as Hosts
| stats list() by Hosts
Once finished, click “Apply”. Double check that your search is returning the correct results and each host is selectable in the dropdown. Finally, add the input token you just created to the appropriate search(es).
That’s it! You can add multiple dynamic inputs to your dashboard by repeating these steps, or pass multiple values through a single token by making a few changes:
Instead of using the Dropdown input, select “Checkbox” or “Multiselect”
2. Adjust the SPL in the relevant panels to accept multiple values:
My guess is that this will demonstrate that Splunk really does stand out from the pack. With the ability to normalize and visualize your data, you’ll provide actionable insights and put your company on the path to success using Splunk. Fill out the form below if you’d like to ask more. Happy Splunking!