/*
   Odin by Brandefense - Monograph 26 / 30 YARA Artifact Suite
   Scope: Bounded detection rules for Hidden-Desktop (HVNC) DLLs, Chrome-CDP cookie
          hijackers, Form1120 tax-lure stagers, and XenoRAT/PureRAT plugin configs.
   Classification: TLP:CLEAR
*/

rule ODIN_HVNC_HiddenDesktop_DLL_Strings
{
    meta:
        author = "Odin by Brandefense"
        monograph = "26 / 30"
        classification = "TLP:CLEAR"
        action = "isolate host and review"
        description = "Matches Win32 hidden-desktop creation and workbench HVNC DLL markers"
    strings:
        $api1 = "CreateDesktopA" ascii
        $api2 = "CreateDesktopW" ascii
        $api3 = "SetThreadDesktop" ascii
        $api4 = "PrintWindow" ascii
        $hv1 = "HVNC_final" ascii wide nocase
        $hv2 = "HVNC_mark3" ascii wide nocase
        $hv3 = "HVNC_patched" ascii wide nocase
        $hv4 = "hijack_standalone" ascii wide nocase
    condition:
        filesize < 2MB and (($api1 or $api2) and $api3 and $api4) and 1 of ($hv*)
}

rule ODIN_Chrome_CDP_Cookie_Hijack_PowerShell
{
    meta:
        author = "Odin by Brandefense"
        monograph = "26 / 30"
        classification = "TLP:CLEAR"
        action = "isolate host and review"
        description = "Matches PowerShell or C# browser relaunch scripts abusing Chrome DevTools Protocol cookie extraction"
    strings:
        $cdp1 = "--remote-debugging-port=" ascii wide nocase
        $cdp2 = "/json/version" ascii wide nocase
        $ws1 = "Network.getAllCookies" ascii wide
        $ws2 = "Storage.getCookies" ascii wide
        $ax1 = "AxRelaunch" ascii wide nocase
        $ax2 = "dump_cookies" ascii wide nocase
    condition:
        filesize < 512KB and ($cdp1 or $cdp2) and ($ws1 or $ws2) and ($ax1 or $ax2)
}

rule ODIN_Form1120_TaxLure_Delivery_Stager
{
    meta:
        author = "Odin by Brandefense"
        monograph = "26 / 30"
        classification = "TLP:CLEAR"
        action = "quarantine file and review"
        description = "Matches corporate tax-lure delivery scripts and LNK/VBS stagers referencing Form1120 and UAC bypass modules"
    strings:
        $tx1 = "Form1120.bin" ascii wide nocase
        $tx2 = "Form1120.pdf" ascii wide nocase
        $ln1 = "Tax Documents 2025.pdf.lnk" ascii wide nocase
        $ln2 = "sacloader.b64" ascii wide nocase
        $uac = "Uacbypass.dll" ascii wide nocase
    condition:
        filesize < 2MB and ($tx1 or $tx2) and ($ln1 or $ln2 or $uac)
}

rule ODIN_XenoRAT_PureRAT_Plugin_Loader_Config
{
    meta:
        author = "Odin by Brandefense"
        monograph = "26 / 30"
        classification = "TLP:CLEAR"
        action = "analyst review"
        description = "Matches XenoRAT side-loading plugin manifests and PureRAT and PureCoder brand markers"
    strings:
        $xe1 = "xeno_plugins" ascii wide nocase
        $xe2 = "ChromeServer" ascii wide
        $pr1 = "purecoder" ascii wide nocase
        $pr2 = "PureRAT Agent" ascii wide
        $sl1 = "version_new_fresh.dll" ascii wide nocase
    condition:
        filesize < 2MB and (($xe1 and ($xe2 or $sl1)) or $pr2 or ($pr1 and ($xe2 or $sl1)))
}
