rule win_blackbasta_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.blackbasta."
        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.blackbasta"
        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 = { e8???????? 8a4304 88459e 668b4306 66894598 8d4598 50 }
            // n = 7, score = 100
            //   e8????????           |                     
            //   8a4304               | mov                 al, byte ptr [ebx + 4]
            //   88459e               | mov                 byte ptr [ebp - 0x62], al
            //   668b4306             | mov                 ax, word ptr [ebx + 6]
            //   66894598             | mov                 word ptr [ebp - 0x68], ax
            //   8d4598               | lea                 eax, [ebp - 0x68]
            //   50                   | push                eax

        $sequence_1 = { 894514 8955c8 3b45ec 72c1 8b7df0 8b4dec }
            // n = 6, score = 100
            //   894514               | mov                 dword ptr [ebp + 0x14], eax
            //   8955c8               | mov                 dword ptr [ebp - 0x38], edx
            //   3b45ec               | cmp                 eax, dword ptr [ebp - 0x14]
            //   72c1                 | jb                  0xffffffc3
            //   8b7df0               | mov                 edi, dword ptr [ebp - 0x10]
            //   8b4dec               | mov                 ecx, dword ptr [ebp - 0x14]

        $sequence_2 = { 8975e8 c645fc01 85f6 0f84f0000000 8b4508 8b4804 85c9 }
            // n = 7, score = 100
            //   8975e8               | mov                 dword ptr [ebp - 0x18], esi
            //   c645fc01             | mov                 byte ptr [ebp - 4], 1
            //   85f6                 | test                esi, esi
            //   0f84f0000000         | je                  0xf6
            //   8b4508               | mov                 eax, dword ptr [ebp + 8]
            //   8b4804               | mov                 ecx, dword ptr [eax + 4]
            //   85c9                 | test                ecx, ecx

        $sequence_3 = { 8bf0 c7458c00000000 6a18 8d458c c7459c00000000 56 50 }
            // n = 7, score = 100
            //   8bf0                 | mov                 esi, eax
            //   c7458c00000000       | mov                 dword ptr [ebp - 0x74], 0
            //   6a18                 | push                0x18
            //   8d458c               | lea                 eax, [ebp - 0x74]
            //   c7459c00000000       | mov                 dword ptr [ebp - 0x64], 0
            //   56                   | push                esi
            //   50                   | push                eax

        $sequence_4 = { ff5228 8b5608 8d4e08 8bf8 897de8 }
            // n = 5, score = 100
            //   ff5228               | call                dword ptr [edx + 0x28]
            //   8b5608               | mov                 edx, dword ptr [esi + 8]
            //   8d4e08               | lea                 ecx, [esi + 8]
            //   8bf8                 | mov                 edi, eax
            //   897de8               | mov                 dword ptr [ebp - 0x18], edi

        $sequence_5 = { e9???????? 8b4dbc e9???????? 8d8dd8feffff e9???????? 8d8dd8feffff e9???????? }
            // n = 7, score = 100
            //   e9????????           |                     
            //   8b4dbc               | mov                 ecx, dword ptr [ebp - 0x44]
            //   e9????????           |                     
            //   8d8dd8feffff         | lea                 ecx, [ebp - 0x128]
            //   e9????????           |                     
            //   8d8dd8feffff         | lea                 ecx, [ebp - 0x128]
            //   e9????????           |                     

        $sequence_6 = { e9???????? 8b4dd8 e9???????? 8b4dd8 e9???????? 8b4dbc e9???????? }
            // n = 7, score = 100
            //   e9????????           |                     
            //   8b4dd8               | mov                 ecx, dword ptr [ebp - 0x28]
            //   e9????????           |                     
            //   8b4dd8               | mov                 ecx, dword ptr [ebp - 0x28]
            //   e9????????           |                     
            //   8b4dbc               | mov                 ecx, dword ptr [ebp - 0x44]
            //   e9????????           |                     

        $sequence_7 = { e8???????? 8bb5e4feffff 8d8de4feffff 8b4620 ffd0 50 8b4310 }
            // n = 7, score = 100
            //   e8????????           |                     
            //   8bb5e4feffff         | mov                 esi, dword ptr [ebp - 0x11c]
            //   8d8de4feffff         | lea                 ecx, [ebp - 0x11c]
            //   8b4620               | mov                 eax, dword ptr [esi + 0x20]
            //   ffd0                 | call                eax
            //   50                   | push                eax
            //   8b4310               | mov                 eax, dword ptr [ebx + 0x10]

        $sequence_8 = { 8b7304 c645fc0d 3b7308 7444 8d4504 897550 50 }
            // n = 7, score = 100
            //   8b7304               | mov                 esi, dword ptr [ebx + 4]
            //   c645fc0d             | mov                 byte ptr [ebp - 4], 0xd
            //   3b7308               | cmp                 esi, dword ptr [ebx + 8]
            //   7444                 | je                  0x46
            //   8d4504               | lea                 eax, [ebp + 4]
            //   897550               | mov                 dword ptr [ebp + 0x50], esi
            //   50                   | push                eax

        $sequence_9 = { ff7574 c7456800000000 8b4e14 897560 e8???????? 8b4e14 8ad8 }
            // n = 7, score = 100
            //   ff7574               | push                dword ptr [ebp + 0x74]
            //   c7456800000000       | mov                 dword ptr [ebp + 0x68], 0
            //   8b4e14               | mov                 ecx, dword ptr [esi + 0x14]
            //   897560               | mov                 dword ptr [ebp + 0x60], esi
            //   e8????????           |                     
            //   8b4e14               | mov                 ecx, dword ptr [esi + 0x14]
            //   8ad8                 | mov                 bl, al

    condition:
        7 of them and filesize < 1758208
}