rule win_revil_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.revil."
        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.revil"
        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 = { eb08 c1f91a 25ffffff03 014c95c4 894495c0 42 83fa09 }
            // n = 7, score = 4600
            //   eb08                 | jmp                 0xa
            //   c1f91a               | sar                 ecx, 0x1a
            //   25ffffff03           | and                 eax, 0x3ffffff
            //   014c95c4             | add                 dword ptr [ebp + edx*4 - 0x3c], ecx
            //   894495c0             | mov                 dword ptr [ebp + edx*4 - 0x40], eax
            //   42                   | inc                 edx
            //   83fa09               | cmp                 edx, 9

        $sequence_1 = { 33c8 894af8 8b42dc 33c1 8942fc 8b450c }
            // n = 6, score = 4600
            //   33c8                 | xor                 ecx, eax
            //   894af8               | mov                 dword ptr [edx - 8], ecx
            //   8b42dc               | mov                 eax, dword ptr [edx - 0x24]
            //   33c1                 | xor                 eax, ecx
            //   8942fc               | mov                 dword ptr [edx - 4], eax
            //   8b450c               | mov                 eax, dword ptr [ebp + 0xc]

        $sequence_2 = { 33433c 334dec 3345e8 894b38 }
            // n = 4, score = 4600
            //   33433c               | xor                 eax, dword ptr [ebx + 0x3c]
            //   334dec               | xor                 ecx, dword ptr [ebp - 0x14]
            //   3345e8               | xor                 eax, dword ptr [ebp - 0x18]
            //   894b38               | mov                 dword ptr [ebx + 0x38], ecx

        $sequence_3 = { 8945e0 8b4704 8945e4 8b470c 8b7f1c 8945e8 }
            // n = 6, score = 4600
            //   8945e0               | mov                 dword ptr [ebp - 0x20], eax
            //   8b4704               | mov                 eax, dword ptr [edi + 4]
            //   8945e4               | mov                 dword ptr [ebp - 0x1c], eax
            //   8b470c               | mov                 eax, dword ptr [edi + 0xc]
            //   8b7f1c               | mov                 edi, dword ptr [edi + 0x1c]
            //   8945e8               | mov                 dword ptr [ebp - 0x18], eax

        $sequence_4 = { 8945e0 8b87a4000000 8b97b4000000 8945e4 8b87ac000000 }
            // n = 5, score = 4600
            //   8945e0               | mov                 dword ptr [ebp - 0x20], eax
            //   8b87a4000000         | mov                 eax, dword ptr [edi + 0xa4]
            //   8b97b4000000         | mov                 edx, dword ptr [edi + 0xb4]
            //   8945e4               | mov                 dword ptr [ebp - 0x1c], eax
            //   8b87ac000000         | mov                 eax, dword ptr [edi + 0xac]

        $sequence_5 = { 8b5d08 8945ec 8b4508 8b80c4000000 }
            // n = 4, score = 4600
            //   8b5d08               | mov                 ebx, dword ptr [ebp + 8]
            //   8945ec               | mov                 dword ptr [ebp - 0x14], eax
            //   8b4508               | mov                 eax, dword ptr [ebp + 8]
            //   8b80c4000000         | mov                 eax, dword ptr [eax + 0xc4]

        $sequence_6 = { 0f8cad040000 43 895db8 803b75 0f85a0040000 43 895db8 }
            // n = 7, score = 4600
            //   0f8cad040000         | jl                  0x4b3
            //   43                   | inc                 ebx
            //   895db8               | mov                 dword ptr [ebp - 0x48], ebx
            //   803b75               | cmp                 byte ptr [ebx], 0x75
            //   0f85a0040000         | jne                 0x4a6
            //   43                   | inc                 ebx
            //   895db8               | mov                 dword ptr [ebp - 0x48], ebx

        $sequence_7 = { 85c0 7405 83c702 ebe4 8b75ec 8bc1 }
            // n = 6, score = 4600
            //   85c0                 | test                eax, eax
            //   7405                 | je                  7
            //   83c702               | add                 edi, 2
            //   ebe4                 | jmp                 0xffffffe6
            //   8b75ec               | mov                 esi, dword ptr [ebp - 0x14]
            //   8bc1                 | mov                 eax, ecx

        $sequence_8 = { 8d8568ffffff 56 57 ff750c 50 e8???????? 8d8568ffffff }
            // n = 7, score = 4600
            //   8d8568ffffff         | lea                 eax, [ebp - 0x98]
            //   56                   | push                esi
            //   57                   | push                edi
            //   ff750c               | push                dword ptr [ebp + 0xc]
            //   50                   | push                eax
            //   e8????????           |                     
            //   8d8568ffffff         | lea                 eax, [ebp - 0x98]

        $sequence_9 = { 0f841c010000 8b5d10 8b7d14 85db 7508 }
            // n = 5, score = 4600
            //   0f841c010000         | je                  0x122
            //   8b5d10               | mov                 ebx, dword ptr [ebp + 0x10]
            //   8b7d14               | mov                 edi, dword ptr [ebp + 0x14]
            //   85db                 | test                ebx, ebx
            //   7508                 | jne                 0xa

    condition:
        7 of them and filesize < 155794432
}