rule win_pseudo_manuscrypt_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.pseudo_manuscrypt."
        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.pseudo_manuscrypt"
        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 = { c706???????? c7460401000000 c7460800000000 c7460c00000000 c7461010270000 e8???????? 6a00 }
            // n = 7, score = 200
            //   c706????????         |                     
            //   c7460401000000       | mov                 dword ptr [esi + 4], 1
            //   c7460800000000       | mov                 dword ptr [esi + 8], 0
            //   c7460c00000000       | mov                 dword ptr [esi + 0xc], 0
            //   c7461010270000       | mov                 dword ptr [esi + 0x10], 0x2710
            //   e8????????           |                     
            //   6a00                 | push                0

        $sequence_1 = { 53 56 8b35???????? 8bd9 6a00 6a00 6a01 }
            // n = 7, score = 200
            //   53                   | push                ebx
            //   56                   | push                esi
            //   8b35????????         |                     
            //   8bd9                 | mov                 ebx, ecx
            //   6a00                 | push                0
            //   6a00                 | push                0
            //   6a01                 | push                1

        $sequence_2 = { ff750c ff7004 8b4e48 56 8b11 ff5210 5e }
            // n = 7, score = 200
            //   ff750c               | push                dword ptr [ebp + 0xc]
            //   ff7004               | push                dword ptr [eax + 4]
            //   8b4e48               | mov                 ecx, dword ptr [esi + 0x48]
            //   56                   | push                esi
            //   8b11                 | mov                 edx, dword ptr [ecx]
            //   ff5210               | call                dword ptr [edx + 0x10]
            //   5e                   | pop                 esi

        $sequence_3 = { 0f11465c 660fd6466c c7467400000000 ff763c c7464000000000 c7464400000000 c7465403000000 }
            // n = 7, score = 200
            //   0f11465c             | movups              xmmword ptr [esi + 0x5c], xmm0
            //   660fd6466c           | movq                qword ptr [esi + 0x6c], xmm0
            //   c7467400000000       | mov                 dword ptr [esi + 0x74], 0
            //   ff763c               | push                dword ptr [esi + 0x3c]
            //   c7464000000000       | mov                 dword ptr [esi + 0x40], 0
            //   c7464400000000       | mov                 dword ptr [esi + 0x44], 0
            //   c7465403000000       | mov                 dword ptr [esi + 0x54], 3

        $sequence_4 = { e8???????? 8b7dd4 56 ff75f0 57 e8???????? 8b45fc }
            // n = 7, score = 200
            //   e8????????           |                     
            //   8b7dd4               | mov                 edi, dword ptr [ebp - 0x2c]
            //   56                   | push                esi
            //   ff75f0               | push                dword ptr [ebp - 0x10]
            //   57                   | push                edi
            //   e8????????           |                     
            //   8b45fc               | mov                 eax, dword ptr [ebp - 4]

        $sequence_5 = { 50 ff15???????? 8b95e4fdffff 8b8de8fdffff 42 83c118 8995e4fdffff }
            // n = 7, score = 200
            //   50                   | push                eax
            //   ff15????????         |                     
            //   8b95e4fdffff         | mov                 edx, dword ptr [ebp - 0x21c]
            //   8b8de8fdffff         | mov                 ecx, dword ptr [ebp - 0x218]
            //   42                   | inc                 edx
            //   83c118               | add                 ecx, 0x18
            //   8995e4fdffff         | mov                 dword ptr [ebp - 0x21c], edx

        $sequence_6 = { 85c0 7403 50 ffd7 8d4e1c e8???????? ff7608 }
            // n = 7, score = 200
            //   85c0                 | test                eax, eax
            //   7403                 | je                  5
            //   50                   | push                eax
            //   ffd7                 | call                edi
            //   8d4e1c               | lea                 ecx, [esi + 0x1c]
            //   e8????????           |                     
            //   ff7608               | push                dword ptr [esi + 8]

        $sequence_7 = { 6a40 6800300000 57 6a00 ff742440 ff15???????? }
            // n = 6, score = 200
            //   6a40                 | push                0x40
            //   6800300000           | push                0x3000
            //   57                   | push                edi
            //   6a00                 | push                0
            //   ff742440             | push                dword ptr [esp + 0x40]
            //   ff15????????         |                     

        $sequence_8 = { c745d400000000 837e7000 8bbeb4000000 8bdf 8b464c 8945f4 897dfc }
            // n = 7, score = 200
            //   c745d400000000       | mov                 dword ptr [ebp - 0x2c], 0
            //   837e7000             | cmp                 dword ptr [esi + 0x70], 0
            //   8bbeb4000000         | mov                 edi, dword ptr [esi + 0xb4]
            //   8bdf                 | mov                 ebx, edi
            //   8b464c               | mov                 eax, dword ptr [esi + 0x4c]
            //   8945f4               | mov                 dword ptr [ebp - 0xc], eax
            //   897dfc               | mov                 dword ptr [ebp - 4], edi

        $sequence_9 = { 33c9 8945ec 8b87b4010000 8945e8 83fb08 0f8299000000 8bc3 }
            // n = 7, score = 200
            //   33c9                 | xor                 ecx, ecx
            //   8945ec               | mov                 dword ptr [ebp - 0x14], eax
            //   8b87b4010000         | mov                 eax, dword ptr [edi + 0x1b4]
            //   8945e8               | mov                 dword ptr [ebp - 0x18], eax
            //   83fb08               | cmp                 ebx, 8
            //   0f8299000000         | jb                  0x9f
            //   8bc3                 | mov                 eax, ebx

    condition:
        7 of them and filesize < 753664
}