rule win_dustman_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-05-04"
        version = "1"
        description = "Detects win.dustman."
        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.dustman"
        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 = { 8bd9 4c8d0dedb20000 b902000000 4c8d05d9b20000 }
            // n = 4, score = 100
            //   8bd9                 | dec                 eax
            //   4c8d0dedb20000       | shl                 eax, 0x20
            //   b902000000           | dec                 esp
            //   4c8d05d9b20000       | or                  edx, eax

        $sequence_1 = { 884810 488b4d88 0fb60c01 884811 488b4d90 0fb60c01 884812 }
            // n = 7, score = 100
            //   884810               | mov                 byte ptr [eax + 0x3c], cl
            //   488b4d88             | dec                 eax
            //   0fb60c01             | mov                 ecx, dword ptr [ebp + 0xe8]
            //   884811               | movzx               ecx, byte ptr [ecx + eax]
            //   488b4d90             | mov                 byte ptr [eax + 0x3d], cl
            //   0fb60c01             | dec                 eax
            //   884812               | mov                 ecx, dword ptr [ebp + 0xf0]

        $sequence_2 = { c3 488d055d954101 c3 488d054d954101 c3 }
            // n = 5, score = 100
            //   c3                   | sub                 ecx, edx
            //   488d055d954101       | dec                 esp
            //   c3                   | lea                 ebx, [ebp + 0x1c8]
            //   488d054d954101       | dec                 ecx
            //   c3                   | add                 ecx, ebx

        $sequence_3 = { 4c8d9db1010000 4903cb 48894d88 488bca 492bca }
            // n = 5, score = 100
            //   4c8d9db1010000       | inc                 esp
            //   4903cb               | mov                 edi, ecx
            //   48894d88             | dec                 esp
            //   488bca               | lea                 esi, [0xffff9ce6]
            //   492bca               | dec                 ebp

        $sequence_4 = { 4d8be1 498be8 4c8bea 4b8b8cfe40c80100 4c8b15???????? 4883cfff }
            // n = 6, score = 100
            //   4d8be1               | dec                 eax
            //   498be8               | mov                 ecx, dword ptr [ebp + 0x140]
            //   4c8bea               | movzx               ecx, byte ptr [ecx + eax]
            //   4b8b8cfe40c80100     | mov                 byte ptr [eax + 0x48], cl
            //   4c8b15????????       |                     
            //   4883cfff             | dec                 eax

        $sequence_5 = { 492bca 4c8d9dc4010000 4903cb 48894d20 488bca 492bca 4c8d9dc5010000 }
            // n = 7, score = 100
            //   492bca               | movzx               eax, byte ptr [ebp + 0x227]
            //   4c8d9dc4010000       | dec                 eax
            //   4903cb               | shl                 eax, 0x38
            //   48894d20             | dec                 esp
            //   488bca               | or                  edx, eax
            //   492bca               | movzx               edi, byte ptr [ebp + 0x1fe]
            //   4c8d9dc5010000       | dec                 eax

        $sequence_6 = { c4c173590cc1 4c8d0d05750000 c5f359c1 c5fb101d???????? c5fb102d???????? c4e2f1a91d???????? c4e2f1a92d???????? }
            // n = 7, score = 100
            //   c4c173590cc1         | push                ebx
            //   4c8d0d05750000       | dec                 eax
            //   c5f359c1             | sub                 esp, 0x20
            //   c5fb101d????????     |                     
            //   c5fb102d????????     |                     
            //   c4e2f1a91d????????     |     
            //   c4e2f1a92d????????     |     

        $sequence_7 = { 0fb68525020000 48c1e028 4c0bd0 0fb68526020000 48c1e030 4c0bd0 0fb68527020000 }
            // n = 7, score = 100
            //   0fb68525020000       | dec                 ecx
            //   48c1e028             | add                 ecx, ebx
            //   4c0bd0               | dec                 eax
            //   0fb68526020000       | mov                 dword ptr [ebp + 0x138], ecx
            //   48c1e030             | dec                 eax
            //   4c0bd0               | mov                 dword ptr [ebp + 0x138], ecx
            //   0fb68527020000       | dec                 eax

        $sequence_8 = { e8???????? 4883f8ff 7524 ff15???????? 488d4c2420 }
            // n = 5, score = 100
            //   e8????????           |                     
            //   4883f8ff             | dec                 ecx
            //   7524                 | sub                 ecx, edx
            //   ff15????????         |                     
            //   488d4c2420           | dec                 esp

        $sequence_9 = { e9???????? 4d8bb4f6d0320100 33d2 498bce 41b800080000 }
            // n = 5, score = 100
            //   e9????????           |                     
            //   4d8bb4f6d0320100     | sub                 esp, 0x20
            //   33d2                 | inc                 ecx
            //   498bce               | mov                 esi, eax
            //   41b800080000         | dec                 esp

    condition:
        7 of them and filesize < 368640
}