rule win_derusbi_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.derusbi."
        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.derusbi"
        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 = { 59 59 85c0 750d ff75a8 ff75b0 }
            // n = 6, score = 200
            //   59                   | pop                 ecx
            //   59                   | pop                 ecx
            //   85c0                 | test                eax, eax
            //   750d                 | jne                 0xf
            //   ff75a8               | push                dword ptr [ebp - 0x58]
            //   ff75b0               | push                dword ptr [ebp - 0x50]

        $sequence_1 = { 6a00 6a01 8d45fc 50 ffb60c010000 ff15???????? 83f8ff }
            // n = 7, score = 200
            //   6a00                 | push                0
            //   6a01                 | push                1
            //   8d45fc               | lea                 eax, [ebp - 4]
            //   50                   | push                eax
            //   ffb60c010000         | push                dword ptr [esi + 0x10c]
            //   ff15????????         |                     
            //   83f8ff               | cmp                 eax, -1

        $sequence_2 = { e8???????? c9 c20800 55 8bec f6450801 56 }
            // n = 7, score = 200
            //   e8????????           |                     
            //   c9                   | leave               
            //   c20800               | ret                 8
            //   55                   | push                ebp
            //   8bec                 | mov                 ebp, esp
            //   f6450801             | test                byte ptr [ebp + 8], 1
            //   56                   | push                esi

        $sequence_3 = { 8d85c4f9ffff 50 8d85e8fbffff 50 ff15???????? 8b450c 83c40c }
            // n = 7, score = 200
            //   8d85c4f9ffff         | lea                 eax, [ebp - 0x63c]
            //   50                   | push                eax
            //   8d85e8fbffff         | lea                 eax, [ebp - 0x418]
            //   50                   | push                eax
            //   ff15????????         |                     
            //   8b450c               | mov                 eax, dword ptr [ebp + 0xc]
            //   83c40c               | add                 esp, 0xc

        $sequence_4 = { 68???????? eb05 68???????? 8d85b8fdffff 50 ff15???????? 8b35???????? }
            // n = 7, score = 200
            //   68????????           |                     
            //   eb05                 | jmp                 7
            //   68????????           |                     
            //   8d85b8fdffff         | lea                 eax, [ebp - 0x248]
            //   50                   | push                eax
            //   ff15????????         |                     
            //   8b35????????         |                     

        $sequence_5 = { 68???????? 68???????? 8d45c4 50 ff15???????? 85c0 0f84ae010000 }
            // n = 7, score = 200
            //   68????????           |                     
            //   68????????           |                     
            //   8d45c4               | lea                 eax, [ebp - 0x3c]
            //   50                   | push                eax
            //   ff15????????         |                     
            //   85c0                 | test                eax, eax
            //   0f84ae010000         | je                  0x1b4

        $sequence_6 = { ff15???????? 83c40c 03f7 ff8df0fdffff 75bf e9???????? 8d4758 }
            // n = 7, score = 200
            //   ff15????????         |                     
            //   83c40c               | add                 esp, 0xc
            //   03f7                 | add                 esi, edi
            //   ff8df0fdffff         | dec                 dword ptr [ebp - 0x210]
            //   75bf                 | jne                 0xffffffc1
            //   e9????????           |                     
            //   8d4758               | lea                 eax, [edi + 0x58]

        $sequence_7 = { 53 6a2f ffb5c8fbffff ffd6 59 59 83c002 }
            // n = 7, score = 200
            //   53                   | push                ebx
            //   6a2f                 | push                0x2f
            //   ffb5c8fbffff         | push                dword ptr [ebp - 0x438]
            //   ffd6                 | call                esi
            //   59                   | pop                 ecx
            //   59                   | pop                 ecx
            //   83c002               | add                 eax, 2

        $sequence_8 = { ff15???????? 83c40c 6a02 58 ff7510 6689442430 }
            // n = 6, score = 200
            //   ff15????????         |                     
            //   83c40c               | add                 esp, 0xc
            //   6a02                 | push                2
            //   58                   | pop                 eax
            //   ff7510               | push                dword ptr [ebp + 0x10]
            //   6689442430           | mov                 word ptr [esp + 0x30], ax

        $sequence_9 = { 8d440002 8901 33c0 83c40c 40 eb02 33c0 }
            // n = 7, score = 200
            //   8d440002             | lea                 eax, [eax + eax + 2]
            //   8901                 | mov                 dword ptr [ecx], eax
            //   33c0                 | xor                 eax, eax
            //   83c40c               | add                 esp, 0xc
            //   40                   | inc                 eax
            //   eb02                 | jmp                 4
            //   33c0                 | xor                 eax, eax

    condition:
        7 of them and filesize < 360448
}