rule win_rerdom_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-05-04"
        version = "1"
        description = "Detects win.rerdom."
        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.rerdom"
        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 = { 83ec50 53 56 8bf2 33db 8bd1 8d45dc }
            // n = 7, score = 200
            //   83ec50               | sub                 esp, 0x50
            //   53                   | push                ebx
            //   56                   | push                esi
            //   8bf2                 | mov                 esi, edx
            //   33db                 | xor                 ebx, ebx
            //   8bd1                 | mov                 edx, ecx
            //   8d45dc               | lea                 eax, [ebp - 0x24]

        $sequence_1 = { 5a 66891448 5e 5d 5b c3 33c0 }
            // n = 7, score = 200
            //   5a                   | pop                 edx
            //   66891448             | mov                 word ptr [eax + ecx*2], dx
            //   5e                   | pop                 esi
            //   5d                   | pop                 ebp
            //   5b                   | pop                 ebx
            //   c3                   | ret                 
            //   33c0                 | xor                 eax, eax

        $sequence_2 = { 8b864c010000 6a00 ff3407 ff15???????? 8b864c010000 ff3407 ffd3 }
            // n = 7, score = 200
            //   8b864c010000         | mov                 eax, dword ptr [esi + 0x14c]
            //   6a00                 | push                0
            //   ff3407               | push                dword ptr [edi + eax]
            //   ff15????????         |                     
            //   8b864c010000         | mov                 eax, dword ptr [esi + 0x14c]
            //   ff3407               | push                dword ptr [edi + eax]
            //   ffd3                 | call                ebx

        $sequence_3 = { 55 8bec 81ec1c020000 53 8b5d10 33d2 33c0 }
            // n = 7, score = 200
            //   55                   | push                ebp
            //   8bec                 | mov                 ebp, esp
            //   81ec1c020000         | sub                 esp, 0x21c
            //   53                   | push                ebx
            //   8b5d10               | mov                 ebx, dword ptr [ebp + 0x10]
            //   33d2                 | xor                 edx, edx
            //   33c0                 | xor                 eax, eax

        $sequence_4 = { 53 68a5000000 6805020000 ff75f8 8d45ac 50 }
            // n = 6, score = 200
            //   53                   | push                ebx
            //   68a5000000           | push                0xa5
            //   6805020000           | push                0x205
            //   ff75f8               | push                dword ptr [ebp - 8]
            //   8d45ac               | lea                 eax, [ebp - 0x54]
            //   50                   | push                eax

        $sequence_5 = { 85c0 7421 8b8fd4000000 33d2 42 89560c 83f9ff }
            // n = 7, score = 200
            //   85c0                 | test                eax, eax
            //   7421                 | je                  0x23
            //   8b8fd4000000         | mov                 ecx, dword ptr [edi + 0xd4]
            //   33d2                 | xor                 edx, edx
            //   42                   | inc                 edx
            //   89560c               | mov                 dword ptr [esi + 0xc], edx
            //   83f9ff               | cmp                 ecx, -1

        $sequence_6 = { 83c404 5e 5d c22400 55 8bec }
            // n = 6, score = 200
            //   83c404               | add                 esp, 4
            //   5e                   | pop                 esi
            //   5d                   | pop                 ebp
            //   c22400               | ret                 0x24
            //   55                   | push                ebp
            //   8bec                 | mov                 ebp, esp

        $sequence_7 = { 56 8d8578feffff eb0b 6800010000 8d858cfeffff 57 50 }
            // n = 7, score = 200
            //   56                   | push                esi
            //   8d8578feffff         | lea                 eax, [ebp - 0x188]
            //   eb0b                 | jmp                 0xd
            //   6800010000           | push                0x100
            //   8d858cfeffff         | lea                 eax, [ebp - 0x174]
            //   57                   | push                edi
            //   50                   | push                eax

        $sequence_8 = { 33c0 40 ebf8 8b15???????? 56 85d2 742b }
            // n = 7, score = 200
            //   33c0                 | xor                 eax, eax
            //   40                   | inc                 eax
            //   ebf8                 | jmp                 0xfffffffa
            //   8b15????????         |                     
            //   56                   | push                esi
            //   85d2                 | test                edx, edx
            //   742b                 | je                  0x2d

        $sequence_9 = { 6a02 8975f4 895df8 ff15???????? 2bc7 7412 48 }
            // n = 7, score = 200
            //   6a02                 | push                2
            //   8975f4               | mov                 dword ptr [ebp - 0xc], esi
            //   895df8               | mov                 dword ptr [ebp - 8], ebx
            //   ff15????????         |                     
            //   2bc7                 | sub                 eax, edi
            //   7412                 | je                  0x14
            //   48                   | dec                 eax

    condition:
        7 of them and filesize < 352256
}