rule win_lobshot_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.lobshot."
        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.lobshot"
        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 = { 33c0 c744246c01000000 6689442470 8d44241c 50 8d442444 50 }
            // n = 7, score = 200
            //   33c0                 | xor                 eax, eax
            //   c744246c01000000     | mov                 dword ptr [esp + 0x6c], 1
            //   6689442470           | mov                 word ptr [esp + 0x70], ax
            //   8d44241c             | lea                 eax, [esp + 0x1c]
            //   50                   | push                eax
            //   8d442444             | lea                 eax, [esp + 0x44]
            //   50                   | push                eax

        $sequence_1 = { 59 8b0f 894754 e8???????? 8b07 }
            // n = 5, score = 200
            //   59                   | pop                 ecx
            //   8b0f                 | mov                 ecx, dword ptr [edi]
            //   894754               | mov                 dword ptr [edi + 0x54], eax
            //   e8????????           |                     
            //   8b07                 | mov                 eax, dword ptr [edi]

        $sequence_2 = { 50 57 c74424186e756d65 c744241c72617465 c744242053657373 c7442424696f6e73 c744242841000000 }
            // n = 7, score = 200
            //   50                   | push                eax
            //   57                   | push                edi
            //   c74424186e756d65     | mov                 dword ptr [esp + 0x18], 0x656d756e
            //   c744241c72617465     | mov                 dword ptr [esp + 0x1c], 0x65746172
            //   c744242053657373     | mov                 dword ptr [esp + 0x20], 0x73736553
            //   c7442424696f6e73     | mov                 dword ptr [esp + 0x24], 0x736e6f69
            //   c744242841000000     | mov                 dword ptr [esp + 0x28], 0x41

        $sequence_3 = { 83ec38 8bc2 83caff 53 56 57 8b38 }
            // n = 7, score = 200
            //   83ec38               | sub                 esp, 0x38
            //   8bc2                 | mov                 eax, edx
            //   83caff               | or                  edx, 0xffffffff
            //   53                   | push                ebx
            //   56                   | push                esi
            //   57                   | push                edi
            //   8b38                 | mov                 edi, dword ptr [eax]

        $sequence_4 = { 660bc1 8997b4160000 0fb7f0 8b4508 8bca 48 }
            // n = 6, score = 200
            //   660bc1               | or                  ax, cx
            //   8997b4160000         | mov                 dword ptr [edi + 0x16b4], edx
            //   0fb7f0               | movzx               esi, ax
            //   8b4508               | mov                 eax, dword ptr [ebp + 8]
            //   8bca                 | mov                 ecx, edx
            //   48                   | dec                 eax

        $sequence_5 = { 1bc0 83e70f 83e027 83c030 }
            // n = 4, score = 200
            //   1bc0                 | sbb                 eax, eax
            //   83e70f               | and                 edi, 0xf
            //   83e027               | and                 eax, 0x27
            //   83c030               | add                 eax, 0x30

        $sequence_6 = { 8b1d???????? 85c0 7421 8b442420 85c0 7419 50 }
            // n = 7, score = 200
            //   8b1d????????         |                     
            //   85c0                 | test                eax, eax
            //   7421                 | je                  0x23
            //   8b442420             | mov                 eax, dword ptr [esp + 0x20]
            //   85c0                 | test                eax, eax
            //   7419                 | je                  0x1b
            //   50                   | push                eax

        $sequence_7 = { 83676000 8d4601 6a02 59 894f58 8b4df8 3b4df4 }
            // n = 7, score = 200
            //   83676000             | and                 dword ptr [edi + 0x60], 0
            //   8d4601               | lea                 eax, [esi + 1]
            //   6a02                 | push                2
            //   59                   | pop                 ecx
            //   894f58               | mov                 dword ptr [edi + 0x58], ecx
            //   8b4df8               | mov                 ecx, dword ptr [ebp - 8]
            //   3b4df4               | cmp                 ecx, dword ptr [ebp - 0xc]

        $sequence_8 = { 8b55f8 33ff 85d2 7839 8b5dfc 0fb774bb02 85f6 }
            // n = 7, score = 200
            //   8b55f8               | mov                 edx, dword ptr [ebp - 8]
            //   33ff                 | xor                 edi, edi
            //   85d2                 | test                edx, edx
            //   7839                 | js                  0x3b
            //   8b5dfc               | mov                 ebx, dword ptr [ebp - 4]
            //   0fb774bb02           | movzx               esi, word ptr [ebx + edi*4 + 2]
            //   85f6                 | test                esi, esi

        $sequence_9 = { 8b2d???????? 89442418 0f1f8000000000 8b442454 }
            // n = 4, score = 200
            //   8b2d????????         |                     
            //   89442418             | mov                 dword ptr [esp + 0x18], eax
            //   0f1f8000000000       | nop                 dword ptr [eax]
            //   8b442454             | mov                 eax, dword ptr [esp + 0x54]

    condition:
        7 of them and filesize < 247808
}