rule win_alreay_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.alreay."
        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.alreay"
        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 = { 8b4c2431 81e2ff000000 25ff000000 52 8bd0 81e1ff000000 c1e208 }
            // n = 7, score = 200
            //   8b4c2431             | mov                 ecx, dword ptr [esp + 0x31]
            //   81e2ff000000         | and                 edx, 0xff
            //   25ff000000           | and                 eax, 0xff
            //   52                   | push                edx
            //   8bd0                 | mov                 edx, eax
            //   81e1ff000000         | and                 ecx, 0xff
            //   c1e208               | shl                 edx, 8

        $sequence_1 = { e8???????? 8d542464 52 e8???????? 83c424 8bc6 5f }
            // n = 7, score = 200
            //   e8????????           |                     
            //   8d542464             | lea                 edx, [esp + 0x64]
            //   52                   | push                edx
            //   e8????????           |                     
            //   83c424               | add                 esp, 0x24
            //   8bc6                 | mov                 eax, esi
            //   5f                   | pop                 edi

        $sequence_2 = { 8bc1 c3 8b0d???????? a3???????? 3bc8 1bc9 f7d9 }
            // n = 7, score = 200
            //   8bc1                 | mov                 eax, ecx
            //   c3                   | ret                 
            //   8b0d????????         |                     
            //   a3????????           |                     
            //   3bc8                 | cmp                 ecx, eax
            //   1bc9                 | sbb                 ecx, ecx
            //   f7d9                 | neg                 ecx

        $sequence_3 = { 8b35???????? 68???????? 68???????? c705????????3c000000 ffd6 83c408 68???????? }
            // n = 7, score = 200
            //   8b35????????         |                     
            //   68????????           |                     
            //   68????????           |                     
            //   c705????????3c000000     |     
            //   ffd6                 | call                esi
            //   83c408               | add                 esp, 8
            //   68????????           |                     

        $sequence_4 = { d3e2 8b0f 0bca 48 890f 8b4c2410 46 }
            // n = 7, score = 200
            //   d3e2                 | shl                 edx, cl
            //   8b0f                 | mov                 ecx, dword ptr [edi]
            //   0bca                 | or                  ecx, edx
            //   48                   | dec                 eax
            //   890f                 | mov                 dword ptr [edi], ecx
            //   8b4c2410             | mov                 ecx, dword ptr [esp + 0x10]
            //   46                   | inc                 esi

        $sequence_5 = { 8b6c2450 03c5 8b6c2430 8dac28f33e706d 8bc5 c1e81a c1e506 }
            // n = 7, score = 200
            //   8b6c2450             | mov                 ebp, dword ptr [esp + 0x50]
            //   03c5                 | add                 eax, ebp
            //   8b6c2430             | mov                 ebp, dword ptr [esp + 0x30]
            //   8dac28f33e706d       | lea                 ebp, [eax + ebp + 0x6d703ef3]
            //   8bc5                 | mov                 eax, ebp
            //   c1e81a               | shr                 eax, 0x1a
            //   c1e506               | shl                 ebp, 6

        $sequence_6 = { 8b86e0000000 50 ffd5 83c404 899ee0000000 899ee4000000 56 }
            // n = 7, score = 200
            //   8b86e0000000         | mov                 eax, dword ptr [esi + 0xe0]
            //   50                   | push                eax
            //   ffd5                 | call                ebp
            //   83c404               | add                 esp, 4
            //   899ee0000000         | mov                 dword ptr [esi + 0xe0], ebx
            //   899ee4000000         | mov                 dword ptr [esi + 0xe4], ebx
            //   56                   | push                esi

        $sequence_7 = { 53 8b5c2408 55 56 8b434c 57 8b28 }
            // n = 7, score = 200
            //   53                   | push                ebx
            //   8b5c2408             | mov                 ebx, dword ptr [esp + 8]
            //   55                   | push                ebp
            //   56                   | push                esi
            //   8b434c               | mov                 eax, dword ptr [ebx + 0x4c]
            //   57                   | push                edi
            //   8b28                 | mov                 ebp, dword ptr [eax]

        $sequence_8 = { e8???????? 8b4638 6a30 83c030 8d4c2448 50 51 }
            // n = 7, score = 200
            //   e8????????           |                     
            //   8b4638               | mov                 eax, dword ptr [esi + 0x38]
            //   6a30                 | push                0x30
            //   83c030               | add                 eax, 0x30
            //   8d4c2448             | lea                 ecx, [esp + 0x48]
            //   50                   | push                eax
            //   51                   | push                ecx

        $sequence_9 = { 896c242c 8a9860954700 8bc3 8bdd 33d8 33c0 8a8160954700 }
            // n = 7, score = 200
            //   896c242c             | mov                 dword ptr [esp + 0x2c], ebp
            //   8a9860954700         | mov                 bl, byte ptr [eax + 0x479560]
            //   8bc3                 | mov                 eax, ebx
            //   8bdd                 | mov                 ebx, ebp
            //   33d8                 | xor                 ebx, eax
            //   33c0                 | xor                 eax, eax
            //   8a8160954700         | mov                 al, byte ptr [ecx + 0x479560]

    condition:
        7 of them and filesize < 1867776
}