Carter Dack, 2023.
Endpoint Protection & Threat Analysis
Endpoints within an organization are constantly at risk of threats both online and offline, and with the advancement of various Endpoint Detection & Response (“EDR”) tools, security personnel now have more visibility into an organization than ever before.
This article will explore the configuration of EDR tools, sandboxed threat simulation, and post-incident threat analysis. In doing so, this article will model the hands-on techniques that threat hunters and security teams alike are capable of performing in order to discover host based threats.
EDR agent Installation
We begin by gaining access to an EDR platform. There are many on the market, and all will have a slightly different process of installing the “agents” or “sensors” or “sentinels” onto an endpoint or groups of endpoints. In this example, the Sophos XDR sensors will be demonstrated.
Figure I - Sophos Sensor Download
Food for Thought: Depending on how someone looks at it, EDR tools can be likened to a Command and Control (“C2”) framework, in the sense that a privileged piece of software is installed on an endpoint and is sending back endpoint telemetry to a central command center. In the case of EDR platforms however, we can hope that the central command center is a benevolent one controlled by an organization’s IT department.
Next, the sensor can be moved onto an endpoint and installed, as seen in Figure II.
Figure II - Sensor Install (Windows 10)
Figure III - EDR Dashboard Populated
Once installed, the endpoint should now populate within the EDR dashboard. From the EDR dashboard, there is visibility into many aspects of the endpoint, and in order to establish a useful sandbox, some malicious actions will be taken on the endpoint and investigated below.
In order to identify a scope, a fictional scenario will be created which will guide the investigation.
Scenario
An employee named Randy has decided to begin mining Monero cryptocurrency on his corporate device using the xmrig tool, which has been alerted due to its known file hash. Additionally, there have been some reports that Randy has downloaded a malware builder and is plotting to infect the internal network. Security personnel have confiscated Randy’s laptop and have begun to investigate the reported threats.
Scope:
XMRIG Identification and Removal
To begin, the xmrig software will first be identified on the system and removed. As a threat hunter, I know that xmrig is commonly identified by windows defender, so I will begin by querying the windows defender detections on the endpoint. Hopefully this action will also show some information regarding the malware builder, but let's see…
Figure IV - Windows Defender Detections
As seen above, windows defender was not able to identify the xmrig software, however it did identify various locations that Randy’s malware builder seems to live. We will leverage these paths later on when we focus on the removal of the builder, but for now let's move on with xmrig.
Hypothesis:
Based on how xmrig is obtained, I would guess that Randy downloaded xmrig from the internet, so let's check his downloads folder for the xmrig files.
There are a few ways of checking Randy’s downloads folder, but for quick remediation, I will remote into his endpoint and use the command line. (note: Truthfully I am opting for the command line because I am running this sandbox in a crappy virtual machine and the Sophos agent will fail if a query uses up more than 30% of the CPU.)
Figure V - Randy’s Downloads
Figure VI - Deleting Randy’s Files
As we can see from the above information, the xmrig software was downloaded on 12/13/2023. By doing some behind the scenes research and analysis, I was able to determine that the filehashes of xmrig downloaded to Randy’s machine match those of the regularly distributed tool, and thus I can be confident of its behavior and that it will not have further compromised the system or network.
For peace of mind, I also queried whether any scheduled tasks were created in the last week, and from my query I can see that there are not.
Figure VII - Scheduled Tasks
Network Analysis
In order to further understand the network connections and data transfer activity, I will again query the endpoint for network activity to identify xmrig behavior.
Figure VIII - xmrig network activity
From this activity, we can see that Randy ran xmrig on 12/14/2023 which contacted both 178.128.242.134 as well as 199.247.27.41 on port 3333. Using this information, we can block the xmrig software signatures as well as these IP addresses from being contacted.
Additionally, this search showed no network connections related to the malware builder, which is good news. Lets shift to investigating that component of this incident.
Malware Builder Analysis
Up to this point, we have found a few Indicators of Compromise (“IoC’s”) for the identified malware builder:
As before, I will remove the executable from all file paths and confirm that its file hash no longer exists on the system. Based on my investigation, it would appear that this software was relatively basic, and Randy fortunately did not actually build any malware with it.
Thankfully, no additional Indicators of Compromise were identified.
Evaluation and Detections
Based on our brief investigation, we can begin thinking about detections. Using our IoC’s to inform the detections, the following are some realistic options:
Note: Unfortunately, I am using a free trial version of EDR software, and I am unable to configure these alerts, however at a high level, these detections can be used based on our IoC’s.
Conclusion
The exploration and application of Endpoint Detection & Response (EDR) tools in this report underscores their critical role in modern cybersecurity defenses. Our journey through the installation and configuration of Sophos XDR sensors, coupled with hands-on threat hunting and incident response activities, has vividly demonstrated the capabilities and benefits of these powerful tools.
The fictional scenario involving employee Randy, who engaged in unauthorized Monero mining and downloaded a malware builder, served as a practical backdrop for applying EDR tools in a real-world context. The detailed steps taken - from the initial identification of the xmrig mining tool and malware builder to the thorough network analysis and eventual remediation - highlight the depth and breadth of visibility that EDR solutions provide.
Through this exercise, we learned key lessons:
In conclusion, the utilization of EDR tools is not just about deploying technology; it's about integrating these tools into a broader cybersecurity strategy. This includes understanding the tools' capabilities, continuously updating detection rules, and educating users about safe computing practices. As demonstrated, EDR solutions are a vital component of an organization's defense, providing the necessary capabilities to detect, investigate, and respond to threats effectively. This exercise reinforces the notion that in the realm of cybersecurity, vigilance, combined with the right tools and expertise, is the key to maintaining a robust security posture.