/*
   Odin by Brandefense - Monograph 41 / 46 Bounded YARA Detection Suite
   Covers dual-channel DNS/HTTP Beacon and backoper_agent staging manifests,
   Linux root_pwn.sh and ARM64 WebSocket persistence bundles, and Mimikatz/fscan
   lateral-movement staging kits.
   Classification: TLP:CLEAR
*/

rule ODIN_Dual_Channel_DNS_HTTP_Beacon_Staging_Manifest {
    meta:
        author = "Odin by Brandefense"
        monograph = "41 / 46"
        date = "2026-11-21"
        tlp = "CLEAR"
        description = "Detects staging manifests or directory listings pairing DNS and HTTP x64 Beacons with backoper_agent.elf or custom agent builds"
    strings:
        $dns1 = "beacon_dns_x64.dll" ascii wide
        $dns2 = "beacon_dns_x64.exe" ascii wide
        $http1 = "beacon_http_x64.dll" ascii wide
        $http2 = "beacon_http_x64.exe" ascii wide
        $http3 = "beacon_http_x64_shellcode.bin" ascii wide
        $ag1 = "backoper_agent.elf" ascii wide
        $ag2 = "agent_custom_tag.bin" ascii wide
        $ag3 = "gopher_linux_arm64.elf" ascii wide
    condition:
        filesize < 256KB and (1 of ($dns*)) and (1 of ($http*)) and (1 of ($ag*))
}

rule ODIN_Linux_Root_Pwn_and_ARM64_WebSocket_Bundle {
    meta:
        author = "Odin by Brandefense"
        monograph = "41 / 46"
        date = "2026-11-21"
        tlp = "CLEAR"
        description = "Detects Linux privilege-escalation helper scripts or manifests pairing root_pwn.sh with ARM64 WebSocket agents or RustDesk .deb staging"
    strings:
        $pwn = "root_pwn.sh" ascii wide
        $ws1 = "ws_linux_arm64" ascii wide
        $ws2 = "/cs/ws.bin" ascii wide
        $ag = "c_agent" ascii wide
        $rd = "rustdesk-1.5.1-x86_64.deb" ascii wide
        $sh1 = "#!/bin/" ascii
        $sh2 = "chmod +x" ascii
    condition:
        filesize < 256KB and ($pwn or ($sh1 and $sh2)) and (2 of ($ws1, $ws2, $ag, $rd))
}

rule ODIN_Mimikatz_Kiwi_Passwords_and_Lateral_Kit_Manifest {
    meta:
        author = "Odin by Brandefense"
        monograph = "41 / 46"
        date = "2026-11-21"
        tlp = "CLEAR"
        description = "Detects lateral-movement staging inventories pairing kiwi_passwords.yar with multi-arch Mimikatz binaries and fscan.exe"
    strings:
        $yar = "kiwi_passwords.yar" ascii wide
        $fsc = "fscan.exe" ascii wide
        $mk1 = "mimikatz.exe" ascii wide
        $mk2 = "mimilib.dll" ascii wide
        $mk3 = "mimispool.dll" ascii wide
        $mk4 = "mimidrv.sys" ascii wide
    condition:
        filesize < 256KB and $yar and $fsc and (2 of ($mk*))
}
