rule win_pathwiper_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.pathwiper."
        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.pathwiper"
        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 = { e9???????? 8d8534ecffff 50 8d8db8ebffff e8???????? 8d8534ecffff c645fc09 }
            // n = 7, score = 100
            //   e9????????           |                     
            //   8d8534ecffff         | lea                 eax, [ebp - 0x13cc]
            //   50                   | push                eax
            //   8d8db8ebffff         | lea                 ecx, [ebp - 0x1448]
            //   e8????????           |                     
            //   8d8534ecffff         | lea                 eax, [ebp - 0x13cc]
            //   c645fc09             | mov                 byte ptr [ebp - 4], 9

        $sequence_1 = { c7461c100e0000 bf8fbc0000 c74620b4000000 f7e7 6a00 68ffffff7f }
            // n = 6, score = 100
            //   c7461c100e0000       | mov                 dword ptr [esi + 0x1c], 0xe10
            //   bf8fbc0000           | mov                 edi, 0xbc8f
            //   c74620b4000000       | mov                 dword ptr [esi + 0x20], 0xb4
            //   f7e7                 | mul                 edi
            //   6a00                 | push                0
            //   68ffffff7f           | push                0x7fffffff

        $sequence_2 = { 8b851cfdffff 8b35???????? 83f8ff 7403 50 ffd6 8b8518fdffff }
            // n = 7, score = 100
            //   8b851cfdffff         | mov                 eax, dword ptr [ebp - 0x2e4]
            //   8b35????????         |                     
            //   83f8ff               | cmp                 eax, -1
            //   7403                 | je                  5
            //   50                   | push                eax
            //   ffd6                 | call                esi
            //   8b8518fdffff         | mov                 eax, dword ptr [ebp - 0x2e8]

        $sequence_3 = { 8d8df4feffff c645fc08 e8???????? 8d853cfdffff 50 ffb518fdffff e8???????? }
            // n = 7, score = 100
            //   8d8df4feffff         | lea                 ecx, [ebp - 0x10c]
            //   c645fc08             | mov                 byte ptr [ebp - 4], 8
            //   e8????????           |                     
            //   8d853cfdffff         | lea                 eax, [ebp - 0x2c4]
            //   50                   | push                eax
            //   ffb518fdffff         | push                dword ptr [ebp - 0x2e8]
            //   e8????????           |                     

        $sequence_4 = { c1f806 83e13f 6bd130 8b0c8538984700 8b4514 c1e810 3244112d }
            // n = 7, score = 100
            //   c1f806               | sar                 eax, 6
            //   83e13f               | and                 ecx, 0x3f
            //   6bd130               | imul                edx, ecx, 0x30
            //   8b0c8538984700       | mov                 ecx, dword ptr [eax*4 + 0x479838]
            //   8b4514               | mov                 eax, dword ptr [ebp + 0x14]
            //   c1e810               | shr                 eax, 0x10
            //   3244112d             | xor                 al, byte ptr [ecx + edx + 0x2d]

        $sequence_5 = { 6a0c 50 e8???????? 83c408 8b75c8 8b5dc4 }
            // n = 6, score = 100
            //   6a0c                 | push                0xc
            //   50                   | push                eax
            //   e8????????           |                     
            //   83c408               | add                 esp, 8
            //   8b75c8               | mov                 esi, dword ptr [ebp - 0x38]
            //   8b5dc4               | mov                 ebx, dword ptr [ebp - 0x3c]

        $sequence_6 = { 8bcf e8???????? 0f1045cc 0f1107 f30f7e45dc 660fd64710 eb34 }
            // n = 7, score = 100
            //   8bcf                 | mov                 ecx, edi
            //   e8????????           |                     
            //   0f1045cc             | movups              xmm0, xmmword ptr [ebp - 0x34]
            //   0f1107               | movups              xmmword ptr [edi], xmm0
            //   f30f7e45dc           | movq                xmm0, qword ptr [ebp - 0x24]
            //   660fd64710           | movq                qword ptr [edi + 0x10], xmm0
            //   eb34                 | jmp                 0x36

        $sequence_7 = { 33c5 8945fc 56 8b7508 8d45f4 683734ecf3 50 }
            // n = 7, score = 100
            //   33c5                 | xor                 eax, ebp
            //   8945fc               | mov                 dword ptr [ebp - 4], eax
            //   56                   | push                esi
            //   8b7508               | mov                 esi, dword ptr [ebp + 8]
            //   8d45f4               | lea                 eax, [ebp - 0xc]
            //   683734ecf3           | push                0xf3ec3437
            //   50                   | push                eax

        $sequence_8 = { 33c5 8945fc 56 8b7508 8d45f4 68373490f3 50 }
            // n = 7, score = 100
            //   33c5                 | xor                 eax, ebp
            //   8945fc               | mov                 dword ptr [ebp - 4], eax
            //   56                   | push                esi
            //   8b7508               | mov                 esi, dword ptr [ebp + 8]
            //   8d45f4               | lea                 eax, [ebp - 0xc]
            //   68373490f3           | push                0xf3903437
            //   50                   | push                eax

        $sequence_9 = { 33f6 89750c 8d4dbc c645fc02 e8???????? c745bc3cd74500 c7450c00000000 }
            // n = 7, score = 100
            //   33f6                 | xor                 esi, esi
            //   89750c               | mov                 dword ptr [ebp + 0xc], esi
            //   8d4dbc               | lea                 ecx, [ebp - 0x44]
            //   c645fc02             | mov                 byte ptr [ebp - 4], 2
            //   e8????????           |                     
            //   c745bc3cd74500       | mov                 dword ptr [ebp - 0x44], 0x45d73c
            //   c7450c00000000       | mov                 dword ptr [ebp + 0xc], 0

    condition:
        7 of them and filesize < 1047552
}