rule win_caddywiper_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-05-04"
        version = "1"
        description = "Detects win.caddywiper."
        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.caddywiper"
        malpedia_rule_date = "20260422"
        malpedia_hash = "a182e35da64e6d71cb55f125c4d4225196523f14"
        malpedia_version = "20260504"
        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 = { c685befbffff6c c685bffbffff00 c685c0fbffff33 c685c1fbffff00 c685c2fbffff32 }
            // n = 5, score = 100
            //   c685befbffff6c       | mov                 byte ptr [ebp - 0x442], 0x6c
            //   c685bffbffff00       | mov                 byte ptr [ebp - 0x441], 0
            //   c685c0fbffff33       | mov                 byte ptr [ebp - 0x440], 0x33
            //   c685c1fbffff00       | mov                 byte ptr [ebp - 0x43f], 0
            //   c685c2fbffff32       | mov                 byte ptr [ebp - 0x43e], 0x32

        $sequence_1 = { 6a00 6a03 68000000c0 8b95f4f7ffff 52 ff95fcf7ffff 8945fc }
            // n = 7, score = 100
            //   6a00                 | push                0
            //   6a03                 | push                3
            //   68000000c0           | push                0xc0000000
            //   8b95f4f7ffff         | mov                 edx, dword ptr [ebp - 0x80c]
            //   52                   | push                edx
            //   ff95fcf7ffff         | call                dword ptr [ebp - 0x804]
            //   8945fc               | mov                 dword ptr [ebp - 4], eax

        $sequence_2 = { 8d8d00f8ffff 51 8d55dc 52 e8???????? 83c408 }
            // n = 6, score = 100
            //   8d8d00f8ffff         | lea                 ecx, [ebp - 0x800]
            //   51                   | push                ecx
            //   8d55dc               | lea                 edx, [ebp - 0x24]
            //   52                   | push                edx
            //   e8????????           |                     
            //   83c408               | add                 esp, 8

        $sequence_3 = { c645df54 c645e06f c645e16b c645e265 c645e36e }
            // n = 5, score = 100
            //   c645df54             | mov                 byte ptr [ebp - 0x21], 0x54
            //   c645e06f             | mov                 byte ptr [ebp - 0x20], 0x6f
            //   c645e16b             | mov                 byte ptr [ebp - 0x1f], 0x6b
            //   c645e265             | mov                 byte ptr [ebp - 0x1e], 0x65
            //   c645e36e             | mov                 byte ptr [ebp - 0x1d], 0x6e

        $sequence_4 = { 898568ffffff c78548ffffff00000000 c685acfeffff53 c685adfeffff65 }
            // n = 4, score = 100
            //   898568ffffff         | mov                 dword ptr [ebp - 0x98], eax
            //   c78548ffffff00000000     | mov    dword ptr [ebp - 0xb8], 0
            //   c685acfeffff53       | mov                 byte ptr [ebp - 0x154], 0x53
            //   c685adfeffff65       | mov                 byte ptr [ebp - 0x153], 0x65

        $sequence_5 = { 52 ff55b0 85c0 7504 }
            // n = 4, score = 100
            //   52                   | push                edx
            //   ff55b0               | call                dword ptr [ebp - 0x50]
            //   85c0                 | test                eax, eax
            //   7504                 | jne                 6

        $sequence_6 = { c6459e5c c6459f00 c645a050 c645a100 c645a248 }
            // n = 5, score = 100
            //   c6459e5c             | mov                 byte ptr [ebp - 0x62], 0x5c
            //   c6459f00             | mov                 byte ptr [ebp - 0x61], 0
            //   c645a050             | mov                 byte ptr [ebp - 0x60], 0x50
            //   c645a100             | mov                 byte ptr [ebp - 0x5f], 0
            //   c645a248             | mov                 byte ptr [ebp - 0x5e], 0x48

        $sequence_7 = { 6a00 6a00 6880070000 8d8d10f8ffff }
            // n = 4, score = 100
            //   6a00                 | push                0
            //   6a00                 | push                0
            //   6880070000           | push                0x780
            //   8d8d10f8ffff         | lea                 ecx, [ebp - 0x7f0]

        $sequence_8 = { c68543ffffff00 8d8d38ffffff 51 8d55b8 52 e8???????? 83c408 }
            // n = 7, score = 100
            //   c68543ffffff00       | mov                 byte ptr [ebp - 0xbd], 0
            //   8d8d38ffffff         | lea                 ecx, [ebp - 0xc8]
            //   51                   | push                ecx
            //   8d55b8               | lea                 edx, [ebp - 0x48]
            //   52                   | push                edx
            //   e8????????           |                     
            //   83c408               | add                 esp, 8

        $sequence_9 = { 83c40c 8d8524f2ffff 50 8d8d38f3ffff 51 8d95d0fbffff }
            // n = 6, score = 100
            //   83c40c               | add                 esp, 0xc
            //   8d8524f2ffff         | lea                 eax, [ebp - 0xddc]
            //   50                   | push                eax
            //   8d8d38f3ffff         | lea                 ecx, [ebp - 0xcc8]
            //   51                   | push                ecx
            //   8d95d0fbffff         | lea                 edx, [ebp - 0x430]

    condition:
        7 of them and filesize < 33792
}