rule win_cryptolocker_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.cryptolocker."
        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.cryptolocker"
        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 = { 0f84d1000000 83fe21 0f84c8000000 83fe22 0f84bf000000 5f }
            // n = 6, score = 600
            //   0f84d1000000         | je                  0xd7
            //   83fe21               | cmp                 esi, 0x21
            //   0f84c8000000         | je                  0xce
            //   83fe22               | cmp                 esi, 0x22
            //   0f84bf000000         | je                  0xc5
            //   5f                   | pop                 edi

        $sequence_1 = { b8???????? 0f45c7 33c9 85d2 7521 3808 }
            // n = 6, score = 600
            //   b8????????           |                     
            //   0f45c7               | cmovne              eax, edi
            //   33c9                 | xor                 ecx, ecx
            //   85d2                 | test                edx, edx
            //   7521                 | jne                 0x23
            //   3808                 | cmp                 byte ptr [eax], cl

        $sequence_2 = { 6a00 ff35???????? ff15???????? eb10 57 50 6a00 }
            // n = 7, score = 600
            //   6a00                 | push                0
            //   ff35????????         |                     
            //   ff15????????         |                     
            //   eb10                 | jmp                 0x12
            //   57                   | push                edi
            //   50                   | push                eax
            //   6a00                 | push                0

        $sequence_3 = { 8b4004 ff743824 ff15???????? 5f 5e 5b 8be5 }
            // n = 7, score = 600
            //   8b4004               | mov                 eax, dword ptr [eax + 4]
            //   ff743824             | push                dword ptr [eax + edi + 0x24]
            //   ff15????????         |                     
            //   5f                   | pop                 edi
            //   5e                   | pop                 esi
            //   5b                   | pop                 ebx
            //   8be5                 | mov                 esp, ebp

        $sequence_4 = { 83f806 7538 8b0d???????? 85c9 7509 c605????????05 eb25 }
            // n = 7, score = 600
            //   83f806               | cmp                 eax, 6
            //   7538                 | jne                 0x3a
            //   8b0d????????         |                     
            //   85c9                 | test                ecx, ecx
            //   7509                 | jne                 0xb
            //   c605????????05       |                     
            //   eb25                 | jmp                 0x27

        $sequence_5 = { f7d8 1bc0 2345f8 3bd9 7504 3bf8 }
            // n = 6, score = 600
            //   f7d8                 | neg                 eax
            //   1bc0                 | sbb                 eax, eax
            //   2345f8               | and                 eax, dword ptr [ebp - 8]
            //   3bd9                 | cmp                 ebx, ecx
            //   7504                 | jne                 6
            //   3bf8                 | cmp                 edi, eax

        $sequence_6 = { 8b4d10 f6c101 7556 8b450c 83f801 7405 83f802 }
            // n = 7, score = 600
            //   8b4d10               | mov                 ecx, dword ptr [ebp + 0x10]
            //   f6c101               | test                cl, 1
            //   7556                 | jne                 0x58
            //   8b450c               | mov                 eax, dword ptr [ebp + 0xc]
            //   83f801               | cmp                 eax, 1
            //   7405                 | je                  7
            //   83f802               | cmp                 eax, 2

        $sequence_7 = { 6a44 8d45a4 56 50 e8???????? 83c40c c745a444000000 }
            // n = 7, score = 600
            //   6a44                 | push                0x44
            //   8d45a4               | lea                 eax, [ebp - 0x5c]
            //   56                   | push                esi
            //   50                   | push                eax
            //   e8????????           |                     
            //   83c40c               | add                 esp, 0xc
            //   c745a444000000       | mov                 dword ptr [ebp - 0x5c], 0x44

        $sequence_8 = { 0f8544010000 a0???????? 3c01 757a a1???????? 83f805 7539 }
            // n = 7, score = 600
            //   0f8544010000         | jne                 0x14a
            //   a0????????           |                     
            //   3c01                 | cmp                 al, 1
            //   757a                 | jne                 0x7c
            //   a1????????           |                     
            //   83f805               | cmp                 eax, 5
            //   7539                 | jne                 0x3b

        $sequence_9 = { 55 8bec 56 8db1e0feffff 8bce e8???????? f6450801 }
            // n = 7, score = 600
            //   55                   | push                ebp
            //   8bec                 | mov                 ebp, esp
            //   56                   | push                esi
            //   8db1e0feffff         | lea                 esi, [ecx - 0x120]
            //   8bce                 | mov                 ecx, esi
            //   e8????????           |                     
            //   f6450801             | test                byte ptr [ebp + 8], 1

    condition:
        7 of them and filesize < 778240
}