rule win_citadel_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.citadel."
        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.citadel"
        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 = { eb0e 6800800000 53 57 }
            // n = 4, score = 5100
            //   eb0e                 | jmp                 0x10
            //   6800800000           | push                0x8000
            //   53                   | push                ebx
            //   57                   | push                edi

        $sequence_1 = { 03f7 6a0d 5f e8???????? }
            // n = 4, score = 5000
            //   03f7                 | add                 esi, edi
            //   6a0d                 | push                0xd
            //   5f                   | pop                 edi
            //   e8????????           |                     

        $sequence_2 = { ff15???????? 85c0 0f8566010000 57 57 57 57 }
            // n = 7, score = 5000
            //   ff15????????         |                     
            //   85c0                 | test                eax, eax
            //   0f8566010000         | jne                 0x16c
            //   57                   | push                edi
            //   57                   | push                edi
            //   57                   | push                edi
            //   57                   | push                edi

        $sequence_3 = { 50 57 e8???????? 33db 3c01 }
            // n = 5, score = 5000
            //   50                   | push                eax
            //   57                   | push                edi
            //   e8????????           |                     
            //   33db                 | xor                 ebx, ebx
            //   3c01                 | cmp                 al, 1

        $sequence_4 = { a1???????? 57 e8???????? 8945fc }
            // n = 4, score = 5000
            //   a1????????           |                     
            //   57                   | push                edi
            //   e8????????           |                     
            //   8945fc               | mov                 dword ptr [ebp - 4], eax

        $sequence_5 = { 3d00002003 7715 8b4d08 890e 895604 895e0c }
            // n = 6, score = 5000
            //   3d00002003           | cmp                 eax, 0x3200000
            //   7715                 | ja                  0x17
            //   8b4d08               | mov                 ecx, dword ptr [ebp + 8]
            //   890e                 | mov                 dword ptr [esi], ecx
            //   895604               | mov                 dword ptr [esi + 4], edx
            //   895e0c               | mov                 dword ptr [esi + 0xc], ebx

        $sequence_6 = { 743b 68???????? 03f7 6a0d }
            // n = 4, score = 5000
            //   743b                 | je                  0x3d
            //   68????????           |                     
            //   03f7                 | add                 esi, edi
            //   6a0d                 | push                0xd

        $sequence_7 = { 33c9 663918 7507 41 66395802 7405 83c002 }
            // n = 7, score = 5000
            //   33c9                 | xor                 ecx, ecx
            //   663918               | cmp                 word ptr [eax], bx
            //   7507                 | jne                 9
            //   41                   | inc                 ecx
            //   66395802             | cmp                 word ptr [eax + 2], bx
            //   7405                 | je                  7
            //   83c002               | add                 eax, 2

        $sequence_8 = { ff4df8 47 0f8525ffffff 5b }
            // n = 4, score = 3900
            //   ff4df8               | dec                 dword ptr [ebp - 8]
            //   47                   | inc                 edi
            //   0f8525ffffff         | jne                 0xffffff2b
            //   5b                   | pop                 ebx

        $sequence_9 = { eb30 d0e8 3ac3 73fa 0fb6c0 8b44c104 }
            // n = 6, score = 3900
            //   eb30                 | jmp                 0x32
            //   d0e8                 | shr                 al, 1
            //   3ac3                 | cmp                 al, bl
            //   73fa                 | jae                 0xfffffffc
            //   0fb6c0               | movzx               eax, al
            //   8b44c104             | mov                 eax, dword ptr [ecx + eax*8 + 4]

        $sequence_10 = { 85c0 7404 84d2 7548 33c0 85c0 }
            // n = 6, score = 3900
            //   85c0                 | test                eax, eax
            //   7404                 | je                  6
            //   84d2                 | test                dl, dl
            //   7548                 | jne                 0x4a
            //   33c0                 | xor                 eax, eax
            //   85c0                 | test                eax, eax

        $sequence_11 = { 0f8417010000 85ff 0f84dd000000 53 837df800 0f84d1000000 803e00 }
            // n = 7, score = 3900
            //   0f8417010000         | je                  0x11d
            //   85ff                 | test                edi, edi
            //   0f84dd000000         | je                  0xe3
            //   53                   | push                ebx
            //   837df800             | cmp                 dword ptr [ebp - 8], 0
            //   0f84d1000000         | je                  0xd7
            //   803e00               | cmp                 byte ptr [esi], 0

        $sequence_12 = { 85c0 7404 84d2 7575 33c0 85c0 740b }
            // n = 7, score = 3900
            //   85c0                 | test                eax, eax
            //   7404                 | je                  6
            //   84d2                 | test                dl, dl
            //   7575                 | jne                 0x77
            //   33c0                 | xor                 eax, eax
            //   85c0                 | test                eax, eax
            //   740b                 | je                  0xd

        $sequence_13 = { 8a0f ffd0 8807 fe45ff }
            // n = 4, score = 3900
            //   8a0f                 | mov                 cl, byte ptr [edi]
            //   ffd0                 | call                eax
            //   8807                 | mov                 byte ptr [edi], al
            //   fe45ff               | inc                 byte ptr [ebp - 1]

        $sequence_14 = { 763c 8a06 2a45ff 8a5602 }
            // n = 4, score = 3900
            //   763c                 | jbe                 0x3e
            //   8a06                 | mov                 al, byte ptr [esi]
            //   2a45ff               | sub                 al, byte ptr [ebp - 1]
            //   8a5602               | mov                 dl, byte ptr [esi + 2]

        $sequence_15 = { 8bec 51 51 57 8bf8 c745f801000000 85f6 }
            // n = 7, score = 3900
            //   8bec                 | mov                 ebp, esp
            //   51                   | push                ecx
            //   51                   | push                ecx
            //   57                   | push                edi
            //   8bf8                 | mov                 edi, eax
            //   c745f801000000       | mov                 dword ptr [ebp - 8], 1
            //   85f6                 | test                esi, esi

    condition:
        7 of them and filesize < 1236992
}