/*
   Odin by Brandefense - Report #17 YARA OAST Server & Cloud Burst Provisioning Suite
   Classification: TLP:CLEAR
   Scope: Detects self-hosted Interactsh server descriptors, private BurpCollaborator JSON configs,
          DNSLog / OAST callback polling configurations, and multi-stack IaC cloud burst manifests.
*/

rule ODIN_Interactsh_SelfHosted_Server_Config
{
    meta:
        author = "Odin by Brandefense"
        report = "Monograph 17 - OAST Callback Fabrics and Cloud Bursts"
        classification = "TLP:CLEAR"
        tactic = "Command and Control"
    strings:
        $i1 = "Interactsh-Server" ascii wide nocase
        $i2 = "interactsh-server" ascii wide nocase
        $p1 = "smtp-port:" ascii wide nocase
        $p2 = "smtps-port:" ascii wide nocase
        $w1 = "wildcard: true" ascii wide nocase
        $w2 = "listen-ip:" ascii wide nocase
    condition:
        filesize < 512KB and (($i1 or $i2) and ($p1 or $p2) and ($w1 or $w2))
}

rule ODIN_BurpCollaborator_Custom_Server_Config
{
    meta:
        author = "Odin by Brandefense"
        report = "Monograph 17 - OAST Callback Fabrics and Cloud Bursts"
        classification = "TLP:CLEAR"
        tactic = "Command and Control"
    strings:
        $b1 = "\"serverDomain\"" ascii wide
        $b2 = "\"polling\"" ascii wide
        $c1 = "\"eventCapture\"" ascii wide
        $c2 = "\"workerThreads\"" ascii wide
        $d1 = "\"publicAddress\"" ascii wide
        $d2 = "\"localAddress\"" ascii wide
        $e1 = "\"dns\"" ascii wide
    condition:
        filesize < 512KB and ($b1 and $b2 and ($c1 or $c2) and ($d1 or $d2) and $e1)
}

rule ODIN_DNSLog_And_OAST_Polling_Descriptor
{
    meta:
        author = "Odin by Brandefense"
        report = "Monograph 17 - OAST Callback Fabrics and Cloud Bursts"
        classification = "TLP:CLEAR"
        tactic = "Discovery"
    strings:
        $d1 = /https?:\/\/[^ \t\r\n"']{1,80}\/getrecords/ ascii nocase
        $d2 = /https?:\/\/[^ \t\r\n"']{1,80}\/getdomain/ ascii nocase
        $z1 = ".dnslog.cn" ascii wide nocase
        $z2 = ".oast.pro" ascii wide nocase
        $z3 = ".oast.site" ascii wide nocase
        $z4 = ".oast.online" ascii wide nocase
    condition:
        filesize < 16KB and ($d1 and $d2 and 1 of ($z*))
}

rule ODIN_IaC_MultiStack_Offensive_Burst_Manifest
{
    meta:
        author = "Odin by Brandefense"
        report = "Monograph 17 - OAST Callback Fabrics and Cloud Bursts"
        classification = "TLP:CLEAR"
        tactic = "Command and Control"
    strings:
        $iac1 = /resource[ \t]+"alicloud_instance"/ ascii
        $s1 = /"cyberstrikeai:[0-9]{2,5}"/ ascii nocase
        $s2 = /"hexstrikeai:[0-9]{2,5}"/ ascii nocase
        $s3 = /"vshell:[0-9]{2,5}"/ ascii nocase
        $s4 = /"dnslog:[0-9]{2,5}"/ ascii nocase
    condition:
        filesize < 64KB and $iac1 and 3 of ($s*)
}
