Device Isolation

Pre-Incident Preparation

Environment Familiarisation

Get-CimInstance Win32_OperatingSystem | Select-Object @{N='Name';E={$_.CSName}},@{N='OS';E={$_.Caption}},@{N='Version';E={$_.Version}},@{N='Build';E={$_.BuildNumber}},@{N='InstallDate';E={$_.InstallDate}},@{N='LastBoot';E={$_.LastBootUpTime}},@{N='FreeMemoryMB';E={[math]::Round($_.FreePhysicalMemory/1024,2)}} | Export-Csv "C:\Inventory\device_$(Get-Date -Format 'yyyyMMdd_HHmmss').csv" -NoTypeInformation

Incident Detection and Initial Assessment

Detection Triggers

SecurityEvent
| where EventID in (4624, 4625, 4672, 4688) // Common security-related Event IDs
| project TimeGenerated, Account, EventID, Activity, Computer, IpAddress
| order by TimeGenerated desc

Scope Assessment

DeviceProcessEvents
| where FileName == "svch0st.exe"
| summarize AffectedHosts = dcount(DeviceName), FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated), ProcessCount = count(), AffectedHostsList = make_set(DeviceName) by FileName

Containment (Short-Term)

Network-Level Containment

Isolate a Device Using the Defender Live Response Console

  1. Initiate Live Response Session

    Click Go Hunt → Initiate Live Response session.

  2. Isolate the Device

    In the Live Response console, enter:

    To verify isolation status:

  3. (Optional) Release Isolation

    To reconnect the device:

System-Level Containment

This method assumes remote or local execution capability.

Script: Comprehensive Containment

How It Works:

  • Network Adapters: Disables all active adapters, cutting physical network access.

  • Firewall Rules: Blocks all inbound and outbound traffic as a secondary layer, even if adapters are re-enabled.

  • Services: Stops services like "Server" (SMB sharing) and "Workstation" (SMB client) to limit local network interactions.

Usage:

  • Run locally: Save as Contain-System.ps1 and execute in an elevated PowerShell session.

  • Run remotely: Use Invoke-Command -ComputerName "TargetDevice" -ScriptBlock { <script above> } if remoting is still available.

Reversal:


3. Windows Firewall for Network ContainmentIf physical adapter control isn’t desired, you can use the Windows Firewall to block all network traffic at the system level.

Steps (via PowerShell):

Why This Works:

  • Firewall rules apply system-wide, preventing all network communication regardless of adapter state.

  • Easier to reverse than disabling adapters, as it doesn’t require physical access if remoting is lost.

Reversal:


4. Defender Live Response for Containment

You can manually execute commands to isolate a device.

Steps:

  1. Start Live Response:

    Go to the device page in the Defender portal and select Initiate Live Response Session.

  2. Disable Adapters:

    Run:

  3. Verify:

    Check status:

Reversal:

Re-enable adapters:


Enterprise-Wide Checks

Basic Check:


Last updated