rule win_icedid_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.icedid."
        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.icedid"
        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 = { 7427 6a3b 56 ff15???????? 8bf8 }
            // n = 5, score = 1300
            //   7427                 | je                  0x29
            //   6a3b                 | push                0x3b
            //   56                   | push                esi
            //   ff15????????         |                     
            //   8bf8                 | mov                 edi, eax

        $sequence_1 = { ff15???????? 85c0 7420 837c241000 }
            // n = 4, score = 1300
            //   ff15????????         |                     
            //   85c0                 | test                eax, eax
            //   7420                 | je                  0x22
            //   837c241000           | cmp                 dword ptr [esp + 0x10], 0

        $sequence_2 = { 50 0fb705???????? 50 51 0fb60d???????? }
            // n = 5, score = 1300
            //   50                   | push                eax
            //   0fb705????????       |                     
            //   50                   | push                eax
            //   51                   | push                ecx
            //   0fb60d????????       |                     

        $sequence_3 = { 85c0 7511 56 57 ff15???????? }
            // n = 5, score = 1300
            //   85c0                 | test                eax, eax
            //   7511                 | jne                 0x13
            //   56                   | push                esi
            //   57                   | push                edi
            //   ff15????????         |                     

        $sequence_4 = { 6905????????e8030000 50 ff35???????? ff15???????? }
            // n = 4, score = 1300
            //   6905????????e8030000     |     
            //   50                   | push                eax
            //   ff35????????         |                     
            //   ff15????????         |                     

        $sequence_5 = { 7413 ff36 6a08 ff15???????? 50 }
            // n = 5, score = 1300
            //   7413                 | je                  0x15
            //   ff36                 | push                dword ptr [esi]
            //   6a08                 | push                8
            //   ff15????????         |                     
            //   50                   | push                eax

        $sequence_6 = { ff15???????? 8bf7 8bc6 eb02 33c0 }
            // n = 5, score = 1300
            //   ff15????????         |                     
            //   8bf7                 | mov                 esi, edi
            //   8bc6                 | mov                 eax, esi
            //   eb02                 | jmp                 4
            //   33c0                 | xor                 eax, eax

        $sequence_7 = { be01000080 50 56 ff15???????? }
            // n = 4, score = 1300
            //   be01000080           | mov                 esi, 0x80000001
            //   50                   | push                eax
            //   56                   | push                esi
            //   ff15????????         |                     

        $sequence_8 = { e8???????? 8bf0 8d45fc 50 ff75fc 6a05 }
            // n = 6, score = 1000
            //   e8????????           |                     
            //   8bf0                 | mov                 esi, eax
            //   8d45fc               | lea                 eax, [ebp - 4]
            //   50                   | push                eax
            //   ff75fc               | push                dword ptr [ebp - 4]
            //   6a05                 | push                5

        $sequence_9 = { 8d5b11 83c414 47 3b7820 72d1 }
            // n = 5, score = 800
            //   8d5b11               | lea                 ebx, [ebx + 0x11]
            //   83c414               | add                 esp, 0x14
            //   47                   | inc                 edi
            //   3b7820               | cmp                 edi, dword ptr [eax + 0x20]
            //   72d1                 | jb                  0xffffffd3

        $sequence_10 = { 8d6af8 d1ed 6a00 5f 743f 8d5808 }
            // n = 6, score = 800
            //   8d6af8               | lea                 ebp, [edx - 8]
            //   d1ed                 | shr                 ebp, 1
            //   6a00                 | push                0
            //   5f                   | pop                 edi
            //   743f                 | je                  0x41
            //   8d5808               | lea                 ebx, [eax + 8]

        $sequence_11 = { 3bfd 72c4 8b542414 0302 }
            // n = 4, score = 800
            //   3bfd                 | cmp                 edi, ebp
            //   72c4                 | jb                  0xffffffc6
            //   8b542414             | mov                 edx, dword ptr [esp + 0x14]
            //   0302                 | add                 eax, dword ptr [edx]

        $sequence_12 = { 03c2 eb5c 8d5004 89542414 }
            // n = 4, score = 800
            //   03c2                 | add                 eax, edx
            //   eb5c                 | jmp                 0x5e
            //   8d5004               | lea                 edx, [eax + 4]
            //   89542414             | mov                 dword ptr [esp + 0x14], edx

        $sequence_13 = { 57 33ff 397820 7633 53 8bdf }
            // n = 6, score = 800
            //   57                   | push                edi
            //   33ff                 | xor                 edi, edi
            //   397820               | cmp                 dword ptr [eax + 0x20], edi
            //   7633                 | jbe                 0x35
            //   53                   | push                ebx
            //   8bdf                 | mov                 ebx, edi

        $sequence_14 = { 8d4508 50 0fb6440b34 50 ff740b28 8b440b24 }
            // n = 6, score = 800
            //   8d4508               | lea                 eax, [ebp + 8]
            //   50                   | push                eax
            //   0fb6440b34           | movzx               eax, byte ptr [ebx + ecx + 0x34]
            //   50                   | push                eax
            //   ff740b28             | push                dword ptr [ebx + ecx + 0x28]
            //   8b440b24             | mov                 eax, dword ptr [ebx + ecx + 0x24]

        $sequence_15 = { 8d5004 89542414 8b12 85d2 7454 8d6af8 }
            // n = 6, score = 800
            //   8d5004               | lea                 edx, [eax + 4]
            //   89542414             | mov                 dword ptr [esp + 0x14], edx
            //   8b12                 | mov                 edx, dword ptr [edx]
            //   85d2                 | test                edx, edx
            //   7454                 | je                  0x56
            //   8d6af8               | lea                 ebp, [edx - 8]

        $sequence_16 = { ff15???????? 85c0 750a b8010000c0 e9???????? }
            // n = 5, score = 400
            //   ff15????????         |                     
            //   85c0                 | test                eax, eax
            //   750a                 | jne                 0xc
            //   b8010000c0           | mov                 eax, 0xc0000001
            //   e9????????           |                     

        $sequence_17 = { ff5010 85c0 7407 33c0 }
            // n = 4, score = 400
            //   ff5010               | call                dword ptr [eax + 0x10]
            //   85c0                 | test                eax, eax
            //   7407                 | je                  9
            //   33c0                 | xor                 eax, eax

        $sequence_18 = { 8a4173 a808 75f5 a804 7406 }
            // n = 5, score = 400
            //   8a4173               | mov                 al, byte ptr [ecx + 0x73]
            //   a808                 | test                al, 8
            //   75f5                 | jne                 0xfffffff7
            //   a804                 | test                al, 4
            //   7406                 | je                  8

        $sequence_19 = { 44 886b05 41 2ac7 41 02fd }
            // n = 6, score = 200
            //   44                   | inc                 esp
            //   886b05               | mov                 byte ptr [ebx + 5], ch
            //   41                   | inc                 ecx
            //   2ac7                 | sub                 al, bh
            //   41                   | inc                 ecx
            //   02fd                 | add                 bh, ch

        $sequence_20 = { 48 85d2 0f8422020000 33d2 }
            // n = 4, score = 200
            //   48                   | dec                 eax
            //   85d2                 | test                edx, edx
            //   0f8422020000         | je                  0x228
            //   33d2                 | xor                 edx, edx

        $sequence_21 = { 89433c 48 85c0 744e 41 }
            // n = 5, score = 200
            //   89433c               | mov                 dword ptr [ebx + 0x3c], eax
            //   48                   | dec                 eax
            //   85c0                 | test                eax, eax
            //   744e                 | je                  0x50
            //   41                   | inc                 ecx

        $sequence_22 = { 8d429c 49 03f9 48 8d6f16 48 8bcd }
            // n = 7, score = 200
            //   8d429c               | lea                 eax, [edx - 0x64]
            //   49                   | dec                 ecx
            //   03f9                 | add                 edi, ecx
            //   48                   | dec                 eax
            //   8d6f16               | lea                 ebp, [edi + 0x16]
            //   48                   | dec                 eax
            //   8bcd                 | mov                 ecx, ebp

        $sequence_23 = { 0fb64303 45 33c9 8b4858 8b4304 894de0 0fb74b02 }
            // n = 7, score = 200
            //   0fb64303             | movzx               eax, byte ptr [ebx + 3]
            //   45                   | inc                 ebp
            //   33c9                 | xor                 ecx, ecx
            //   8b4858               | mov                 ecx, dword ptr [eax + 0x58]
            //   8b4304               | mov                 eax, dword ptr [ebx + 4]
            //   894de0               | mov                 dword ptr [ebp - 0x20], ecx
            //   0fb74b02             | movzx               ecx, word ptr [ebx + 2]

        $sequence_24 = { 74e4 4533c9 48895c2420 4533c0 33c9 418d511a ff15???????? }
            // n = 7, score = 100
            //   74e4                 | mov                 edi, eax
            //   4533c9               | inc                 edi
            //   48895c2420           | cmp                 edi, dword ptr [ebx + 0x1c]
            //   4533c0               | jb                  0xffffffd9
            //   33c9                 | mov                 eax, dword ptr [ebx + 0xc]
            //   418d511a             | dec                 eax
            //   ff15????????         |                     

        $sequence_25 = { ff15???????? 4c8bc3 33d2 488bc8 ff15???????? 488bb590020000 4885f6 }
            // n = 7, score = 100
            //   ff15????????         |                     
            //   4c8bc3               | dec                 esp
            //   33d2                 | mov                 eax, ebx
            //   488bc8               | xor                 edx, edx
            //   ff15????????         |                     
            //   488bb590020000       | dec                 eax
            //   4885f6               | mov                 ecx, eax

        $sequence_26 = { 4883ff04 0f8210010000 4883ef04 48897c2430 4885db }
            // n = 5, score = 100
            //   4883ff04             | xor                 ecx, ecx
            //   0f8210010000         | inc                 ecx
            //   4883ef04             | lea                 edx, [ecx + 0x1a]
            //   48897c2430           | jne                 6
            //   4885db               | xor                 eax, eax

        $sequence_27 = { 741e 498b1f 4885db 7414 ff15???????? 4c8bc3 }
            // n = 6, score = 100
            //   741e                 | dec                 eax
            //   498b1f               | mov                 esi, dword ptr [ebp + 0x290]
            //   4885db               | dec                 eax
            //   7414                 | test                esi, esi
            //   ff15????????         |                     
            //   4c8bc3               | je                  0x20

        $sequence_28 = { 488bf2 488bd9 ff15???????? 4885c0 7504 }
            // n = 5, score = 100
            //   488bf2               | dec                 ecx
            //   488bd9               | mov                 ebx, dword ptr [edi]
            //   ff15????????         |                     
            //   4885c0               | dec                 eax
            //   7504                 | test                ebx, ebx

        $sequence_29 = { 7504 33c0 eb7e 488d15550d0000 488bc8 ff15???????? 488bf8 }
            // n = 7, score = 100
            //   7504                 | test                eax, eax
            //   33c0                 | jne                 9
            //   eb7e                 | inc                 esp
            //   488d15550d0000       | cmp                 ecx, ecx
            //   488bc8               | je                  0x5d
            //   ff15????????         |                     
            //   488bf8               | inc                 ebp

        $sequence_30 = { 443bc9 7458 4585d2 7420 }
            // n = 4, score = 100
            //   443bc9               | je                  0x19
            //   7458                 | dec                 esp
            //   4585d2               | mov                 eax, ebx
            //   7420                 | dec                 eax

        $sequence_31 = { ff15???????? ffc7 3b7b1c 72d7 8b430c 4803c6 0f845affffff }
            // n = 7, score = 100
            //   ff15????????         |                     
            //   ffc7                 | test                edx, edx
            //   3b7b1c               | je                  0x25
            //   72d7                 | dec                 eax
            //   8b430c               | mov                 dword ptr [esp + 0x20], ebx
            //   4803c6               | inc                 ebp
            //   0f845affffff         | xor                 eax, eax

    condition:
        7 of them and filesize < 303104
}