Creating Detection Rules
YARA Rules
Basic YARA Rule Example
rule Shell_Sandbox_Detection {
strings:
$sandbox_string = "Sandbox detected"
condition:
$sandbox_string
}Enhanced YARA Rule Creation with yarGen
mkdir /home/htb-student/Samples/MalwareAnalysis/Test cp /home/htb-student/Samples/MalwareAnalysis/shell.exe /home/htb-student/Samples/MalwareAnalysis/Test/cd /home/htb-student/yarGen-0.23.4 sudo python3 yarGen.py -m /home/htb-student/Samples/MalwareAnalysis/Test/rule _home_htb_student_Samples_MalwareAnalysis_Test_shell { meta: description = "Test - file shell.exe" author = "yarGen Rule Generator" date = "2023-08-02" hash1 = "bd841e796feed0088ae670284ab991f212cf709f2391310a85443b2ed1312bda" strings: $x1 = "C:\\Windows\\System32\\cmd.exe" fullword ascii $s2 = "http://ms-windows-update.com/svchost.exe" fullword ascii $s3 = "45.33.32.156" fullword ascii $s4 = "[-] Error code is : %lu" fullword ascii $s5 = "Connection sent to C2" fullword ascii $s6 = "iuqerfsodp9ifjaposdfjhgosurijfaewrwergwea.com" fullword ascii condition: uint16(0) == 0x5a4d and filesize < 60KB and 3 of ($s*) }yara /home/htb-student/yarGen-0.23.4/yargen_rules.yar /home/htb-student/Samples/MalwareAnalysis/
YARA Resources
Sigma Rules
Basic Sigma Rule Example
Example Detection Rule with Sysmon Logs
Sigma Resources
References and Additional Resources
Last updated