rule win_shylock_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.shylock."
        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.shylock"
        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???????? 50 e8???????? 59 59 89433c 3bc6 }
            // n = 7, score = 500
            //   e8????????           |                     
            //   50                   | push                eax
            //   e8????????           |                     
            //   59                   | pop                 ecx
            //   59                   | pop                 ecx
            //   89433c               | mov                 dword ptr [ebx + 0x3c], eax
            //   3bc6                 | cmp                 eax, esi

        $sequence_1 = { ff7508 33db e8???????? 59 85c0 0f840d010000 8d8d70fdffff }
            // n = 7, score = 500
            //   ff7508               | push                dword ptr [ebp + 8]
            //   33db                 | xor                 ebx, ebx
            //   e8????????           |                     
            //   59                   | pop                 ecx
            //   85c0                 | test                eax, eax
            //   0f840d010000         | je                  0x113
            //   8d8d70fdffff         | lea                 ecx, [ebp - 0x290]

        $sequence_2 = { e8???????? 8b750c 83c604 8d5de4 e8???????? 8bf3 e9???????? }
            // n = 7, score = 500
            //   e8????????           |                     
            //   8b750c               | mov                 esi, dword ptr [ebp + 0xc]
            //   83c604               | add                 esi, 4
            //   8d5de4               | lea                 ebx, [ebp - 0x1c]
            //   e8????????           |                     
            //   8bf3                 | mov                 esi, ebx
            //   e9????????           |                     

        $sequence_3 = { e8???????? c745f001000000 5e 5f ff75fc e8???????? ff75f4 }
            // n = 7, score = 500
            //   e8????????           |                     
            //   c745f001000000       | mov                 dword ptr [ebp - 0x10], 1
            //   5e                   | pop                 esi
            //   5f                   | pop                 edi
            //   ff75fc               | push                dword ptr [ebp - 4]
            //   e8????????           |                     
            //   ff75f4               | push                dword ptr [ebp - 0xc]

        $sequence_4 = { ff7630 e8???????? 894630 83c40c 57 ff36 ff7508 }
            // n = 7, score = 500
            //   ff7630               | push                dword ptr [esi + 0x30]
            //   e8????????           |                     
            //   894630               | mov                 dword ptr [esi + 0x30], eax
            //   83c40c               | add                 esp, 0xc
            //   57                   | push                edi
            //   ff36                 | push                dword ptr [esi]
            //   ff7508               | push                dword ptr [ebp + 8]

        $sequence_5 = { 8d45cc 50 b8???????? e8???????? 59 8d45cc 50 }
            // n = 7, score = 500
            //   8d45cc               | lea                 eax, [ebp - 0x34]
            //   50                   | push                eax
            //   b8????????           |                     
            //   e8????????           |                     
            //   59                   | pop                 ecx
            //   8d45cc               | lea                 eax, [ebp - 0x34]
            //   50                   | push                eax

        $sequence_6 = { 8bec 51 53 8b5f2c 56 8b773c 2b7774 }
            // n = 7, score = 500
            //   8bec                 | mov                 ebp, esp
            //   51                   | push                ecx
            //   53                   | push                ebx
            //   8b5f2c               | mov                 ebx, dword ptr [edi + 0x2c]
            //   56                   | push                esi
            //   8b773c               | mov                 esi, dword ptr [edi + 0x3c]
            //   2b7774               | sub                 esi, dword ptr [edi + 0x74]

        $sequence_7 = { e8???????? 8d7dec e8???????? 8b4508 5f 5e 5b }
            // n = 7, score = 500
            //   e8????????           |                     
            //   8d7dec               | lea                 edi, [ebp - 0x14]
            //   e8????????           |                     
            //   8b4508               | mov                 eax, dword ptr [ebp + 8]
            //   5f                   | pop                 edi
            //   5e                   | pop                 esi
            //   5b                   | pop                 ebx

        $sequence_8 = { 8d7d10 e8???????? 8b4d10 c645ff01 85c9 741b e8???????? }
            // n = 7, score = 500
            //   8d7d10               | lea                 edi, [ebp + 0x10]
            //   e8????????           |                     
            //   8b4d10               | mov                 ecx, dword ptr [ebp + 0x10]
            //   c645ff01             | mov                 byte ptr [ebp - 1], 1
            //   85c9                 | test                ecx, ecx
            //   741b                 | je                  0x1d
            //   e8????????           |                     

        $sequence_9 = { e8???????? ff37 8bfe e8???????? ff75fc 8b7d08 e8???????? }
            // n = 7, score = 500
            //   e8????????           |                     
            //   ff37                 | push                dword ptr [edi]
            //   8bfe                 | mov                 edi, esi
            //   e8????????           |                     
            //   ff75fc               | push                dword ptr [ebp - 4]
            //   8b7d08               | mov                 edi, dword ptr [ebp + 8]
            //   e8????????           |                     

    condition:
        7 of them and filesize < 630784
}