Author: dystrick

  • TekStream Security Bulletin: Use Splunk to Swat StripedFly

    TekStream Security Bulletin: Use Splunk to Swat StripedFly

    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

    StripedFly has been a consistent threat since first discovered by Kaspersky in 2016. It is associated with APT malware and is estimated to have infected over 1 million systems – both Windows and Linux. This malware is known to infect machines by exploiting the following:

    • The initial infection is by piggybacking off a custom EternalBlue SMBv1 exploit.
    • A lightweight TOR client is then used to communicate with a C2 server and download additional malware – though the main purpose (crypt mining, espionage, etc.) is not fully known.
    • This additional malware can then engage in a variety of malicious activities including credential harvesting, crypto mining, adware, etc.
    • The malware disables the SMBv1 protocol and uses SSH along with processes similar EternalBlue to spread.

    Threat Overview

    The vulnerability has been acknowledged by Kaspersky and they have suggested various mitigation steps to prevent its exploitation. Due to the flexibility of the malware and the way its APT uses it, the recommendations are quite generic.

    These steps include:

    • Training and mitigations for phishing attacks – the most common way victims are exposed to this malware.
    • Exercising good credential hygiene including the use of a secure password manager
    • Ensuring all devices on a network have an updated endpoint security system.
    • Disabling SMBv1 if it is not necessary for critical business processes.

    So far, we have seen many good options and would like to present a few more specific cases using Splunk. 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 a StripedFly malware infection. Recommendations on remediating the vulnerability are discussed at length by various resources including Secure List.

    In this security bulletin, we go through the various ways StripedFly exploits a victim system and how to detect it. 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: Analyzing trends in your environment to detect anomalies relating to processes normally run and regular access to online code repositories would be ideal. This requires massaging to a specific environment and 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:

    1. Detect malicious PowerShell scripts indicating initial infection.
    2. Detect disabling of SMBv1.
    3. Detect requests to malicious code repositories.
    4. Detect beaconing to a command-and-control server in the TOR network.
    5. Detect the existence of files associated with StripedFly malware modules

    Threat Implication

    StripedFly primarily exploits the weakness of SMBv1 on internet-facing systems. The initial infection is dropped on the machine and this malware self-propagates once on a network. It sets up an encrypted channel using TOR to hide communications with a C2 server. As part of its activities, it downloads updates and additional malware by connecting to malicious code repositories.

    The fact the malware has support and pluggable modules to update its functionality points to APT malware. It has been associated with the Shadow Brokers, but the true origin of the malware is still unclear. It has also been associated with the ThunderCrypt ransomware, which may suggest a monetary incentive for the malware’s authors.

    Threat Detection

    Step 1

    If a victim machine is infected with the original malware from StripedFly, PowerShell scripts are run if the tool is available. This is done to set up persistence for the malware.  Here we are looking to detect any PowerShell commands that are run and contain more than 50 trailing or leading spaces – not typical for a normal user or process running scripts. The spaces are used to obfuscate the code and avoid detection by an EDR system.

    Actions Detect

    Using Regex to find a PowerShell command with more than 50 leading or trailing spaces.

    SPL – Using Windows Data Source
    index=windows sourcetype=WinEventLog EventCode=4104 
    | where match(ScriptBlockText, "(?i)[ ]{50,}w+") OR match(ScriptBlockText, "(?i)w+[ ]{50,}")
    | table _time EventCode name action service UserData_Xml Message Subject_Account_Name ComputerName EventCode cmd ScriptBlockText
    

    Step 2

    A mark of the StripedFly infection the disabling of the SMBv1 protocol after infection. This is done once the malware payload is executed and a lightweight TOR client is installed. This step is done to “seal the gates” on the victim’s machine. Here we are detecting the disabling of these protocols.

    Actions Detect

    We are looking to detect the following activity and parameter set in the appropriate registry entry:

    HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesLanmanServerParameters
    Copy
    Registry entry: SMB1
    REG_DWORD: 0 = Disabled
    REG_DWORD: 1 = Enabled
    Default: 1 = Enabled (No registry key is created)
    SPL 1 – Using the Windows Data Source
    index=windows sourcetype=wineventlog EventCode=4657 Object_Name="*HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesLanmanServerParameters*" New_Value_Type = "REG_DWORD" Old_Value_Type = "REG_DWORD" Old_Value = 1 New_Value = 0 Object_Value_Name = "SMB1" 
    SPL 2 – Using the Endpoint Datamodel
    | tstats allow_old_summaries=true count, values("Registry.registry_key_name") AS registry_key_name, values("Registry.registry_path") AS registry_path, min(_time) AS firstTime, max(_time) AS lastTime FROM datamodel=Endpoint.Registry WHERE ("Registry.registry_hive" = "HKEY_LOCAL_MACHINESYSTEM" AND "Registry.registry_path" = "*HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesLanmanServerParameters*" AND "Registry.registry_value_type" = "REG_DWORD" AND "Registry.registry_value_name" = "SMB1" AND ("Registry.registry_value_data" = "0" OR "Registry.registry_value_text" = "0" )) BY "Registry.dest", "Registry.user"  

    Step 3

    As a way to reduce the footprint of the initial exploit, the StripedFly malware has most of its elements offloaded and stored in legitimate websites. Once persistence is set up, the malware will then request these elements to carry out malicious activities on the victim machine. The sophistication of these pluggable, customizable and version control malware modules point to an APT developing this malware. Multiple repositories have been identified to contain code requested by malware.

    Actions Detect

    Attempts to hit the URL’s associated with the malicious code repositories from within the victim’s environment.

    URLs

    This is a selection of URL’s to watch for:

    ghtyqipha6mcwxiz[.]onion:1111

    bitbucket[.]org/JulieHeilman/m100-firmware-mirror/downloads/

    bitbucket[.]org/upgrades/um/downloads/

    bitbucket[.]org/legit-updates/flash-player/downloads

    gitlab[.]com/JulieHeilman/m100-firmware-mirror/raw/master/

    gitlab[.]com/saev3aeg/ugee8zee/raw/master/

    github[.]com/amf9esiabnb/documents/releases/download/

    tcp://pool.minexmr[.]com:4444

    tcp://mine.aeon-pool[.]com:5555

    tcp://5.255.86[.]125:8080

    tcp://45.9.148[.]21:80

    tcp://45.9.148[.]36:80tcp://45.9.148[.]132:8080

    This CSV file includes all the listed URLS, along with other Indicators of Compromise (IOCs), conveniently consolidated for streamlined export into a lookup for notable detections.

    SPL – Using the Web Datamodel

    Detect URLs

    | 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 IN (" ghtyqipha6mcwxiz[.]onion:1111", "bitbucket[.]org/JulieHeilman/m100-firmware-mirror/downloads/","bitbucket[.]org/upgrades/um/downloads/","bitbucket[.]org/legit-updates/flash-player/downloads","gitlab[.]com/JulieHeilman/m100-firmware-mirror/raw/master/","gitlab[.]com/saev3aeg/ugee8zee/raw/master/","github[.]com/amf9esiabnb/documents/releases/download/","tcp://pool.minexmr[.]com:4444","tcp://mine.aeon-pool[.]com:5555","tcp://5.255.86[.]125:8080","tcp://45.9.148[.]21:80","tcp://45.9.148[.]36:80","tcp://45.9.148[.]132:808") by "Web.src", "Web.dest", "Web.user", "Web.http_referrer", "Web.url", _time | `drop_dm_object_name("Web")` | 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")

    Note: The malicious URLs have been kept sanitized using “[.]” for the periods, please remove these when running the SPL. Please be careful not to navigate to them outside a sandbox.

    Step 4

    The StripedFly malware has a few known Command-and-Control servers hosted in the TOR network. The malware uses a lightweight TOR client to connect to the C2 server through TCP connections – often sending a unique ID for the victim machine, requesting malware modules/updates and beaconing. Finding any attempts to communicate with these known C2 servers would be a smoking gun for this malware being present in a victim’s environment.

    Actions Detect

    Any connection attempts with the following domains and/or IP addresses.

    C2 Domains

    gpiekd65jgshwp2p53igifv43aug2adacdebmuuri34hduvijr5pfjad[.]onion

    ghtyqipha6mcwxiz[.]onion

    ajiumbl2p2mjzx3l[.]onion

    C2 IPv4 Addresses

    45.9.148[.]21
    45.9.148[.]36
    45.9.148[.]132
    5.255.86[.]125

    This CSV file includes all the listed URLS, along with other Indicators of Compromise (IOCs), conveniently consolidated for streamlined export into a lookup for notable detections.

    SPL 1 – Using the Web Datamodel for Domains

    Detect Domains

    | 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)(gpiekd65jgshwp2p53igifv43aug2adacdebmuuri34hduvijr5pfjad[.]onion)|(ghtyqipha6mcwxiz[.]onion)|(ajiumbl2p2mjzx3l[.]onion)") | 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")

    Note: The malicious URLs have been kept sanitized using “[.]” for the periods, please remove these when running the SPL. Please be careful not to navigate to them outside a sandbox.

    SPL 2 – Using the Network Datamodel for IPs

    Detect IPs

    | 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 ("45.9.148[.]21","45.9.148[.]36","45.9.148[.]132","5.255.86[.]125") OR All_Traffic.dest IN ("45.9.148[.]21","45.9.148[.]36","45.9.148[.]132","5.255.86[.]125") 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

    Note: The malicious IPs have been kept sanitized using “[.]” for the periods, please remove these when running the SPL. Please be careful not to navigate to them outside a sandbox.

    Step 5

    Since the malicious code repositories are known, the files are often requested are known. The filenames and hashes have been taken from malware repos. Evidence of these files in a victim’s environment would point to malware modules requested/downloaded and this malware present. Looking for these known IOCs would also be a smoking gun for StripedFly presence.

    Actions Detect

    The presence of any of these known bad hashes in the victim’s environment:

    Table showcasing the presence of any known bad hashes in the victim's environment after a StripedFly malware attack.
    SPL
    | 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 | search Filesystem.file_name IN ("system.img", "delta.dat", "delta.img", "ota.dat", "ota.img ") OR Filesystem.file_hash IN ( "b28c6d00855be3b60e220c32bfad2535", "18f5ccdd9efb9c41aa63efbe0c65d3db", "2cdc600185901cf045af027289c4429c", "54dd5c70f67df5dc8d750f19ececd797", "d32fa257cd6fb1b0c6df80f673865581", "c04868dabd6b9ce132a790fdc02acc14", "c7e3df6455738fb080d741dcbb620b89", "d684de2c5cfb38917c5d99c04c21769a", "a5d3abe7feb56f49fa33dc49fea11f85", "35fadceca0bae2cdcfdaac0f188ba7e0", "00c9fd9371791e9160a3adaade0b4aa2", "41b326df0d21d0a8fad6ed01fec1389f", "506599fe3aecdfb1acc846ea52adc09f", "6ace7d5115a1c63b674b736ae760423b", "2e2ef6e074bd683b477a2a2e581386f0", "04df1280798594965d6fdfeb4c257f6c", "abe845285510079229d83bb117ab8ed6", "090059c1786075591dec7ddc6f9ee3eb", "120f62e78b97cd748170b2779d8c0c67", "d64361802515cf32bd34f98312dfd40d") | 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")
    

    IOC List

    This file is an aggregate of IOCs found related to StripedFly exploitation. 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.

    TekStream StripedFly IOC List

    Conclusion

    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!

    References

    Bleeping Computer: StripedFly Malware Framework Infects 1 Million Windows Linux Hosts

    Securelist.com: StripedFly Perennially Flying Under the Radar

    OTX.Alienvault.com StripedFly Securelist

    OTX.Alienvault.com StripedFly: Perennially flying under the radar

    Disclaimer

    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.

  • How Datamodel Works in Splunk ES

    How Datamodel Works in Splunk ES

    By Kamal Dorairaj, Senior Splunk Consultant

    Datamodel is really like Savedsearches, providing structure to underlying unstructured data. Datamodel has multiple datasets, where datasets are like a table in the traditional database. In Splunk, when we create dataset, we create with some constrains. This blog walks through the end-to-end flow of a datamodel in Splunk ES. By the end of this demonstration, you will find the above definition makes sense.

    Let’s take “Authentication” datamodel as an example:

    Step One

    Login into your Splunk ES search head. Navigate to Settings -> Data models and Click on the “Authentication” DM. We can see the macros and base constrain for the DM. Then click on the failed authentication. Now we can see new constrain on top of the base constrain. The base constrain does not change. The child constrains look into every index that has tag authentication defined in the base constrain and also the “action =success” defined in the child constrain.

    Note down the macro used in the Authentication datamodel and proceed to Step Two.

    Step Two

    Go to ES -> Configure -> CIM Setup -> Click on the Authentication DM -> at the bottom -> Indexes are whitelist -> Only these indexes are scoped for the DM. I.E.: this is only data that is coming into this datamodel. Now, we have to ask ourselves, do all indexes included here have authentication events as desired? Is there anything that we want that is not added here? Please add/remove indexes according to your authentication log sources.

    Step Three

    Let’s say we are sending authentication logs to an index called “abc”, but we are not seeing any events in the Authentication DM.

    Then let’s do a search on that index -> “index=abc | stats count by tag”

    If we go back to the Authentication DM constrain, it uses action as one of the tags. But that tag is not available in the above “abc” index. It says that the base constrain for the DM is not met for this index.

    Let’s do index=abc | stats count by action

    We can see the values in the action field. It says we have to create tag, so we can see the events in the authentication datamodel. Create the tag authentication.

    Step Four

    All the TAs runs by eventtypes. Let’s go to Settings -> Eventtypes -> search for authentication, and sort by tags. When the accelerated Authentication DM runs, it looks for the tags and runs all the eventtypes related to the authentication tag. If we don’t have the eventtype that is looking for the tag authentication, then it will not give any data for the DM.

    Let’s run -> “index=abc action=success”

    It will show the list of sourcetype and check the sourcetype that got the data that we wanted.

    Go back to the eventtypes -> Create new eventtype and in the search string -> sourcetype=<that we are looking for> and we can use index also in the search string.

    Go to tag -> type authentication. Now when we search for eventtype it returns the data for that sourcetype. We don’t have to mention index in the eventtype but the more you scope its better.

    Step Five

    The above link provides all the ES Dashboards and the DM, the fields it depends on. If our raw data doesn’t have the same field name defined for the DM, then create a field alias for that. In general, we may not have all the fields in our data that is cim compliant.

    We have to check the raw data and make a decision which of those fields may potentially map to a datamodel. The prescribed values are those values should be in for that particular field. No other values.

    Step Six

    a.) |datamodel Authentication

    This shows if the datamodel is functional.

    b.) |from datamodel:Authentication

    This shows all the data in the datamodel. Click on the “users” field on the left side. We can see data for the “users” field. Check if all the data is extracted correctly. If we see ‘unknown’ then data is not extracted correctly. The fields we see in the left side are the fields that are part of the datamodel.

    c.) | datamodel Authentication flat
    | table *
    | fields – date_* host index punct _raw time* splunk_server splunk_server sourcetype source eventtype linecount
    | fieldsummary

    This uses fieldsummary with the datamodel search. It groups all the values for each field. It helps to find the list of fields in the DM that got “unknown” values.

    d.) |datamodel Authentication search
    |datamodel Authentication acceleration_search_string

    This is what the accelerated dm search looks like.

    Step Seven

    a.) When we search only the sourcetype and if it’s not returning anything then because the user not having permission to search all the indexes by default. So it’s better to search index=* sourcetype=abc… -> then it looks for the indexes that use has permissions.
    b.) Review the permissions on the eventtype and tags and make sure its global.
    c.) If there is any bundle problem, then creating tag/eventtype won’t reflect immediately. It’s hard to troubleshoot when your bundle is broken. We will cover this topic in a separate blog.

    Summary

    Configuring DM with proper scoping as explained helps your SVC cost in the cloud environment. When we do Index whitelist and Tag whitelist, we are running specific tags only on specific indexes. Please follow the same steps for all the other datamodels in your environment. If you are on ingest model then it would not cost money but when users are accessing the ES dashboard, it would be slow loading and cause performance problems.

    Please contact us here if you have any questions!

  • Splunk SOAR: Make the Most of Your HUD Space with Pin Lists

    Splunk SOAR: Make the Most of Your HUD Space with Pin Lists

    By Marvin Martinez, Team Lead, Automation Engineering

    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. 

    Screenshot of the Splunk SOAR HUD interface displaying two labeled fields, event metadata such as playbooks run and artifact count, and container details including creation time and source ID.

    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.

    Screenshot of the “Configure Utility” panel in Splunk SOAR with the “APIs” tab selected and the term “pin” entered into the search bar, highlighting the ability to locate and configure pin-related utilities.
    Detailed configuration panel for the Splunk SOAR “pin” utility, showing fields to input a message, value, pin type, pin color, and optional name, emphasizing customization options for pin visuals.

    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?

    HUD interface showing a dropdown labeled “Multivalue Pin” with three selectable field options (Field 1, Field 2, Field 3), demonstrating how users can manage and select multiple pin values efficiently.

    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:

    Screenshot of the “Asset Settings” tab within Splunk SOAR, showing setup fields for endpoint URL, authentication methods, and HTTP settings — used to establish connectivity for pin-based visual feedback.
    • 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!

  • Three Splunk Commands That Can Cause Loss of Data

    Three Splunk Commands That Can Cause Loss of Data

    By David Allen, Senior Splunk Consultant

    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:

    
index=main sourcetype=access_combined 
    | join pid [search index=my_index sourcetype=apache_error] 
    | stats sum(rows) sum(cputime) by pid
    

    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.

    Simple Venn diagram illustrating the difference between a left join and an inner join in Splunk. The left join highlights all data from dataset A and only the overlapping portion from dataset B, while the inner join shows only the intersection between A and B.

    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):

    stats
    chart
    timechart
join 
    append 
    transaction 
    table 
    eventstats 
    streamstats
    etc…
    

    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!

  • Security Bulletin: Inject Splunk to Detect HTML Injection in Citrix NetScaler

    Security Bulletin: Inject Splunk to Detect HTML Injection in Citrix NetScaler

    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:

    1. Detect the initial web request attackers use to append custom HTML code to the index.html hosted on a vulnerable NetScaler device
    2. Detect the hashes and file names that point to malicious files and scripts injected into the vulnerable NetScaler device
    3. Detect Ip Addresses associated with known ATP group that used this exploit as well as addresses seen associated with the attack
    4. Detect connections to domains that hosted the malicious JS script file created by threat actors who exploited this vulnerability
    5. 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.
    • The affected Citrix products are as follows:
    Citrix ADC and Citrix Gateway Security Bulletin.

    Reference: Citrix ADC and Citrix Gateway Security Bulletin

    Threat Detection

    Step 1

    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;

    /gwtest/formssso? event=start&target=

    /items/accounts/

    /api/now/sp/widget/widget-simple-list

    /api/now/sp/widget/5b255672cb03020000f8d856634c9c28

    SPL
    | 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.

    This is thoroughly explained here: CISA.GOV Cybersecurity Advisories

    Actions to Detect

    Appearance of the following file names in the victim’s Netscaler devices:

    Logouttm[.]php
    pykeygen
    info[.]php
    NPS
    The

    Appearance of the following hashes in the victim’s environment:

    SHA-1 Hash

    3345ad8b43d6771532ca55acf7e95fe98aeadb27 – Logouttm[.]php

    b8f9258e9c7c882944e2b773557b49e5821517fe – pykeygen

    55c83cb25be5c521e4874e22b1422c360abf0a29 – info[.]php

    ec17f7b3acb2334a062c37e0271c31c3c8b6879c – NPS

    dec36a2aa4ecb86eafd01015e27c06f51d104317 – the

    MD5 Hash

    47b8d29319a9e85aaf829f4f2f9c6c00 – Logouttm[.]php

    ee51f599d266be5fd89b423ca24521f1 – pykeygen

    c0b32901f9c6ce3f965b8552f7d058d4 – info[.]php

    9b6f12aed2369a99a1132edd2ede779d – NPS

    b383c4ed6712a0a06fb85b1d8405e0f1 – the

    SPL 1: File Names
    | 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:

    5.2.64[.]155
    5.255.101[.]76
    172.94.124[.]18
    154.6.91[.]149
    216[.]41[.]162[.]172
    216[.]51[.]171[.]17

    SPL
    | 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.

    Auto Download: TekStream CitrixNetScaler3519 IOC List

    Conclusion

    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!

    References

    Bleeping Computer: Hackers Hijack Citrix NetScaler Login Pages to Steal Credentials

    CISA: Cybersecurity Advisories

    Security Intelligence: X-Force Uncovers Global NetScaler Gateway Credential Harvesting Campaign

    SOC Radar: Critical and High Vulnerabilities in Citrix ADC and Citrix Gateway

    Citrix: Citrix ADC and Citrix Gateway Security Bulletin

    Disclaimer

    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.

  • Getting Rid of Unwanted Data with SEDCMD’s in Splunk

    Getting Rid of Unwanted Data with SEDCMD’s in Splunk

    By Aaron Dobrzeniecki, Senior Splunk Consultant

    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:

    Screenshot showing raw log data with highlighted segments — source IPs, timestamps, resource paths, HTTP status codes, object sizes, and user agents — used to demonstrate fields targeted for removal or masking using SEDCMDs.
    [unwanted_test]
    LINE_BREAKER=([rn]+)[d.]+
    MAX_TIMESTAMP_LOOKAHEAD=20
    SHOULD_LINEMERGE=false
    TIME_PREFIX=^[^[]+[
    TRUNCATE=9999
    TIME_FORMAT=%d/%b/%Y:%H:%M:%S
    SEDCMD-mask=s/^d+.d+.d+.d+/xxx.xxx.xxx.xxx/g
    SEDCMD-reqmethod=s/"[A-Z]+s[^"]+"s//g
    SEDCMD-useragent=s/"w+/[^"]+"s//g
    
    
    Search results showing access logs with source IPs anonymized and highlighted host, source, and sourcetype fields, demonstrating the outcome of applying SEDCMDs to remove sensitive data.

    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.

    [unwanted_test]
    LINE_BREAKER=([rn]+)[d.]+
    MAX_TIMESTAMP_LOOKAHEAD=20
    SHOULD_LINEMERGE=false
    TIME_PREFIX=^[^[]+[
    TRUNCATE=9999
    TIME_FORMAT=%d/%b/%Y:%H:%M:%S
    SEDCMD-sid=s/^.*JSESSIONID=/JSESSIONID=/g
    SEDCMD-remove=s/s[A-Z]+s.*//g
    
    Splunk log table filtered by session ID with masked hostnames and source fields, showing successful pattern removal via SEDCMD to reduce noisy or unwanted events.

    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.

  • Splunk Disaster Recovery Architecture

    Splunk Disaster Recovery Architecture

    By Brent Mckinney, Senior Splunk Consultant and Jon Walthour, Technical Architect

    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.

    Diagram showing Splunk indexer cluster replication between Region 1 and Region 2 (Disaster Recovery). Indexers in three availability zones in each region are connected via S3 buckets using cross-region replication.

    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:

    server.conf
    
    [clustering]
    contrain_singlesite_buckets=false 
    
    

    To enable SmartStore on our indexers, we need to update indexes.conf in the indexes app under $SPLUNK_HOME/etc/manager-apps.
    indexes.conf

    [volume:smartstore]
    storageType = remote
    path = s3://<name_of_s3_bucket>
    remote.s3.access_key = <s3_access_key>
    remote.s3.secret_key = <s3_secret_key>
    remote.s3.endpoint = http|https://<s3_host_url>
    
    [default]
    remotePath = volume:smartstore/$_index_name
    repFactor = auto
    

    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

    Diagram illustrating a Splunk search head cluster setup across two regions. Each region (Region 1 and DR) includes three availability zones with interlinked search head nodes, showing cluster-level synchronization.

    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.

    Full Splunk DR architecture diagram combining search head and indexer clusters across Region 1 and DR. Includes load balancer at the top directing traffic, DNS routing for search heads to local indexers, and S3 buckets facilitating index replication between regions.

    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!

  • GOV. EDWARDS, PRESIDENT TATE OPEN DOORS TO NEW LSU CYBERSECURITY OPERATIONS CENTER, PROTECTION MODEL FOR LOUISIANA

    GOV. EDWARDS, PRESIDENT TATE OPEN DOORS TO NEW LSU CYBERSECURITY OPERATIONS CENTER, PROTECTION MODEL FOR LOUISIANA

    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.”

    Ribbon Cutting at the LSU Student SOC Center.

    “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.

    Bruce and Rob at LSU student-powered co-managed SOC ribbon cutting event.

    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.”

  • Time Range for Searching Splunk Events

    Time Range for Searching Splunk Events

    By Tyler Phillips, Splunk Consultant

    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.

    Blank Splunk dashboard titled "Time Inputs Blog" showing a single text input labeled "Time Input Text" with no panels or search results.

    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).

    Splunk dashboard displaying a time input box and a basic search result table with fields like _raw, _time, host, index, and sourcetype.

    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.

    The dashboard now contains a date-time string in the input box, filtering logs based on a specific time (2023-6-20T10:00:00), with corresponding Splunk log results displayed below.

    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:

    A dropdown configuration window inside the Splunk dashboard showing static time offset options like 0 minutes, 5 minutes, 10 minutes, and 15 minutes, set with relative values (+0m to -15m).

    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

    index=_internal sourcetype=splunkd
    [ | makeresults | eval earliest_time=relative_time(strptime(“$time$”,”%Y-%m-%dT%H:%M:%S”), “$earliest_tok$”) | return earliest_time ]
    [ | makeresults | eval latest_time=relative_time(strptime(“$time$”,”%Y-%m-%dT%H:%M:%S”), “$latest_tok$”) | return latest_time ]

    Complete Splunk dashboard with inputs for start and end time using dropdowns. Time range from “0 minutes” to “15 minutes” applied, and corresponding log data is visible in the panel.

    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!

  • Guidance for Headless Content Management Design: Key Design Strategies for Headless Implementations of Oracle Content Management Cloud

    Guidance for Headless Content Management Design: Key Design Strategies for Headless Implementations of Oracle Content Management Cloud

    By Courtney Dooley, Technical Architect

    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 AssetTags can 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: