/*
   Odin by Brandefense - Monograph 49 YARA Posture & Artifact Rules
   Detects captured HTML open-directory listings exposing .NET debug-symbol
   and DLL suites, Linux FHS root-like directory trees, or MSI installer
   and disk-image shares.
*/

rule ODIN_Exposed_Payment_Kiosk_Directory_Index {
    meta:
        author = "Odin by Brandefense"
        date = "2026-11-21"
        description = "Detects open-directory listings exposing .NET debug-symbol files alongside executable, DLL, or configuration links"
        tlp = "CLEAR"
    strings:
        $idx1 = "Index of /" ascii nocase
        $idx2 = "Directory listing for /" ascii nocase
        $ext1 = ".exe\"" ascii nocase
        $ext2 = ".pdb\"" ascii nocase
        $ext3 = ".dll\"" ascii nocase
        $ext4 = ".config\"" ascii nocase
    condition:
        filesize < 512KB and 1 of ($idx*) and $ext2 and 2 of ($ext1, $ext3, $ext4)
}

rule ODIN_Apache_Root_Symlink_Traversal_Index {
    meta:
        author = "Odin by Brandefense"
        date = "2026-11-21"
        description = "Detects open-directory listings exposing Linux FHS top-level system directories"
        tlp = "CLEAR"
    strings:
        $idx1 = "Index of /" ascii nocase
        $idx2 = "Directory listing for /" ascii nocase
        $fhs1 = "href=\"etc/\"" ascii nocase
        $fhs2 = "href=\"bin/\"" ascii nocase
        $fhs3 = "href=\"boot/\"" ascii nocase
        $fhs4 = "href=\"sbin/\"" ascii nocase
        $fhs5 = "href=\"lib/\"" ascii nocase
    condition:
        filesize < 1MB and 1 of ($idx*) and 3 of ($fhs*)
}

rule ODIN_Exposed_MSP_RMM_Share_Index {
    meta:
        author = "Odin by Brandefense"
        date = "2026-11-21"
        description = "Detects open-directory shares exposing Windows MSI installers alongside executables, ISO media, or VHDX virtual disks"
        tlp = "CLEAR"
    strings:
        $idx1 = "Index of /" ascii nocase
        $idx2 = "Directory listing for /" ascii nocase
        $pkg1 = ".msi\"" ascii nocase
        $pkg2 = ".exe\"" ascii nocase
        $pkg3 = ".iso\"" ascii nocase
        $pkg4 = ".vhdx\"" ascii nocase
    condition:
        filesize < 1MB and 1 of ($idx*) and $pkg1 and 1 of ($pkg2, $pkg3, $pkg4)
}
