Let's start writing Yara rules by writing a rule to flag malware originating from the most famous IoT botnet ever :
Mirai.
Mirai is known to have paralyzed the whole Internet in northern america in 2016 by attacking the DNS provider DynDNS.
And it is still alive to this day, searching online for new IoT and GNU/Linux devices to recruit in the botnet!
In the terminal (that can be opened by clicking the Open Terminal button), you can access a
/malware directory containing uncategorized malware.
In this lab, we'll learn to categorize specific malware pieces using yara.Yara uses a
simple rules syntax that you will likely quickly learn!
Using
nano, emacs or vim create a new
mirai.yara file and then write the following contents inside:
rule MiraiBot {
meta:
description = "Mirai Botnet Malware"
strings:
$ua = "USER-AGENT: Google Chrome/60.0.3112.90 Windows"
$snquery = "SNQUERY: 127.0.0.1:AAAAAA:xsvr"
  condition:
    $ua and $snquery
}Then, look for matches of your yara rule in the
/malware directory using
yara -r mirai.yara /malware.
If you copied everything correctly, a flag should be given to you!