rule win_cloud_duke_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.cloud_duke."
        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.cloud_duke"
        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 = { ff15???????? 83f87a 7564 8b44242c 33c9 ba02000000 }
            // n = 6, score = 800
            //   ff15????????         |                     
            //   83f87a               | cmp                 eax, 0x7a
            //   7564                 | jne                 0x66
            //   8b44242c             | mov                 eax, dword ptr [esp + 0x2c]
            //   33c9                 | xor                 ecx, ecx
            //   ba02000000           | mov                 edx, 2

        $sequence_1 = { 72b3 6a00 6a00 6aff 57 6a00 }
            // n = 6, score = 800
            //   72b3                 | jb                  0xffffffb5
            //   6a00                 | push                0
            //   6a00                 | push                0
            //   6aff                 | push                -1
            //   57                   | push                edi
            //   6a00                 | push                0

        $sequence_2 = { 8d8c2424010000 e8???????? 8d842440010000 ba???????? 50 8d4c247c e8???????? }
            // n = 7, score = 800
            //   8d8c2424010000       | lea                 ecx, [esp + 0x124]
            //   e8????????           |                     
            //   8d842440010000       | lea                 eax, [esp + 0x140]
            //   ba????????           |                     
            //   50                   | push                eax
            //   8d4c247c             | lea                 ecx, [esp + 0x7c]
            //   e8????????           |                     

        $sequence_3 = { 83f806 0f8563020000 8d85f4fdffff 50 a1???????? 6a00 6a00 }
            // n = 7, score = 800
            //   83f806               | cmp                 eax, 6
            //   0f8563020000         | jne                 0x269
            //   8d85f4fdffff         | lea                 eax, [ebp - 0x20c]
            //   50                   | push                eax
            //   a1????????           |                     
            //   6a00                 | push                0
            //   6a00                 | push                0

        $sequence_4 = { 02c8 884de5 85db 7e14 0fb64435e4 }
            // n = 5, score = 800
            //   02c8                 | add                 cl, al
            //   884de5               | mov                 byte ptr [ebp - 0x1b], cl
            //   85db                 | test                ebx, ebx
            //   7e14                 | jle                 0x16
            //   0fb64435e4           | movzx               eax, byte ptr [ebp + esi - 0x1c]

        $sequence_5 = { 83c40c 33c0 668984242c070000 6816060000 }
            // n = 4, score = 800
            //   83c40c               | add                 esp, 0xc
            //   33c0                 | xor                 eax, eax
            //   668984242c070000     | mov                 word ptr [esp + 0x72c], ax
            //   6816060000           | push                0x616

        $sequence_6 = { c1e902 f3a5 8bca 83e103 f3a4 8b85e8fbffff 8bbde0fbffff }
            // n = 7, score = 800
            //   c1e902               | shr                 ecx, 2
            //   f3a5                 | rep movsd           dword ptr es:[edi], dword ptr [esi]
            //   8bca                 | mov                 ecx, edx
            //   83e103               | and                 ecx, 3
            //   f3a4                 | rep movsb           byte ptr es:[edi], byte ptr [esi]
            //   8b85e8fbffff         | mov                 eax, dword ptr [ebp - 0x418]
            //   8bbde0fbffff         | mov                 edi, dword ptr [ebp - 0x420]

        $sequence_7 = { e9???????? 8d8c245c010000 e8???????? 8d8c2440010000 e8???????? 8d8c2408010000 e8???????? }
            // n = 7, score = 800
            //   e9????????           |                     
            //   8d8c245c010000       | lea                 ecx, [esp + 0x15c]
            //   e8????????           |                     
            //   8d8c2440010000       | lea                 ecx, [esp + 0x140]
            //   e8????????           |                     
            //   8d8c2408010000       | lea                 ecx, [esp + 0x108]
            //   e8????????           |                     

        $sequence_8 = { 64a300000000 89542420 8bf1 8b4508 }
            // n = 4, score = 800
            //   64a300000000         | mov                 dword ptr fs:[0], eax
            //   89542420             | mov                 dword ptr [esp + 0x20], edx
            //   8bf1                 | mov                 esi, ecx
            //   8b4508               | mov                 eax, dword ptr [ebp + 8]

        $sequence_9 = { ffb42400010000 83bc242001000010 8d84240c010000 ffb4241c010000 0f43842410010000 6a01 }
            // n = 6, score = 800
            //   ffb42400010000       | push                dword ptr [esp + 0x100]
            //   83bc242001000010     | cmp                 dword ptr [esp + 0x120], 0x10
            //   8d84240c010000       | lea                 eax, [esp + 0x10c]
            //   ffb4241c010000       | push                dword ptr [esp + 0x11c]
            //   0f43842410010000     | cmovae              eax, dword ptr [esp + 0x110]
            //   6a01                 | push                1

    condition:
        7 of them and filesize < 368640
}