/*
   Odin by Brandefense - Monograph 67 YARA Suite
   4 filesize-bounded structural rules covering CVE-2022-4262 no-natives reproducers,
   V8 in-cage JSFunction/Code pointer recon scripts, TurboFan float64 constant-pool spray tests,
   and V8 renderer address-inspection harnesses on disk.
*/

rule ODIN_V8_CVE_2022_4262_NoNatives_Reproducer
{
    meta:
        author = "Odin by Brandefense"
        monograph = "67"
        description = "Detects unpacked CVE-2022-4262 standard-renderer V8 type-confusion test files"
        date = "2026-11-25"
    strings:
        $c1 = "CVE-2022-4262" ascii nocase
        $n1 = "exploit-no-natives" ascii nocase
        $n2 = "allow-natives-syntax" ascii nocase
    condition:
        filesize < 512KB and $c1 and ($n1 or $n2)
}

rule ODIN_V8_InCage_CodePointer_Recon_Script
{
    meta:
        author = "Odin by Brandefense"
        monograph = "67"
        description = "Detects V8 pointer-compression cage reconnaissance scripts walking JSFunction and Code object fields"
        date = "2026-11-25"
    strings:
        $s1 = "JSFunction" ascii
        $s2 = "code_entry_point" ascii
        $a1 = "external_pointer" ascii
        $a2 = "in-cage" ascii nocase
    condition:
        filesize < 512KB and $s1 and ($s2 or $a1) and $a2
}

rule ODIN_V8_TurboFan_Float64_JITSpray_Test
{
    meta:
        author = "Odin by Brandefense"
        monograph = "67"
        description = "Detects V8 JIT-spray diagnostic scripts testing TurboFan float64 constant-pool spacing"
        date = "2026-11-25"
    strings:
        $t1 = "TurboFan" ascii
        $t2 = "float64" ascii
        $p1 = "constant pool" ascii nocase
        $p2 = "JIT-spray" ascii nocase
    condition:
        filesize < 512KB and $t1 and $t2 and ($p1 or $p2)
}

rule ODIN_V8_ProcMem_Renderer_Inspection_Script
{
    meta:
        author = "Odin by Brandefense"
        monograph = "67"
        description = "Detects V8 address-inspection harnesses containing addr_of, v8_read64 and v8_write64."
        date = "2026-11-25"
    strings:
        $v1 = "addr_of" ascii
        $v2 = "v8_read64" ascii
        $v3 = "v8_write64" ascii
    condition:
        filesize < 512KB and all of ($v*)
}
