Skip to content
SIEMBench
100% Client-Side Tool • Inputs Never Sent to Our Servers

Event ID 5140

Event ID 5140: Network Share Accessed

A network share object was accessed

Log source
Security
How to enable it
Object Access > Audit File Share (Success and Failure)
Category
Lateral Movement
Priority
Medium
Typical volume
High
MITRE ATT&CK

What Event ID 5140 means

5140 is written once when a session first connects to a share. It names the share, the account and the source address, with no detail on individual files. That restraint makes it affordable, with a fraction of the volume of 5145.

The administrative shares deserve the attention. ADMIN$, C$ and IPC$ exist on every Windows computer. Ordinary users connect to IPC$ all day, but ADMIN$ and C$ require administrator rights and are used by remote execution tools to deliver their payloads.

Between workstations there is seldom any reason for SMB. A 5140 on a laptop from another laptop's address is a strong sign by itself, and one source that touches the shares of dozens of hosts in a few minutes is enumeration.

Key fields to inspect

FieldMeaningSuspicious when
ShareName Share, as \\*\name. \\*\ADMIN$ and \\*\C$ from anything but a management system.
IpAddress Source address. Another workstation, or a server that does not manage this one.
SubjectUserName Account that connected. A user with no administrative role, or a local account.
SubjectLogonId Session, matching 4624 type 3. A session with NTLM where Kerberos is expected.
ShareLocalPath Folder behind the share. \??\C:\Windows for ADMIN$.
AccessMask Access at connection, in hexadecimal. 0x1 is usual and tells you little, so use 5145 for detail.

Detection queries

Find sources that connect to administrative shares, or to shares on many hosts, in a short time. Adjust names and thresholds to your environment. About these queries.

Splunk SPL

index=windows source="XmlWinEventLog:Security" EventCode=5140
ShareName IN ("\\\\*\\ADMIN$", "\\\\*\\C$")
| bin _time span=10m
| stats dc(Computer) AS hosts values(Computer) AS targets values(ShareName) AS shares BY _time IpAddress SubjectUserName
| where hosts>=3

Microsoft Sentinel KQL

SecurityEvent
| where EventID == 5140
| where ShareName in~ (@"\\*\ADMIN$", @"\\*\C$")
| summarize Hosts = dcount(Computer), Targets = make_set(Computer, 30), Shares = make_set(ShareName) by IpAddress, SubjectUserName, bin(TimeGenerated, 10m)
| where Hosts >= 3

PowerShell

Get-WinEvent -FilterHashtable @{ LogName = 'Security'; Id = 5140; StartTime = (Get-Date).AddDays(-1) } |
  ForEach-Object { $d = @{ Time = $_.TimeCreated }; ([xml]$_.ToXml()).Event.EventData.Data | ForEach-Object { $d[$_.Name] = $_.'#text' }; [pscustomobject]$d } |
  Where-Object { $_.ShareName -match 'ADMIN\$|\\C\$' } |
  Select-Object Time, SubjectUserName, IpAddress, ShareName | Format-Table -AutoSize

Attack scenarios

Remote execution through ADMIN$

PsExec-style tools connect to ADMIN$, write a program and start it as a service. 5140 is the first step, followed by 5145 for the file and 7045 for the service.

Share discovery

net view and scanning tools connect to IPC$ and then to each share across the network. The number of distinct hosts for each source is the measure, and failures show where access was denied.

Data collection

An account that normally uses two shares connects to twenty in an afternoon. Volume is not in this event, so combine it with firewall or flow data.

Investigation checklist

  1. Resolve IpAddress to a host and find the user who was active there.
  2. Match SubjectLogonId to 4624 and check the authentication package.
  3. Look for 5145, 7045 and 4698 on the same host within a minute.
  4. Search for the same source and account across all hosts.

Common benign causes

Event ID 5140 FAQ

What is the difference between 5140 and 5145?

5140 is written once per session when a share is first accessed. 5145 is written for each file or folder that is checked within it. 5140 shows who connected, and 5145 shows what they touched.

Is access to IPC$ suspicious?

Usually not, since it carries ordinary remote procedure calls. Named pipes opened through it, visible in 5145, can be: svcctl, atsvc, winreg and samr are used for remote services, tasks, registry and account enumeration.

Can I disable administrative shares?

It is possible through the registry, but management tools depend on them. Restricting SMB between workstations with the host firewall and removing local administrator rights reduces the risk with less disruption.

Techniques follow MITRE ATT&CK® v20.1. © 2026 The MITRE Corporation. This work is reproduced and distributed with the permission of The MITRE Corporation (license). Field names were checked against Microsoft documentation and provider schemas.