rule win_avaddon_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-05-04"
        version = "1"
        description = "Detects win.avaddon."
        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.avaddon"
        malpedia_rule_date = "20260422"
        malpedia_hash = "a182e35da64e6d71cb55f125c4d4225196523f14"
        malpedia_version = "20260504"
        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 = { 8d044502000000 50 ff758c e8???????? 83c408 c7459c00000000 33c0 }
            // n = 7, score = 200
            //   8d044502000000       | lea                 eax, [eax*2 + 2]
            //   50                   | push                eax
            //   ff758c               | push                dword ptr [ebp - 0x74]
            //   e8????????           |                     
            //   83c408               | add                 esp, 8
            //   c7459c00000000       | mov                 dword ptr [ebp - 0x64], 0
            //   33c0                 | xor                 eax, eax

        $sequence_1 = { e8???????? 8bb7a0000000 b8abaaaa2a 8b8fa8000000 2bce f7e9 c1fa02 }
            // n = 7, score = 200
            //   e8????????           |                     
            //   8bb7a0000000         | mov                 esi, dword ptr [edi + 0xa0]
            //   b8abaaaa2a           | mov                 eax, 0x2aaaaaab
            //   8b8fa8000000         | mov                 ecx, dword ptr [edi + 0xa8]
            //   2bce                 | sub                 ecx, esi
            //   f7e9                 | imul                ecx
            //   c1fa02               | sar                 edx, 2

        $sequence_2 = { 75f5 2bc2 8d4c2410 d1f8 50 8d442450 50 }
            // n = 7, score = 200
            //   75f5                 | jne                 0xfffffff7
            //   2bc2                 | sub                 eax, edx
            //   8d4c2410             | lea                 ecx, [esp + 0x10]
            //   d1f8                 | sar                 eax, 1
            //   50                   | push                eax
            //   8d442450             | lea                 eax, [esp + 0x50]
            //   50                   | push                eax

        $sequence_3 = { c64405f000 40 83f804 72f5 8b0d???????? 33ff 0f1f840000000000 }
            // n = 7, score = 200
            //   c64405f000           | mov                 byte ptr [ebp + eax - 0x10], 0
            //   40                   | inc                 eax
            //   83f804               | cmp                 eax, 4
            //   72f5                 | jb                  0xfffffff7
            //   8b0d????????         |                     
            //   33ff                 | xor                 edi, edi
            //   0f1f840000000000     | nop                 dword ptr [eax + eax]

        $sequence_4 = { 50 ffb508ffffff e8???????? 83c408 33c0 c78518ffffff00000000 c7851cffffff07000000 }
            // n = 7, score = 200
            //   50                   | push                eax
            //   ffb508ffffff         | push                dword ptr [ebp - 0xf8]
            //   e8????????           |                     
            //   83c408               | add                 esp, 8
            //   33c0                 | xor                 eax, eax
            //   c78518ffffff00000000     | mov    dword ptr [ebp - 0xe8], 0
            //   c7851cffffff07000000     | mov    dword ptr [ebp - 0xe4], 7

        $sequence_5 = { 89b500ffffff 3bf1 0f8c87fdffff 8b9554ffffff 8bb5f4feffff 46 89b5f4feffff }
            // n = 7, score = 200
            //   89b500ffffff         | mov                 dword ptr [ebp - 0x100], esi
            //   3bf1                 | cmp                 esi, ecx
            //   0f8c87fdffff         | jl                  0xfffffd8d
            //   8b9554ffffff         | mov                 edx, dword ptr [ebp - 0xac]
            //   8bb5f4feffff         | mov                 esi, dword ptr [ebp - 0x10c]
            //   46                   | inc                 esi
            //   89b5f4feffff         | mov                 dword ptr [ebp - 0x10c], esi

        $sequence_6 = { 895df8 8b4f14 8bc1 8b7710 2bc6 8975ec 894df4 }
            // n = 7, score = 200
            //   895df8               | mov                 dword ptr [ebp - 8], ebx
            //   8b4f14               | mov                 ecx, dword ptr [edi + 0x14]
            //   8bc1                 | mov                 eax, ecx
            //   8b7710               | mov                 esi, dword ptr [edi + 0x10]
            //   2bc6                 | sub                 eax, esi
            //   8975ec               | mov                 dword ptr [ebp - 0x14], esi
            //   894df4               | mov                 dword ptr [ebp - 0xc], ecx

        $sequence_7 = { 33f0 8b4514 33f1 8b4d24 3bc1 8bd9 }
            // n = 6, score = 200
            //   33f0                 | xor                 esi, eax
            //   8b4514               | mov                 eax, dword ptr [ebp + 0x14]
            //   33f1                 | xor                 esi, ecx
            //   8b4d24               | mov                 ecx, dword ptr [ebp + 0x24]
            //   3bc1                 | cmp                 eax, ecx
            //   8bd9                 | mov                 ebx, ecx

        $sequence_8 = { 85d2 0f8ea0020000 8b4dac 8b45a4 0f1f840000000000 33f6 89b500ffffff }
            // n = 7, score = 200
            //   85d2                 | test                edx, edx
            //   0f8ea0020000         | jle                 0x2a6
            //   8b4dac               | mov                 ecx, dword ptr [ebp - 0x54]
            //   8b45a4               | mov                 eax, dword ptr [ebp - 0x5c]
            //   0f1f840000000000     | nop                 dword ptr [eax + eax]
            //   33f6                 | xor                 esi, esi
            //   89b500ffffff         | mov                 dword ptr [ebp - 0x100], esi

        $sequence_9 = { baffffff7f 8bc2 2bc3 83f801 0f82a4000000 56 8d7301 }
            // n = 7, score = 200
            //   baffffff7f           | mov                 edx, 0x7fffffff
            //   8bc2                 | mov                 eax, edx
            //   2bc3                 | sub                 eax, ebx
            //   83f801               | cmp                 eax, 1
            //   0f82a4000000         | jb                  0xaa
            //   56                   | push                esi
            //   8d7301               | lea                 esi, [ebx + 1]

    condition:
        7 of them and filesize < 2343936
}