rule win_dustman_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        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 = "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 = { 488d4c2420 e8???????? 488d05beec0000 488903 488bc3 4883c430 }
            // n = 6, score = 100
            //   488d4c2420           | mov                 eax, 0x1400000
            //   e8????????           |                     
            //   488d05beec0000       | div                 ecx
            //   488903               | mov                 esi, eax
            //   488bc3               | mov                 edx, 0x3e8
            //   4883c430             | dec                 eax

        $sequence_1 = { 66390549d5ffff 7579 4863057cd5ffff 488d1539d5ffff 488d0c10 813950450000 755f }
            // n = 7, score = 100
            //   66390549d5ffff       | shl                 eax, 8
            //   7579                 | dec                 eax
            //   4863057cd5ffff       | or                  ebx, eax
            //   488d1539d5ffff       | movzx               eax, byte ptr [ebp + 0x22a]
            //   488d0c10             | dec                 eax
            //   813950450000         | shl                 eax, 0x10
            //   755f                 | dec                 eax

        $sequence_2 = { 837b1000 75dd 488d056be30000 483bd8 }
            // n = 4, score = 100
            //   837b1000             | lea                 edx, [0x132f5]
            //   75dd                 | inc                 ebp
            //   488d056be30000       | xor                 eax, eax
            //   483bd8               | dec                 eax

        $sequence_3 = { 884807 420fb60c10 884808 420fb60c18 884809 }
            // n = 5, score = 100
            //   884807               | dec                 eax
            //   420fb60c10           | sub                 esp, 0x20
            //   884808               | mov                 edi, edx
            //   420fb60c18           | dec                 esp
            //   884809               | lea                 ecx, [0x82f1]

        $sequence_4 = { eb03 498bf7 48895f18 488d150d620100 4b8d1c36 4c897710 }
            // n = 6, score = 100
            //   eb03                 | lea                 ebx, [ebp + 0x1de]
            //   498bf7               | dec                 ecx
            //   48895f18             | add                 ecx, ebx
            //   488d150d620100       | dec                 eax
            //   4b8d1c36             | mov                 dword ptr [ebp + 0xf0], ecx
            //   4c897710             | dec                 eax

        $sequence_5 = { 741c 488d05a8600000 483bc8 7410 b801000000 f00fc1815c010000 }
            // n = 6, score = 100
            //   741c                 | add                 ebp, eax
            //   488d05a8600000       | dec                 ecx
            //   483bc8               | mov                 esi, eax
            //   7410                 | inc                 ecx
            //   b801000000           | mov                 esi, eax
            //   f00fc1815c010000     | dec                 esp

        $sequence_6 = { 4c8d9de4010000 4903cb 48898d20010000 488bca 492bca 4c8d9de5010000 4903cb }
            // n = 7, score = 100
            //   4c8d9de4010000       | lea                 edi, [0x11180]
            //   4903cb               | jmp                 0x7f7
            //   48898d20010000       | dec                 eax
            //   488bca               | lea                 edi, [0x1115f]
            //   492bca               | jmp                 0x816
            //   4c8d9de5010000       | dec                 eax
            //   4903cb               | lea                 eax, [0x1328b]

        $sequence_7 = { 480f438580010000 0fb74808 e8???????? 410fbecd 33d2 }
            // n = 5, score = 100
            //   480f438580010000     | mov                 edx, dword ptr [ebp + 0x508]
            //   0fb74808             | dec                 eax
            //   e8????????           |                     
            //   410fbecd             | lea                 eax, [0xd9ac]
            //   33d2                 | movups              xmm0, xmmword ptr [eax]

        $sequence_8 = { 48833d????????00 741e 488d0daccc0000 e8???????? }
            // n = 4, score = 100
            //   48833d????????00     |                     
            //   741e                 | dec                 eax
            //   488d0daccc0000       | mov                 ecx, dword ptr [esp + 0x50]
            //   e8????????           |                     

        $sequence_9 = { 884825 488b4d30 0fb60c01 884826 488b4d38 }
            // n = 5, score = 100
            //   884825               | dec                 eax
            //   488b4d30             | lea                 ecx, [esp + 0x20]
            //   0fb60c01             | dec                 eax
            //   884826               | sub                 esp, 0x48
            //   488b4d38             | dec                 eax

    condition:
        7 of them and filesize < 368640
}