rule win_doubleback_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.doubleback."
        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.doubleback"
        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 = { b9e3050000 eb3b b90b070000 eb34 2d63450000 7428 2d57020000 }
            // n = 7, score = 400
            //   b9e3050000           | xor                 ecx, ecx
            //   eb3b                 | inc                 esp
            //   b90b070000           | mov                 eax, esi
            //   eb34                 | dec                 eax
            //   2d63450000           | mov                 ecx, eax
            //   7428                 | jmp                 0xb49
            //   2d57020000           | mov                 ebp, eax

        $sequence_1 = { b9ad060000 eb57 b9a7060000 eb50 b947060000 eb49 b9e7050000 }
            // n = 7, score = 400
            //   b9ad060000           | mov                 ebx, eax
            //   eb57                 | test                ebx, ebx
            //   b9a7060000           | je                  0xb63
            //   eb50                 | dec                 eax
            //   b947060000           | mov                 ecx, eax
            //   eb49                 | dec                 esp
            //   b9e7050000           | mov                 esi, eax

        $sequence_2 = { b9d4070000 eb13 b975070000 eb0c b96f070000 eb05 b911070000 }
            // n = 7, score = 400
            //   b9d4070000           | dec                 eax
            //   eb13                 | mov                 ecx, eax
            //   b975070000           | lea                 esi, [ebp + 1]
            //   eb0c                 | dec                 esp
            //   b96f070000           | mov                 dword ptr [esp + 0x28], esp
            //   eb05                 | mov                 edi, eax
            //   b911070000           | inc                 ebp

        $sequence_3 = { eb49 b9e7050000 eb42 b9e3050000 }
            // n = 4, score = 400
            //   eb49                 | mov                 eax, ecx
            //   b9e7050000           | shr                 eax, 2
            //   eb42                 | mov                 dword ptr [esi + 8], eax
            //   b9e3050000           | mov                 dword ptr [esi + 4], eax

        $sequence_4 = { 751a b9d4070000 eb13 b975070000 eb0c b96f070000 eb05 }
            // n = 7, score = 400
            //   751a                 | pop                 edi
            //   b9d4070000           | pop                 ebx
            //   eb13                 | jl                  0xc56
            //   b975070000           | mov                 ecx, edi
            //   eb0c                 | mov                 eax, ebx
            //   b96f070000           | pop                 esi
            //   eb05                 | pop                 edi

        $sequence_5 = { 740e 3dab3f0000 755e b9ad060000 eb57 b9a7060000 }
            // n = 6, score = 400
            //   740e                 | inc                 ecx
            //   3dab3f0000           | mov                 esi, 0x3000
            //   755e                 | inc                 ebp
            //   b9ad060000           | mov                 ecx, ebp
            //   eb57                 | inc                 ebp
            //   b9a7060000           | mov                 eax, esi

        $sequence_6 = { eb42 b9e3050000 eb3b b90b070000 eb34 2d63450000 7428 }
            // n = 7, score = 400
            //   eb42                 | inc                 ebp
            //   b9e3050000           | xor                 eax, eax
            //   eb3b                 | dec                 ecx
            //   b90b070000           | and                 dword ptr [ebx - 0x48], 0
            //   eb34                 | xor                 edx, edx
            //   2d63450000           | dec                 eax
            //   7428                 | or                  ecx, 0xffffffff

        $sequence_7 = { b9ad060000 eb57 b9a7060000 eb50 b947060000 eb49 }
            // n = 6, score = 400
            //   b9ad060000           | inc                 ebp
            //   eb57                 | mov                 dword ptr [esi], esp
            //   b9a7060000           | dec                 ecx
            //   eb50                 | mov                 ecx, edi
            //   b947060000           | jmp                 0x1fec
            //   eb49                 | inc                 ecx

        $sequence_8 = { 742a 3d39380000 741c 3dd73a0000 740e 3dab3f0000 755e }
            // n = 7, score = 400
            //   742a                 | dec                 eax
            //   3d39380000           | mov                 dword ptr [esp + 0x20], eax
            //   741c                 | dec                 esp
            //   3dd73a0000           | lea                 edi, [edi + 0x500]
            //   740e                 | dec                 eax
            //   3dab3f0000           | lea                 eax, [edi + 0x4c4]
            //   755e                 | dec                 esp

        $sequence_9 = { b9ad060000 eb57 b9a7060000 eb50 }
            // n = 4, score = 400
            //   b9ad060000           | arpl                ax, di
            //   eb57                 | dec                 ebp
            //   b9a7060000           | lea                 esi, [edi + 0x20]
            //   eb50                 | add                 eax, 0x18

    condition:
        7 of them and filesize < 106496
}