rule win_dnwipe_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.dnwipe."
        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.dnwipe"
        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 = { 1306 16 1307 2b22 1106 }
            // n = 5, score = 100
            //   1306                 | add                 byte ptr [edx], cl
            //   16                   | jb                  0xb5
            //   1307                 | add                 byte ptr [eax], al
            //   2b22                 | jo                  0x179
            //   1106                 | sub                 dword ptr [eax], eax

        $sequence_1 = { 00 2b37 00 7e01000004 281c00000a 720f000070 }
            // n = 6, score = 100
            //   00                   | adc                 dword ptr [esi], eax
            //   2b37                 | outsd               dx, dword ptr [esi]
            //   00                   | push                ss
            //   7e01000004           | add                 byte ptr [eax], al
            //   281c00000a           | or                  ch, byte ptr [edi + 0x17]
            //   720f000070           | add                 byte ptr [eax], al

        $sequence_2 = { 00 00 2b37 00 }
            // n = 4, score = 100
            //   00                   |                     
            //   00                   |                     
            //   2b37                 |                     
            //   00                   | sub                 esi, dword ptr [edi]

        $sequence_3 = { 58 0d 09 07 8e 69 fe04 }
            // n = 7, score = 100
            //   58                   | add                 byte ptr [edx], cl
            //   0d                   | cmp                 dl, byte ptr [ebp - 2]
            //   09                   | adc                 dword ptr [edx], ecx
            //   07                   | adc                 dword ptr [edx + ebx*4], ecx
            //   8e                   | outsd               dx, dword ptr [esi]
            //   69                   | and                 al, 0
            //   fe04                 | add                 byte ptr [edx], cl

        $sequence_4 = { 281b00000a 00 00 00 de04 }
            // n = 5, score = 100
            //   281b00000a           | or                  al, byte ptr [esi]
            //   00                   | sub                 byte ptr [ebx], bl
            //   00                   | add                 byte ptr [eax], al
            //   00                   | add                 byte ptr [eax], al
            //   de04                 |                     

        $sequence_5 = { 110c 9a 6f2400000a 7285000070 6f2900000a 3a01010000 110a }
            // n = 7, score = 100
            //   110c                 | add                 byte ptr [edx], cl
            //   9a                   | sub                 eax, 0x110a1116
            //   6f2400000a           | or                  al, 0x9a
            //   7285000070           | outsd               dx, dword ptr [esi]
            //   6f2900000a           | and                 al, 0
            //   3a01010000           | add                 byte ptr [edx], cl
            //   110a                 | jb                  0x62

        $sequence_6 = { 00 2b09 00 17 }
            // n = 4, score = 100
            //   00                   | or                  al, 0x12
            //   2b09                 |                     
            //   00                   | sub                 ecx, dword ptr [ecx]
            //   17                   |                     

        $sequence_7 = { 09 1304 16 1305 2b74 }
            // n = 5, score = 100
            //   09                   | add                 byte ptr [ebx], ch
            //   1304                 | add                 byte ptr [eax], al
            //   16                   | fiadd               word ptr [ecx]
            //   1305                 | add                 byte ptr [ecx], dl
            //   2b74                 | or                  al, 0x17

        $sequence_8 = { 8e 69 3284 00 de05 26 }
            // n = 6, score = 100
            //   8e                   | or                  ah, byte ptr [esi]
            //   69                   | adc                 dword ptr [edx + ebx], eax
            //   3284                 | outsd               dx, dword ptr [esi]
            //   00                   | and                 eax, 0x720a0000
            //   de05                 | imul                eax, dword ptr [eax], 0
            //   26                   | jo                  0xc0

        $sequence_9 = { 09 9a 732200000a 1304 07 09 9a }
            // n = 7, score = 100
            //   09                   | add                 byte ptr [eax], al
            //   9a                   | sub                 byte ptr [esi], ah
            //   732200000a           | add                 byte ptr [eax], al
            //   1304                 | or                  ah, byte ptr [esi]
            //   07                   | adc                 dword ptr [edx + ebx], eax
            //   09                   | lcall               0x130a:0x2273
            //   9a                   | add                 al, 7

    condition:
        7 of them and filesize < 50176
}