Bird
Raised Fist0
Cybersecurityknowledge~5 mins

Threat hunting techniques in Cybersecurity - Time & Space Complexity

Choose your learning style10 modes available
Time Complexity: Threat hunting techniques
O(n x m)
Understanding Time Complexity

When we analyze threat hunting techniques, we want to understand how the time needed grows as the amount of data or alerts increases.

We ask: How does the effort change when we have more logs or events to check?

Scenario Under Consideration

Analyze the time complexity of the following threat hunting process.


for alert in alerts_list:
    for log_entry in logs_database:
        if matches(alert, log_entry):
            record_suspicious(log_entry)
    analyze_results()
    

This code checks every alert against every log entry to find suspicious activity.

Identify Repeating Operations

Identify the loops, recursion, array traversals that repeat.

  • Primary operation: Nested loops comparing alerts to logs.
  • How many times: For each alert, it checks all log entries.
How Execution Grows With Input

As the number of alerts and logs grow, the total checks increase quickly.

Input Size (alerts x logs)Approx. Operations
10 alerts x 100 logs1,000 checks
100 alerts x 1,000 logs100,000 checks
1,000 alerts x 10,000 logs10,000,000 checks

Pattern observation: The number of operations grows very fast as both alerts and logs increase.

Final Time Complexity

Time Complexity: O(n x m)

This means the time needed grows proportionally to the number of alerts times the number of logs.

Common Mistake

[X] Wrong: "Checking alerts one by one is always fast enough."

[OK] Correct: When data grows large, checking every alert against every log can take a very long time.

Interview Connect

Understanding how time grows with data size helps you explain how to handle large security data efficiently in real work.

Self-Check

"What if we indexed the logs to quickly find matches? How would the time complexity change?"

Practice

(1/5)
1. What is the main goal of threat hunting in cybersecurity?
easy
A. To create strong passwords for users
B. To install antivirus software on all computers
C. To block all internet access to prevent attacks
D. To actively search for hidden cyber threats before they cause damage

Solution

  1. Step 1: Understand the purpose of threat hunting

    Threat hunting is about proactively looking for threats that may not be detected by automated tools.
  2. Step 2: Compare options to the goal

    Installing antivirus, creating passwords, or blocking internet are preventive or reactive, not active searching.
  3. Final Answer:

    To actively search for hidden cyber threats before they cause damage -> Option D
  4. Quick Check:

    Threat hunting = active search [OK]
Hint: Threat hunting means actively looking for hidden threats [OK]
Common Mistakes:
  • Confusing threat hunting with installing security software
  • Thinking threat hunting is only about blocking access
  • Believing it is about password management
2. Which of the following is a common technique used in threat hunting?
easy
A. Ignoring network logs
B. Waiting for alerts from antivirus software
C. Forming hypotheses about attacker behavior
D. Disabling firewalls to reduce false alarms

Solution

  1. Step 1: Identify common threat hunting methods

    Threat hunting often starts with forming hypotheses about how attackers might behave.
  2. Step 2: Evaluate each option

    Waiting for alerts is reactive, ignoring logs or disabling firewalls harms security, so only forming hypotheses fits.
  3. Final Answer:

    Forming hypotheses about attacker behavior -> Option C
  4. Quick Check:

    Hypothesis formation = key hunting step [OK]
Hint: Threat hunting starts with guessing attacker actions [OK]
Common Mistakes:
  • Thinking threat hunting is passive waiting
  • Ignoring important data sources like logs
  • Reducing security tools to avoid alerts
3. Consider this simplified threat hunting step: if suspicious_activity_detected and data_source == 'network_logs': alert(). What happens if suspicious activity is found in network logs?
medium
A. An alert is generated
B. No alert is generated
C. The system shuts down
D. Data source is ignored

Solution

  1. Step 1: Understand the condition in the code

    The code triggers alert() only if suspicious_activity_detected is true and data_source equals 'network_logs'.
  2. Step 2: Analyze the scenario

    If suspicious activity is found in network logs, both conditions are true, so alert() runs.
  3. Final Answer:

    An alert is generated -> Option A
  4. Quick Check:

    Conditions met = alert triggered [OK]
Hint: Alert triggers when suspicious activity is in network logs [OK]
Common Mistakes:
  • Assuming no alert without checking both conditions
  • Confusing alert with system shutdown
  • Ignoring the data source condition
4. A threat hunter wrote this pseudocode: if event_type = 'login_failure' then investigate(). What is wrong with this code?
medium
A. The assignment operator '=' is used instead of comparison '=='
B. The function investigate() is missing parentheses
C. The event_type variable is undefined
D. The condition should check for 'login_success' instead

Solution

  1. Step 1: Identify the operator used in the condition

    The code uses '=' which usually means assignment, not comparison.
  2. Step 2: Understand correct syntax for comparison

    To check equality, '==' should be used, so the condition properly tests event_type.
  3. Final Answer:

    The assignment operator '=' is used instead of comparison '==' -> Option A
  4. Quick Check:

    Use '==' for comparison, not '=' [OK]
Hint: Use '==' to compare, '=' assigns value [OK]
Common Mistakes:
  • Confusing '=' with '==' in conditions
  • Assuming function syntax error without checking operators
  • Changing condition logic unnecessarily
5. You want to improve threat hunting by combining multiple data sources. Which approach best helps find hidden threats?
hard
A. Use only firewall logs to reduce data volume
B. Form hypotheses and analyze data from network, endpoint, and user activity logs
C. Ignore user activity logs because they are noisy
D. Rely solely on automated alerts without manual analysis

Solution

  1. Step 1: Understand the benefit of multiple data sources

    Using diverse data like network, endpoint, and user logs gives a fuller picture of threats.
  2. Step 2: Evaluate approaches for effective threat hunting

    Forming hypotheses and analyzing multiple sources is proactive and thorough, unlike ignoring data or relying only on alerts.
  3. Final Answer:

    Form hypotheses and analyze data from network, endpoint, and user activity logs -> Option B
  4. Quick Check:

    Multiple data sources + hypotheses = better hunting [OK]
Hint: Combine data sources and hypotheses for best results [OK]
Common Mistakes:
  • Using only one data source limits threat visibility
  • Ignoring noisy data that can hold clues
  • Relying only on automated alerts misses hidden threats
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard