Network Share Connection Removal
Adversaries remove Windows network share connections after use to clean up traces of lateral movement and data access. Network shares mapped via net use or UNC paths leave artifacts in the Windows registry (HKCU\Network), Windows event logs (Event ID 5140 — network share object accessed, Event ID 5142 — network share created), and in the MRU list. The primary utility for removal is net use \\target\share /delete or net use * /DELETE /Y to remove all mapped drives simultaneously. RobbinHood ransomware used net use * /DELETE /Y to disconnect all network shares before encryption, likely to ensure local encryption of any mapped network paths. Threat Group-3390 detached network shares after exfiltrating files. InvisiMole, DUSTTRAP (APT41), and various ransomware families routinely perform share cleanup as a post-exploitation step.
DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName =~ "net.exe" or FileName =~ "net1.exe"
| where ProcessCommandLine has "use" and ProcessCommandLine has_any ("/delete", "/DELETE", "/d")
| project Timestamp, DeviceName, AccountName, ProcessCommandLine,
InitiatingProcessFileName, InitiatingProcessCommandLine
| sort by Timestamp desc
| union (
DeviceProcessEvents
| where Timestamp > ago(24h)
| where FileName =~ "net.exe" or FileName =~ "net1.exe"
| where ProcessCommandLine has "use" and ProcessCommandLine has "*"
| project Timestamp, DeviceName, AccountName, ProcessCommandLine,
InitiatingProcessFileName, InitiatingProcessCommandLine
)
| sort by Timestamp desc Data Sources
Required Tables
False Positives
- IT administrators running scripts that map and then unmap network shares as part of batch file operations
- Logoff scripts configured in Group Policy that disconnect mapped drives when users log off
- VPN clients that disconnect network shares when the VPN session ends and reconnect when it re-establishes
- Backup agents that map network backup destinations, perform backup, then disconnect
Unlock Pro Content
Get the full detection package for T1070.005 including response playbook, investigation guide, and atomic red team tests.