/*
   Odin by Brandefense - Monograph 50 / 52 YARA Artifact Suite
   Scope: Heuristic detection rules for modular PHP phishing kit files
          (not validated against the observed files, whose paths are withheld),
          and CyberStrikeAI default or typo-squatted certificate configs.
   Classification: TLP:CLEAR
*/

rule ODIN_PHP_Phishing_DOM_Obfuscator_Suite
{
    meta:
        author = "Odin by Brandefense"
        monograph = "50 / 52"
        classification = "TLP:CLEAR"
        action = "HUNT_PHP_PHISH_OBFUSCATOR"
        description = "Heuristic match for PHP DOM obfuscation helper strings; not validated against the observed files."
    strings:
        $c1 = "<?php" ascii
        $c2 = "class " ascii
        $p1 = "base64_encode" ascii nocase
        $p2 = "base64_decode" ascii nocase
    condition:
        filesize < 128KB and $c1 and $c2 and ($p1 and $p2)
}

rule ODIN_PHP_Phishing_Storage_and_LogPanel_API
{
    meta:
        author = "Odin by Brandefense"
        monograph = "50 / 52"
        classification = "TLP:CLEAR"
        action = "HUNT_PHP_PHISH_LOG_PANEL"
        description = "Heuristic match for at least two listed strings, including at least one of PDO(, openssl_encrypt, or openssl_decrypt; not validated against the observed files."
    strings:
        $g1 = "<?php" ascii
        $g2 = "unlink(" ascii nocase
        $s1 = "PDO(" ascii
        $s2 = "openssl_encrypt" ascii nocase
        $s3 = "openssl_decrypt" ascii nocase
        $d1 = "Index of /" ascii
        $d2 = "Directory listing for /" ascii
    condition:
        filesize < 128KB and not ($d1 or $d2) and 1 of ($s1, $s2, $s3) and 2 of ($s1, $s2, $s3, $g1, $g2)
}

rule ODIN_CyberStrikeAI_Config_and_Typosquat_Cert_Indicators
{
    meta:
        author = "Odin by Brandefense"
        monograph = "50 / 52"
        classification = "TLP:CLEAR"
        action = "HUNT_CYBERSTRIKEAI_OR_TYPOSQUAT_CERT"
        description = "Matches CyberStrikeAI configuration files or certificate generation scripts naming CN=cdn.cloduflare.com"
    strings:
        $typo = "cdn.cloduflare.com" ascii nocase
        $cs1 = "cyberstrikeai" ascii nocase
        $m1 = "mcp_server" ascii nocase
        $m2 = "18666" ascii
        $m3 = "CN=cyberstrikeai" ascii nocase
    condition:
        filesize < 256KB and ($typo or ($cs1 and 1 of ($m1, $m2, $m3)))
}
