top of page
  • CSNP

Threat Hunting Series: Using Threat Emulation for Threat Hunting

Originally published on October 10, 2022 on Medium.

Author Kostas

This post will demonstrate how threat emulation can be used for threat hunting. I often use threat emulation to understand the evidence an attack leaves behind upon execution.

While there are many use cases for threat emulation, this post will focus on emulating attackers’ techniques to help with threat hunting. Threat emulation is a powerful tool that can be used for threat hunting. Security teams can generate the necessary telemetry and test security solutions by emulating attackers' techniques in a lab environment. This process can help you understand an attacker’s mindset and approach, allowing you to hunt for threats more effectively.

As a threat hunter, finding available resources to hunt for an adversarial technique can be difficult at times. Some of the resources could be attack-related information (think threat intelligence/incident response reports) and telemetry (logs). In such cases, you must conduct your own research and employ threat emulation to help generate the necessary data.


Before you start emulating the attack and digging through logs, it would be best to establish what you are looking for and the purpose of your research.

It is necessary to have a lab environment to assist with recreating the attack scenarios and collect the generated telemetry. You can then analyze the results and hunt for the unique Indicators of Attack (IoAs) in production environment(s).

Steps to a successful emulation

There are numerous factors to consider before emulating an attack. I have separated the phases of emulation below:

  1. Create a lab environment.

  2. Gather information about the attack

  3. Execute the attack

  4. Analyze the collected data and create your TH queries

  5. Eliminate false positives

  6. Make the threat hunt repeatable

This section will go over these key steps and provide a high-level explanation for each. I will also include an example to solidify the concept. The example use case will enable the Wdigest protocol to extract clear-text credentials.

Here is a mind map of the below process:

1. Create a test environment


Just to clarify here, this will not be a malware lab. Although it is still recommended that the lab environment is isolated from any other hosts outside the lab, this will be a testing environment for re-creating attacks.

Consider using policies matching your organization’s environment when building the test environment. For instance, requesting the golden image from the IT department to have installed on one of the hosts in the lab. Additionally, in the case of a windows AD environment, you could use the same Group policies, for instance:

  • Disabling LDAP signing

  • Disabling SMB signing

  • Disabling NLA

  • etc.

Mirroring your test environment is not essential; however, it can make the results of the threat emulation more relevant to the network you will be hunting later on.

Another important aspect is the logging capabilities of the host machines. To get the most out of the emulation, hosts should record all activities, and enabling enhanced logging will help with that. A good way of enhancing logging capabilities is by using Sysmon. Sysmon can provide extensive details in addition to the default Windows event logs. Furthermore, all logs should be forwarded to a centralized location to facilitate analysis. You might use the ELK stack or any other solution you can get your hands on.

What logs should you collect?

While endpoint telemetry is arguably the most relevant data source in most scenarios, network data is also useful when developing detections for malicious communication patterns. An Intrusion Detection System (IDS) like Suricata could help create network detections, while solutions such as Zeek can provide detailed network visibility. Capturing web traffic may therefore be beneficial.

You can capture web traffic on individual endpoints with open-source software such as Wireshark or T-Shark. There are more efficient methods of capturing network traffic, but this method should be enough to get things started.

Finally, if you want to evaluate the security solutions that your organization is using, it is best to include them in your lab setup. Make sure to create detect-only policies in cases where the default prevention policy blocks tools during the emulation.

By incorporating all the above configurations, you can recreate attacks and observe their potential impact on your organization’s production environment. At the same time, the generated telemetry will help you research various attacks and attack paths. Below, I include some resources for setting up a lab environment:

Pre-made lab environments:

  • Detection Lab:

  • Splunk Attack Range v2.0:

Step-by-step guide:

Use-case example:

  • Setting up and using Detection-Lab

2. Gather information about the attack

The next step is to gather as much information as possible about the tools needed to re-create the attack scenario. You can use OSINT to collect as much information as possible. Even if there is only high-level information available, every little hint helps. For instance, you may only find mentions of the attack in a threat intelligence report along with the outcome or the end goal after its use. Knowing the outcome can be helpful during the data analysis step later on.

If you feel stuck, you can reach out to others within the information security community. You will be surprised how many people are willing to assist. Be patient when you reach out to others; they don’t work around your schedule.

Some general questions to consider are:

A. What are the prerequisites for the attack?

  • Specific app/OS version

  • A certain misconfiguration needs to be present.

  • Privileges needed.

B. What is the end goal of the attack?

C. What data sources do I need to have to capture the activity?

  • Network logs

  • Process execution logs

  • Authentication logs

  • A combination of all the above?!

D. How do I launch the attack?

Use-case example:

The red teaming experiments blog has a nice post going through the attack.


  • Download mimikatz from gentilkiwi’s official Github page

3. Execute the attack

Once you have the necessary information and tools, it is time to execute the threat emulation. Making a note of the attack’s execution time and hostname will come in handy during the analysis phase.

It is important to note that if you require external tools to carry out the attack, you should validate the credibility and authenticity of the tools you intend to use. There have been numerous occasions where people publish backdoored tools and scripts.

Use-case example:

Step 1: Enable the Wdigest protocol and Log-off and Log back on

Step 2: Execute mimikatz with the appropriate command-line arguments

4. Analyze the collected data and create your TH queries

Having enriched logs forwarded to a centralized location where they can be parsed and be ready to review can save a lot of time during this phase. Knowing the execution time, you can jump-start the investigation and start looking into data without worrying about running additional tools.

If this is out of reach for whatever reason, you can still use some tools to collect the information from the hosts involved during the emulation. Some of these tools are Velociraptor and Kape. One should be familiar with more than one method of solving the same problem.

When capturing and analyzing network traffic, tools like the Security Onion, Arkime, or good ‘ol Wireshark make great candidates for the job.

After running the attack, you can check the security solutions you have installed (if any). Do you see any network or endpoint-based detections? If so, you can get more information about the type of detection triggered. Regardless of whether detection was triggered, if you use an EDR solution, you can query the generated telemetry surrounding the execution time.

Assuming that you found some interesting and unique indicators of attack, next step is to craft the initial queries based on the language supported by your SIEM or other solutions you use.

Knowing about some indicators that may appear in your dataset can help you identify unique patterns associated with the execution of the attack. The list below is not exhaustive, but it does include some of my favorite things to check out first:

A. Process Tree analysis

  • Parent-child process relationships

B. Command Line

  • Execution Paths

  • Arguments used

  • etc.

C. Files

  • Dropped files

  • Directory creation

D. Service/scheduled task creation/modification

E. Registry key creation/modification

Sysmon logs can include even more, detailed endpoint information that can be useful for creating the initial threat-hunting queries. Some of my favorite Sysmon Event IDs for enhanced visibility are: