Security · Object access
5140 · A network share object was accessed
Logged on the server hosting a share when a client first connects to that share in an SMB session. It records who connected, from which IP and to which share, so it is the go-to event for spotting admin-share (C$, ADMIN$) access used in lateral movement and for scoping data access on file servers.
Where it is logged
Key fields to read
| Field | What it tells you |
|---|---|
| ShareName | Share accessed, e.g. \\*\C$, \\*\ADMIN$, \\*\IPC$ or \\*\Finance. |
| ShareLocalPath | Local folder behind the share, e.g. \??\C:\Windows for ADMIN$. |
| IpAddress | Source IP of the SMB client. |
| SubjectUserName | Account that connected. |
| SubjectLogonId | Links to the 4624 type 3 logon on the same server. |
| AccessMask | Requested access (e.g. 0x1 read); useful but not always decisive at the session level. |
Sample event
Log Name: Security
EventID: 5140
TimeCreated: 2026-11-20T23:11:46.902Z
Computer: NW-FIN-WS07.northwind.local
SubjectUserName: adm.jkim
SubjectDomainName: NORTHWIND
SubjectLogonId: 0x5F0B11A
ObjectType: File
IpAddress: 10.20.30.57
IpPort: 52211
ShareName: \\*\ADMIN$
ShareLocalPath: \??\C:\Windows
AccessMask: 0x1How to triage it
- 1Classify the share: admin shares (
C$,ADMIN$) on workstations are higher risk than normal departmental shares. - 2Identify the source from
IpAddressand the account fromSubjectUserName; is this an expected admin or management server? - 3Pivot on
SubjectLogonIdto the 4624 type 3 logon and check the authentication package (NTLM vs Kerberos). - 4Look for follow-on activity on the target within minutes: 7045/4697 service installs, 4698 tasks, or new processes from
services.exe. - 5Check how many hosts the same source/account touched; one source hitting admin shares on many hosts suggests lateral movement or ransomware staging.
Benign vs suspicious
Usually benign
- Software deployment, patching and inventory tools (SCCM/Intune agents, backup servers) using admin shares.
- IT staff browsing
\\host\C$for troubleshooting from a jump host. - Group Policy and logon script access to
SYSVOL/NETLOGONon DCs (very common).
Red flags
- Workstation-to-workstation access to
ADMIN$orC$. - One account connecting to admin shares on many hosts in a short time.
- Admin share access followed by 7045 service creation (PsExec-style) on the same target.
- Unusual accounts (service accounts, newly created users) accessing sensitive data shares off-hours.
Hunt for it: Splunk & KQL
index=wineventlog EventCode=5140 ShareName IN ("\\*\ADMIN$", "\\*\C$")
| stats dc(host) AS targets values(host) AS hosts count BY SubjectUserName, IpAddress
| where targets >= 3
| sort - targets// Sentinel SecurityEvent: admin share access fan-out per source
SecurityEvent
| where TimeGenerated > ago(1d)
| where EventID == 5140
| where ShareName endswith @"\ADMIN$" or ShareName endswith @"\C$"
| summarize Targets = dcount(Computer), Hosts = make_set(Computer, 50) by SubjectUserName, IpAddress
| where Targets >= 3
| order by Targets descField names depend on your add-on and table. More translations in the Splunk vs KQL cheat sheet.
Interview question
“What is the difference between Event 5140 and 5145?”
✓ Strong answer sketch
5140 is logged once when a client first connects to a share in a session, so it tells me who connected to which share from where. 5145 is the detailed file share audit, logged for each file or pipe access check inside the share with the RelativeTargetName, so it tells me exactly what was touched. 5140 needs Audit File Share and is manageable volume; 5145 needs Audit Detailed File Share and is very noisy, so many teams enable it only on sensitive servers. For PsExec detection, 5140 shows the ADMIN$ connection and 5145 shows the svcctl pipe and the dropped service binary.
Frequently asked questions
Where is Event 5140 logged, on the client or the server?
On the server hosting the share (the target), not on the client that connected.
Why do I see so many 5140 events for IPC$?
IPC$ is used for named-pipe communication such as RPC, so it is accessed constantly by legitimate management traffic. It becomes interesting when combined with suspicious pipes in 5145.