rule win_telebot_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.telebot."
        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.telebot"
        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 = { 893424 ffd3 83ec08 85c0 a3???????? 0f84eb050000 c7442404???????? }
            // n = 7, score = 100
            //   893424               | mov                 dword ptr [esp], esi
            //   ffd3                 | call                ebx
            //   83ec08               | sub                 esp, 8
            //   85c0                 | test                eax, eax
            //   a3????????           |                     
            //   0f84eb050000         | je                  0x5f1
            //   c7442404????????     |                     

        $sequence_1 = { 0fb71446 6685d2 7411 0fb74c5464 8d5901 6689044f 66895c5464 }
            // n = 7, score = 100
            //   0fb71446             | movzx               edx, word ptr [esi + eax*2]
            //   6685d2               | test                dx, dx
            //   7411                 | je                  0x13
            //   0fb74c5464           | movzx               ecx, word ptr [esp + edx*2 + 0x64]
            //   8d5901               | lea                 ebx, [ecx + 1]
            //   6689044f             | mov                 word ptr [edi + ecx*2], ax
            //   66895c5464           | mov                 word ptr [esp + edx*2 + 0x64], bx

        $sequence_2 = { 8b5c2440 8b742444 85db 0f8499010000 85f6 0f8491010000 8b6e1c }
            // n = 7, score = 100
            //   8b5c2440             | mov                 ebx, dword ptr [esp + 0x40]
            //   8b742444             | mov                 esi, dword ptr [esp + 0x44]
            //   85db                 | test                ebx, ebx
            //   0f8499010000         | je                  0x19f
            //   85f6                 | test                esi, esi
            //   0f8491010000         | je                  0x197
            //   8b6e1c               | mov                 ebp, dword ptr [esi + 0x1c]

        $sequence_3 = { 0fb61c43 881c24 8b5c2438 0fb73c43 8b4c2404 2b4c2408 }
            // n = 6, score = 100
            //   0fb61c43             | movzx               ebx, byte ptr [ebx + eax*2]
            //   881c24               | mov                 byte ptr [esp], bl
            //   8b5c2438             | mov                 ebx, dword ptr [esp + 0x38]
            //   0fb73c43             | movzx               edi, word ptr [ebx + eax*2]
            //   8b4c2404             | mov                 ecx, dword ptr [esp + 4]
            //   2b4c2408             | sub                 ecx, dword ptr [esp + 8]

        $sequence_4 = { 83c204 d1e8 75f3 d1fd 7458 31ff }
            // n = 6, score = 100
            //   83c204               | add                 edx, 4
            //   d1e8                 | shr                 eax, 1
            //   75f3                 | jne                 0xfffffff5
            //   d1fd                 | sar                 ebp, 1
            //   7458                 | je                  0x5a
            //   31ff                 | xor                 edi, edi

        $sequence_5 = { e8???????? 29df 0f8584000000 8b4630 8b5628 01d8 }
            // n = 6, score = 100
            //   e8????????           |                     
            //   29df                 | sub                 edi, ebx
            //   0f8584000000         | jne                 0x8a
            //   8b4630               | mov                 eax, dword ptr [esi + 0x30]
            //   8b5628               | mov                 edx, dword ptr [esi + 0x28]
            //   01d8                 | add                 eax, ebx

        $sequence_6 = { 8b542414 891424 ff15???????? 892c24 ff15???????? 85c0 7531 }
            // n = 7, score = 100
            //   8b542414             | mov                 edx, dword ptr [esp + 0x14]
            //   891424               | mov                 dword ptr [esp], edx
            //   ff15????????         |                     
            //   892c24               | mov                 dword ptr [esp], ebp
            //   ff15????????         |                     
            //   85c0                 | test                eax, eax
            //   7531                 | jne                 0x33

        $sequence_7 = { c744240800000000 895c2404 c7042400000000 e8???????? 85c0 89c6 }
            // n = 6, score = 100
            //   c744240800000000     | mov                 dword ptr [esp + 8], 0
            //   895c2404             | mov                 dword ptr [esp + 4], ebx
            //   c7042400000000       | mov                 dword ptr [esp], 0
            //   e8????????           |                     
            //   85c0                 | test                eax, eax
            //   89c6                 | mov                 esi, eax

        $sequence_8 = { 89f1 83e801 23442414 d3e0 014238 31c0 }
            // n = 6, score = 100
            //   89f1                 | mov                 ecx, esi
            //   83e801               | sub                 eax, 1
            //   23442414             | and                 eax, dword ptr [esp + 0x14]
            //   d3e0                 | shl                 eax, cl
            //   014238               | add                 dword ptr [edx + 0x38], eax
            //   31c0                 | xor                 eax, eax

        $sequence_9 = { 01d6 39c8 77e3 89d8 896c2444 89cb 89c1 }
            // n = 7, score = 100
            //   01d6                 | add                 esi, edx
            //   39c8                 | cmp                 eax, ecx
            //   77e3                 | ja                  0xffffffe5
            //   89d8                 | mov                 eax, ebx
            //   896c2444             | mov                 dword ptr [esp + 0x44], ebp
            //   89cb                 | mov                 ebx, ecx
            //   89c1                 | mov                 ecx, eax

    condition:
        7 of them and filesize < 393216
}