Tag: Security

  • Letter from the CEO 

    Letter from the CEO 

    As the CEO of TekStream, cybersecurity is on my mind every day. And it must be for you as well. It seems we can’t go a day without word of another breach taking place, with the cost to individuals and to corporations rising with each incident. We are fortunate, here, to have a team of the best cybersecurity experts in the business who use Splunk, AWS and other tools to create a safe environment for our employees and our data.

    Not every company has the luxury or the budget for best-in-class digital security. Often, an IT generalist is tasked with the first defense measures against threats, with best of intentions and a set of foundational basics that kick the ball down the field a bit. We ask a lot of our teams in this category, and for every alarming thought we have on the subject, they have two.

    Fatigue and fear of the unknown creep in eventually, though, and with alarming infiltrations and new complexities coming from threat actors our staff can get underwater quickly.

    There are answers out there, though. After a consultation with our security team, we can give you a roadmap to security and a platform for future growth and innovation.

    It starts with our security assessment. This program gives you visibility into your current posture, fidelity measurement of your responses and a strategy and communication plan. Members of your IT, security and C-Suite will take away a clear view of current security gaps and a plan for remediation.

    Next, our team will assess security architecture, tools, and resources, creating a documented incident response process, security policy and related documents. This three-to-five-week engagement builds the foundation for your digital assets. After stakeholder interviews, the collaborative assessment delivers an optimized resource allocation model and remediation roadmaps, prioritized by risk and complexity.

    Some of our clients choose 24/7 coverage by our team, some choose a combination approach and some take the reins fully. With training and tools, the options are limitless.

    With the freedom of security comes innovation. The modern data platform gives way to GenAI, machine learning and other artificial intelligence protocols that can vault your firm into the next level of performance and efficiency.

    Let’s explore the possibilities together.

    Sincerely;
    Rob Jansen
    CEO

  • Security Bulletin: SPLUNK it to detect MOVEit

    Security Bulletin: SPLUNK it to detect MOVEit

    By Bryan Bollou, Team Lead, Cybersecurity Engineering

    Background

    On May 31st, 2023, it was announced that there was an expanding occurrence of the MOVEit vulnerability – an application used on over 2.5k servers on the internet. This was a critical vulnerability that could be exploited using SQL injection to do the following: 

    • Obtain a list of all folders, files, and users within MOVEit 
    • Download any file within MOVEit 
    • Insert an administrative backdoor user into MOVEit and give attackers an active session to allow credential bypass 

    Since then, a patch has been released that will prevent this exploitation of systems. So, the issue is resolved, right? Absolutely not! We know change management processes can take a while, even in serious situations like this. It may take many cycles before the proper patching is done to your machines to stop this attack. You may have already put in some workarounds to prevent the attack such as disabling ports 80 and 443 on the web servers or some detections to see the exploit. So far, we have seen many good options and would like to present a few specific cases using everyone’s favorite SIEM: Splunk.

    Objective

    The purpose of this security bulletin is not to fully explain or give recommendations on remediating the vulnerability, as has been discussed at length by various resources such as Progress Community.

    Our 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 MOVEit vulnerability being exploited. Here at TekStream, we have several security engineers that are intimate with cybersecurity knowledge and especially the logs of our clients.

    We will walk you through the various steps in the MOVEit 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.

    The following detection steps mirror the stages and TTP-related indicators used in the attack:

    1. Detect initial malicious file spawning SQL Injections
    2. Search for potential beaconing web traffic containing specific parameters
    3. Detect existence of downloaded malicious script
    4. Detect ancillary signs of malicious script activity
    5. Persistent malicious file install
    6. Detect data exfiltration
    7. Scan for related known malicious IPs
    8. Scan for related known malicious web domain

    Detections

    Step 1

    As part of the exploitation, a backdoor named “human2.aspx” was uploaded to multiple sites, this was a main file responsible for performing the SQL injection and exfiltrate sensitive data. Other executable files leveraged in the attack include:

    moveitisapi.dll to perform SQL injection directed by specific headers seen below.

    guestaccess.aspx to create a session and grab CSRF tokens and other parameters for more actions.

    Actions to Detect
    GET /human2.aspx – 443 
    POST /moveitisapi/moveitisapi.dll
    POST /guestaccess.aspx
    GET /human2.aspx

    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 AND Web.url = "*human2.aspx*") OR (http_method = POST AND Web.url = "*/moveitisapi/moveitisapi.dll*") OR (http_method = POST AND Web.url = "*/guestaccess.aspx*") OR (http_method = GET AND Web.url = "*/human2.aspx") 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")
    
    

    Step 2

    In the backdoor code, there is a check for specific parameters that will tell the malicious script what action to perform. Looking for the specific string of this request could be used to detect attempts to exploit the MOVEit Vulnerability. Search for web requests that contain any of the request or response headers listed below:

    Parameters to Detect
    X-siLock-Step1
    X-siLock-Comment
    X-siLock-Step2
    X-siLock-Step3

    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 Web.url = "*X-siLock-Step1*" OR Web.url = "*X-siLock-Comment*" OR Web.url = "*X-siLock-Step2*" OR Web.url = "*X-siLock-Step3*" 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")

    Step 3

    As mentioned above, depending on the parameters supplied, the malicious script can do multiple actions. Some include creating a backdoor user or deleting it. The account is called “Health Check Service” and doing searches for the existence of the user in a MOVEit database, or any account activity would help in detecting the exploit.

    Activity to Detect
    IF X-siLockStep1 = -2
    A backdoor user called Health Check Service is removed from the users table, potentially as a method to cover tracks.

    IF X-siLockStep1 = null AND X-siLock-Step2 = null AND X-siLock-Step3 = null
    The malicious script creates an administrative user named Health Check Service in the users table. It also creates and inserts a new active session for this user into the application.

    SPL

    | tstats `summariesonly` latest(_time) as _time from datamodel="Change"."All_Changes" where nodename="All_Changes.Account_Management" (All_Changes.user="Health Check Service" OR All_Changes.src_user="Health Check Service") by "All_Changes.action", "All_Changes.src", "All_Changes.Account_Management.src_user", "All_Changes.dest", "All_Changes.user"  | fields _time, action, src, src_user, dest, user
    | fieldformat Time = strftime(_time,"%m/%d/%Y %T")
    

    Step 4

    Like the above, with different parameters, the malicious script looks to enumerate information about the targeted MOVEit instances. It uses a malformed Azure account that can be detected.

    Activity to Detect

    IF X-siLockStep1 = -1
    The script will attempt to leak Azure information via the response header and return a GZIP stream of all files, file owners and file sizes, and institution data present in MOVEit instance. Account to Detect- azureAccout

    SPL

    index=azure (sourcetype="azure:aad:audit" "initiatedBy.user"=" azureAccout") OR (sourcetype="azure:aad:signin" userPrincipalName=" azureAccout ")

    Step 5

    The posting of the malicious file “human2.aspx” will add the file to the C:MOVEitTransferwwwroot directory on the MOVEit instance. This filesystem path is based on install locations and can vary (for example it can be E drive). The detections here are to detect any files that are created in these vulnerable locations.

    File and File Location to Monitor

    :MOVEitTransferwwwroot
     human2.aspx
     App_Web_*.dll

    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 where (Filesystem.file_name = "*human2.aspx" OR Filesystem.file_name = "*App_Web_*.dll" OR Filesystem.file_path = "*:MOVEitTransferwwwroot*") | 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 6

    Detecting the exfiltration of data is another way to find out if a bad actor is exploiting the MOVEit vulnerability. Examine firewall logs for large outbound network transfers from the MOVEit environment. 

    IPs and Volume to Detect

    IPs – these will be your MOVEit Instance IPs
    Volume in bytes – this will depend on time (defaulted to 1 hour in this detection) and what is considered abnormally high volume in your environment (default to 1MB in this detection).

    SPL

    | tstats `summariesonly` values(_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", values("All_Traffic.action") as action where All_Traffic.src="[INSERT MOVEit INSTANCES IPS]” AND All_Traffic.action !=blocked AND All_Traffic.dest_category !=internal AND All_Traffic.bytes > 1000
     by  "All_Traffic.dest" , "All_Traffic.user", "All_Traffic.src", _time span=1h
    | rename "All_Traffic.dest" as dest, "All_Traffic.user" as user, "All_Traffic.src" as src
    | table_time, action, src, src_port, dest, transport, dest_port, user, bytes
    | fieldformat Time = strftime(_time,"%m/%d/%Y %T") 

    Step 7

    There are several IP addresses that have been associated with the exploitation of the MOVEit vulnerability. TekStream has consolidated a list of these IOCs from numerous sources on the internet. These IOCs can be added to a lookup table and used in the detection below.

    TekStream MOVEit IOC List

    This CSV has the list of the IOCs at the time of this blog post being written – for a more updated version and/or information on how to build the lookup in the detection, please contact a TekStream consultant below.

    Search firewall and MOVEit IIS logs for requests from any of the IP addresses specified within the IOCs below.

    IPs To Detect

    In this case, you will look for any and all of the IP’s on the TekStream MOVEit IOC List

    SPL

    | tstats `summariesonly` values(_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", values("All_Traffic.action") as action
     by  "All_Traffic.dest" , "All_Traffic.user", "All_Traffic.src"
    | rename "All_Traffic.dest" as dest, "All_Traffic.user" as user, "All_Traffic.src" as src
    | eval allips = mvappend(src, dest)
    | inputlookup TS_MOVEit_IPs_List.csv | fields ip | rename ip as allips
    | table_time, action, src, src_port, dest, transport, dest_port, user, bytes
    | fieldformat Time = strftime(_time,"%m/%d/%Y %T")

    Step 8

    There is a domain associated with the MOVEit vulnerability and it is detectable with the logic below.

    Domain to Detect

    dojustit[.]mooo[.]com

    SPL

    | 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="dojustit[.]mooo[.]com" | table _time, dest, query, query_count, message_type, answer, reply_code | fieldformat Time = strftime(_time,"%m/%d/%Y %T")

    IOC List

    Below is an aggregate of IOCs found related to the MOVEit 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.

    TekStream MOVEit 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.

    References

    Articles referenced and used for this post: Trusted SEC, Huntress, Progress Community

    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.

    We are available to assist if you have any questions, just contact us here:

  • Smarter Whitelisting for Splunk Deployment Clients

    Smarter Whitelisting for Splunk Deployment Clients

    by Brent McKinney, Senior Splunk Consultant and Team Lead

    This blog will showcase how to use external files to manage whitelisting deployment client hosts, as an alternative to including rules directly in serverclass.conf.

    The following 2 settings in serverclass.conf can be used to reference an external file that can be used for serverclass filtering. These paths can point to text files, or csv files.

    serverclass.conf
    
    [<serverclass_name>]
    whitelist.from_pathname = <pathname>
    blacklist.from_pathname = <pathname>
    

    This is helpful when naming filtering may not be a simple wildcard (like us* for us hosts) or when you want to allow teams to onboard new hosts without giving direct access to the conf files. This can also be used with the values of the clientName field.

    Let’s say we wanted to break out our server classes by country. In this example we have 2 server classes, 1 for hosts in the US, and 1 for hosts in Europe. Notice how we whitelist and blacklist the respective txt files.

    splunk/etc/system/local/serverclass.conf:
    
    [us_hosts]
    whitelist.from_pathname = etc/system/whitelist_files/us_hosts.txt
    blacklist.from_pathname = etc/system/whitelist_files/eu_hosts.txt
    
    [eu_hosts]
    whitelist.from_pathname = etc/system/whitelist_files/eu_hosts.txt
    blacklist.from_pathname = etc/system/whitelist_files/us_hosts.txt
    

    Within etc/system/whitelist_files we have the 2 txt files containing our whitelist rules:

    us_hosts.txt contains the following:
    
    us*
    nixhost1
    mysqlserver1
    
    eu_hosts.txt contains the following:
    
    eu*
    nixhost2
    mysqlserver2
    

    Going forward, instead of making direct changes to serverclass.conf to add a new host whitelist, we can just add the host filter in the respective txt file.

    The relative path to the whitelist file is needed. For example, if the serverclass definition live in an app, rather than etc/system/local, then we would set the us hosts whitelist to the following in serverclass.conf.

    [us_hosts]
    whitelist.from_pathname = etc/apps/<app_name>/whitelist_files/us_hosts.txt
    blacklist.from_pathname = etc/apps/<app_name>/whitelist_files/eu_hosts.txt
    
    

    And include the corresponding txt files in the etc/apps/<app_name>/whitelist_files directory.

    There you have it – a simple way to manage whitelisting your deployment client hosts. Contact us below if you have questions. Happy Splunking!

  • Using Splunk to Search LDAP & Monitor for Last Time Password Was Set by Active Users on Windows OS

    Using Splunk to Search LDAP & Monitor for Last Time Password Was Set by Active Users on Windows OS

    by Patricia Orea-Arebun, Splunk Consultant II

    This use case helps to monitor active user accounts on Windows OS that have not updated their passwords in the client system in more than “n” number of days. The “n” number of days depends on organizational policy. Using your Splunk instance is the best way to search for changes and monitor active updates.

    Risk

    The risk involved in having active user accounts with passwords not changed is that the organization might be susceptible to brute force attacks. A brute force attack is where an attacker will be trying to access a company’s network by trying all possible passwords until they get lucky (dangerous!!!!).

    Control

    Using LDAP can help set monitoring in place for active users whose passwords are yet to be changed or nearing expiration (based on organization policy). LDAP, or Lightweight Directory Access Protocol, is a communication protocol that provides the ability to access and maintain distributed directory information services over a network. LDAP is used in Microsoft’s Active Directory but can also be used in other tools. Querying the LDAP directory requires using the Supporting Add-on for Active Directory (SA-ldapsearch) from Splunkbase in order to use the ldapsearch command. The ldapsearch command will display the users, their respective organizational units, lastLogonTime, created date, pwdLastset and so on.

    SPL Query

    Begin your query like this:

    |ldapsearch domain=<**your company domain**> search="(&(objectClass=user)(!(objectClass=computer)))" 
    | search userAccountControl!=ACCOUNTDISABLE 
    | rex "OU=(?<OU>[a-zA-Zs]+),DC" 
    | eval lasttime=strptime(pwdLastSet,"%Y-%m-%dT%H:%M:%S.%6N")
    |eval diff=round(((now() - lasttime)/86400),2)  
    | eval timediff = n - diff 
    | stats values(whenCreated) as "Created Date" latest(lastLogonTimestamp) as "LastLogonTime" values(OU) as OU values(sAMAccountName) as sAMAccountName values(pwdLastSet) as PWDLastSet values(timediff) as "Time left to change password"  by displayName
    SPL Analysis
    | ldapsearch domain=<**your company domain**>   search="(&(objectClass=user)(!(objectClass=computer)))" 

    This is querying the ldap tree for users, service accounts and not computers.

    | search userAccountControl!=ACCOUNTDISABLE

    This is searching for the active users and service accounts and ignoring disabled accounts

    | rex "OU=(?<OU>[a-zA-Zs]+),DC" 

    This is optional and depends on the use case. This is a field extraction for the list of “Organizational Unit” that each user or service accounts belongs to in the ldap tree.

    | eval lasttime=strptime(pwdLastSet,"%Y-%m-%dT%H:%M:%S.%6N")

    Converts the “pwdLastSet” timestamp field to current Unix epoch time to allows make further comparisons by creating a field “lasttime”.

    |eval diff=round(((now() - lasttime)/86400),2)  

    Converts the “lasttime” (the last time password was set in days) by creating a new field called “diff”.

    | eval timediff = n - diff

    Assuming your organizational policy for password change is “90 days” where n = number of days. This will calculate the “the time left to change password after n days”.

    | stats values(whenCreated) as "Created Date" latest(lastLogonTimestamp) as "LastLogonTime" values(OU) as OU values(sAMAccountName) as sAMAccountName values(pwdLastSet) as PWDLastSet values(timediff) as "Time left to change password" by displayName

    This search will tabulate resulting fields by the User’s displayname.

    Result

    Any user/service account that is non-compliant or has not changed the password within the Organization’s policy will have a negative sign (-) before the accrued number of days, signifying the number of days their password has been not being changed. The user accounts that are compliant will have a positive sign (+) before the number of days, signifying the number of days left to change their password.

    Example of a dashboard panel of an active user accounts list.
    Example: Dashboard Panel of Active User Accounts

    This can be turned into the following knowledge objects.

    Alert
    Splunk will send an email alert to the admin with list of user/service accounts with negative sign (-) to take action and user/service accounts with the number days left to change password.

    Dashboard Panel
    This can form part of a Splunk dashboard that will be constantly monitored by an Admin.

    Report
    Splunk can be set to send a report to the admin on a monthly or quarterly basis with the list of active user accounts and how much time left to change their password.

    That will do it! Now you’ll equip your team with brute force security monitoring for passwords using Splunk. If you would like more details, please contact us using the form below. Happy Splunking!

  • Setting up MFA with SNS and Java

    Setting up MFA with SNS and Java

    Rimpi Mathur | Technical Architect

    To provide better security and avoid unauthorized access to your applications, you should enable multi-factor authentication (MFA). This blog explains how to set up MFA using AWS APIs and services.

    What is MFA?

    With identity theft and cybercrime on the rise, multi-factor authentication (MFA) is a good way to improve your account security. MFA adds an additional layer of identity validation along with the basic login credentials. It is a unique number that is valid for a short duration of time and is sent to a device of your choice. This number is typically sent to an email address or cell phone number, but it can also be accessed using a specialty app.

    Technology

    We will be using the following technologies to achieve our goal.

    • • AWS SNS API
    • • Java 1.8 or higher
    • • Eclipse or any other IDE
    • • Maven for code build

     

    First, let’s look at sending MFA using the AWS admin console.

    Sending text message to cell phone using Amazon Simple Notification Service


    • • AWS Console Settings


    1.  Under “Simple Notification Service,” click on Test Messaging (SMS).
    2.  Make sure your account is not in the SMS sandbox; in sandbox mode, you can send a maximum of 10 text messages. Submit a request for Service Limit Increase. This normally takes a day to be approved by AWS.
    3.  From the console, purchase an origination number. This is a 10-digit toll-free number that will be used for sending out messages. This number is assigned by AWS.
    4.  To send a message from the console click on “Publish Text Message.”
      AWS SMS mobile text messaging  setup dialog box.
    5. Enter all the information in each box.
    Publish SMS message, Details in AWS console settings.
    Destination phone number
    Country-specific attributes, Entity ID, Template ID in Java.

    Now that we know how to send an MFA code from the console, let’s integrate this into our code.

    We will see how we can send the MFA code post-login from our codebase.

    Generate MFA code using Java

    There are many ways of creating a  6-digit number. One of the simplest ways is to use the Random() method in Java.


    • • Code for sending messages using SNS.


     

      1. We will import six packages that are required for defining the settings in AWS.

    com.amazonaws.regions.Regions;

    com.amazonaws.services.sns.AmazonSNSAsync;

    com.amazonaws.services.sns.AmazonSNSAsyncClientBuilder;

    com.amazonaws.services.sns.model.MessageAttributeValue;

    com.amazonaws.services.sns.model.PublishRequest;

    com.amazonaws.services.sns.model.PublishResult;

      1. Sample code for creating a text message.

    There are three AWS attributes that need to be set: region, maximum cost, and SMS type.

    public void sendSMS(String message, String phoneNumber) {

    // Initializes the message, phone number, aws attributes, and sends the code.

    try {

    PublishResult result = initSnsClient()
         .publish(new PublishRequest()
    .withMessage(message)
    .withPhoneNumber(phoneNumber)
    .withMessageAttributes(initSmsAttributes()));

    } catch (Exception e)

    }

    // The AWS region you will use for sending text messages; this region should be the same region that you moved to production mode (from sandbox) in the initial setting from AWS console.

    private AmazonSNSAsync initSnsClient() {

    AmazonSNSAsync snsClient =  AmazonSNSAsyncClientBuilder.standard()

    .withRegion(Regions.US_EAST_2).build();

    return snsClient;

    }

    // Sets the max price for sending each text message.

    private Map<String, MessageAttributeValue> initSmsAttributes() {

    if(smsAttributes == null) {

    smsAttributes = new HashMap<String, MessageAttributeValue>();

    smsAttributes.put(“AWS.SNS.SMS.MaxPrice”, new MessageAttributeValue()

    .withStringValue(“0.10″))

    .withDataType(“Number”));

    // Sets the type to Promotional (non-critical) or Transactional (message sent with high priority).

    smsAttributes.put(“AWS.SNS.SMS.SMSType”, new MessageAttributeValue()

    .withStringValue(“Transactional “))

    .withDataType(“String”));

    }

    return smsAttributes;

    }

        1. This code can easily be called from any other class for sending the text message.

        • • Sending MFA code using E-mail


    An e-mail can be sent using the helper class JmsTemplate

    private void addMessageToQueue(final Email email) {

    try {

        jmsTemplate.send(new MessageCreator() {

    @Override

    public Message createMessage(Session session) throws JMSException {

    return session.createObjectMessage(email);

    }

    });

    }

    catch (Exception e) {

    throw e;

    }

    }

    }

    Contact us for more help setting up MFA with SNS and Java!