rule win_gazer_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.gazer."
        info = "autogenerated rule brought to you by yara-signator"
        tool = "yara-signator v0.6.0"
        signator_config = "callsandjumps;datarefs;binvalue"
        malpedia_reference = "https://malpedia.caad.fkie.fraunhofer.de/details/win.gazer"
        malpedia_rule_date = "20260916"
        malpedia_hash = "53a643781c18e08f4a50949af60172d837a0b6f6"
        malpedia_version = "20260917"
        malpedia_license = "CC BY-SA 4.0"
        malpedia_sharing = "TLP:WHITE"

    /* DISCLAIMER
     * The strings used in this rule have been automatically selected from the
     * disassembly of memory dumps and unpacked files, using YARA-Signator.
     * The code and documentation is published here:
     * https://github.com/fxb-cocacoding/yara-signator
     * As Malpedia is used as data source, please note that for a given
     * number of families, only single samples are documented.
     * This likely impacts the degree of generalization these rules will offer.
     * Take the described generation method also into consideration when you
     * apply the rules in your use cases and assign them confidence levels.
     */


    strings:
        $sequence_0 = { ff15???????? 85c0 7511 e8???????? 84c0 7508 }
            // n = 6, score = 300
            //   ff15????????         |                     
            //   85c0                 | dec                 eax
            //   7511                 | mov                 dword ptr [eax + 0xc58], edi
            //   e8????????           |                     
            //   84c0                 | mov                 dword ptr [eax + 0xb8], edi
            //   7508                 | test                eax, eax

        $sequence_1 = { 85c0 7511 e8???????? 84c0 7508 83c8ff e9???????? }
            // n = 7, score = 300
            //   85c0                 | cmp                 eax, ebx
            //   7511                 | jne                 0x11e9
            //   e8????????           |                     
            //   84c0                 | jmp                 0x1269
            //   7508                 | dec                 esp
            //   83c8ff               | mov                 edx, ecx
            //   e9????????           |                     

        $sequence_2 = { 85c0 7511 e8???????? 84c0 7508 83c8ff }
            // n = 6, score = 300
            //   85c0                 | add                 eax, eax
            //   7511                 | push                ebx
            //   e8????????           |                     
            //   84c0                 | push                0
            //   7508                 | push                dword ptr [esi + 8]
            //   83c8ff               | call                edi

        $sequence_3 = { 85c0 7511 e8???????? 84c0 7508 }
            // n = 5, score = 300
            //   85c0                 | je                  0x1601
            //   7511                 | inc                 dword ptr [ebp - 0x34]
            //   e8????????           |                     
            //   84c0                 | mov                 word ptr [ecx + edx], ax
            //   7508                 | mov                 eax, dword ptr [ebp - 0x34]

        $sequence_4 = { ff15???????? 85c0 7511 e8???????? 84c0 }
            // n = 5, score = 300
            //   ff15????????         |                     
            //   85c0                 | jne                 0x7ae
            //   7511                 | dec                 esp
            //   e8????????           |                     
            //   84c0                 | lea                 eax, [esp + 0x68]

        $sequence_5 = { 85c0 7511 e8???????? 84c0 }
            // n = 4, score = 300
            //   85c0                 | je                  0x1fbd
            //   7511                 | dec                 eax
            //   e8????????           |                     
            //   84c0                 | lea                 eax, [0x39095]

        $sequence_6 = { 7511 e8???????? 84c0 7508 83c8ff }
            // n = 5, score = 300
            //   7511                 | lea                 esi, [0x24ca4]
            //   e8????????           |                     
            //   84c0                 | dec                 esp
            //   7508                 | lea                 eax, [0x24c8d]
            //   83c8ff               | dec                 ecx

        $sequence_7 = { ff15???????? 85c0 7511 e8???????? 84c0 7508 83c8ff }
            // n = 7, score = 300
            //   ff15????????         |                     
            //   85c0                 | jmp                 0x1c9
            //   7511                 | mov                 eax, dword ptr [ebp + 0x7f]
            //   e8????????           |                     
            //   84c0                 | xor                 ebx, ebx
            //   7508                 | test                eax, eax
            //   83c8ff               | je                  0x204

        $sequence_8 = { 7511 e8???????? 84c0 7508 83c8ff e9???????? }
            // n = 6, score = 300
            //   7511                 | mov                 ecx, dword ptr [eax + eax - 4]
            //   e8????????           |                     
            //   84c0                 | inc                 edx
            //   7508                 | mov                 dword ptr [edx + eax - 4], ecx
            //   83c8ff               | dec                 esp
            //   e9????????           |                     

        $sequence_9 = { 448b442478 468d9400870dd5f4 41c1c20e 4403d2 8bc2 }
            // n = 5, score = 200
            //   448b442478           | mov                 ebx, dword ptr [esp + 0x38]
            //   468d9400870dd5f4     | dec                 eax
            //   41c1c20e             | mov                 ebp, dword ptr [esp + 0x40]
            //   4403d2               | xor                 edx, edx
            //   8bc2                 | inc                 ecx

    condition:
        7 of them and filesize < 950272
}