/*
 * Odin by Brandefense - Monograph 44 / 46 YARA Detection Suite
 * Scope: Kaiji Golang Linux SSH/DDoS implants, Mozi BitTorrent DHT peer payloads,
 *        and Mirai/Gafgyt multi-architecture BusyBox droppers.
 * Classification: TLP:CLEAR
 */

rule ODIN_Kaiji_Golang_Linux_SSH_DDoS_Implant
{
    meta:
        author = "Odin by Brandefense"
        monograph = "44 / 46"
        family = "Kaiji"
        action = "alert_and_isolate"
        tlp = "CLEAR"
    strings:
        $go_id = "Go build" ascii
        $p1 = "/usr/bin/lib/" ascii
        $p2 = "/etc/init.d/" ascii
        $s1 = ".ssh/known_hosts" ascii
        $s2 = "SYN_ACK" ascii nocase
    condition:
        uint32(0) == 0x464c457f and filesize < 15360KB and $go_id and ($p1 or $p2) and ($s1 or $s2)
}

rule ODIN_Mozi_P2P_BitTorrent_DHT_Config_Node
{
    meta:
        author = "Odin by Brandefense"
        monograph = "44 / 46"
        family = "Mozi"
        action = "alert_and_isolate"
        tlp = "CLEAR"
    strings:
        $dht1 = "d1:ad2:id20:" ascii
        $dht2 = "find_node" ascii
        $cfg1 = "[count]" ascii
        $cfg2 = "[ss]" ascii
        $bb = "/bin/busybox" ascii
    condition:
        filesize < 2048KB and ($dht1 or $dht2) and ($cfg1 or $cfg2) and $bb
}

rule ODIN_Mirai_Gafgyt_MultiArch_Shell_Dropper
{
    meta:
        author = "Odin by Brandefense"
        monograph = "44 / 46"
        family = "Mirai_Gafgyt"
        action = "alert_and_contain"
        tlp = "CLEAR"
    strings:
        $bb = "/bin/busybox" ascii
        $ch = "chmod 777" ascii
        $a1 = ".mips" ascii
        $a2 = ".mpsl" ascii
        $a3 = ".arm7" ascii
        $a4 = ".sh4" ascii
    condition:
        filesize < 512KB and $bb and $ch and 2 of ($a1,$a2,$a3,$a4)
}
