rule win_lockfile_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.lockfile."
        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.lockfile"
        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 = { 488d0d293d0700 8b440104 8b4c243c 33c8 8bc1 8944243c 8b442440 }
            // n = 7, score = 200
            //   488d0d293d0700       | adc                 edi, 0
            //   8b440104             | dec                 eax
            //   8b4c243c             | adc                 edi, 0
            //   33c8                 | dec                 ecx
            //   8bc1                 | mul                 dword ptr [ecx + 0x38]
            //   8944243c             | dec                 esp
            //   8b442440             | lea                 edx, [edi + ebx]

        $sequence_1 = { 410fb6d2 ff5060 488b8c2480000000 4833cc e8???????? 4881c498000000 c3 }
            // n = 7, score = 200
            //   410fb6d2             | add                 al, 6
            //   ff5060               | xor                 al, 0x72
            //   488b8c2480000000     | mov                 byte ptr [ebp - 0x76], al
            //   4833cc               | mov                 eax, dword ptr [ebp - 0x80]
            //   e8????????           |                     
            //   4881c498000000       | add                 al, 7
            //   c3                   | mov                 eax, dword ptr [ebp - 0x80]

        $sequence_2 = { 4133c5 03d0 488d05d7270300 031488 4103d0 03d6 8b75bb }
            // n = 7, score = 200
            //   4133c5               | add                 al, 0x1b
            //   03d0                 | mov                 eax, dword ptr [ebp - 0x30]
            //   488d05d7270300       | add                 al, 0x1b
            //   031488               | xor                 al, 0x69
            //   4103d0               | mov                 byte ptr [ebp - 0x11], al
            //   03d6                 | mov                 eax, dword ptr [ebp - 0x30]
            //   8b75bb               | add                 al, 0x1c

        $sequence_3 = { 4889842480000000 488d1510da0400 488d4c2420 e8???????? 90 488d542420 488d4c2440 }
            // n = 7, score = 200
            //   4889842480000000     | xor                 ecx, edx
            //   488d1510da0400       | inc                 ecx
            //   488d4c2420           | ror                 ecx, 2
            //   e8????????           |                     
            //   90                   | inc                 ecx
            //   488d542420           | mov                 ecx, eax
            //   488d4c2440           | or                  ecx, ebx

        $sequence_4 = { 041c 346b 88442460 8b442440 041d 3465 88442461 }
            // n = 7, score = 200
            //   041c                 | lea                 eax, [ecx - 1]
            //   346b                 | dec                 eax
            //   88442460             | lea                 eax, [edx + eax*8]
            //   8b442440             | dec                 eax
            //   041d                 | cmp                 dword ptr [eax], esi
            //   3465                 | jne                 0x212
            //   88442461             | dec                 eax

        $sequence_5 = { 4d2bc1 7415 0f1f4000 48836b2001 7504 4c897b18 4983e801 }
            // n = 7, score = 200
            //   4d2bc1               | dec                 ecx
            //   7415                 | adc                 ebp, 0
            //   0f1f4000             | dec                 ecx
            //   48836b2001           | cmp                 edi, esi
            //   7504                 | dec                 esp
            //   4c897b18             | mov                 esi, dword ptr [ebp + 0x50]
            //   4983e801             | dec                 ecx

        $sequence_6 = { 4c2bc3 420fb60411 3201 488d4901 440ac8 4983e801 75ec }
            // n = 7, score = 200
            //   4c2bc3               | dec                 ecx
            //   420fb60411           | add                 eax, eax
            //   3201                 | dec                 ecx
            //   488d4901             | cmp                 eax, eax
            //   440ac8               | dec                 eax
            //   4983e801             | adc                 edx, 0
            //   75ec                 | dec                 esp

        $sequence_7 = { 3468 8845e2 8b45d0 040f 3465 8845e3 8b45d0 }
            // n = 7, score = 200
            //   3468                 | mov                 dword ptr [ebp - 0x24], edx
            //   8845e2               | movups              xmmword ptr [ebp - 0x20], xmm1
            //   8b45d0               | inc                 esp
            //   040f                 | mov                 esi, edx
            //   3465                 | inc                 esp
            //   8845e3               | mov                 esp, ebx
            //   8b45d0               | cpuid               

        $sequence_8 = { 488d0d03350700 8b440101 8b4c243c 33c8 8bc1 8944243c 8b44244c }
            // n = 7, score = 200
            //   488d0d03350700       | mov                 dword ptr [ecx + 0x20], eax
            //   8b440101             | dec                 eax
            //   8b4c243c             | mov                 eax, dword ptr [ebp + 0x77]
            //   33c8                 | dec                 ebp
            //   8bc1                 | lea                 ebx, [eax + edi]
            //   8944243c             | dec                 eax
            //   8b44244c             | mov                 eax, dword ptr [eax + 0x78]

        $sequence_9 = { 4833c4 48898590010000 4c8bad08020000 0f57c0 0f1185b0000000 0f1185c0000000 0f1185d0000000 }
            // n = 7, score = 200
            //   4833c4               | mov                 dword ptr [ebp - 0x20], ecx
            //   48898590010000       | dec                 eax
            //   4c8bad08020000       | mov                 dword ptr [ebp - 0x18], edi
            //   0f57c0               | dec                 eax
            //   0f1185b0000000       | mov                 edx, dword ptr [ebp + 0x20]
            //   0f1185c0000000       | dec                 ebp
            //   0f1185d0000000       | mov                 eax, edx

    condition:
        7 of them and filesize < 1163264
}