rule win_dratzarus_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.dratzarus."
        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.dratzarus"
        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 = { 488905???????? e8???????? 488bcb 488bd0 ff15???????? 488d8da0000000 ba0e000000 }
            // n = 7, score = 200
            //   488905????????       |                     
            //   e8????????           |                     
            //   488bcb               | dec                 eax
            //   488bd0               | lea                 edx, [esp + 0x38]
            //   ff15????????         |                     
            //   488d8da0000000       | dec                 eax
            //   ba0e000000           | lea                 ecx, [esp + 0x78]

        $sequence_1 = { 488905???????? e8???????? 488bcb 488bd0 ff15???????? 488d8d78030000 ba15000000 }
            // n = 7, score = 200
            //   488905????????       |                     
            //   e8????????           |                     
            //   488bcb               | mov                 esi, dword ptr [esp + 0x38]
            //   488bd0               | dec                 esp
            //   ff15????????         |                     
            //   488d8d78030000       | lea                 esi, [0x92ebd]
            //   ba15000000           | inc                 esp

        $sequence_2 = { eb04 8b442430 488b4c2448 4833cc e8???????? 488b5c2478 4883c450 }
            // n = 7, score = 200
            //   eb04                 | dec                 eax
            //   8b442430             | add                 esi, 2
            //   488b4c2448           | movzx               eax, byte ptr [esi + 1]
            //   4833cc               | dec                 esp
            //   e8????????           |                     
            //   488b5c2478           | lea                 eax, [0x33a89]
            //   4883c450             | inc                 ecx

        $sequence_3 = { 488bd0 ff15???????? 488d8d80000000 ba14000000 488905???????? e8???????? }
            // n = 6, score = 200
            //   488bd0               | mov                 dword ptr [esp + 0x30], ebp
            //   ff15????????         |                     
            //   488d8d80000000       | dec                 eax
            //   ba14000000           | mov                 ebx, eax
            //   488905????????       |                     
            //   e8????????           |                     

        $sequence_4 = { c785e8000000961a40af 66c785ec00000072ff c685ee000000e4 c785a00000005f70777c }
            // n = 4, score = 200
            //   c785e8000000961a40af     | dec    esp
            //   66c785ec00000072ff     | lea    ecx, [esp + 0x40]
            //   c685ee000000e4       | dec                 esp
            //   c785a00000005f70777c     | lea    eax, [ebp + 0x150]

        $sequence_5 = { 89742450 6689b510020000 48898512020000 4889851a020000 66898522020000 6689b500030000 e8???????? }
            // n = 7, score = 200
            //   89742450             | mov                 word ptr [ebp - 0x18], ax
            //   6689b510020000       | mov                 dword ptr [esp + 0x7c], 0xc5333ba9
            //   48898512020000       | mov                 dword ptr [ebp - 0x80], 0x3c404693
            //   4889851a020000       | mov                 dword ptr [esp + 0x70], 0xd050922a
            //   66898522020000       | mov                 dword ptr [esp + 0x74], 0xfd517295
            //   6689b500030000       | mov                 dword ptr [esp + 0x78], 0xdfe3c086
            //   e8????????           |                     

        $sequence_6 = { 8d0c52 442bd9 7526 e8???????? 448bd8 b84fecc44e }
            // n = 6, score = 200
            //   8d0c52               | movzx               eax, bh
            //   442bd9               | dec                 eax
            //   7526                 | lea                 ecx, [esp + ecx + 0x50]
            //   e8????????           |                     
            //   448bd8               | inc                 ebp
            //   b84fecc44e           | mov                 eax, esp

        $sequence_7 = { 0fb785ec000000 440fb6642440 6689442444 0fb6442445 0fb6542444 }
            // n = 5, score = 200
            //   0fb785ec000000       | lea                 ecx, [eax + 0x18]
            //   440fb6642440         | inc                 ecx
            //   6689442444           | mov                 eax, 0x130
            //   0fb6442445           | jne                 0x926
            //   0fb6542444           | test                ebp, ebp

        $sequence_8 = { 488d8d90030000 ba15000000 488905???????? e8???????? 488bcb 488bd0 ff15???????? }
            // n = 7, score = 200
            //   488d8d90030000       | je                  0x1dbf
            //   ba15000000           | dec                 ecx
            //   488905????????       |                     
            //   e8????????           |                     
            //   488bcb               | mov                 ecx, esp
            //   488bd0               | xor                 eax, eax
            //   ff15????????         |                     

        $sequence_9 = { 488d4de0 ba16000000 e8???????? 488bcb 488bd0 ff15???????? 488b5c2460 }
            // n = 7, score = 200
            //   488d4de0             | mov                 dword ptr [esp + 0x30], 0xd
            //   ba16000000           | dec                 eax
            //   e8????????           |                     
            //   488bcb               | mov                 dword ptr [esp + 0x20], edi
            //   488bd0               | dec                 esp
            //   ff15????????         |                     
            //   488b5c2460           | lea                 eax, [esp + 0x34]

    condition:
        7 of them and filesize < 1606656
}