rule win_virut_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.virut."
        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.virut"
        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 = { ab 33c0 6a10 59 f3ab 50 50 }
            // n = 7, score = 200
            //   ab                   | stosd               dword ptr es:[edi], eax
            //   33c0                 | xor                 eax, eax
            //   6a10                 | push                0x10
            //   59                   | pop                 ecx
            //   f3ab                 | rep stosd           dword ptr es:[edi], eax
            //   50                   | push                eax
            //   50                   | push                eax

        $sequence_1 = { 7412 3d50485000 740b 3d41535000 }
            // n = 4, score = 200
            //   7412                 | je                  0x14
            //   3d50485000           | cmp                 eax, 0x504850
            //   740b                 | je                  0xd
            //   3d41535000           | cmp                 eax, 0x505341

        $sequence_2 = { 50 8d8424e0020000 50 ff15???????? 83c40c 8d8424d8020000 }
            // n = 6, score = 200
            //   50                   | push                eax
            //   8d8424e0020000       | lea                 eax, [esp + 0x2e0]
            //   50                   | push                eax
            //   ff15????????         |                     
            //   83c40c               | add                 esp, 0xc
            //   8d8424d8020000       | lea                 eax, [esp + 0x2d8]

        $sequence_3 = { 8d8424e0030000 50 6a02 ff15???????? 895c2414 }
            // n = 5, score = 200
            //   8d8424e0030000       | lea                 eax, [esp + 0x3e0]
            //   50                   | push                eax
            //   6a02                 | push                2
            //   ff15????????         |                     
            //   895c2414             | mov                 dword ptr [esp + 0x14], ebx

        $sequence_4 = { 74ec 3c2e 74dd 3c00 75e8 }
            // n = 5, score = 200
            //   74ec                 | je                  0xffffffee
            //   3c2e                 | cmp                 al, 0x2e
            //   74dd                 | je                  0xffffffdf
            //   3c00                 | cmp                 al, 0
            //   75e8                 | jne                 0xffffffea

        $sequence_5 = { 8d9704010000 51 51 6a02 51 6a01 }
            // n = 6, score = 200
            //   8d9704010000         | lea                 edx, [edi + 0x104]
            //   51                   | push                ecx
            //   51                   | push                ecx
            //   6a02                 | push                2
            //   51                   | push                ecx
            //   6a01                 | push                1

        $sequence_6 = { 53 89742468 ff15???????? 85c0 7416 }
            // n = 5, score = 200
            //   53                   | push                ebx
            //   89742468             | mov                 dword ptr [esp + 0x68], esi
            //   ff15????????         |                     
            //   85c0                 | test                eax, eax
            //   7416                 | je                  0x18

        $sequence_7 = { e8???????? 83c40c 53 6800040000 8d842400060000 50 ff742424 }
            // n = 7, score = 200
            //   e8????????           |                     
            //   83c40c               | add                 esp, 0xc
            //   53                   | push                ebx
            //   6800040000           | push                0x400
            //   8d842400060000       | lea                 eax, [esp + 0x600]
            //   50                   | push                eax
            //   ff742424             | push                dword ptr [esp + 0x24]

        $sequence_8 = { 8bd4 50 54 6a40 51 52 53 }
            // n = 7, score = 200
            //   8bd4                 | mov                 edx, esp
            //   50                   | push                eax
            //   54                   | push                esp
            //   6a40                 | push                0x40
            //   51                   | push                ecx
            //   52                   | push                edx
            //   53                   | push                ebx

        $sequence_9 = { 46 83fe04 72ee ff742408 }
            // n = 4, score = 200
            //   46                   | inc                 esi
            //   83fe04               | cmp                 esi, 4
            //   72ee                 | jb                  0xfffffff0
            //   ff742408             | push                dword ptr [esp + 8]

        $sequence_10 = { 8b7220 8b4a18 8d3433 51 }
            // n = 4, score = 200
            //   8b7220               | mov                 esi, dword ptr [edx + 0x20]
            //   8b4a18               | mov                 ecx, dword ptr [edx + 0x18]
            //   8d3433               | lea                 esi, [ebx + esi]
            //   51                   | push                ecx

        $sequence_11 = { 59 03f3 8b521c 0fb7044e 03d3 }
            // n = 5, score = 200
            //   59                   | pop                 ecx
            //   03f3                 | add                 esi, ebx
            //   8b521c               | mov                 edx, dword ptr [edx + 0x1c]
            //   0fb7044e             | movzx               eax, word ptr [esi + ecx*2]
            //   03d3                 | add                 edx, ebx

        $sequence_12 = { 03c2 a3???????? ff15???????? a3???????? }
            // n = 4, score = 200
            //   03c2                 | add                 eax, edx
            //   a3????????           |                     
            //   ff15????????         |                     
            //   a3????????           |                     

        $sequence_13 = { 8d8424fc050000 53 50 e8???????? }
            // n = 4, score = 200
            //   8d8424fc050000       | lea                 eax, [esp + 0x5fc]
            //   53                   | push                ebx
            //   50                   | push                eax
            //   e8????????           |                     

        $sequence_14 = { 7407 40 3bc6 7cee eb1b 83c004 2bf0 }
            // n = 7, score = 200
            //   7407                 | je                  9
            //   40                   | inc                 eax
            //   3bc6                 | cmp                 eax, esi
            //   7cee                 | jl                  0xfffffff0
            //   eb1b                 | jmp                 0x1d
            //   83c004               | add                 eax, 4
            //   2bf0                 | sub                 esi, eax

        $sequence_15 = { 8d8c2404060000 51 89442428 895c241c 895c2424 50 eb49 }
            // n = 7, score = 200
            //   8d8c2404060000       | lea                 ecx, [esp + 0x604]
            //   51                   | push                ecx
            //   89442428             | mov                 dword ptr [esp + 0x28], eax
            //   895c241c             | mov                 dword ptr [esp + 0x1c], ebx
            //   895c2424             | mov                 dword ptr [esp + 0x24], ebx
            //   50                   | push                eax
            //   eb49                 | jmp                 0x4b

    condition:
        7 of them and filesize < 98304
}