Skip to main content
5140SecurityObject AccessSecurity tier 1

Event ID 5140: A network share object was accessed

Event ID 5140 records that a network share was accessed, written once per session when the first access attempt is made. It names the account, the client IP, the share and the share's local path. It does not name files, so use it to answer who connected where, and use 5145 for what they touched.

What Triggers Event 5140 and Why Its Low Volume Is the Point

Event 5140 comes from the File Share subcategory and fires when a client first reaches a network share in a session. Microsoft's description says it fires once per session. A user who opens a share and browses it for an hour produces one 5140, where the Detailed File Share subcategory behind 5145 would write an event for every file and folder. That makes 5140 a cheap, durable record of which accounts connected from which addresses to which shares, so keep it for months.

The volume story differs from its sibling's. Microsoft rates the File Share subcategory high on file servers and on domain controllers, where Group Policy clients keep reading SYSVOL, but low on member servers and workstations. Its table recommends Success and Failure auditing across domain controllers, member servers and workstations. In practice you can enable it estate-wide and still keep the data volume manageable, which is the opposite of what you can say about 5145. Shares carry no system access control lists, so once the subcategory is on, access to every share on the machine is audited.

Read the fields in the order an investigation uses them. SubjectUserName and SubjectLogonId tell you who and tie the event to the 4624 network logon that created the session. IpAddress and IpPort are the client, and Microsoft documents the address as IPv6 or an IPv4-mapped ::ffff: form, which breaks naive joins against asset inventories. ShareName is written as \\*\SHARE and ShareLocalPath is the NTFS location behind it, such as \??\C:\ for the C$ share, and it is empty for IPC$. ObjectType is always File.

Two fields are constants, and treating them as variables wastes effort. AccessMask is always 0x1 and AccessList is always ReadData for this event, because the event records the connection and not the operation. Filtering on write rights here will return nothing. If you need to know whether the client wrote to the share, that is 5145.

Share names are where the detection lives. C$, ADMIN$ and IPC$ are the default administrative shares, and the trailing dollar sign hides them from browsing, not from the log. Microsoft's own monitoring advice for 5140 names C$ on domain controllers as an example of what to watch, alongside source addresses outside your internal ranges and computers that should never connect to this one. MITRE groups administrative share use under SMB/Windows Admin Shares (T1021.002) and enumeration of shares under Network Share Discovery (T1135).

The sample shows a regular user, a.chen, opening C$ from 198.51.100.64 with the only right this event can carry. Opening the root of a peer's C$ implies local administrator rights on that machine, and a standard user rarely needs it. The event alone cannot say whether it was a help-desk visit or a pass-the-hash hop, and that is fine. Its job is to put the edge on the map: this source touched that host, as this account, at this minute.

To switch it on, enable Audit File Share under Object Access in Advanced Audit Policy, or run auditpol /set /subcategory:"File Share" /success:enable /failure:enable on the host. Read the result back with auditpol /get /subcategory:"File Share" before assuming coverage. The failure half is not an afterthought: 5140 also has a failure form, and a burst of failures from one source across many hosts is either a scanner without rights or someone trying credentials against administrative shares.

Treat the output as a graph. Each event is an edge from a source address to a host through a named share. After a few weeks of data you know which edges are normal: the backup server reaching file servers, the scanner reaching everything, the jump host reaching servers. Anything else is a new edge, and in a flat network a new edge between two workstations is the cheapest lateral movement signal Windows will give you.

The limit to remember is the same property that makes the event cheap. Because it is logged per session, a client that keeps one SMB session open for hours generates one record. Activity inside that session never produces another 5140, so a quiet log is not proof that nothing happened. Follow any suspicious 5140 into 5145 on the same host for the files, and into the 4624 for the authentication details.

Event 5140 Fields

FieldWhat it tells youSimulated value
SubjectUserSidSID of the account that accessed the share.S-1-5-21-424242-1133
SubjectUserNameName of the account that accessed the share.a.chen
SubjectDomainNameDomain or computer name of the account.CORP
SubjectLogonIdLogon session ID; correlates to the 4624 network logon on the server.0x6b3f02
ObjectTypeAlways File for this event.File
IpAddressSource address of the client; IPv6 or a ::ffff: mapped IPv4 address.198.51.100.64
IpPortSource port used by the client; 0 for local access.50342
ShareNameName of the accessed share, in the form \\*\SHARE.\\*\C$
ShareLocalPathNTFS path behind the share, in the form \??\PATH; empty for IPC$.\??\C:\
AccessMaskAlways 0x1 for this event.0x1
AccessListAlways ReadData for this event, shown as its message code.%%4416

Inspect Event 5140 Values

Click a field to inspect the full simulated value, the way you would expand it in a SIEM event view.

Example Event 5140 Log

A representative Security entry for Event 5140, generated deterministically by our telemetry engine so every field holds a realistic, internally consistent value.

Simulated example generated by SOCSimulator Research
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="Microsoft-Windows-Security-Auditing" />
    <EventID>5140</EventID>
    <Version>0</Version>
    <Level>0</Level>
    <Task>0</Task>
    <Opcode>0</Opcode>
    <Keywords>0x8020000000000000</Keywords>
    <TimeCreated SystemTime="2025-08-07T06:21:06.000Z" />
    <EventRecordID>843810</EventRecordID>
    <Channel>Security</Channel>
    <Computer>WS-SIM-001.corp.socsimulator.example</Computer>
    <Security />
  </System>
  <EventData>
    <Data Name="SubjectUserSid">S-1-5-21-424242-1133</Data>
    <Data Name="SubjectUserName">a.chen</Data>
    <Data Name="SubjectDomainName">CORP</Data>
    <Data Name="SubjectLogonId">0x6b3f02</Data>
    <Data Name="ObjectType">File</Data>
    <Data Name="IpAddress">198.51.100.64</Data>
    <Data Name="IpPort">50342</Data>
    <Data Name="ShareName">\\*\C$</Data>
    <Data Name="ShareLocalPath">\??\C:\</Data>
    <Data Name="AccessMask">0x1</Data>
    <Data Name="AccessList">%%4416</Data>
  </EventData>
</Event>

Detecting Event 5140

Administrative share opened from a source that is not on the management allowlist

SPL assumes sourcetype XmlWinEventLog:Security. The allowlist holds your scanner, deployment, backup and jump-host addresses, without the ::ffff: prefix.

index=wineventlog sourcetype=XmlWinEventLog:Security EventCode=5140
| where match(ShareName, "(?i)\\\\(C|ADMIN)\\$$")
| eval src=replace(IpAddress, "^::ffff:", "")
| lookup admin_share_sources.csv src OUTPUT allowed
| where isnull(allowed)
| table _time, host, SubjectUserName, src, ShareName

One source opening administrative shares on many hosts in fifteen minutes (spreading)

Five hosts is a starting threshold; scanners and deployment servers will exceed it, so exclude them by source address first.

index=wineventlog sourcetype=XmlWinEventLog:Security EventCode=5140
| where match(ShareName, "(?i)\\\\(C|ADMIN)\\$$")
| bin _time span=15m
| stats dc(host) as targets, values(host) as hosts by _time, IpAddress, SubjectUserName
| where targets >= 5

Source, host and account combination seen for the first time in thirty days

Run it daily. The first run after enabling the audit policy flags everything, so let a baseline accumulate before you page anyone.

index=wineventlog sourcetype=XmlWinEventLog:Security EventCode=5140 earliest=-30d
| eval src=replace(IpAddress, "^::ffff:", "")
| stats earliest(_time) as first_seen, count by src, host, SubjectUserName
| where first_seen >= relative_time(now(), "-1d")

C$ opened on a domain controller from a host that is not an admin jump host

Microsoft names C$ on domain controllers as an example to monitor. dc_hosts and jump_hosts are lookup files you maintain.

index=wineventlog sourcetype=XmlWinEventLog:Security EventCode=5140
| where match(ShareName, "(?i)\\\\C\\$$")
| lookup dc_hosts.csv host OUTPUT is_dc
| where is_dc="true"
| eval src=replace(IpAddress, "^::ffff:", "")
| lookup jump_hosts.csv src OUTPUT is_jump
| where isnull(is_jump)
| table _time, host, SubjectUserName, src

True Positive vs False Positive

Plenty of legitimate software uses administrative shares. Credentialed vulnerability scanners authenticate to C$ and ADMIN$ on every host they assess. Software deployment, backup and endpoint management tools do the same, and help-desk staff open C$ to fetch logs. None of that is suspicious as long as the source address is the scanner, the deployment server or the support jump host. Keep an allowlist of source addresses by role, and review it when roles change, because an allowlist is only as honest as its last update.

On domain controllers, the bulk of the noise is computer accounts (names ending in a dollar sign) reading SYSVOL and NETLOGON for Group Policy. Drop those two share names for computer accounts at collection and keep every other 5140, including computer accounts touching C$, which is rare enough to read on its own. Doing this keeps the estate-wide enablement affordable.

What remains is what the detections should chase. A workstation reaching C$ or ADMIN$ on another workstation is the first shape. A single source reaching admin shares on many hosts in a quarter of an hour is the second, and it looks like spreading, not support. A source and host pair that has never appeared in thirty days is the third. The fourth is any non-administrative host opening C$ on a domain controller, which Microsoft's guidance specifically calls out.

Work the case with a short, fixed routine. Resolve IpAddress to a host and an owner. Take SubjectLogonId to the 4624 on the target and note the authentication package: an NTLM network logon from a workstation using an administrator account looks worse than Kerberos from the jump host. A 4672 with the same logon ID tells you the logon carried administrative privileges. Then read the 5145 events on the target to see which files moved, and look for a service, scheduled task or WMI activity in the minutes that follow.

A long-lived SMB session hides everything after its first access, so read a lone 5140 together with the 5145 events on the same host.

MITRE ATT&CK® Techniques

Event 5140 telemetry feeds detections for these ATT&CK® techniques:

Practice Investigating Event 5140

Reading about a network share object was accessed is one thing. Working the detection inside a live console is another. These free SOCSimulator operations cover the attack techniques Event 5140 helps you detect:

FortiOS Bypass to Hunters International Ransomware

FortiOS Bypass to Hunters International Ransomware

Operators consistent with the Hunters International ransomware group abuse a FortiOS super-admin authentication bypass on an internet-facing FortiGate, plant rogue accounts, pivot over the SSL-VPN tunnel by RDP, sweep the network with Advanced IP and Port Scanner, and push roughly 6.8 GB of share data to a single external host over SFTP before running the encrypter. Work the FortiGate edge, the directory records, the perimeter egress, and the endpoint process tree to reconstruct the intrusion from entry to encryption.

30m·256 tasks
View Operation
MFA Fatigue: The Notification Flood

MFA Fatigue: The Notification Flood

In this guided walkthrough, you will step into the shoes of a SOC analyst investigating a modern identity-based attack. The threat landscape in 2026 has shifted: adversaries are no longer just 'breaking in'; they are logging in. You will analyze real-time identity signals, correlate disparate log sources across a hybrid cloud environment, and identify the markers of an MFA fatigue attack used by the FlowerStorm phishing kit. This scenario highlights the critical importance of behavioral analysis over simple IOC matching in an era of malware-free intrusions and compromised human identities.

30m·256 tasks
View Operation
Edge Device Exploitation: VPN Zero-Day

Edge Device Exploitation: VPN Zero-Day

Investigate a breach targeting exposed edge security appliances. In this scenario, an attacker exploits Ivanti Connect Secure CVE-2025-22457 to obtain unauthenticated code execution, spawns a shell from the gateway web process, retrieves a Linux payload, and attempts to preserve access using edge-device service abuse patterns similar to FortiGate SSL-VPN post-exploitation tradecraft. Analyze SIEM, XDR, and firewall evidence to identify the spawned shell, suspicious domain, local sync script, and defensive block policy.

55m·508 tasks
View Operation
Start investigating free

Frequently Asked Questions

What is event ID 5140?
It records that a network share object was accessed. Windows writes it once per session, when the first access attempt is made, with the account, client IP and port, share name and the share's local path. The access mask is always 0x1 (ReadData), because the event marks the connection, not the file operations.
Does event 5140 show which file was accessed?
No. 5140 identifies the share, not the file, and appears only once per session. Event 5145, from the Detailed File Share subcategory, logs each file or folder with RelativeTargetName and the rights requested. Enable both on hosts where you need to answer who connected and what they opened.
What does event 5140 for C$ or ADMIN$ mean?
Someone opened a default administrative share. That is routine for scanners, backup and deployment tools, and a lateral movement step when it comes from a workstation or an unexpected host. Microsoft suggests monitoring C$ on domain controllers and watching source addresses outside the internal range.

Sources

“5140 field schema, once-per-session behavior, constant AccessMask 0x1, and Microsoft's monitoring recommendations including C$ on domain controllers”

“File Share subcategory: no SACLs for shares, volume high on file servers and domain controllers and low on member servers and workstations, Success and Failure recommended”

“SMB/Windows Admin Shares: lateral movement with valid accounts over SMB, including Pass the Hash against administrator shares”

“auditpol /set syntax with /subcategory, /success and /failure switches”

“T1135 Network Share Discovery, the enumeration behavior behind share sweeps”

Event ID

Event ID 5145: Per-File Share Access & PsExec Detection

Event ID 5145 logs every file or folder checked on a network share. Read ShareName and RelativeTargetName, spot ADMIN$ w…

Read more
Event ID

Event ID 4663: File Access, AccessMask and Detection Queries

Event ID 4663 shows an access right being used on a file or key. Decode AccessMask, fix 'not logging', and detect stagin…

Read more
Glossary

What is Data Exfiltration? SOC Glossary

Data exfiltration in cyber security is the unauthorized transfer of data from an organization's systems to infrastructur…

Read more
Glossary

What is Persistence? SOC Glossary

Persistence is the set of techniques an adversary uses to keep access to a compromised system after whatever gave them t…

Read more
Glossary

What is Threat Hunting? SOC Glossary

Threat hunting is the proactive search through security telemetry for attackers that existing controls missed. The hunte…

Read more
Career Path

SOC Analyst (Tier 2) Career Guide: Salary & Skills

Tier 2 SOC Analysts handle the investigations that Tier 1 escalates. You dig into multi-stage attacks, coordinate contai…

Read more
Career Path

Threat Hunter Career Guide: Salary & Skills

Threat Hunters do not wait for alerts. You develop hypotheses based on threat intelligence and adversary behavior models…

Read more
Technique

Remote Services (T1021): Detection Training

Remote Services lateral movement reuses valid credentials against services built to accept remote sessions, RDP, SSH, VN…

Read more
Comparison

SOCSimulator vs. LetsDefend: Platform Comparison

SOCSimulator wins on operational realism. You get multi-tool shift simulation with SLA pressure, noise injection, and al…

Read more
Event ID

Windows Event ID Library: SOC Reference

Windows Security and Sysmon event IDs with simulated log samples, field tables, and tested detection queries.

Read more
Feature

Shift Mode: Real-Time SOC Simulation

Practice alert triage under realistic time pressure with SLA timers and noise injection.

Read more
Feature

Operations: Guided Training Operations

Structured CTF-style investigation operations covering real-world attack scenarios.

Read more