rule win_acridrain_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.acridrain."
        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.acridrain"
        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 = { ffb744010000 56 e8???????? 83c408 85f6 740a 0fb64718 }
            // n = 7, score = 200
            //   ffb744010000         | push                dword ptr [edi + 0x144]
            //   56                   | push                esi
            //   e8????????           |                     
            //   83c408               | add                 esp, 8
            //   85f6                 | test                esi, esi
            //   740a                 | je                  0xc
            //   0fb64718             | movzx               eax, byte ptr [edi + 0x18]

        $sequence_1 = { 83c42c 85ff 0f85bf030000 3945f4 758e eb24 56 }
            // n = 7, score = 200
            //   83c42c               | add                 esp, 0x2c
            //   85ff                 | test                edi, edi
            //   0f85bf030000         | jne                 0x3c5
            //   3945f4               | cmp                 dword ptr [ebp - 0xc], eax
            //   758e                 | jne                 0xffffff90
            //   eb24                 | jmp                 0x26
            //   56                   | push                esi

        $sequence_2 = { 8b4714 0306 8945e4 e9???????? 57 6a00 ff77e0 }
            // n = 7, score = 200
            //   8b4714               | mov                 eax, dword ptr [edi + 0x14]
            //   0306                 | add                 eax, dword ptr [esi]
            //   8945e4               | mov                 dword ptr [ebp - 0x1c], eax
            //   e9????????           |                     
            //   57                   | push                edi
            //   6a00                 | push                0
            //   ff77e0               | push                dword ptr [edi - 0x20]

        $sequence_3 = { eb58 8b750c 8d047f 8d14c6 81cb00100400 c742e807000000 eb40 }
            // n = 7, score = 200
            //   eb58                 | jmp                 0x5a
            //   8b750c               | mov                 esi, dword ptr [ebp + 0xc]
            //   8d047f               | lea                 eax, [edi + edi*2]
            //   8d14c6               | lea                 edx, [esi + eax*8]
            //   81cb00100400         | or                  ebx, 0x41000
            //   c742e807000000       | mov                 dword ptr [edx - 0x18], 7
            //   eb40                 | jmp                 0x42

        $sequence_4 = { ff742418 e8???????? 57 e8???????? 83c410 8bf0 5e }
            // n = 7, score = 200
            //   ff742418             | push                dword ptr [esp + 0x18]
            //   e8????????           |                     
            //   57                   | push                edi
            //   e8????????           |                     
            //   83c410               | add                 esp, 0x10
            //   8bf0                 | mov                 esi, eax
            //   5e                   | pop                 esi

        $sequence_5 = { eb28 8b750c 8d047f 8d14c6 81cb00100800 c742e807000000 eb10 }
            // n = 7, score = 200
            //   eb28                 | jmp                 0x2a
            //   8b750c               | mov                 esi, dword ptr [ebp + 0xc]
            //   8d047f               | lea                 eax, [edi + edi*2]
            //   8d14c6               | lea                 edx, [esi + eax*8]
            //   81cb00100800         | or                  ebx, 0x81000
            //   c742e807000000       | mov                 dword ptr [edx - 0x18], 7
            //   eb10                 | jmp                 0x12

        $sequence_6 = { ff7010 56 53 e8???????? 8b8dd8fdffff 83c40c 8a11 }
            // n = 7, score = 200
            //   ff7010               | push                dword ptr [eax + 0x10]
            //   56                   | push                esi
            //   53                   | push                ebx
            //   e8????????           |                     
            //   8b8dd8fdffff         | mov                 ecx, dword ptr [ebp - 0x228]
            //   83c40c               | add                 esp, 0xc
            //   8a11                 | mov                 dl, byte ptr [ecx]

        $sequence_7 = { ff7208 6a00 56 6a00 6a61 53 e8???????? }
            // n = 7, score = 200
            //   ff7208               | push                dword ptr [edx + 8]
            //   6a00                 | push                0
            //   56                   | push                esi
            //   6a00                 | push                0
            //   6a61                 | push                0x61
            //   53                   | push                ebx
            //   e8????????           |                     

        $sequence_8 = { ff731c 8b4724 ff7310 ff7728 ffd0 83c410 85c0 }
            // n = 7, score = 200
            //   ff731c               | push                dword ptr [ebx + 0x1c]
            //   8b4724               | mov                 eax, dword ptr [edi + 0x24]
            //   ff7310               | push                dword ptr [ebx + 0x10]
            //   ff7728               | push                dword ptr [edi + 0x28]
            //   ffd0                 | call                eax
            //   83c410               | add                 esp, 0x10
            //   85c0                 | test                eax, eax

        $sequence_9 = { ffb3a0000000 8b08 ff75f0 50 8b410c ffd0 83c414 }
            // n = 7, score = 200
            //   ffb3a0000000         | push                dword ptr [ebx + 0xa0]
            //   8b08                 | mov                 ecx, dword ptr [eax]
            //   ff75f0               | push                dword ptr [ebp - 0x10]
            //   50                   | push                eax
            //   8b410c               | mov                 eax, dword ptr [ecx + 0xc]
            //   ffd0                 | call                eax
            //   83c414               | add                 esp, 0x14

    condition:
        7 of them and filesize < 2244608
}