User and IP Address Investigation

Earn 25 points (50 with Pro) in two steps

  1. ① Read through the lesson — each section gets a ✓ as you scroll through it.
  2. ② When every section has a ✓, tap Complete lesson.

0 of 12 read · keep scrolling

✦ See fewer ads and earn double points — 50 a lesson instead of 25 — with Pro

Mitigating Threats: User and IP Address Investigation in Microsoft Defender for Endpoint

Introduction: The Criticality of Identity and Network Context

In the modern cybersecurity landscape, the traditional perimeter defense model is effectively obsolete. With the rise of cloud services, remote work, and mobile devices, the identity of the user and the network context (the IP address) have become the new front lines of defense. When a security alert triggers in Microsoft Defender for Endpoint, simply knowing that a file was executed or a process was spawned is rarely enough to stop an attacker. To truly mitigate a threat, you must understand the "who" and the "where."

User and IP address investigation is the process of correlating isolated security events into a cohesive narrative. By investigating the user account, you can determine if a credential has been compromised, if an insider is acting maliciously, or if an attacker is moving laterally through your environment. By investigating the IP address, you can determine if a device is communicating with a known malicious command-and-control server, or if an internal asset is probing your network for vulnerabilities.

This lesson serves as a deep dive into the practical application of these investigations within the Microsoft Defender portal. We will explore how to pivot from a simple alert to a comprehensive understanding of an incident, how to use Kusto Query Language (KQL) to extract meaningful data, and how to apply these findings to harden your environment. Mastering these techniques is the difference between simply closing an alert and actually neutralizing a persistent threat.


Not read yet

The Anatomy of a User Investigation

When an alert flags a specific user account, your primary goal is to establish the "normal" baseline for that user and identify deviations. Attackers often use compromised accounts to blend in with legitimate traffic, making them difficult to detect without a structured investigation process.

Step-by-Step User Investigation Workflow

  1. Examine the User Page: Navigate to the Microsoft Defender portal and select the "Users" entity from the alert details. This page provides a consolidated view of the user’s activity, including their risk level, associated devices, and recent alerts.
  2. Review Recent Activity: Look for spikes in activity, logins from unusual locations, or access to sensitive files that the user does not typically interact with. Pay close attention to sign-in logs, as these are the most common indicators of credential theft.
  3. Cross-Reference with Cloud Apps: Use Microsoft Defender for Cloud Apps (if integrated) to see if the user has performed unusual actions in SaaS applications like Office 365, Salesforce, or AWS.
  4. Check for Lateral Movement: Investigate if the user account has logged into multiple devices in a short window of time. This is a classic indicator of an attacker moving from a low-privilege workstation to a higher-privilege server.

Callout: User Risk vs. Device Risk It is vital to distinguish between a compromised user and a compromised device. A device may be compromised via malware that has no knowledge of the user's credentials, while a user may be compromised (via phishing) without the device itself showing any traditional malware signatures. Always investigate both entities separately, even if they appear in the same alert.

Practical Example: Detecting Credential Stuffing

Imagine you receive an alert for "Suspicious sign-in activity." You navigate to the user profile and notice a series of failed sign-in attempts from an IP address in a country where the employee does not reside, followed by a successful sign-in. This is a textbook case of credential stuffing. Your investigation should immediately trigger a password reset and a force-logout of all active sessions for that user.


Not read yet

Investigating IP Addresses: Network Context and Threat Hunting

An IP address investigation is fundamentally different from a user investigation. While users represent intent, IP addresses represent connectivity and infrastructure. When you see an IP address in an alert, you are looking at the bridge between your internal network and the external world.

The Lifecycle of an IP Investigation

  1. Determine Public vs. Private: First, identify if the IP is internal (RFC 1918) or external. Internal IPs require you to look for the specific device that was assigned that address at the time of the event. External IPs require you to look for intelligence regarding the reputation of that address.
  2. Check Reputation Services: Use built-in Defender tools or external threat intelligence sources to determine if the IP is known for hosting malware, phishing pages, or command-and-control (C2) infrastructure.
  3. Analyze Traffic Patterns: Use KQL to look at the volume of data transferred to or from this IP. A small, constant heartbeat of data often indicates a C2 connection, while a massive spike in data transfer might indicate data exfiltration.

Note: Always remember that IP addresses are dynamic. A device may have been assigned a specific internal IP address during the time of an incident, but that same IP could be assigned to a different device an hour later. Always use timestamps when querying device information associated with an IP address.

KQL for IP Investigation

To investigate network traffic, you can use the DeviceNetworkEvents table in Advanced Hunting. Here is a common query to identify all connections to a specific suspicious IP:

// Search for connections to a specific suspicious IP address
DeviceNetworkEvents
| where RemoteIP == "192.0.2.1"
| project Timestamp, DeviceName, ActionType, RemoteIP, RemotePort, LocalIP
| sort by Timestamp desc

This query provides the exact devices that communicated with the IP, the ports used, and the timing. If you see multiple devices connecting to the same suspicious IP, you are likely looking at an infection spreading within your network.


Not read yet

Advanced Hunting: Bridging Users and IPs

The most effective investigations occur when you correlate user activity with network activity. By combining these, you can answer complex questions such as, "Did this user log in from a new device and then immediately begin communicating with a suspicious IP?"

Building a Correlated Investigation Strategy

When you suspect a compromise, you should follow this structured approach to data correlation:

  • Identify the User: Find the user account associated with the alert.
  • Identify the Devices: Find all devices that the user has logged into within the last 24 hours.
  • Identify Network Connections: Filter network logs for those specific devices to see if they communicated with any external IPs flagged as "high risk" or "unknown."

Callout: The Importance of Timestamps In distributed systems, clock skew and log latency are real issues. When investigating, always use a window of time rather than a single second. Look for events 5 minutes before and 5 minutes after the alert timestamp to ensure you capture the full context of the activity.

Practical Example: Detecting Exfiltration

A user account begins downloading large volumes of data from a file server. Simultaneously, the device they are using starts sending HTTPS traffic to an unknown IP in a foreign data center. By correlating the user's file access logs with the device's network logs, you can confirm that this is not a routine backup process, but a potential data breach.


Not read yet

Best Practices for Effective Investigation

Investigating security incidents is as much an art as it is a science. To maintain consistency and accuracy, follow these industry-standard best practices:

1. Maintain a Chronological Timeline

Always build a timeline of events. Attackers rarely perform one action; they follow a sequence: Reconnaissance, Initial Access, Persistence, Lateral Movement, and Exfiltration. If you only look at the final alert, you miss the earlier stages that show how the attacker got in.

2. Document Your Assumptions

As you investigate, write down your assumptions. For example, "I am assuming this user was compromised because of the geographic anomaly." If you later find out the user was actually traveling, you can quickly pivot your investigation without losing time on a false premise.

3. Leverage Automation

Microsoft Defender for Endpoint has built-in automated investigation and response (AIR) capabilities. Let the system do the heavy lifting for common alerts (like known malware), so your human analysts can focus on the complex, multi-stage attacks that require human judgment.

4. Verify Against Threat Intelligence

Never trust a single source. If Defender flags an IP as "suspicious," check it against other intelligence platforms like VirusTotal or AlienVault OTX. This cross-verification helps you determine the confidence level of the threat.


Not read yet

Common Pitfalls and How to Avoid Them

Even experienced analysts fall into traps during an investigation. Being aware of these pitfalls is the first step toward avoiding them.

  • The "Tunnel Vision" Trap: Analysts often focus so intently on the device that triggered the alert that they ignore the user account or the network path. Always remember that the device is just one piece of the puzzle.
  • Ignoring False Positives: While it is important to be thorough, spending five hours investigating an alert that is clearly a legitimate administrative task is a waste of resources. Learn to identify the "noise" of your specific environment—such as automated scanner activity—so you can filter it out efficiently.
  • Failure to Reset Credentials: A common mistake is stopping an attack but failing to reset the compromised user's credentials. If the attacker still has the password, they will simply return later. Always force a password reset and clear session tokens as part of your remediation.
  • Over-reliance on Automated Tools: Automation is great, but it is not infallible. Sometimes, an attacker will use a legitimate tool in a way that doesn't trigger an automated alert. Always perform a manual "sanity check" on the data provided by the portal.

Warning: Never perform remediation actions (like isolating a device) during an active investigation unless you are certain of the threat. Isolate too early, and you might lose the ability to collect forensic evidence from the device's memory or local logs.


Not read yet

Comparison: Reactive vs. Proactive Investigation

Feature Reactive Investigation Proactive Investigation (Hunting)
Trigger Security Alert/Incident Hypothesis/Threat Intelligence
Goal Stop an active attack Find hidden threats
Data Usage Focus on specific entities Large-scale data analysis
Outcome Remediation/Cleanup Hardening/Prevention
Frequency As needed Continuous

Deep Dive: KQL for Proactive Hunting

Proactive hunting involves using KQL to find patterns that haven't triggered an alert yet. This is the hallmark of a mature security operations center (SOC).

Example: Searching for "Living off the Land" Techniques

Attackers often use built-in Windows tools (like PowerShell, WMI, or Certutil) to execute their malicious code. You can hunt for these patterns by looking for unusual command-line arguments:

// Hunt for encoded PowerShell commands often used by attackers
DeviceProcessEvents
| where ProcessCommandLine contains "-enc" or ProcessCommandLine contains "-encodedcommand"
| project Timestamp, DeviceName, InitiatingProcessFileName, ProcessCommandLine
| sort by Timestamp desc

This query identifies every instance of an encoded PowerShell command. By reviewing these, you can determine if they are legitimate administrative scripts or an attacker trying to hide their command execution. If you see a user running these commands from a workstation where they shouldn't be, you have a high-confidence indicator of compromise.


Not read yet

Step-by-Step: Handling an Incident

When you have identified a threat through your investigation, you must act decisively. Follow these steps to ensure a clean recovery:

  1. Containment: If a device is compromised, use the "Isolate device" function in the Defender portal. This restricts the device's network traffic to only communicate with the Defender service, preventing the attacker from moving laterally while keeping the device online for further analysis.
  2. User Remediation: If the user account is compromised, disable the account in Active Directory or Microsoft Entra ID. Require a password reset and enable Multi-Factor Authentication (MFA) if it was not already active.
  3. Evidence Collection: Before wiping or reimaging the device, use the "Collect investigation package" feature. This gathers memory dumps, logs, and other forensic artifacts that you can analyze later to understand the attacker's tools and methods.
  4. Eradication: Once the threat is understood, remove the malicious files, delete the scheduled tasks, and clean up the registry keys that the attacker used for persistence.
  5. Recovery: Re-image the device if necessary to ensure no hidden backdoors remain. Monitor the user account closely for the next 48-72 hours to ensure no further unauthorized access occurs.
  6. Post-Incident Review: Hold a meeting with your team to discuss what happened, how it was detected, and how you can change your configurations (e.g., firewall rules, group policies, Conditional Access policies) to prevent this specific attack from happening again.

Not read yet

The Role of Threat Intelligence in Investigations

Threat intelligence is the fuel that powers your investigation. Without it, you are just looking at raw logs. Microsoft Defender for Endpoint integrates with the Microsoft Intelligent Security Graph, which provides real-time updates on global threat actors, malicious infrastructure, and common attack patterns.

When you investigate an IP address, the portal often provides information about the "threat actor" associated with that IP. This context is invaluable. If you know that a specific threat actor (e.g., a group known for ransomware) is behind an IP, your response plan changes dramatically. You know that you are not just dealing with a simple piece of malware, but a human adversary who will likely attempt to escalate privileges and exfiltrate data.

Incorporating External Intelligence

While Microsoft provides excellent built-in intelligence, you should also consider integrating your own sources. Many organizations use internal threat feeds or industry-specific information sharing centers (ISACs). By importing these into your Defender environment, you can trigger alerts for threats that are specific to your industry or geographic region.


Not read yet

Building a Culture of Investigation

Effective security is not just about the tools; it is about the people. To build a team that excels at user and IP investigation, you must foster a culture of curiosity and continuous learning.

  • Encourage "Why" Questions: When an analyst finds an alert, encourage them to ask why it happened, not just what happened.
  • Share Lessons Learned: When a major investigation is complete, share the findings with the wider team. A "blameless post-mortem" approach ensures that everyone learns from the incident without fear of reprisal.
  • Invest in Training: The landscape changes weekly. Provide your team with the time and resources to stay updated on the latest TTPs (Tactics, Techniques, and Procedures) used by attackers.

Callout: The "Human Element" Technology is only as good as the analyst using it. Your ability to interpret the data, understand the intent of the attacker, and make a judgment call is what separates a successful security team from one that is constantly overwhelmed by alerts.


Not read yet

Frequently Asked Questions (FAQ)

Q: How do I know if an IP address is a VPN or a Tor exit node? A: Many threat intelligence services provide metadata about IP addresses, including their type. In the Defender portal, you can often see if an IP is associated with a known anonymization service. If you see persistent traffic from these sources, it is almost certainly a sign of malicious intent.

Q: What if the user account is a service account? A: Service accounts are high-value targets. If a service account is acting in a way that deviates from its baseline (e.g., a service account that normally only runs a backup task suddenly starts querying the Active Directory), treat it with the same level of urgency as a human user account compromise.

Q: Should I block all unknown IPs? A: No. Blocking all unknown IPs would break most legitimate business functions. Instead, use a "deny-list" approach for IPs that have been confirmed as malicious, and use "monitoring" for IPs that are simply unknown.

Q: How long should I keep investigation data? A: Retention policies are critical. You need enough history to perform trend analysis and investigate long-term threats (like "low and slow" attacks), but you must also comply with your organization's data privacy policies. Typically, 30 to 90 days of detailed logs is sufficient for most investigations.


Not read yet

Summary and Key Takeaways

As we conclude this lesson, it is important to reflect on the core principles of effective investigation within Microsoft Defender for Endpoint. The security landscape is complex, but by focusing on the identity and the network, you can cut through the noise and find the signal.

Key Takeaways

  1. Identity is the Perimeter: Always treat user accounts as the primary target for attackers. Monitor their behavior for deviations from the norm, such as unusual sign-in locations or access patterns.
  2. Context is King: An IP address or a file hash is meaningless without context. Always use timestamps and correlation to see the full story of what happened before, during, and after an alert.
  3. KQL is Your Best Tool: Advanced Hunting with KQL allows you to move beyond canned alerts and perform true, proactive threat hunting. Invest the time to learn the language and experiment with queries in your environment.
  4. Follow the Process: Maintain a structured workflow for every investigation. Use a timeline approach, document your assumptions, and always verify your findings against threat intelligence.
  5. Don't Rush Remediation: While speed is important, accuracy is paramount. Ensure you understand the scope of the threat before taking destructive actions like isolating devices or disabling accounts, as this preserves forensic evidence.
  6. Continuous Improvement: Use every incident as a learning opportunity. Update your defenses, refine your alert thresholds, and share knowledge across your team to build a more resilient organization.
  7. Balance Automation and Human Insight: Let the system handle the mundane tasks, but never abdicate your responsibility to think critically. The most dangerous attacks are those that appear "normal" to automated systems but look suspicious to a trained human eye.

By mastering these skills, you move from being a reactive administrator to a proactive defender. You are no longer just waiting for an alert to fire; you are actively shaping the security posture of your organization and making it significantly harder for attackers to succeed. Keep practicing your KQL, keep questioning the activity you see, and stay diligent in your pursuit of a secure environment.

Not read yet

Each section gets a ✓ as you scroll through it. Tap the button to jump to the next one.