Windows SecurityObject AccessEnhanced Analysis

Event 5140: A network share object was accessed.

Quick Answer

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.

Technical Details

Windows Security Source

Event ID: 5140

Windows Security- Object Access

Event Description

A network share object was accessed.

Key Log Fields

  • 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)

MITRE ATT&CK® Mapping (5)

T1039collection
Data from Network Shared Drive

Adversaries may search network shares on computers they have compromised to find files of interest. Sensitive data can be collected from remote systems via shared network drives (host shared directory, network file server, etc.) that are accessible from the current system prior to Exfiltration. Interactive command shells may be in use, and common functionality within [cmd](https://attack.mitre.org/software/S0106) may be used to gather information.

T1074.002collection
Remote Data Staging

Adversaries may stage data collected from multiple systems in a central location or directory on one system prior to Exfiltration. Data may be kept in separate files or combined into one file through techniques such as [Archive Collected Data](https://attack.mitre.org/techniques/T1560). Interactive command shells may be used, and common functionality within [cmd](https://attack.mitre.org/software/S0106) and bash may be used to copy data into a staging location. In cloud environments, adversaries may stage data within a particular instance or virtual machine before exfiltration. An adversary may [Create Cloud Instance](https://attack.mitre.org/techniques/T1578/002) and stage data in that instance.(Citation: Mandiant M-Trends 2020) By staging data on one system prior to Exfiltration, adversaries can minimize the number of connections made to their C2 server and better evade detection.

T1080lateral-movement
Taint Shared Content

Adversaries may deliver payloads to remote systems by adding content to shared storage locations, such as network drives or internal code repositories. Content stored on network drives or in other shared locations may be tainted by adding malicious programs, scripts, or exploit code to otherwise valid files. Once a user opens the shared tainted content, the malicious portion can be executed to run the adversary's code on a remote system. Adversaries may use tainted shared content to move laterally. A directory share pivot is a variation on this technique that uses several other techniques to propagate malware when users access a shared network directory. It uses [Shortcut Modification](https://attack.mitre.org/techniques/T1547/009) of directory .LNK files that use [Masquerading](https://attack.mitre.org/techniques/T1036) to look like the real directories, which are hidden through [Hidden Files and Directories](https://attack.mitre.org/techniques/T1564/001). The malicious .LNK-based directories have an embedded command that executes the hidden malware file in the directory and then opens the real intended directory so that the user's expected action still occurs. When used with frequently used network directories, the technique may result in frequent reinfections and broad access to systems and potentially to new and higher privileged accounts. (Citation: Retwin Directory Share Pivot) Adversaries may also compromise shared network directories through binary infections by appending or prepending its code to the healthy binary on the shared network directory. The malware may modify the original entry point (OEP) of the healthy binary to ensure that it is executed before the legitimate code. The infection could continue to spread via the newly infected file when it is executed by a remote system. These infections may target both binary and non-binary formats that end with extensions including, but not limited to, .EXE, .DLL, .SCR, .BAT, and/or .VBS.

T1135discovery
Network Share Discovery

Adversaries may look for folders and drives shared on remote systems as a means of identifying sources of information to gather as a precursor for Collection and to identify potential systems of interest for Lateral Movement. Networks often contain shared network drives and folders that enable users to access file directories on various systems across a network. File sharing over a Windows network occurs over the SMB protocol. (Citation: Wikipedia Shared Resource) (Citation: TechNet Shared Folder) [Net](https://attack.mitre.org/software/S0039) can be used to query a remote system for available shared drives using the <code>net view \\\\remotesystem</code> command. It can also be used to query shared drives on the local system using <code>net share</code>. For macOS, the <code>sharing -l</code> command lists all shared points used for smb services.

Event Comparison

Event 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.

What This Event Means

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.

Security Implications

  • 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

Detection Strategies

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.

Note: Comprehensive SIEM detection queries for Splunk SPL, Microsoft KQL, and Elastic Query DSL will be added in future updates.

Real-World Attack Examples

  • Ryuk ransomware deployment: Attackers accessed 200+ network shares (Event 5140) from compromised domain controller before deploying encryption across all file servers

  • 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

Contents