rule win_miancha_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.miancha."
        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.miancha"
        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 = { 68???????? 52 ffd6 85c0 740b }
            // n = 5, score = 200
            //   68????????           |                     
            //   52                   | push                edx
            //   ffd6                 | call                esi
            //   85c0                 | test                eax, eax
            //   740b                 | je                  0xd

        $sequence_1 = { ffd6 85c0 741a 837c241800 }
            // n = 4, score = 200
            //   ffd6                 | call                esi
            //   85c0                 | test                eax, eax
            //   741a                 | je                  0x1c
            //   837c241800           | cmp                 dword ptr [esp + 0x18], 0

        $sequence_2 = { ff15???????? 8bf0 85f6 7412 8d542418 52 }
            // n = 6, score = 200
            //   ff15????????         |                     
            //   8bf0                 | mov                 esi, eax
            //   85f6                 | test                esi, esi
            //   7412                 | je                  0x14
            //   8d542418             | lea                 edx, [esp + 0x18]
            //   52                   | push                edx

        $sequence_3 = { 85c0 741f 6a00 6800040000 }
            // n = 4, score = 200
            //   85c0                 | test                eax, eax
            //   741f                 | je                  0x21
            //   6a00                 | push                0
            //   6800040000           | push                0x400

        $sequence_4 = { 50 56 8b35???????? 6a02 6a00 68???????? 52 }
            // n = 7, score = 200
            //   50                   | push                eax
            //   56                   | push                esi
            //   8b35????????         |                     
            //   6a02                 | push                2
            //   6a00                 | push                0
            //   68????????           |                     
            //   52                   | push                edx

        $sequence_5 = { 8d542418 52 ff15???????? 50 ffd6 85c0 }
            // n = 6, score = 200
            //   8d542418             | lea                 edx, [esp + 0x18]
            //   52                   | push                edx
            //   ff15????????         |                     
            //   50                   | push                eax
            //   ffd6                 | call                esi
            //   85c0                 | test                eax, eax

        $sequence_6 = { 52 ff15???????? 50 ffd6 85c0 741a }
            // n = 6, score = 200
            //   52                   | push                edx
            //   ff15????????         |                     
            //   50                   | push                eax
            //   ffd6                 | call                esi
            //   85c0                 | test                eax, eax
            //   741a                 | je                  0x1c

        $sequence_7 = { 85f6 7412 8d542418 52 ff15???????? 50 }
            // n = 6, score = 200
            //   85f6                 | test                esi, esi
            //   7412                 | je                  0x14
            //   8d542418             | lea                 edx, [esp + 0x18]
            //   52                   | push                edx
            //   ff15????????         |                     
            //   50                   | push                eax

        $sequence_8 = { 85f6 7412 8d542418 52 ff15???????? 50 ffd6 }
            // n = 7, score = 200
            //   85f6                 | test                esi, esi
            //   7412                 | je                  0x14
            //   8d542418             | lea                 edx, [esp + 0x18]
            //   52                   | push                edx
            //   ff15????????         |                     
            //   50                   | push                eax
            //   ffd6                 | call                esi

        $sequence_9 = { 8d542418 52 ff15???????? 50 ffd6 }
            // n = 5, score = 200
            //   8d542418             | lea                 edx, [esp + 0x18]
            //   52                   | push                edx
            //   ff15????????         |                     
            //   50                   | push                eax
            //   ffd6                 | call                esi

    condition:
        7 of them and filesize < 376832
}