rule win_ryuk_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.ryuk."
        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.ryuk"
        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 = { 68???????? 6a01 6a00 6814010000 }
            // n = 4, score = 2400
            //   68????????           |                     
            //   6a01                 | add                 esp, 0x30
            //   6a00                 | pop                 ebx
            //   6814010000           | ret                 

        $sequence_1 = { 85c0 7508 6a01 ff15???????? 68???????? 6a01 }
            // n = 6, score = 2300
            //   85c0                 | jne                 0x18
            //   7508                 | cmp                 word ptr [edi + 2], 0x54
            //   6a01                 | jne                 0x16
            //   ff15????????         |                     
            //   68????????           |                     
            //   6a01                 | cmp                 word ptr [edi + 6], 0x41

        $sequence_2 = { 6a08 6a18 68???????? 68???????? 68???????? ff15???????? 85c0 }
            // n = 7, score = 1900
            //   6a08                 | cmp                 word ptr [edi], 0x4e
            //   6a18                 | jne                 0x18
            //   68????????           |                     
            //   68????????           |                     
            //   68????????           |                     
            //   ff15????????         |                     
            //   85c0                 | cmp                 word ptr [edi + 2], 0x54

        $sequence_3 = { 754c b90b010000 66398818000035 753e 8b4508 }
            // n = 5, score = 1800
            //   754c                 | jb                  0x14
            //   b90b010000           | cmp                 ecx, 0x7d0
            //   66398818000035       | ja                  0x14
            //   753e                 | test                edx, edx
            //   8b4508               | ja                  0x16

        $sequence_4 = { 68???????? ff15???????? 85c0 7578 6a10 6a18 68???????? }
            // n = 7, score = 1800
            //   68????????           |                     
            //   ff15????????         |                     
            //   85c0                 | jne                 0x18
            //   7578                 | cmp                 word ptr [edi + 2], 0x54
            //   6a10                 | jne                 0x18
            //   6a18                 | cmp                 word ptr [edi + 6], 0x41
            //   68????????           |                     

        $sequence_5 = { 68c0cf6a00 ff15???????? 6a01 ff15???????? }
            // n = 4, score = 1700
            //   68c0cf6a00           | shl                 ecx, 0
            //   ff15????????         |                     
            //   6a01                 | add                 eax, dword ptr [ebp - 0xc]
            //   ff15????????         |                     

        $sequence_6 = { e8???????? 68e8030000 ff15???????? 68???????? e8???????? }
            // n = 5, score = 1400
            //   e8????????           |                     
            //   68e8030000           | xor                 ecx, ecx
            //   ff15????????         |                     
            //   68????????           |                     
            //   e8????????           |                     

        $sequence_7 = { 85c0 7407 b801000000 eb0b eb04 33c0 eb05 }
            // n = 7, score = 1400
            //   85c0                 | push                dword ptr [ebp + 8]
            //   7407                 | jne                 0x1d
            //   b801000000           | push                1
            //   eb0b                 | jne                 0x1d
            //   eb04                 | push                1
            //   33c0                 | jne                 0x1d
            //   eb05                 | push                1

        $sequence_8 = { 6bd100 8b4dfc 880411 ba04000000 }
            // n = 4, score = 1300
            //   6bd100               | mov                 dword ptr [esp + 8], ebx
            //   8b4dfc               | dec                 eax
            //   880411               | mov                 dword ptr [esp + 0x10], ebp
            //   ba04000000           | dec                 eax

        $sequence_9 = { 0fb60c10 83c101 ba01000000 d1e2 8b45fc }
            // n = 5, score = 1300
            //   0fb60c10             | mov                 eax, ecx
            //   83c101               | dec                 ecx
            //   ba01000000           | mov                 ebx, eax
            //   d1e2                 | dec                 ecx
            //   8b45fc               | mov                 eax, ecx

        $sequence_10 = { 0345f4 1355f8 8945f4 8955f8 837d0800 }
            // n = 5, score = 1300
            //   0345f4               | dec                 eax
            //   1355f8               | add                 esp, 0x30
            //   8945f4               | pop                 ebx
            //   8955f8               | ret                 
            //   837d0800             | dec                 eax

        $sequence_11 = { 50 8b0d???????? 51 6a01 68???????? e8???????? }
            // n = 6, score = 1300
            //   50                   | ret                 
            //   8b0d????????         |                     
            //   51                   | inc                 eax
            //   6a01                 | push                ebx
            //   68????????           |                     
            //   e8????????           |                     

        $sequence_12 = { 0f870b020000 720c 8b459c 3b45f4 0f87fd010000 b904000000 }
            // n = 6, score = 1300
            //   0f870b020000         | test                eax, eax
            //   720c                 | je                  0xb
            //   8b459c               | mov                 eax, 1
            //   3b45f4               | jmp                 0x12
            //   0f87fd010000         | jmp                 0xd
            //   b904000000           | xor                 eax, eax

        $sequence_13 = { ff15???????? b811000000 e9???????? e9???????? }
            // n = 4, score = 1200
            //   ff15????????         |                     
            //   b811000000           | dec                 eax
            //   e9????????           |                     
            //   e9????????           |                     

        $sequence_14 = { 7407 48 85c0 7ff0 }
            // n = 4, score = 900
            //   7407                 | rep stosd           dword ptr es:[edi], eax
            //   48                   | dec                 eax
            //   85c0                 | mov                 edi, dword ptr [esp + 8]
            //   7ff0                 | dec                 ecx

        $sequence_15 = { ff35???????? ff15???????? 833d????????00 6a10 6a18 }
            // n = 5, score = 900
            //   ff35????????         |                     
            //   ff15????????         |                     
            //   833d????????00       |                     
            //   6a10                 | mov                 eax, ecx
            //   6a18                 | ret                 

        $sequence_16 = { 6a00 6814010000 ff7508 ff35???????? }
            // n = 4, score = 900
            //   6a00                 | add                 esp, 0x30
            //   6814010000           | pop                 ebx
            //   ff7508               | ret                 
            //   ff35????????         |                     

        $sequence_17 = { 2bf0 33c0 66890473 83ffff }
            // n = 4, score = 800
            //   2bf0                 | jne                 0x11
            //   33c0                 | cmp                 word ptr [edi + 6], 0x41
            //   66890473             | jne                 0x18
            //   83ffff               | cmp                 word ptr [edi + 2], 0x54

        $sequence_18 = { ff15???????? b803000000 eb05 b805000000 }
            // n = 4, score = 800
            //   ff15????????         |                     
            //   b803000000           | mov                 eax, 3
            //   eb05                 | jmp                 7
            //   b805000000           | mov                 eax, 5

        $sequence_19 = { 751b ff35???????? ff35???????? 6a01 68???????? e8???????? }
            // n = 6, score = 800
            //   751b                 | jne                 0x18
            //   ff35????????         |                     
            //   ff35????????         |                     
            //   6a01                 | cmp                 word ptr [edi + 2], 0x54
            //   68????????           |                     
            //   e8????????           |                     

        $sequence_20 = { 85d2 7714 7212 81f9d0070000 770a 85d2 }
            // n = 6, score = 700
            //   85d2                 | dec                 eax
            //   7714                 | lea                 ecx, [0x863]
            //   7212                 | je                  0x6e
            //   81f9d0070000         | dec                 eax
            //   770a                 | lea                 ecx, [0x863]
            //   85d2                 | test                al, al

        $sequence_21 = { 56 ff15???????? 8bcb 8d5102 }
            // n = 4, score = 700
            //   56                   | cmp                 word ptr [edi + 6], 0x41
            //   ff15????????         |                     
            //   8bcb                 | mov                 eax, ecx
            //   8d5102               | sub                 eax, edx

        $sequence_22 = { eb0b 8bc1 99 f7fe }
            // n = 4, score = 700
            //   eb0b                 | jne                 0x18
            //   8bc1                 | cmp                 word ptr [edi + 2], 0x54
            //   99                   | jne                 0x18
            //   f7fe                 | cmp                 word ptr [edi + 6], 0x41

        $sequence_23 = { 2bf2 68???????? 53 d1fe e8???????? 83c408 }
            // n = 6, score = 600
            //   2bf2                 | shr                 eax, 1
            //   68????????           |                     
            //   53                   | add                 eax, edx
            //   d1fe                 | shr                 eax, 6
            //   e8????????           |                     
            //   83c408               | imul                eax, eax, 0x5a

        $sequence_24 = { 0f9fc0 5d c3 8bff 55 8bec 8b4508 }
            // n = 7, score = 600
            //   0f9fc0               | lea                 ecx, [0x863]
            //   5d                   | mov                 ecx, eax
            //   c3                   | test                eax, eax
            //   8bff                 | jne                 0x5c
            //   55                   | je                  0x6e
            //   8bec                 | dec                 eax
            //   8b4508               | lea                 ecx, [0x863]

        $sequence_25 = { 8d7f02 6685c0 75f4 a1???????? 8907 eb03 }
            // n = 6, score = 600
            //   8d7f02               | test                ax, ax
            //   6685c0               | jne                 0xfffffff7
            //   75f4                 | sub                 esi, edx
            //   a1????????           |                     
            //   8907                 | push                ebx
            //   eb03                 | sar                 esi, 1

        $sequence_26 = { 83c602 6685c9 75f5 2bf2 68???????? 53 }
            // n = 6, score = 600
            //   83c602               | mov                 ecx, eax
            //   6685c9               | mov                 ecx, 0x1388
            //   75f5                 | mov                 ebx, eax
            //   2bf2                 | sub                 esi, eax
            //   68????????           |                     
            //   53                   | xor                 eax, eax

        $sequence_27 = { 66f3ab 488b7c2408 498bc1 c3 4053 4883ec20 8bc1 }
            // n = 7, score = 600
            //   66f3ab               | dec                 eax
            //   488b7c2408           | sub                 esp, 0x30
            //   498bc1               | and                 dword ptr [esp + 0x20], 0
            //   c3                   | rep stosd           dword ptr es:[edi], eax
            //   4053                 | dec                 eax
            //   4883ec20             | mov                 edi, dword ptr [esp + 8]
            //   8bc1                 | dec                 ecx

        $sequence_28 = { 4983c8ff e8???????? 488bc3 4883c430 5b c3 48895c2408 }
            // n = 7, score = 600
            //   4983c8ff             | dec                 ecx
            //   e8????????           |                     
            //   488bc3               | mov                 eax, ecx
            //   4883c430             | ret                 
            //   5b                   | inc                 eax
            //   c3                   | push                ebx
            //   48895c2408           | dec                 eax

        $sequence_29 = { 83e103 f3a4 8d7afe 668b4702 8d7f02 6685c0 }
            // n = 6, score = 600
            //   83e103               | shr                 eax, 6
            //   f3a4                 | imul                eax, eax, 0x5a
            //   8d7afe               | mov                 dword ptr [esp + 0x20], 3
            //   668b4702             | mov                 edx, 0x40000000
            //   8d7f02               | dec                 eax
            //   6685c0               | mov                 ebx, eax

        $sequence_30 = { 4883c428 c3 48895c2408 57 4883ec30 8364242000 }
            // n = 6, score = 600
            //   4883c428             | dec                 eax
            //   c3                   | add                 esp, 0x28
            //   48895c2408           | ret                 
            //   57                   | dec                 eax
            //   4883ec30             | mov                 dword ptr [esp + 8], ebx
            //   8364242000           | push                edi

        $sequence_31 = { 6685c0 75f5 8d7bfe 2bd6 8d5f02 668b4702 83c702 }
            // n = 7, score = 600
            //   6685c0               | mov                 eax, 0x6c16c16d
            //   75f5                 | mul                 ecx
            //   8d7bfe               | mov                 eax, ecx
            //   2bd6                 | sub                 eax, edx
            //   8d5f02               | shr                 eax, 1
            //   668b4702             | add                 eax, edx
            //   83c702               | shr                 eax, 6

        $sequence_32 = { 2bca 33c0 6689444bfe e9???????? }
            // n = 4, score = 600
            //   2bca                 | mul                 ecx
            //   33c0                 | mov                 eax, ecx
            //   6689444bfe           | sub                 eax, edx
            //   e9????????           |                     

        $sequence_33 = { e8???????? 99 2bc2 d1f8 85c0 }
            // n = 5, score = 500
            //   e8????????           |                     
            //   99                   | mov                 ecx, eax
            //   2bc2                 | je                  9
            //   d1f8                 | dec                 eax
            //   85c0                 | cmp                 ebx, edi

        $sequence_34 = { 33c9 ff15???????? 448b442468 33d2 }
            // n = 4, score = 500
            //   33c9                 | push                dword ptr [ebp + 8]
            //   ff15????????         |                     
            //   448b442468           | push                0
            //   33d2                 | push                0x114

        $sequence_35 = { 66837f0254 750f 66837f0641 7508 }
            // n = 4, score = 500
            //   66837f0254           | push                ebx
            //   750f                 | dec                 eax
            //   66837f0641           | sub                 esp, 0x20
            //   7508                 | mov                 eax, ecx

        $sequence_36 = { ff15???????? 83f820 7510 488bcb ff15???????? b802000000 }
            // n = 6, score = 500
            //   ff15????????         |                     
            //   83f820               | and                 dword ptr [esp + 0x20], 0
            //   7510                 | mov                 ecx, 8
            //   488bcb               | dec                 eax
            //   ff15????????         |                     
            //   b802000000           | mov                 edi, dword ptr [esp + 8]

        $sequence_37 = { e8???????? 488bcf ff15???????? 8d4301 e9???????? }
            // n = 5, score = 500
            //   e8????????           |                     
            //   488bcf               | je                  0x70
            //   ff15????????         |                     
            //   8d4301               | dec                 eax
            //   e9????????           |                     

        $sequence_38 = { ff15???????? 66833f4e 7516 66837f0254 }
            // n = 4, score = 500
            //   ff15????????         |                     
            //   66833f4e             | dec                 ecx
            //   7516                 | mov                 eax, ecx
            //   66837f0254           | ret                 

        $sequence_39 = { ff15???????? 41b900300000 c744242040000000 448bc3 }
            // n = 4, score = 500
            //   ff15????????         |                     
            //   41b900300000         | dec                 eax
            //   c744242040000000     | sub                 esp, 0x20
            //   448bc3               | mov                 eax, ecx

        $sequence_40 = { 48897c2430 488d4c2440 c744242802000000 4533c9 4533c0 }
            // n = 5, score = 500
            //   48897c2430           | dec                 ecx
            //   488d4c2440           | mov                 eax, ecx
            //   c744242802000000     | ret                 
            //   4533c9               | inc                 eax
            //   4533c0               | push                ebx

        $sequence_41 = { 8905???????? e8???????? b988130000 8bd8 }
            // n = 4, score = 500
            //   8905????????         |                     
            //   e8????????           |                     
            //   b988130000           | test                al, al
            //   8bd8                 | je                  0x6e

        $sequence_42 = { 8bc1 2bc2 d1e8 03c2 c1e806 6bc05a }
            // n = 6, score = 500
            //   8bc1                 | mov                 dword ptr [esp + 8], ebx
            //   2bc2                 | push                edi
            //   d1e8                 | dec                 eax
            //   03c2                 | sub                 esp, 0x30
            //   c1e806               | and                 dword ptr [esp + 0x20], 0
            //   6bc05a               | cmp                 word ptr [edi], 0x4e

        $sequence_43 = { c744242003000000 ba00000040 ff15???????? 488bd8 ff15???????? }
            // n = 5, score = 500
            //   c744242003000000     | cmp                 word ptr [edi + 2], 0x54
            //   ba00000040           | jne                 0x16
            //   ff15????????         |                     
            //   488bd8               | cmp                 word ptr [edi + 6], 0x41
            //   ff15????????         |                     

        $sequence_44 = { 8903 e8???????? 84c0 746c e8???????? 488d0d63080000 e8???????? }
            // n = 7, score = 400
            //   8903                 | dec                 eax
            //   e8????????           |                     
            //   84c0                 | sub                 esp, 0x20
            //   746c                 | mov                 eax, ecx
            //   e8????????           |                     
            //   488d0d63080000       | dec                 ecx
            //   e8????????           |                     

        $sequence_45 = { 488d0d63080000 e8???????? e8???????? 8bc8 e8???????? 85c0 7556 }
            // n = 7, score = 400
            //   488d0d63080000       | jne                 0x16
            //   e8????????           |                     
            //   e8????????           |                     
            //   8bc8                 | cmp                 word ptr [edi], 0x4e
            //   e8????????           |                     
            //   85c0                 | jne                 0x18
            //   7556                 | cmp                 word ptr [edi + 2], 0x54

    condition:
        7 of them and filesize < 7450624
}