rule win_kazuar_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.kazuar."
        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.kazuar"
        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 = { 4889442428 c744242000000000 ff15???????? 90 }
            // n = 4, score = 300
            //   4889442428           | dec                 esp
            //   c744242000000000     | add                 ecx, ebx
            //   ff15????????         |                     
            //   90                   | mov                 esi, dword ptr [ecx + 0x88]

        $sequence_1 = { c744240400000000 668945f2 8d45ec c7042400000000 8944240c 8d45f0 }
            // n = 6, score = 300
            //   c744240400000000     | dec                 eax
            //   668945f2             | lea                 ecx, [0xfb1]
            //   8d45ec               | dec                 eax
            //   c7042400000000       | mov                 ecx, eax
            //   8944240c             | xor                 eax, eax
            //   8d45f0               | dec                 eax

        $sequence_2 = { 668945f0 83c002 c744240400000000 668945f2 }
            // n = 4, score = 300
            //   668945f0             | cmp                 ebx, ebx
            //   83c002               | je                  0x1c1
            //   c744240400000000     | dec                 ebp
            //   668945f2             | test                ebx, ebx

        $sequence_3 = { 83b98c00000000 7449 4c01de 31db 8b6e20 }
            // n = 5, score = 300
            //   83b98c00000000       | dec                 eax
            //   7449                 | mov                 dword ptr [esp + 0x28], eax
            //   4c01de               | mov                 dword ptr [esp + 0x20], 0
            //   31db                 | dec                 eax
            //   8b6e20               | lea                 ebx, [esp + 0x2c]

        $sequence_4 = { 7506 498b4310 eb0f 4d8b1b }
            // n = 4, score = 300
            //   7506                 | mov                 edx, dword ptr [eax]
            //   498b4310             | mov                 dword ptr [esp], eax
            //   eb0f                 | push                edx
            //   4d8b1b               | jns                 0xf9

        $sequence_5 = { 31d2 31c9 01c0 4c89442438 6689442430 4c8d442430 83c002 }
            // n = 7, score = 300
            //   31d2                 | mov                 dword ptr [esp + 4], eax
            //   31c9                 | mov                 dword ptr [esp], 0
            //   01c0                 | mov                 dword ptr [esp + 0x10], edx
            //   4c89442438           | call                ecx
            //   6689442430           | mov                 dword ptr [esp + 4], edi
            //   4c8d442430           | mov                 dword ptr [esp], eax
            //   83c002               | mov                 dword ptr [esp + 8], edx

        $sequence_6 = { 7452 83b98c00000000 7449 4c01de 31db }
            // n = 5, score = 300
            //   7452                 | mov                 ecx, edi
            //   83b98c00000000       | dec                 eax
            //   7449                 | test                ebx, ebx
            //   4c01de               | je                  0x4a1
            //   31db                 | dec                 ecx

        $sequence_7 = { 89e5 e8???????? 85c0 740a }
            // n = 4, score = 300
            //   89e5                 | mov                 edx, 0x4e9dd05b
            //   e8????????           |                     
            //   85c0                 | test                eax, eax
            //   740a                 | je                  0x40e

        $sequence_8 = { 7463 4863493c 4c01d9 8bb188000000 85f6 7452 }
            // n = 6, score = 300
            //   7463                 | ret                 
            //   4863493c             | dec                 eax
            //   4c01d9               | sub                 esp, 0x48
            //   8bb188000000         | xor                 edx, edx
            //   85f6                 | dec                 eax
            //   7452                 | test                eax, eax

        $sequence_9 = { 89c2 89e5 e8???????? 85c0 }
            // n = 4, score = 300
            //   89c2                 | jns                 0x2e2
            //   89e5                 | sub                 esp, 0x10
            //   e8????????           |                     
            //   85c0                 | test                eax, eax

    condition:
        7 of them and filesize < 81920
}