This rule identifies adversary behavior characterized by the specific encryption patterns and system file modifications indicative of a Petya ransomware infection within Azure Sentinel. Proactively hunting for this signature is essential to validate detection efficacy against known variants and ensure rapid containment before the malware can propagate across critical workloads, despite its current low severity classification.
rule Petya_Ransomware {
meta:
description = "Detects Petya Ransomware"
author = "Florian Roth"
reference = "http://www.heise.de/newsticker/meldung/Erpressungs-Trojaner-Petya-riegelt-den-gesamten-Rechner-ab-3150917.html"
date = "2016-03-24"
hash = "26b4699a7b9eeb16e76305d843d4ab05e94d43f3201436927e13b3ebafa90739"
strings:
$a1 = "<description>WinRAR SFX module</description>" fullword ascii
$s1 = "BX-Proxy-Manual-Auth" fullword wide
$s2 = "<!--The ID below indicates application support for Windows 10 -->" fullword ascii
$s3 = "X-HTTP-Attempts" fullword wide
$s4 = "@CommandLineMode" fullword wide
$s5 = "X-Retry-After" fullword wide
condition:
uint16(0) == 0x5a4d and filesize < 500KB and $a1 and 3 of ($s*)
}
This YARA rule can be deployed in the following contexts:
This rule contains 6 string patterns in its detection logic.
Here are 4 specific false positive scenarios for the Detects Petya Ransomware rule in an enterprise environment, along with suggested filters and exclusions:
Windows Update Agent Performing Scheduled Maintenance
wuauserv) or a third-party patch management tool like Microsoft Endpoint Configuration Manager (MECM/SCCM) executes a scheduled task to apply critical security updates. This process often involves writing large files to the system drive and modifying boot configuration data (BCD), which mimics Petya’s behavior of encrypting the Master File Table (MFT) and rebooting the machine.ProcessName is wuapp.exe, ccmexec.exe, or msiexec.exe AND the ParentProcessName is svchost.exe running under the context of the “Windows Update” service, specifically during defined maintenance windows (e.g., 02:00–04:00 local time).Enterprise Antivirus Full System Scan
ProcessName matching known EDR service executables (e.g., CsService.exe, S1Agent.exe) and filter out alerts where the UserAccount is a local system account (e.g., NT AUTHORITY\SYSTEM) rather than an interactive user session.**Group Policy Object (GPO) Enforcement and Registry Modification