Detect Network Share Connection Removal in Splunk
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.
MITRE ATT&CK
- Tactic
- Defense Evasion
- Technique
- T1070 Indicator Removal
- Sub-technique
- T1070.005 Network Share Connection Removal
- Canonical reference
- https://attack.mitre.org/techniques/T1070/005/
SPL Detection Query
index=wineventlog sourcetype="XmlWinEventLog:Microsoft-Windows-Sysmon/Operational" EventCode=1
| where (Image like "%\\net.exe" OR Image like "%\\net1.exe")
AND CommandLine like "%use%"
AND (CommandLine like "%/delete%" OR CommandLine like "%/DELETE%" OR CommandLine like "% /d %")
| eval BulkDelete=if(CommandLine like "% * %", "YES - All Shares", "NO - Targeted")
| eval Severity=if(BulkDelete="YES - All Shares", "HIGH", "MEDIUM")
| table _time, host, User, CommandLine, ParentImage, BulkDelete, Severity
| sort - _time
| append [
search index=wineventlog sourcetype="WinEventLog:Security" (EventCode=5140 OR EventCode=5142)
| eval EventType=case(EventCode=5140, "Share Access", EventCode=5142, "Share Added", true(), "Other")
| table _time, host, SubjectUserName, ShareName, IpAddress, EventCode, EventType
| sort - _time
] Detects network share removal via net.exe/net1.exe process creation with /delete flag. Classifies bulk deletion (net use * /DELETE) as HIGH severity since it is indicative of pre-encryption cleanup or post-exfiltration sweep. Also correlates with Windows Security Event ID 5140 (share access) and 5142 (share added) to provide context about which shares were accessed before removal. Requires Object Access auditing enabled for share events.
Data Sources
Required Sourcetypes
False Positives & Tuning
- Logoff/logon scripts that disconnect mapped drives during session teardown
- IT scripts that map shares for specific tasks and then clean up afterwards
- RDS/Citrix session teardown processes disconnecting shares when sessions end
- Automated drive mapping tools that cycle connections periodically
Other platforms for T1070.005
Testing Methodology
Validate this detection against 3 adversary techniques from Atomic Red Team. Each test below lists the behaviour to exercise and the telemetry you should expect to see. Executable commands and cleanup steps are available with Pro.
- Test 1Remove Specific Network Share Connection with net use /delete
Expected signal: Sysmon EventCode 1: net.exe process creation with 'use \\127.0.0.1\IPC$ /delete' command line. Windows Security Event ID 5140 (share accessed) and then no corresponding 5142 (share removed) since the share never fully established due to authentication. MDE DeviceProcessEvents captures both the mapping and deletion commands.
- Test 2Bulk Network Share Removal with net use * /DELETE
Expected signal: Sysmon EventCode 1: net.exe with '* /DELETE /Y' in command line. Windows Security Event ID 5140 may fire for each share that was disconnected. The wildcard (*) in the command line is a high-fidelity indicator of bulk share removal. MDE DeviceProcessEvents captures the full command including the * wildcard.
- Test 3Delete Network Share Registry History (MountPoints2 Cleanup)
Expected signal: reg.exe process creation with 'delete' and 'MountPoints2' in command line. Sysmon EventCode 12 (RegistryKeyDeleted) for HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\MountPoints2. Security Event ID 4657 if registry auditing is enabled for HKCU keys.
Unlock Pro Content
Get the full detection package for T1070.005 including response playbook, investigation guide, and atomic red team tests.