Wanna_Cry_Ransomware_Generic

YARA-2017-12867 Critical general Active

Detects WannaCry Ransomware on Disk and in Virtual Page

Wanna_Cry_Ransomware_Generic.yar Valid Syntax
rule Wanna_Cry_Ransomware_Generic {
       meta:
              description = "Detects WannaCry Ransomware on Disk and in Virtual Page"
              author = "US-CERT Code Analysis Team"
              reference = "not set"
              date = "2017/05/12"
       hash0 = "4DA1F312A214C07143ABEEAFB695D904"
       strings:
              $s0 = {410044004D0049004E0024}
              $s1 = "WannaDecryptor"
              $s2 = "WANNACRY"
              $s3 = "Microsoft Enhanced RSA and AES Cryptographic"
              $s4 = "PKS"
              $s5 = "StartTask"
              $s6 = "wcry@123"
              $s7 = {2F6600002F72}
              $s8 = "unzip 0.15 Copyrigh"
              $s9 = "Global\\WINDOWS_TASKOSHT_MUTEX"
              $s10 = "Global\\WINDOWS_TASKCST_MUTEX"
             $s11 = {7461736B736368652E657865000000005461736B5374617274000000742E776E7279000069636163}
             $s12 = {6C73202E202F6772616E742045766572796F6E653A46202F54202F43202F5100617474726962202B68}
             $s13 = "WNcry@2ol7"
             $s14 = "wcry@123"
             $s15 = "Global\\MsWinZonesCacheCounterMutexA"
       condition:
              $s0 and $s1 and $s2 and $s3 or $s4 and $s5 and $s6 and $s7 or $s8 and $s9 and $s10 or $s11 and $s12 or $s13 or $s14 or $s15
}
/*The following Yara ruleset is under the GNU-GPLv2 license (http://www.gnu.org/licenses/gpl-2.0.html) and open to any user or organization, as long as you use it under this license.*/
rule MS17_010_WanaCry_worm {
       meta:
              description = "Worm exploiting MS17-010 and dropping WannaCry Ransomware"
              author = "Felipe Molina (@felmoltor)"
              reference = "https://www.exploit-db.com/exploits/41987/"
              date = "2017/05/12"
       strings:
              $ms17010_str1="PC NETWORK PROGRAM 1.0"
              $ms17010_str2="LANMAN1.0"
              $ms17010_str3="Windows for Workgroups 3.1a"
              $ms17010_str4="__TREEID__PLACEHOLDER__"
              $ms17010_str5="__USERID__PLACEHOLDER__"
              $wannacry_payload_substr1 = "h6agLCqPqVyXi2VSQ8O6Yb9ijBX54j"
              $wannacry_payload_substr2 = "h54WfF9cGigWFEx92bzmOd0UOaZlM"
              $wannacry_payload_substr3 = "tpGFEoLOU6+5I78Toh/nHs/RAP"
       condition:
              all of them
}

Rule Metadata

description
Detects WannaCry Ransomware on Disk and in Virtual Page
author
US-CERT Code Analysis Team
reference
not set
date
2017/05/12
hash0
4DA1F312A214C07143ABEEAFB695D904

String Definitions

{"name":"$s0","value":"{410044004D0049004E0024}"}
{"name":"$s1","value":"\"WannaDecryptor\""}
{"name":"$s2","value":"\"WANNACRY\""}
{"name":"$s3","value":"\"Microsoft Enhanced RSA and AES Cryptographic\""}
{"name":"$s4","value":"\"PKS\""}
{"name":"$s5","value":"\"StartTask\""}
{"name":"$s6","value":"\"wcry@123\""}
{"name":"$s7","value":"{2F6600002F72}"}
{"name":"$s8","value":"\"unzip 0.15 Copyrigh\""}
{"name":"$s9","value":"\"Global\\\\WINDOWS_TASKOSHT_MUTEX\""}
{"name":"$s10","value":"\"Global\\\\WINDOWS_TASKCST_MUTEX\""}
{"name":"$s11","value":"{7461736B736368652E657865000000005461736B5374617274000000742E776E7279000069636163}"}
{"name":"$s12","value":"{6C73202E202F6772616E742045766572796F6E653A46202F54202F43202F5100617474726962202B68}"}
{"name":"$s13","value":"\"WNcry@2ol7\""}
{"name":"$s14","value":"\"wcry@123\""}
{"name":"$s15","value":"\"Global\\\\MsWinZonesCacheCounterMutexA\""}

Threat Analysis

This YARA rule is designed to detect general threats.

Severity Level: Critical

The rule uses pattern matching to identify specific byte sequences, strings, or behavioral patterns associated with malicious activity.

Detection Capabilities

  • File-based detection for executables and documents
  • Memory scanning for running processes
  • Network traffic analysis support

Command Line Usage

# Scan a single file
yara Wanna_Cry_Ransomware_Generic.yar /path/to/suspicious/file

# Scan a directory recursively
yara -r Wanna_Cry_Ransomware_Generic.yar /path/to/directory/

# Scan with metadata output
yara -m Wanna_Cry_Ransomware_Generic.yar target_file

# Scan process memory (Linux)
yara Wanna_Cry_Ransomware_Generic.yar /proc/[pid]/exe

Integration Examples

Python (yara-python)

import yara
rules = yara.compile(filepath='Wanna_Cry_Ransomware_Generic.yar')
matches = rules.match('/path/to/file')

ClamAV Integration

clamscan --yara-rules=Wanna_Cry_Ransomware_Generic.yar /path/to/scan

Rule Information

YARA ID
YARA-2017-12867
Created
August 19, 2025
Last Updated
August 19, 2025
Last Imported
Never

Threat Intelligence

Risk Level Critical
Category general
Detection Confidence Analysis Pending
False Positive Rate Not Available
Last Seen in Wild No Data

Export Options