Stamus-Networks-Blog

Hunting for Plain Text Executables with Stamus Security Platform

Written by Peter Manev | Oct 18, 2022 2:00:00 PM

Plain text executables (such as those downloaded from a PowerShell user agent) are often seen on the network, however it is uncommon for these executables to originate outside of administrative IT end users or technical staging endpoints. When these executables are seen in unexpected or unapproved locations, it could signal an internal policy violation. Even worse, PowerShell executables could highlight the presence of a malware actor attempting to take action on the network.

For most organizations, it is important to know when and where executables are present on the network so further investigation can be done. To do this, the security team could use Stamus Security Platforms’s Enriched Hunting Interface and deploy one of the many guided hunting filters to simplify the discovery, investigation, and classification process. 

Stamus Security Platform (SSP) automatically detects and identifies threats on the network, and presents security teams with incident timelines and extensive context for each threat. Many organizations take advantage of advanced SSP features and take an even more proactive approach to their defenses. When this is the case, they might task a security analyst with hunting for specific threat types, anomalous activity, or suspicious behaviors. To do this, they can use the Stamus Enriched Hunting Interface. 

This interface provides security practitioners with over 100 ready-to-use guided threat hunting filters, including various filters for policy violations, that they can use to investigate, classify, escalate, and automate vast amounts of event data, alerts, and contextual metadata. For a more detailed look at the Enriched Hunting Interface, read the blog article titled, “Introduction to Guided Threat Hunting”.

What are plain text executables? 

Executable downloads from unencrypted connections are often used by malware actors. An executable file is a file that contains an encoded sequence of instructions that are executed once a user clicks on the file. Some file types (such as EXE, BAT, COM, and CMD) do not even require the existence of additional programs in order to run on the system. 

Malware authors can disguise malicious executable files behind other file extensions, causing them to appear like a non-executable text file (“technicalbrief.pdf” or “spreadsheet.csv” for example). These plain text executables can be very deceptive, leading users to unintentionally download malicious programs. Not all plain text executables are inherently bad however, and some IT teams use them internally. It is highly unusual to see them outside of that environment though because of the technical knowledge needed to create them, so it is important that security teams can locate instances of plain text executables happening on their network. 

Something that is even more interesting to see are plain text executable downloads that have happened over HTTP from non-IT admin networks with a scripting tool like Powershell. In this example, we want to see which non-IT end users and endpoints are using Powershell, so we can know what kinds of plain text executables are present on the network. 

Identifying plain text executables with Stamus Security Platform

Stamus Security Platform (SSP) does most of the work for you. With Declarations of Compromise™, it definitively identifies serious and imminent threats. However, no system can automatically detect everything. That’s why SSP logs every possible indicator of compromise – otherwise known as “alerts''. These alerts can be used to create a trail of evidence in an incident investigation. Additionally – as seen in this series – they can also be used to perform a guided hunt for specific threat types or other unwanted activity. 

So let’s take a look at the current alerts on our system: 

In the past 48 hours, we have had about1.7 million alert events which have triggered hundreds of thousands of results, including protocol, flow, and file transaction logs and Host Insights for over 15,000 network endpoints and hosts. 

The hunt for plain text executables using Stamus Security Platform

To begin this hunt, we first have to select the relevant filter from the drop down list. Since there are over 100 guided hunting filters, we need to narrow the list down and find the filter we want. To do this, we can search for the keyword “power” and then select the needed filter. In this example, the filter we want is titled “Hunt: Executable downloads from PowerShell”. 

Selecting this filter narrows our results from 1.7 million down to only 17 in the selected timeline. This gives us an excellent starting point to work from. 

It is important to note that SSP Enriched Hunting also provides additional organization-specific context. Users can filter for queries from various departments or user groups within the organization, allowing them to hyper-focus on specific areas without having to aggregate events or organize IP addresses to find specific users or departments. (for example:)

This organizational context is very useful and discloses very interesting results in terms of the clear text downloads.

As part of one of many enrichment processes, the Stamus Security Platform automatically breaks down any http/dns/tls domains within those network protocol records into its subforms  - Domain, TLD, Host , and Domain without TLD. 

For our HTTP downloads, we can also see information about http hostnames, urls, status codes, and user agents.

There are several potential next steps we could take in this investigation, but I would like to take a closer look at the endpoints involved and see if any users that are seen there are still logged in. To get there, we need to see a list of all the hosts in order to know the full scope of what we are dealing with. 

Knowing which clients and hosts are offenders and seeing additional information about the offense is important to get the full picture of this hunt. Specifically, we need to see which services are running on the offender’s host. 

To do this, we can use Host Insights - a very powerful feature included with the Stamus Security Platform. Host Insights tracks over 60 security-related network transactions and communication attributes of a host. This provides a single place to view many aspects of the network activity relative to a given host, such as network services, users, or TLS fingerprinting forensic evidence. 

We can click the “Hosts” tab on the left hand side panel and be transferred from the actual events logs to the Host Insights screen.

This filters our 1.7 million alerts down to only 17 events taking place on 9 total hosts. From here, investigating each host to get a better look at their activity is relatively simple. 

Now we can look into each host and identify the user and view the network protocol log evidence. We want to review the specific information gathered in Host Insights such as the application protocol usafe, user agent’s hostname, encrypted analysis, a timeline of events, and more. 

Now, we select that specific user that is logged in to the endpoint and we can see a list of the events related to the executable download. 

Evidence for Incident Response

With just a few clicks, We are able to view two important sets of evidence: 

  1. 1. The associated network protocol transactions and flow logs
  2. 2. Host Insights - a single screen for reviewing 60+ network activity attributes collected for every host

 

The generated events are already enriched by SSP to include important metadata like DNS records, TLS protocol data containing certificate names, fingerprint JA3/JA3S, connection flow sizes, http user agent, http host, request body, status codes, file transaction info, and more. 

Expanding the actual event details gives us those details and the related network protocol and flow transaction logs. Based on the extra http protocol information like status code, user agent, method, url, and response body, it is obvious that the file was downloaded and the transaction did in fact happen.

It is also helpful to view the file transaction log information with specifics like file magic, filenames, size, and checksums: 

Most importantly, we need the file itself for forensic investigation. Luckily, we’ve also enabled file extraction on the Stamus Security Platform and we have the binary extracted with its corresponding checksum. We simply click on the “Files” tab of the correlated information tab for that event.

With this information, we have located both the users and stations involved. We also have an IoC and details on where the file has been seen in the network. 

Now, we need to identify what part of that offending infrastructure we first saw on the network and where it was located. In other words, we need to locate patient zero. 

To do that, we can use the “Sightings” feature in Stamus Security Platform. This feature gives us the ability to pinpoint the first time a piece of metadata (such as domain, TLS certificate, HTTP host/user agent/server, JA3, JA3S, file checksum, etc) has been seen in the enterprise. 

All we have to do is keep the same filter on, but switch off all “Alerts” and leave “Sightings” switched on. 

The main offender seems to be highlighted:

This gives us the first occurrence of a new, previously unseen HTTP Server inbound into our infrastructure. We have our patient zero.

From here, we can select a specific event and further review the supplemented network protocol and connection logs evidence. This information not only provides context for our current hunt, but also allows us to use the available metadata to create other hunting filters for future use. 

Security analysts can use any piece of metadata to create simple or complex filters for things like wildcarding, negation, or inclusion. You can even include multiple fields for fast drill down capabilities. All domains, TLS SNI, IP addresses, HTTP hosts, and more can easily be checked with an external threat intelligence provider such as Virus Total.  

Armed with the above information and evidence, a threat hunter has enough information and IoCs to generate an Incident Response ticket. 

However, there are still two tasks left to complete: 

  1. 1. We do not want to have to repeat this exact same process again in the future, so we need to set up classification and auto-escalation for future occurrences. 
  2. 2. If anything like this has happened before, we want it to be found and escalated with all the associated evidence - all based on historical data.

 

Classification

In order to streamline the event review/triage process in the future, an experienced analyst can choose to tag/classify the events associated with this filter  By doing so, SSP will tag future events that match the filter criteria as “relevant” or “informational,” depending upon the analyst’s selection. These tags can be used to automate event review/triage and make it easier for a less-experienced analyst to identify events that are relevant for manual review.

To do so, the analyst selects the Tag option from the Policy Action menu on the right hand side menu. This action will cause SSP to insert a tag into each event record as shown below:   

This allows the analyst to easily filter out or search for them in any SIEM (Chronicle, Splunk, Elasticsearch, etc) or data lake using that tag.

It also allows for easy filtering out of those events in the Stamus Enriched Hunting GUI by switching to “relevant” only classified events. 

Escalation and Automation of this Hunt

To set up an automation which causes SSP to escalate past and future occurrences, we can create a Declaration of Compromise (DoC) event from the Policy Actions drop down menu on the right hand side panel in the Stamus Enriched Hunting Interface. 

The next step is to add some explanation about the type of threat. This also gives us a chance to provide informational context and helps convey knowledge to colleagues. 

Select options to generate events from historical data and generate Webhook notifications.

Just like that, the hunt and all related activities are complete. Any past or future generated events from that automation will then be further auto-classified and escalated to the desired response process -  via SOAR playbook, chat notification, or incident response ticket. 

Our DoC escalation gives us exactly that. 

With a timeline of involved hosts and offenders with their past occurrences. 

Conclusion

The post-hunt activities completed in this example are just the tip of the iceberg when it comes to the automation and escalation capabilities of Stamus Security Platform (SSP). To learn more about these features and how to implement them, read our article titled “After the Hunt”

To learn more about Network Detection and Response (NDR) from Stamus Networks and see the enriched hunting interface for yourself, click the button below and schedule a live demo.