rule win_hermeticwiper_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.hermeticwiper."
        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.hermeticwiper"
        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 = { 51 6880000000 50 6a00 6a00 6800005600 56 }
            // n = 7, score = 200
            //   51                   | push                ecx
            //   6880000000           | push                0x80
            //   50                   | push                eax
            //   6a00                 | push                0
            //   6a00                 | push                0
            //   6800005600           | push                0x560000
            //   56                   | push                esi

        $sequence_1 = { 56 8db54cfeffff 57 8bfe }
            // n = 4, score = 200
            //   56                   | push                esi
            //   8db54cfeffff         | lea                 esi, [ebp - 0x1b4]
            //   57                   | push                edi
            //   8bfe                 | mov                 edi, esi

        $sequence_2 = { 03cf 74c4 8b5718 89550c 6690 0fb7fe }
            // n = 6, score = 200
            //   03cf                 | add                 ecx, edi
            //   74c4                 | je                  0xffffffc6
            //   8b5718               | mov                 edx, dword ptr [edi + 0x18]
            //   89550c               | mov                 dword ptr [ebp + 0xc], edx
            //   6690                 | nop                 
            //   0fb7fe               | movzx               edi, si

        $sequence_3 = { ff770c 8d44244c c744241400000000 68???????? 6804010000 50 ff15???????? }
            // n = 7, score = 200
            //   ff770c               | push                dword ptr [edi + 0xc]
            //   8d44244c             | lea                 eax, [esp + 0x4c]
            //   c744241400000000     | mov                 dword ptr [esp + 0x14], 0
            //   68????????           |                     
            //   6804010000           | push                0x104
            //   50                   | push                eax
            //   ff15????????         |                     

        $sequence_4 = { 8b35???????? 83c410 85db 0f848f000000 83fbff 0f8486000000 8d442410 }
            // n = 7, score = 200
            //   8b35????????         |                     
            //   83c410               | add                 esp, 0x10
            //   85db                 | test                ebx, ebx
            //   0f848f000000         | je                  0x95
            //   83fbff               | cmp                 ebx, -1
            //   0f8486000000         | je                  0x8c
            //   8d442410             | lea                 eax, [esp + 0x10]

        $sequence_5 = { 0f85d8010000 8b4710 89442418 8b4714 89442428 8b7710 }
            // n = 6, score = 200
            //   0f85d8010000         | jne                 0x1de
            //   8b4710               | mov                 eax, dword ptr [edi + 0x10]
            //   89442418             | mov                 dword ptr [esp + 0x18], eax
            //   8b4714               | mov                 eax, dword ptr [edi + 0x14]
            //   89442428             | mov                 dword ptr [esp + 0x28], eax
            //   8b7710               | mov                 esi, dword ptr [edi + 0x10]

        $sequence_6 = { bfc0240000 57 6a08 ff15???????? 50 ff15???????? 6a00 }
            // n = 7, score = 200
            //   bfc0240000           | mov                 edi, 0x24c0
            //   57                   | push                edi
            //   6a08                 | push                8
            //   ff15????????         |                     
            //   50                   | push                eax
            //   ff15????????         |                     
            //   6a00                 | push                0

        $sequence_7 = { 83c702 8bcf 2bce d1f9 83f903 7419 49 }
            // n = 7, score = 200
            //   83c702               | add                 edi, 2
            //   8bcf                 | mov                 ecx, edi
            //   2bce                 | sub                 ecx, esi
            //   d1f9                 | sar                 ecx, 1
            //   83f903               | cmp                 ecx, 3
            //   7419                 | je                  0x1b
            //   49                   | dec                 ecx

        $sequence_8 = { 53 ffd6 85db 7405 83fbff }
            // n = 5, score = 200
            //   53                   | push                ebx
            //   ffd6                 | call                esi
            //   85db                 | test                ebx, ebx
            //   7405                 | je                  7
            //   83fbff               | cmp                 ebx, -1

        $sequence_9 = { d3e7 0bf8 8b5dcc 8b4ddc 8b45e4 3bcb 7509 }
            // n = 7, score = 200
            //   d3e7                 | shl                 edi, cl
            //   0bf8                 | or                  edi, eax
            //   8b5dcc               | mov                 ebx, dword ptr [ebp - 0x34]
            //   8b4ddc               | mov                 ecx, dword ptr [ebp - 0x24]
            //   8b45e4               | mov                 eax, dword ptr [ebp - 0x1c]
            //   3bcb                 | cmp                 ecx, ebx
            //   7509                 | jne                 0xb

    condition:
        7 of them and filesize < 247808
}