rule win_pipcreat_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.pipcreat."
        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.pipcreat"
        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 = { ffd6 ff35???????? ff15???????? 6a64 ffd6 e9???????? }
            // n = 6, score = 100
            //   ffd6                 | call                esi
            //   ff35????????         |                     
            //   ff15????????         |                     
            //   6a64                 | push                0x64
            //   ffd6                 | call                esi
            //   e9????????           |                     

        $sequence_1 = { c20400 55 8bec b808100000 e8???????? 53 56 }
            // n = 7, score = 100
            //   c20400               | ret                 4
            //   55                   | push                ebp
            //   8bec                 | mov                 ebp, esp
            //   b808100000           | mov                 eax, 0x1008
            //   e8????????           |                     
            //   53                   | push                ebx
            //   56                   | push                esi

        $sequence_2 = { 8d85a8eeffff 6800100000 50 ff35???????? }
            // n = 4, score = 100
            //   8d85a8eeffff         | lea                 eax, [ebp - 0x1158]
            //   6800100000           | push                0x1000
            //   50                   | push                eax
            //   ff35????????         |                     

        $sequence_3 = { 895de4 bffa0f0000 be10480010 8d45e4 50 ff75f0 }
            // n = 6, score = 100
            //   895de4               | mov                 dword ptr [ebp - 0x1c], ebx
            //   bffa0f0000           | mov                 edi, 0xffa
            //   be10480010           | mov                 esi, 0x10004810
            //   8d45e4               | lea                 eax, [ebp - 0x1c]
            //   50                   | push                eax
            //   ff75f0               | push                dword ptr [ebp - 0x10]

        $sequence_4 = { ff75f4 ff15???????? 85c0 74c8 }
            // n = 4, score = 100
            //   ff75f4               | push                dword ptr [ebp - 0xc]
            //   ff15????????         |                     
            //   85c0                 | test                eax, eax
            //   74c8                 | je                  0xffffffca

        $sequence_5 = { 8d85acdeffff 57 50 8d85aceeffff 50 }
            // n = 5, score = 100
            //   8d85acdeffff         | lea                 eax, [ebp - 0x2154]
            //   57                   | push                edi
            //   50                   | push                eax
            //   8d85aceeffff         | lea                 eax, [ebp - 0x1154]
            //   50                   | push                eax

        $sequence_6 = { 8945fc 57 ffd3 68fc0f0000 8d450c 56 50 }
            // n = 7, score = 100
            //   8945fc               | mov                 dword ptr [ebp - 4], eax
            //   57                   | push                edi
            //   ffd3                 | call                ebx
            //   68fc0f0000           | push                0xffc
            //   8d450c               | lea                 eax, [ebp + 0xc]
            //   56                   | push                esi
            //   50                   | push                eax

        $sequence_7 = { ff30 8d45f4 50 e8???????? 66a1???????? }
            // n = 5, score = 100
            //   ff30                 | push                dword ptr [eax]
            //   8d45f4               | lea                 eax, [ebp - 0xc]
            //   50                   | push                eax
            //   e8????????           |                     
            //   66a1????????         |                     

        $sequence_8 = { 8d85aceeffff 50 ff15???????? 8d85a8eeffff 56 50 }
            // n = 6, score = 100
            //   8d85aceeffff         | lea                 eax, [ebp - 0x1154]
            //   50                   | push                eax
            //   ff15????????         |                     
            //   8d85a8eeffff         | lea                 eax, [ebp - 0x1158]
            //   56                   | push                esi
            //   50                   | push                eax

        $sequence_9 = { 85c0 a3???????? 5e 7403 33c0 c3 }
            // n = 6, score = 100
            //   85c0                 | test                eax, eax
            //   a3????????           |                     
            //   5e                   | pop                 esi
            //   7403                 | je                  5
            //   33c0                 | xor                 eax, eax
            //   c3                   | ret                 

    condition:
        7 of them and filesize < 65536
}