rule win_tinynuke_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.tinynuke."
        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.tinynuke"
        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 = { c3 55 8bec 817d0c00040000 }
            // n = 4, score = 1600
            //   c3                   | ret                 
            //   55                   | push                ebp
            //   8bec                 | mov                 ebp, esp
            //   817d0c00040000       | cmp                 dword ptr [ebp + 0xc], 0x400

        $sequence_1 = { 50 ff750c 57 56 ff15???????? 56 }
            // n = 6, score = 1400
            //   50                   | push                eax
            //   ff750c               | push                dword ptr [ebp + 0xc]
            //   57                   | push                edi
            //   56                   | push                esi
            //   ff15????????         |                     
            //   56                   | push                esi

        $sequence_2 = { f7f1 8a043a 30041e 46 3b750c 72e5 5f }
            // n = 7, score = 1400
            //   f7f1                 | div                 ecx
            //   8a043a               | mov                 al, byte ptr [edx + edi]
            //   30041e               | xor                 byte ptr [esi + ebx], al
            //   46                   | inc                 esi
            //   3b750c               | cmp                 esi, dword ptr [ebp + 0xc]
            //   72e5                 | jb                  0xffffffe7
            //   5f                   | pop                 edi

        $sequence_3 = { 8d8530f6ffff 50 6802020000 ff15???????? }
            // n = 4, score = 1400
            //   8d8530f6ffff         | lea                 eax, [ebp - 0x9d0]
            //   50                   | push                eax
            //   6802020000           | push                0x202
            //   ff15????????         |                     

        $sequence_4 = { 8945f4 8d85d4feffff 50 ff15???????? }
            // n = 4, score = 1400
            //   8945f4               | mov                 dword ptr [ebp - 0xc], eax
            //   8d85d4feffff         | lea                 eax, [ebp - 0x12c]
            //   50                   | push                eax
            //   ff15????????         |                     

        $sequence_5 = { ff35???????? c745f803000000 ff75fc ff15???????? ff75fc }
            // n = 5, score = 1400
            //   ff35????????         |                     
            //   c745f803000000       | mov                 dword ptr [ebp - 8], 3
            //   ff75fc               | push                dword ptr [ebp - 4]
            //   ff15????????         |                     
            //   ff75fc               | push                dword ptr [ebp - 4]

        $sequence_6 = { 8bec 817d0c00040000 7613 8b4508 }
            // n = 4, score = 1400
            //   8bec                 | mov                 ebp, esp
            //   817d0c00040000       | cmp                 dword ptr [ebp + 0xc], 0x400
            //   7613                 | jbe                 0x15
            //   8b4508               | mov                 eax, dword ptr [ebp + 8]

        $sequence_7 = { ff7508 ff15???????? 53 8bf0 8d45fc 50 ff750c }
            // n = 7, score = 1400
            //   ff7508               | push                dword ptr [ebp + 8]
            //   ff15????????         |                     
            //   53                   | push                ebx
            //   8bf0                 | mov                 esi, eax
            //   8d45fc               | lea                 eax, [ebp - 4]
            //   50                   | push                eax
            //   ff750c               | push                dword ptr [ebp + 0xc]

        $sequence_8 = { ff75ec ff75fc e8???????? 83c40c 5f }
            // n = 5, score = 1300
            //   ff75ec               | push                dword ptr [ebp - 0x14]
            //   ff75fc               | push                dword ptr [ebp - 4]
            //   e8????????           |                     
            //   83c40c               | add                 esp, 0xc
            //   5f                   | pop                 edi

        $sequence_9 = { ff15???????? ff35???????? 8d85a4feffff 50 ff15???????? }
            // n = 5, score = 1300
            //   ff15????????         |                     
            //   ff35????????         |                     
            //   8d85a4feffff         | lea                 eax, [ebp - 0x15c]
            //   50                   | push                eax
            //   ff15????????         |                     

        $sequence_10 = { e8???????? eb18 83f803 7519 }
            // n = 4, score = 800
            //   e8????????           |                     
            //   eb18                 | jmp                 0x1a
            //   83f803               | cmp                 eax, 3
            //   7519                 | jne                 0x1b

        $sequence_11 = { ff15???????? a3???????? ff35???????? ff75ec }
            // n = 4, score = 800
            //   ff15????????         |                     
            //   a3????????           |                     
            //   ff35????????         |                     
            //   ff75ec               | push                dword ptr [ebp - 0x14]

        $sequence_12 = { 8a00 3c0a 7409 3c0d }
            // n = 4, score = 800
            //   8a00                 | mov                 al, byte ptr [eax]
            //   3c0a                 | cmp                 al, 0xa
            //   7409                 | je                  0xb
            //   3c0d                 | cmp                 al, 0xd

        $sequence_13 = { a3???????? 68e2010000 68???????? 68???????? e8???????? }
            // n = 5, score = 800
            //   a3????????           |                     
            //   68e2010000           | push                0x1e2
            //   68????????           |                     
            //   68????????           |                     
            //   e8????????           |                     

        $sequence_14 = { 6a2a 50 8945fc ff15???????? }
            // n = 4, score = 800
            //   6a2a                 | push                0x2a
            //   50                   | push                eax
            //   8945fc               | mov                 dword ptr [ebp - 4], eax
            //   ff15????????         |                     

        $sequence_15 = { a3???????? ff35???????? ff75f8 ff15???????? }
            // n = 4, score = 800
            //   a3????????           |                     
            //   ff35????????         |                     
            //   ff75f8               | push                dword ptr [ebp - 8]
            //   ff15????????         |                     

        $sequence_16 = { 59 a3???????? c9 c3 55 }
            // n = 5, score = 800
            //   59                   | pop                 ecx
            //   a3????????           |                     
            //   c9                   | leave               
            //   c3                   | ret                 
            //   55                   | push                ebp

        $sequence_17 = { ff15???????? ff75fc 8d85f0fdffff 50 e8???????? 59 50 }
            // n = 7, score = 700
            //   ff15????????         |                     
            //   ff75fc               | push                dword ptr [ebp - 4]
            //   8d85f0fdffff         | lea                 eax, [ebp - 0x210]
            //   50                   | push                eax
            //   e8????????           |                     
            //   59                   | pop                 ecx
            //   50                   | push                eax

        $sequence_18 = { 50 8d85f0fdffff 50 ff15???????? ff75fc 8d85f0fdffff }
            // n = 6, score = 700
            //   50                   | push                eax
            //   8d85f0fdffff         | lea                 eax, [ebp - 0x210]
            //   50                   | push                eax
            //   ff15????????         |                     
            //   ff75fc               | push                dword ptr [ebp - 4]
            //   8d85f0fdffff         | lea                 eax, [ebp - 0x210]

        $sequence_19 = { 6800000080 8d85d8feffff 50 ff15???????? a3???????? }
            // n = 5, score = 700
            //   6800000080           | push                0x80000000
            //   8d85d8feffff         | lea                 eax, [ebp - 0x128]
            //   50                   | push                eax
            //   ff15????????         |                     
            //   a3????????           |                     

        $sequence_20 = { ff15???????? 8b35???????? 8d430c 50 }
            // n = 4, score = 200
            //   ff15????????         |                     
            //   8b35????????         |                     
            //   8d430c               | lea                 eax, [ebx + 0xc]
            //   50                   | push                eax

        $sequence_21 = { 61 8b8decfeffff 8b95e8feffff 038dd0feffff }
            // n = 4, score = 100
            //   61                   | popal               
            //   8b8decfeffff         | mov                 ecx, dword ptr [ebp - 0x114]
            //   8b95e8feffff         | mov                 edx, dword ptr [ebp - 0x118]
            //   038dd0feffff         | add                 ecx, dword ptr [ebp - 0x130]

        $sequence_22 = { 85c9 0fb7d1 893424 0f48c2 83c704 }
            // n = 5, score = 100
            //   85c9                 | test                ecx, ecx
            //   0fb7d1               | movzx               edx, cx
            //   893424               | mov                 dword ptr [esp], esi
            //   0f48c2               | cmovs               eax, edx
            //   83c704               | add                 edi, 4

        $sequence_23 = { e8???????? 83ec04 c7442404???????? 890424 e8???????? 83ec08 89c3 }
            // n = 7, score = 100
            //   e8????????           |                     
            //   83ec04               | sub                 esp, 4
            //   c7442404????????     |                     
            //   890424               | mov                 dword ptr [esp], eax
            //   e8????????           |                     
            //   83ec08               | sub                 esp, 8
            //   89c3                 | mov                 ebx, eax

        $sequence_24 = { 83c404 85c0 0f847c010000 5f 5e 5b }
            // n = 6, score = 100
            //   83c404               | add                 esp, 4
            //   85c0                 | test                eax, eax
            //   0f847c010000         | je                  0x182
            //   5f                   | pop                 edi
            //   5e                   | pop                 esi
            //   5b                   | pop                 ebx

        $sequence_25 = { 85d2 7449 8b4604 83f807 7639 }
            // n = 5, score = 100
            //   85d2                 | test                edx, edx
            //   7449                 | je                  0x4b
            //   8b4604               | mov                 eax, dword ptr [esi + 4]
            //   83f807               | cmp                 eax, 7
            //   7639                 | jbe                 0x3b

        $sequence_26 = { 0f48c2 83c704 83c504 89442404 e8???????? 8945fc 8b0f }
            // n = 7, score = 100
            //   0f48c2               | cmovs               eax, edx
            //   83c704               | add                 edi, 4
            //   83c504               | add                 ebp, 4
            //   89442404             | mov                 dword ptr [esp + 4], eax
            //   e8????????           |                     
            //   8945fc               | mov                 dword ptr [ebp - 4], eax
            //   8b0f                 | mov                 ecx, dword ptr [edi]

        $sequence_27 = { 740c 83c438 b801000000 5b }
            // n = 4, score = 100
            //   740c                 | je                  0xe
            //   83c438               | add                 esp, 0x38
            //   b801000000           | mov                 eax, 1
            //   5b                   | pop                 ebx

        $sequence_28 = { 05???????? 89c7 8944241c 8b4050 8db708010000 890424 89442418 }
            // n = 7, score = 100
            //   05????????           |                     
            //   89c7                 | mov                 edi, eax
            //   8944241c             | mov                 dword ptr [esp + 0x1c], eax
            //   8b4050               | mov                 eax, dword ptr [eax + 0x50]
            //   8db708010000         | lea                 esi, [edi + 0x108]
            //   890424               | mov                 dword ptr [esp], eax
            //   89442418             | mov                 dword ptr [esp + 0x18], eax

        $sequence_29 = { eb5d 8b54240c 81fa80000000 7c0e 0fba25????????01 0f82de1f0000 }
            // n = 6, score = 100
            //   eb5d                 | jmp                 0x5f
            //   8b54240c             | mov                 edx, dword ptr [esp + 0xc]
            //   81fa80000000         | cmp                 edx, 0x80
            //   7c0e                 | jl                  0x10
            //   0fba25????????01     |                     
            //   0f82de1f0000         | jb                  0x1fe4

        $sequence_30 = { 89442418 e8???????? 89c3 8b4754 c7442404???????? 891c24 89442408 }
            // n = 7, score = 100
            //   89442418             | mov                 dword ptr [esp + 0x18], eax
            //   e8????????           |                     
            //   89c3                 | mov                 ebx, eax
            //   8b4754               | mov                 eax, dword ptr [edi + 0x54]
            //   c7442404????????     |                     
            //   891c24               | mov                 dword ptr [esp], ebx
            //   89442408             | mov                 dword ptr [esp + 8], eax

        $sequence_31 = { 89dd 8944240c 8b442418 89442404 e8???????? 83ec10 8b44241c }
            // n = 7, score = 100
            //   89dd                 | mov                 ebp, ebx
            //   8944240c             | mov                 dword ptr [esp + 0xc], eax
            //   8b442418             | mov                 eax, dword ptr [esp + 0x18]
            //   89442404             | mov                 dword ptr [esp + 4], eax
            //   e8????????           |                     
            //   83ec10               | sub                 esp, 0x10
            //   8b44241c             | mov                 eax, dword ptr [esp + 0x1c]

    condition:
        7 of them and filesize < 1196032
}