Remote Execution via File Shares
The rule identifies the execution of a file created by the virtual system process, potentially indicating lateral movement via network file shares, by detecting a sequence of file creation/modification followed by process execution, excluding trusted vendors.
This detection rule identifies a specific sequence of events that may indicate lateral movement within a Windows environment. The rule focuses on scenarios where a file is created or modified by the System process (PID 4), which is then subsequently executed. This behavior is often associated with attackers leveraging network file shares to distribute malicious tools or payloads across multiple systems. The rule aims to detect this activity while excluding legitimate software installations or updates by filtering out processes signed by trusted vendors such as Veeam, Elasticsearch, CrowdStrike, and Microsoft. This exclusion is designed to reduce false positives and focus on potentially malicious activity. The rule is designed for data generated by Elastic Defend.
Attack Chain
- An attacker gains initial access to a system within the network.
- The attacker uploads a malicious executable (e.g., EXE, SCR, PIF, COM) to a network file share accessible to other systems. The file’s header starts with
4d5a. - The
Systemprocess (PID 4) creates or modifies the malicious executable on the target system via the network share. This can happen through normal network file operations. - The attacker uses lateral movement techniques, such as exploiting SMB/Windows Admin Shares, to remotely trigger the execution of the malicious executable on the target system.
- The malicious executable begins to execute, initiating attacker-controlled code on the target system.
- The process attempts to establish command and control (C2) communication with an external server.
- The attacker uses the compromised system to further propagate within the network, potentially deploying additional malicious tools or escalating privileges.
- The attacker achieves their final objective, such as data exfiltration or ransomware deployment.
Impact
Successful exploitation can lead to widespread compromise of systems within the network. Attackers can leverage compromised systems for data theft, deployment of ransomware, or other malicious activities. The impact can range from business disruption and data loss to significant financial damage and reputational harm. Even with trusted vendor exclusions, a determined adversary could still bypass protections, potentially leading to the compromise of critical infrastructure.
Recommendation
- Deploy the provided Sigma rule to your SIEM to detect remote execution via file shares, and tune exclusions for your specific environment.
- Enable Elastic Defend to generate the necessary process and file events for the Sigma rule to function effectively (see
logs-endpoint.events.process-*,logs-endpoint.events.file-*inindex). - Review and restrict write access to network shares to minimize the risk of unauthorized file uploads (see “Review the privileges needed to write to the network share”).
- Investigate any alerts triggered by the Sigma rule to determine the legitimacy of the activity and take appropriate remediation steps.
- Implement file integrity monitoring (FIM) on network shares to detect unauthorized file modifications or additions.
- Use threat intelligence platforms to enrich file hash values and identify known malicious files.
Detection coverage 2
Remote Execution via File Shares - Creation by System
mediumDetects file creation by the System process (PID 4) followed by execution of the created file, indicating potential lateral movement.
Remote Execution via File Shares - Executable Header Check
mediumDetects the execution of a file with an executable header (MZ) that was created by the System process.
Detection queries are kept inside the platform. Get full rules →