rule win_azorult_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.azorult."
        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.azorult"
        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 = { 56 e8???????? 59 ff05???????? 8b75ec 56 }
            // n = 6, score = 200
            //   56                   | push                esi
            //   e8????????           |                     
            //   59                   | pop                 ecx
            //   ff05????????         |                     
            //   8b75ec               | mov                 esi, dword ptr [ebp - 0x14]
            //   56                   | push                esi

        $sequence_1 = { 234df8 8b703c 337024 337010 33701c d1c6 89701c }
            // n = 7, score = 200
            //   234df8               | and                 ecx, dword ptr [ebp - 8]
            //   8b703c               | mov                 esi, dword ptr [eax + 0x3c]
            //   337024               | xor                 esi, dword ptr [eax + 0x24]
            //   337010               | xor                 esi, dword ptr [eax + 0x10]
            //   33701c               | xor                 esi, dword ptr [eax + 0x1c]
            //   d1c6                 | rol                 esi, 1
            //   89701c               | mov                 dword ptr [eax + 0x1c], esi

        $sequence_2 = { ff15???????? 8d8560faffff 50 8d45d0 50 68???????? 8d85b0fdffff }
            // n = 7, score = 200
            //   ff15????????         |                     
            //   8d8560faffff         | lea                 eax, [ebp - 0x5a0]
            //   50                   | push                eax
            //   8d45d0               | lea                 eax, [ebp - 0x30]
            //   50                   | push                eax
            //   68????????           |                     
            //   8d85b0fdffff         | lea                 eax, [ebp - 0x250]

        $sequence_3 = { 6685db 7504 8bc1 eb40 0fb701 56 6685c0 }
            // n = 7, score = 200
            //   6685db               | test                bx, bx
            //   7504                 | jne                 6
            //   8bc1                 | mov                 eax, ecx
            //   eb40                 | jmp                 0x42
            //   0fb701               | movzx               eax, word ptr [ecx]
            //   56                   | push                esi
            //   6685c0               | test                ax, ax

        $sequence_4 = { 8d45fc 50 51 51 51 ff7618 894dfc }
            // n = 7, score = 200
            //   8d45fc               | lea                 eax, [ebp - 4]
            //   50                   | push                eax
            //   51                   | push                ecx
            //   51                   | push                ecx
            //   51                   | push                ecx
            //   ff7618               | push                dword ptr [esi + 0x18]
            //   894dfc               | mov                 dword ptr [ebp - 4], ecx

        $sequence_5 = { 337024 337010 33701c d1c6 89701c 8b45fc }
            // n = 6, score = 200
            //   337024               | xor                 esi, dword ptr [eax + 0x24]
            //   337010               | xor                 esi, dword ptr [eax + 0x10]
            //   33701c               | xor                 esi, dword ptr [eax + 0x1c]
            //   d1c6                 | rol                 esi, 1
            //   89701c               | mov                 dword ptr [eax + 0x1c], esi
            //   8b45fc               | mov                 eax, dword ptr [ebp - 4]

        $sequence_6 = { 8bc1 c7410410000000 5d c20400 55 8bec 8b4508 }
            // n = 7, score = 200
            //   8bc1                 | mov                 eax, ecx
            //   c7410410000000       | mov                 dword ptr [ecx + 4], 0x10
            //   5d                   | pop                 ebp
            //   c20400               | ret                 4
            //   55                   | push                ebp
            //   8bec                 | mov                 ebp, esp
            //   8b4508               | mov                 eax, dword ptr [ebp + 8]

        $sequence_7 = { 33d2 c745fc03000000 8bc6 f775fc 8a041a 30040e 46 }
            // n = 7, score = 200
            //   33d2                 | xor                 edx, edx
            //   c745fc03000000       | mov                 dword ptr [ebp - 4], 3
            //   8bc6                 | mov                 eax, esi
            //   f775fc               | div                 dword ptr [ebp - 4]
            //   8a041a               | mov                 al, byte ptr [edx + ebx]
            //   30040e               | xor                 byte ptr [esi + ecx], al
            //   46                   | inc                 esi

        $sequence_8 = { 53 53 8d45e8 50 ff15???????? 85c0 742e }
            // n = 7, score = 200
            //   53                   | push                ebx
            //   53                   | push                ebx
            //   8d45e8               | lea                 eax, [ebp - 0x18]
            //   50                   | push                eax
            //   ff15????????         |                     
            //   85c0                 | test                eax, eax
            //   742e                 | je                  0x30

        $sequence_9 = { e8???????? 84c0 0f8444010000 8d45d8 50 8d4dfc e8???????? }
            // n = 7, score = 200
            //   e8????????           |                     
            //   84c0                 | test                al, al
            //   0f8444010000         | je                  0x14a
            //   8d45d8               | lea                 eax, [ebp - 0x28]
            //   50                   | push                eax
            //   8d4dfc               | lea                 ecx, [ebp - 4]
            //   e8????????           |                     

    condition:
        7 of them and filesize < 1073152
}