rule win_royal_ransom_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.royal_ransom."
        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.royal_ransom"
        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 = { c1f806 4863c8 488d052b3a1100 4c89642448 440fb66708 4c89742440 440fb637 }
            // n = 7, score = 100
            //   c1f806               | mov                 ecx, ebx
            //   4863c8               | dec                 eax
            //   488d052b3a1100       | mov                 dword ptr [ebp + 0x58], eax
            //   4c89642448           | dec                 esp
            //   440fb66708           | mov                 edi, eax
            //   4c89742440           | dec                 eax
            //   440fb637             | test                eax, eax

        $sequence_1 = { 8bcb 488d15a6091800 48c1e103 41b8c0000000 e8???????? 48894708 4885c0 }
            // n = 7, score = 100
            //   8bcb                 | dec                 esp
            //   488d15a6091800       | lea                 eax, [0x146c36]
            //   48c1e103             | mov                 edx, 0x92
            //   41b8c0000000         | dec                 eax
            //   e8????????           |                     
            //   48894708             | lea                 ecx, [0x146c02]
            //   4885c0               | inc                 ebp

        $sequence_2 = { 5f c3 e8???????? 4c8d05495b0d00 ba6d000000 488d0d555b0d00 e8???????? }
            // n = 7, score = 100
            //   5f                   | dec                 eax
            //   c3                   | lea                 ecx, [0x14c192]
            //   e8????????           |                     
            //   4c8d05495b0d00       | inc                 ebp
            //   ba6d000000           | xor                 eax, eax
            //   488d0d555b0d00       | lea                 ecx, [ebp + 0xb]
            //   e8????????           |                     

        $sequence_3 = { 895c2454 3b5c2450 0f8cd7feffff 488b542440 4533c9 4533c0 498bce }
            // n = 7, score = 100
            //   895c2454             | dec                 ebp
            //   3b5c2450             | mov                 eax, ecx
            //   0f8cd7feffff         | inc                 ecx
            //   488b542440           | lea                 eax, [ecx + 2]
            //   4533c9               | dec                 esp
            //   4533c0               | arpl                ax, sp
            //   498bce               | dec                 eax

        $sequence_4 = { e8???????? 33c0 e9???????? 4883c60a 488d1590081700 488bce e8???????? }
            // n = 7, score = 100
            //   e8????????           |                     
            //   33c0                 | je                  0x17bb
            //   e9????????           |                     
            //   4883c60a             | jmp                 0x17e1
            //   488d1590081700       | dec                 eax
            //   488bce               | mov                 ecx, dword ptr [ebx + 0xa8]
            //   e8????????           |                     

        $sequence_5 = { 488d15c6131500 488bcf e8???????? 4885c0 7421 488d5520 488bc8 }
            // n = 7, score = 100
            //   488d15c6131500       | dec                 esp
            //   488bcf               | mov                 eax, dword ptr [esi + 8]
            //   e8????????           |                     
            //   4885c0               | dec                 esp
            //   7421                 | add                 eax, edx
            //   488d5520             | je                  0x1e4a
            //   488bc8               | dec                 eax

        $sequence_6 = { 8d5621 488d0d2e5e1400 e8???????? 4533c0 8d4e06 baa5000000 e8???????? }
            // n = 7, score = 100
            //   8d5621               | dec                 eax
            //   488d0d2e5e1400       | lea                 ecx, [0xd8945]
            //   e8????????           |                     
            //   4533c0               | inc                 ebp
            //   8d4e06               | xor                 eax, eax
            //   baa5000000           | dec                 esp
            //   e8????????           |                     

        $sequence_7 = { e8???????? 85c0 7f1a 41b89b000000 488d1544bd1500 488bcb 4883c420 }
            // n = 7, score = 100
            //   e8????????           |                     
            //   85c0                 | mov                 eax, dword ptr [esp + 0x30]
            //   7f1a                 | inc                 ecx
            //   41b89b000000         | mov                 ecx, dword ptr [edi + ecx*4 + 0x25ded0]
            //   488d1544bd1500       | inc                 ecx
            //   488bcb               | xor                 ecx, dword ptr [edi + eax*4 + 0x25e6d0]
            //   4883c420             | inc                 ebx

        $sequence_8 = { e8???????? 33c0 eb5d 488d15a6370b00 488bcf e8???????? 4885c0 }
            // n = 7, score = 100
            //   e8????????           |                     
            //   33c0                 | jmp                 0x1c3c
            //   eb5d                 | dec                 eax
            //   488d15a6370b00       | lea                 edi, [0xcebb6]
            //   488bcf               | jmp                 0x1c37
            //   e8????????           |                     
            //   4885c0               | jmp                 0x1c51

        $sequence_9 = { e8???????? e8???????? 4c8d05aa311700 bae0000000 488d0d6e311700 e8???????? 4533c0 }
            // n = 7, score = 100
            //   e8????????           |                     
            //   e8????????           |                     
            //   4c8d05aa311700       | jne                 0x1ae0
            //   bae0000000           | inc                 ecx
            //   488d0d6e311700       | cmp                 eax, 1
            //   e8????????           |                     
            //   4533c0               | jne                 0x1b19

    condition:
        7 of them and filesize < 6235136
}