Welcome back, young cyber defender! ๐ In Module One, you learned the foundations of the Blue Team. In Module Two, you learned how to defend and monitor networks. In Module Three, you learned how to find and fix vulnerabilities. Now, it is time to take your skills to the next level and become a threat hunter and detection engineer.
Imagine you are a detective ๐ต๏ธ. Instead of waiting for a crime to happen, you actively look for clues and patterns that suggest a crime might be happening or has already happened. That is exactly what threat hunting is โ you proactively search for threats that may have evaded your other defenses.
In this module, you will learn how to hunt for threats using the MITRE ATT&CK framework โ a map of attacker behavior that tells you what to look for. You will learn how to create detection rules using tools like Sigma, YARA, and Snort. You will also learn how to use threat intelligence to stay ahead of attackers. By the end of this module, you will be able to proactively find and stop attackers before they cause damage. Let us dive in! ๐
By the end of this module, you will be able to:
Chidi had become a skilled security analyst. He had learned about firewalls, IDS/IPS, and vulnerability management. But he always felt like he was reacting to alerts โ waiting for something to happen. One day, his manager said, "Chidi, we need you to be proactive. We need you to hunt for threats before they strike."
Chidi was excited but nervous. He did not know where to start. His mentor, Ada, said, "Chidi, think of threat hunting like being a detective. You have clues (logs, alerts) and you follow them to find the attacker. The MITRE ATT&CK framework is your guide โ it tells you what attackers do and how to find them."
Chidi started by creating a hunting hypothesis: "An attacker might be using PowerShell to download malware." He searched for PowerShell activity in his SIEM logs and found suspicious commands. He used YARA to scan files for malware signatures and Sigma rules to detect similar activity across the network.
He found a compromised machine and stopped the attack before any data was stolen. "I am a threat hunter now!" Chidi said. He had learned that proactive hunting is the key to staying ahead of attackers. And now, you will learn how to hunt too! ๐
Definition: Threat hunting is the proactive process of searching for threats that may have evaded existing security controls. It is not waiting for alerts; it is actively looking for signs of compromise.
Why it is important: Attackers are getting better at evading detection. Threat hunting helps you find them before they cause damage.
Simple explanation: Imagine you are a security guard ๐ฎ. Instead of just sitting at your desk waiting for an alarm to go off, you walk around and look for anything suspicious. That is threat hunting โ you are actively looking for problems.
Reactive vs proactive:
Real-life example: A security team notices unusual network traffic patterns and investigates, finding a hidden malware infection.
School example: A teacher walks around the classroom during a test to look for cheating (proactive) instead of waiting for students to tell on each other (reactive).
Home example: You check your doors and windows before going to bed (proactive) instead of waiting for a break-in (reactive).
Nigerian example: A Nigerian bank proactively monitors for unusual transaction patterns to detect fraud before it happens.
Illustration:
THREAT HUNTING CONCEPT
+-------------------------------------------------+
| Reactive: Wait for alert โ Respond |
| Proactive: Search for threats โ Find and stop |
| Threat hunting is proactive. |
+-------------------------------------------------+
Mini summary: Threat hunting is proactively searching for threats that have evaded defenses. It is better than waiting for alerts.
Definition: The threat hunting process is a structured approach to finding threats. It includes creating a hypothesis, collecting data, analyzing it, and taking action.
Why it is important: A structured process ensures you do not miss anything and can repeat your hunts effectively.
Simple explanation: Imagine you are looking for a lost item in your house ๐ . You don't just wander around randomly. You think about where it might be (hypothesis), check those places (data collection), and if you find it, you take action. Threat hunting is the same โ you have a plan.
The 5 steps of threat hunting:
Real-life example: A security team uses this process to hunt for ransomware activity in their network.
School example: A student uses this process to find missing homework: hypothesis (where did I leave it?), data collection (check places), analysis (is it there?), investigation (if not, check again), response (find it or redo it).
Home example: You use this process to find your keys: hypothesis (I left them on the kitchen counter), data collection (check kitchen), analysis (not there), investigation (check living room), response (found them on the sofa).
Nigerian example: A Nigerian company uses this process to hunt for insider threats.
Illustration:
THREAT HUNTING PROCESS
+-------------------------------------------------+
| 1. Hypothesis (What might be happening?) |
| 2. Data collection (Gather evidence) |
| 3. Data analysis (Analyze evidence) |
| 4. Investigation (Confirm or deny) |
| 5. Response (If found, fix it) |
+-------------------------------------------------+
Mini summary: The threat hunting process involves creating a hypothesis, collecting data, analyzing it, investigating, and responding.
Definition: The MITRE ATT&CK (Adversarial Tactics, Techniques, and Common Knowledge) framework is a knowledge base that describes how attackers operate. It is like a map of attacker behavior.
Why it is important: MITRE ATT&CK helps threat hunters understand what attackers do and how to find them. It is the "cheat sheet" for threat hunting.
Simple explanation: Imagine you are playing a game of chess โ๏ธ. MITRE ATT&CK is like a book of all the possible moves and strategies your opponent might use. If you know their moves, you can counter them.
Key components:
Real-life example: A security team uses MITRE ATT&CK to map out how attackers might target their organization and then builds defenses accordingly.
School example: A teacher gives students a study guide that tells them exactly what will be on the test and how to prepare. MITRE ATT&CK is like a study guide for defenders.
Home example: A family has a fire escape plan. They know what to do if there is a fire. MITRE ATT&CK helps defenders know what to do if there is an attack.
Nigerian example: A Nigerian bank uses MITRE ATT&CK to understand how attackers target financial institutions and build defenses against those specific techniques.
Illustration:
MITRE ATT&CK FRAMEWORK
+-------------------------------------------------+
| Tactics: Why attackers do things |
| Techniques: How attackers do things |
| Sub-techniques: More specific methods |
| Procedures: The code and tools used |
+-------------------------------------------------+
Mini summary: MITRE ATT&CK is a knowledge base that describes attacker behavior. It helps threat hunters know what to look for.
Definition: A hunting hypothesis is an educated guess about what an attacker might be doing. It is based on threat intelligence, MITRE ATT&CK, and your organization's environment.
Why it is important: A good hypothesis gives you a direction for your hunt. Without it, you are just looking at random data.
Simple explanation: Imagine you are a detective ๐ต๏ธ. You do not just look at all the clues randomly. You have a theory about who the criminal might be and what they did. That is your hypothesis.
How to create a hypothesis:
Example hypotheses:
Real-life example: A security team creates a hypothesis that attackers are using RDP (Remote Desktop Protocol) to access systems and hunts for unusual RDP connections.
School example: You have a hypothesis that your friend took your pencil. You look for clues (check their backpack, ask them).
Home example: You have a hypothesis that your sibling ate the last cookie. You check the kitchen for crumbs and ask them.
Nigerian example: A Nigerian bank creates a hypothesis that attackers are using social engineering to trick employees into revealing passwords.
Illustration:
CREATING A HYPOTHESIS
+-------------------------------------------------+
| 1. Use threat intelligence |
| 2. Use MITRE ATT&CK |
| 3. Consider your environment |
| 4. Make it specific |
+-------------------------------------------------+
Mini summary: A hunting hypothesis is a specific guess about what an attacker is doing. It guides your threat hunt.
Definition: Detection engineering is the process of creating, testing, and maintaining detection rules to identify malicious activity.
Why it is important: Without detection rules, you cannot find attacks. Detection engineering ensures you have rules to catch attackers.
Simple explanation: Imagine you are a fisherman ๐ฃ. You need the right bait and hooks to catch fish. Detection rules are like the bait โ they help you catch attackers.
Key detection tools:
Real-life example: A security engineer writes a Sigma rule to detect suspicious PowerShell commands and deploys it to the SIEM.
School example: A teacher creates a rule that if a student uses their phone in class, they get a warning. That is a detection rule.
Home example: You set up a rule that if your door sensor is opened at night, you get an alert.
Nigerian example: A Nigerian company uses Sigma rules to detect attacks on its network and sends alerts to its SOC.
Illustration:
DETECTION ENGINEERING
+-------------------------------------------------+
| Sigma: Universal SIEM rules |
| YARA: Malware detection |
| Snort: Network IDS rules |
| Suricata: Similar to Snort |
+-------------------------------------------------+
Mini summary: Detection engineering is the process of creating rules to detect malicious activity using tools like Sigma, YARA, and Snort.
Definition: Sigma is a standard for writing detection rules that can be used across different SIEM platforms. It is like a universal language for detection.
Why it is important: Sigma rules are portable. You can write a rule once and use it in Splunk, ELK, or any other SIEM.
Simple explanation: Imagine you have a recipe ๐ that you can use in any kitchen. Sigma rules are like that โ you write them once and they work in any SIEM.
Example Sigma rule:
title: Suspicious PowerShell Command
id: 12345678-1234-1234-1234-123456789012
status: experimental
description: Detects suspicious PowerShell commands
references:
- https://example.com
logsource:
product: windows
service: powershell
detection:
selection:
EventID: 4104
ScriptBlockText: '*download*'
condition: selection
level: high
Real-life example: A company writes a Sigma rule to detect PowerShell downloads and deploys it to their SIEM.
School example: A teacher writes a rule that if a student uses a phone during class, an alert is sent to the principal.
Home example: You write a rule that if your garage door opens after 10 PM, you get a notification.
Nigerian example: A Nigerian bank uses Sigma rules to detect suspicious activity in their SIEM.
Illustration:
SIGMA RULE EXAMPLE
+-------------------------------------------------+
| title: Suspicious PowerShell Command |
| description: Detects download commands |
| logsource: windows/powershell |
| detection: ScriptBlockText: '*download*' |
| level: high |
+-------------------------------------------------+
Mini summary: Sigma is a universal language for detection rules that works across different SIEMs.
Definition: YARA is a tool used to identify malware and other threats based on patterns in files. It is like a "fingerprint" for malware.
Why it is important: YARA helps you quickly identify known malware and detect new variants.
Simple explanation: Imagine you have a collection of fingerprints ๐๏ธ. YARA is like a fingerprint scanner โ it compares files to known patterns and tells you if they match.
Example YARA rule:
rule Suspicious_String {
meta:
description = "Detects a suspicious string"
strings:
$a = "malware" wide
condition:
$a
}
Real-life example: A security analyst uses a YARA rule to scan a suspected file for known malware signatures.
School example: A teacher has a list of banned words. If a student uses them, the teacher knows. YARA is like that list for files.
Home example: You have a list of suspicious phone numbers. If you see one, you do not answer. YARA is like that list for files.
Nigerian example: A Nigerian company uses YARA to scan files for known malware that targets financial institutions.
Illustration:
YARA RULE EXAMPLE
+-------------------------------------------------+
| rule Suspicious_String { |
| meta: description = "Detects malware" |
| strings: $a = "malware" |
| condition: $a |
| } |
+-------------------------------------------------+
Mini summary: YARA is a tool for detecting malware based on patterns in files. It is like a fingerprint scanner for files.
Definition: Snort and Suricata are intrusion detection and prevention systems (IDS/IPS) that use rules to detect network-based threats.
Why it is important: Network-based detection is essential for catching attacks that happen over the network. Snort and Suricata rules help you detect these attacks.
Simple explanation: Imagine you have a security guard at the gate of your building ๐ข. The guard checks everyone who wants to enter and stops suspicious people. Snort and Suricata are like that guard for your network.
Example Snort rule:
alert tcp any any -> $HOME_NET 80 (msg:"Web Server Attack"; content:"/etc/passwd";)
Real-life example: A company uses Snort rules to detect and block attempts to exploit web server vulnerabilities.
School example: A school uses a rule to block students from accessing inappropriate websites.
Home example: Your home router has a rule to block suspicious connections from the internet.
Nigerian example: A Nigerian telecom uses Snort rules to detect and block attacks on its network.
Illustration:
SNORT RULE EXAMPLE
+-------------------------------------------------+
| alert tcp any any -> $HOME_NET 80 |
| (msg:"Web Server Attack"; content:"/etc/passwd";)|
| This rule alerts if someone tries to access |
| /etc/passwd on a web server. |
+-------------------------------------------------+
Mini summary: Snort and Suricata use rules to detect network-based threats. They are like guards for your network.
Definition: Threat intelligence is information about current and potential threats that can help you defend against them. It includes data about attackers, their tactics, and their targets.
Why it is important: Threat intelligence helps you stay ahead of attackers. It tells you what they are doing and how to stop them.
Simple explanation: Imagine you have a friend who tells you about all the latest scams and tricks ๐ต๏ธ. Threat intelligence is like that friend โ it tells you what attackers are up to.
Sources of threat intelligence:
Real-life example: A company uses threat intelligence to learn about a new ransomware variant and updates its defenses accordingly.
School example: A teacher hears from other teachers about a new cheating method and warns students.
Home example: You hear about a new scam on the news and warn your family.
Nigerian example: A Nigerian bank subscribes to a threat intelligence feed to learn about attacks targeting the financial sector.
Illustration:
THREAT INTELLIGENCE
+-------------------------------------------------+
| Open-source (free) |
| Commercial (paid) |
| Industry sharing (ISACs) |
| Internal (from your own tools) |
+-------------------------------------------------+
Mini summary: Threat intelligence provides information about current threats to help you defend against them.
Definition: Using threat intelligence in hunting means incorporating knowledge about current threats into your hunting hypotheses and detection rules.
Why it is important: Threat intelligence makes your hunts more effective. You know what to look for and where to look.
Simple explanation: Imagine you are looking for a specific type of fish ๐. If you know where it lives and what it eats, you are more likely to catch it. Threat intelligence is like knowing where the fish are.
How to use threat intelligence:
Real-life example: A security team uses threat intelligence to hunt for a new malware strain that is targeting their industry.
School example: A teacher hears about a new way students are cheating and checks for it.
Home example: You hear about a new phishing scam and warn your family not to click on suspicious links.
Nigerian example: A Nigerian bank uses threat intelligence to hunt for attacks targeting the banking sector in Nigeria.
Illustration:
USING THREAT INTELLIGENCE
+-------------------------------------------------+
| 1. Update hypotheses |
| 2. Create new detection rules |
| 3. Prioritize alerts |
| 4. Share intelligence |
+-------------------------------------------------+
Mini summary: Threat intelligence enhances hunting by providing current information to focus your efforts.
Definition: Tuning is the process of adjusting detection rules to reduce false positives (alerts that are not real threats) and false negatives (real threats that are missed).
Why it is important: Too many false positives can overwhelm your team. Too many false negatives mean you are missing attacks. Tuning helps you find the right balance.
Simple explanation: Imagine you have a metal detector ๐งฒ. If it beeps too often (false positives), you will ignore it. If it does not beep enough (false negatives), you will miss important things. Tuning is like adjusting the sensitivity of the metal detector.
How to tune rules:
Real-life example: A security team finds that a Sigma rule is triggering on legitimate administrative PowerShell commands. They add exceptions for those commands.
School example: A teacher has a rule that if a student talks during class, they get a warning. But some students talk about the lesson, which is allowed. The teacher adjusts the rule to only warn if they are off-topic.
Home example: Your home security camera sends an alert every time a car passes by. You adjust the sensitivity so it only alerts when a person is detected.
Nigerian example: A Nigerian company adjusts its Snort rules to reduce false positives from legitimate network traffic.
Illustration:
TUNING DETECTION RULES
+-------------------------------------------------+
| 1. Analyze false positives |
| 2. Adjust conditions |
| 3. Add exceptions |
| 4. Test changes |
| 5. Monitor results |
+-------------------------------------------------+
Mini summary: Tuning adjusts detection rules to reduce false positives and false negatives, making them more effective.
Definition: Conducting a threat hunt is the process of actively searching for threats using the steps we have learned: hypothesis, data collection, analysis, investigation, and response.
Why it is important: This is where you put all your skills into action to find real threats.
Simple explanation: Imagine you are a detective following clues to catch a criminal. Each step brings you closer to the truth.
Steps to conduct a hunt:
Real-life example: A security team conducts a hunt for ransomware activity by looking for known ransomware indicators.
School example: A student hunts for missing homework by checking all possible places where it could be.
Home example: You hunt for a lost key by checking all the rooms where it might be.
Nigerian example: A Nigerian company conducts a threat hunt to find signs of a specific APT group that targets Nigerian organizations.
Illustration:
CONDUCTING A THREAT HUNT
+-------------------------------------------------+
| 1. Prepare (gather tools) |
| 2. Hypothesize (what to look for) |
| 3. Investigate (search for evidence) |
| 4. Correlate (connect the dots) |
| 5. Validate (confirm threat) |
| 6. Respond (fix it) |
| 7. Document (record findings) |
+-------------------------------------------------+
Mini summary: Conducting a threat hunt involves preparing, hypothesizing, investigating, correlating, validating, responding, and documenting.
Now we will see how all the concepts we have learned work together in a real threat hunt scenario.
Scenario: You are a threat hunter at a Nigerian bank. You receive intelligence that a cybercriminal group is targeting banks with phishing emails that contain malicious macros.
Your hunt:
What we used:
Illustration:
THREAT HUNT SCENARIO
+-------------------------------------------------+
| Intelligence โ Hypothesis โ Data Collection |
| โ Analysis โ Investigation โ Validation |
| โ Response โ Documentation |
+-------------------------------------------------+
Mini summary: A threat hunt combines intelligence, hypotheses, data collection, analysis, investigation, validation, response, and documentation to find and stop threats.
| Word | Simple Definition |
|---|---|
| Threat Hunting | Proactively searching for threats that have evaded defenses. |
| MITRE ATT&CK | A knowledge base of attacker tactics and techniques. |
| Hypothesis | An educated guess about what an attacker is doing. |
| Detection Engineering | Creating rules to detect malicious activity. |
| Sigma | A universal language for detection rules. |
| YARA | A tool for detecting malware based on patterns. |
| Snort | An IDS/IPS that uses rules to detect network threats. |
| Suricata | Another IDS/IPS similar to Snort. |
| Threat Intelligence | Information about current threats. |
| Tuning | Adjusting rules to reduce false positives and negatives. |
| Mistake | How to Avoid It |
|---|---|
| Not using a framework like MITRE ATT&CK | Always use MITRE ATT&CK to guide your hunts. |
| Creating vague hypotheses | Make hypotheses specific and testable. |
| Not tuning detection rules | Regularly review and tune rules to reduce false positives. |
| Ignoring threat intelligence | Use threat intelligence to inform your hunting. |
| Not documenting hunts | Document everything for future reference and improvement. |
| Hunting without a plan | Always follow a structured process. |
| Not sharing findings | Share intelligence and findings with your team and industry. |
| Overlooking logs | Analyze logs thoroughly โ they contain valuable clues. |
THREAT HUNTING PROCESS
+-------------------------------------------------+
| 1. Hypothesis (What might be happening?) |
| 2. Data collection (Gather evidence) |
| 3. Data analysis (Analyze evidence) |
| 4. Investigation (Confirm or deny) |
| 5. Response (If found, fix it) |
+-------------------------------------------------+
MITRE ATT&CK FRAMEWORK
+-------------------------------------------------+
| Tactics: Why attackers do things |
| Techniques: How attackers do things |
| Sub-techniques: More specific methods |
| Procedures: The code and tools used |
+-------------------------------------------------+
SIGMA RULE STRUCTURE
+-------------------------------------------------+
| title: Suspicious PowerShell Command |
| description: Detects download commands |
| logsource: windows/powershell |
| detection: ScriptBlockText: '*download*' |
| level: high |
+-------------------------------------------------+
YARA RULE EXAMPLE
+-------------------------------------------------+
| rule Suspicious_String { |
| meta: description = "Detects malware" |
| strings: $a = "malware" |
| condition: $a |
| } |
+-------------------------------------------------+
| Type | Purpose | Example |
|---|---|---|
| Sigma | Universal SIEM rules | Detect PowerShell downloads |
| YARA | Malware detection | Detect malware strings in files |
| Snort | Network IDS rules | Detect web attacks |
| Suricata | Similar to Snort | Detect network anomalies |
| Feature | Reactive | Proactive |
|---|---|---|
| Trigger | Alerts | Hypotheses |
| Timing | After an incident | Before an incident |
| Mindset | Wait and respond | Search and find |
| Example | Responding to a breach | Hunting for threats |
| Effectiveness | Often too late | Early detection |
Lesson 1 Summary: Threat hunting is proactively searching for threats that have evaded defenses.
Lesson 2 Summary: The threat hunting process includes hypothesis, data collection, analysis, investigation, and response.
Lesson 3 Summary: MITRE ATT&CK is a framework that describes attacker tactics and techniques.
Lesson 4 Summary: A hunting hypothesis is a specific guess about what an attacker is doing.
Lesson 5 Summary: Detection engineering is creating rules to detect malicious activity.
Lesson 6 Summary: Sigma is a universal language for detection rules.
Lesson 7 Summary: YARA detects malware based on patterns in files.
Lesson 8 Summary: Snort and Suricata detect network-based threats using rules.
Lesson 9 Summary: Threat intelligence provides information about current threats.
Lesson 10 Summary: Threat intelligence enhances hunting by informing hypotheses and rules.
Lesson 11 Summary: Tuning adjusts detection rules to reduce false positives and negatives.
Lesson 12 Summary: A threat hunt follows a structured process to find and stop attackers.
Lesson 13 Summary: A real threat hunt scenario combines all these concepts to stop an attack.
Congratulations! You have completed Module Four of the Blue Team Ethical Hacking course ๐. You have learned how to become a threat hunter and detection engineer โ a true proactive defender.
You now understand what threat hunting is and why it is better than reactive security. You have learned the threat hunting process and how to use the MITRE ATT&CK framework to guide your hunts. You know how to create hunting hypotheses and use them to focus your efforts.
You have been introduced to detection engineering and the tools of the trade: Sigma for universal detection rules, YARA for malware detection, and Snort and Suricata for network detection. You understand the importance of threat intelligence and how to use it to inform your hunting.
You have learned how to tune detection rules to reduce false positives and how to conduct a complete threat hunt from start to finish. You have seen a real-world hunting scenario that puts all these skills together.
These skills are essential for any Blue Team professional. In the next module, you will learn about Incident Response and Digital Forensics โ how to respond to attacks and investigate them to understand what happened and prevent future incidents.
Keep hunting, keep learning, and never stop protecting. See you in Module Five! ๐ก๏ธ
Match the term on the left with its description on the right:
| Term | Description |
|---|---|
| 1. Threat Hunting | A. Universal detection rules |
| 2. MITRE ATT&CK | B. Detects malware in files |
| 3. Hypothesis | C. Proactive searching for threats |
| 4. Sigma | D. Network intrusion detection |
| 5. YARA | E. Information about current threats |
| 6. Snort | F. Framework of attacker tactics |
| 7. Threat Intelligence | G. An educated guess about attacker behavior |
| 8. Tuning | H. Adjusting rules to reduce false positives |
Answers: 1-C, 2-F, 3-G, 4-A, 5-B, 6-D, 7-E, 8-H
Scenario 1:
Ada is a threat hunter. She receives intelligence that a new malware family is using PowerShell to download payloads. Create a hunting hypothesis and describe the steps she would take to hunt for this threat.
Scenario 2:
Chidi is a detection engineer. He has a Sigma rule that detects suspicious PowerShell commands, but it is generating too many false positives. How should he tune the rule?
Scenario 3:
Zainab is a security analyst. She wants to create a YARA rule to detect a new ransomware variant that has a specific string "encryptme" in its files. Write the YARA rule for her.
Activity Title: Conduct a Mock Threat Hunt
Instructions:
Activity Title: Write a Detection Rule
Instructions:
Project Title: Build a Threat Hunting Playbook
Description:
Create a threat hunting playbook for a specific threat scenario (e.g., ransomware, phishing, insider threat). The playbook should include:
Present your playbook to the class.
Assignment Title: Write and Test a Sigma Rule
Instructions:
Challenge Title: Hunt for a Stealthy Threat
You are given a simulated environment with logs and alerts. Your task is to hunt for a threat that has evaded existing defenses. The threat is using a combination of techniques: phishing to gain initial access, PowerShell for lateral movement, and data exfiltration.
Tasks:
This challenge tests your ability to conduct a complete threat hunt. Good luck!
Fill-in-the-Blank Answers:
True or False Answers:
Multiple Choice Answers:
Excellent work completing Module Four! ๐ You have become a threat hunter and detection engineer. In the next module, you will learn about Incident Response and Digital Forensics.
In Module Five, you will explore:
To prepare, review the concepts from this module and think about how they connect to incident response. The more you practice, the easier it will be to learn the advanced topics.
Keep hunting, keep learning, and never stop protecting. See you in Module Five! ๐ก๏ธ
๐ End of Module Four ๐