Event ID 5140: A network share object was accessed
Event 5140 is generated when a network share object is accessed, logging which user or system accessed what shared folder. This event is essential for detecting lateral movement, data exfiltration, ransomware encryption of network shares, and unauthorized access to sensitive file servers during active intrusions.
- Channel
- Security
- Logged by default
- No
- Written on
- Target host
- Volume
- Moderate
- Audit subcategory
- File Share
- Needs a SACL
- No
To have this event
- Enable File Share:
auditpol /set /subcategory:"File Share" /success:enable /failure:enable
Key fields
Exact XML field names, as they appear in <Data Name="…"> and in SIEM field extractions.
| Field | What it tells you |
|---|---|
| SubjectUserName | Account that accessed the share |
| SubjectDomainName | Domain of the account |
| SubjectLogonId | Logon ID for correlation |
| ObjectType | Type of object (File) |
| IpAddress | Source IP address |
| IpPort | Source port |
| ShareName | Name of the accessed share (e.g., \\*\ADMIN$, \\*\C$) |
| ShareLocalPath | Local path of the share |
| AccessMask | Access rights requested (hex value) |
In an investigation
Event 5140 provides critical visibility into network file share access patterns, which is essential for detecting various attack stages. When attackers move laterally through a network after initial compromise, accessing network shares (especially administrative shares like ADMIN$, C$, IPC$) is a common technique for reconnaissance, tool deployment, and data staging before exfiltration. This event logs the user account, source IP address, share name, and access mask showing permissions requested (read, write, delete). Security teams should baseline normal share access patterns for each file server and alert on anomalous access such as workstations accessing server shares they've never contacted before, administrative share access from non-IT accounts, or rapid access to multiple shares suggesting automated scanning. Ransomware frequently generates mass Event 5140 entries as it encrypts files on network shares.
What it can reveal
- Lateral movement detection when attacker workstations access administrative shares (ADMIN$, C$) for tool deployment or remote execution
- Data exfiltration staging visible through unusual access to sensitive shares from unexpected user accounts or systems
- Ransomware pre-encryption reconnaissance showing automated enumeration of accessible network shares
- Unauthorized privileged access when standard user accounts access shares requiring elevated permissions
- APT groups like APT29 and FIN7 extensively enumerate and access network shares during data theft operations
How to detect with it
Monitor Event 5140 for access to administrative shares (ADMIN$, C$, IPC$) from workstations or user accounts that shouldn't require this access. Alert on first-time access relationships where source systems contact share servers they've never accessed historically. Track access to sensitive shares (executive shares, HR data, finance folders) from accounts outside expected business units. Detect mass share enumeration by monitoring for single source IPs accessing many different shares within short time windows. Correlate Event 5140 with Event 5145 (detailed object access) for granular visibility into which specific files are being accessed. Monitor share access during off-hours or from unusual geolocations. Alert on share access patterns indicating lateral movement - sequential access to multiple systems following a timeline consistent with manual attacker activity.
Attack patterns
- Ransomware pre-deployment attack pattern: a single compromised host (often a domain controller or management server) connects to the ADMIN$ or C$ shares of many servers in a short window, producing a burst of Event 5140 from one source IP before encryption begins
- FIN7 data exfiltration: Event 5140 showed systematic access to point-of-sale system shares from compromised back-office server, staging cardholder data for exfiltration
- APT29 reconnaissance: After initial compromise, attackers accessed administrative shares on all domain controllers and file servers from single workstation, enumerating network architecture
- Insider threat investigation: Employee accessed HR share containing salary data and executive communications from personal workstation, generating unexpected Event 5140 patterns before data leak
Compared withEvent 5140 logs initial share access, while Event 5145 tracks detailed file-level operations within shares. For comprehensive visibility, enable and monitor both events together to track from share access through specific file modifications.
Pull this event
Retrieval queries for a live host, a collected .evtx file and common SIEMs. Filter further on the key fields above.
Get-WinEvent -LogName 'Security' -FilterXPath "*[System[(EventID=5140)]]" -MaxEvents 50 |
Select-Object TimeCreated, Id, MachineName, Message-FilterXPath supports exact matches only. For substring matching, filter in Where-Object.
Where it shows up
Investigations, attack signals and lateral movement techniques that rely on this event.
- InvestigationWhere did this account log on, and was it used for lateral movement?Confirm lateral movement by technique
- InvestigationIs this a brute-force or password-spray attack, and did any attempt succeed?Scope the successful session
- InvestigationWhen did the attacker first get in? Building the initial access timelineIdentify the remote-entry channel
- InvestigationWhich files were accessed or staged over SMB shares?See which shares were touched
ATT&CK mapping
Techniques this event can help detect. Most of these depend on specific field values; the event alone does not mean the technique happened.
Also relevant, depending on field values
Related events
Common questions
- What does Windows event ID 5140 mean?
- Event 5140 is generated when a network share object is accessed, logging which user or system accessed what shared folder. This event is essential for detecting lateral movement, data exfiltration, ransomware encryption of network shares, and unauthorized access to sensitive file servers during active intrusions.
- Is event 5140 logged by default?
- No. It must be enabled before it is recorded. It is controlled by the "File Share" Advanced Audit Policy subcategory (Object Access).
- Where is event 5140 recorded?
- In the Security channel on the target host.
Decode a real event
Paste the XML and every value gets explained. Nothing leaves your browser.
Open decoderEvent 5140 is generated when a network share object is accessed, logging which user or system accessed what shared folder.