rule win_plugx_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.plugx."
        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.plugx"
        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 = { 56 8b750c 8b4604 050070ffff }
            // n = 4, score = 1400
            //   56                   | push                esi
            //   8b750c               | mov                 esi, dword ptr [ebp + 0xc]
            //   8b4604               | mov                 eax, dword ptr [esi + 4]
            //   050070ffff           | add                 eax, 0xffff7000

        $sequence_1 = { 0145f4 8b45fc 0fafc3 33d2 }
            // n = 4, score = 1400
            //   0145f4               | add                 dword ptr [ebp - 0xc], eax
            //   8b45fc               | mov                 eax, dword ptr [ebp - 4]
            //   0fafc3               | imul                eax, ebx
            //   33d2                 | xor                 edx, edx

        $sequence_2 = { 51 56 57 6a1c 8bf8 e8???????? 8bf0 }
            // n = 7, score = 1400
            //   51                   | push                ecx
            //   56                   | push                esi
            //   57                   | push                edi
            //   6a1c                 | push                0x1c
            //   8bf8                 | mov                 edi, eax
            //   e8????????           |                     
            //   8bf0                 | mov                 esi, eax

        $sequence_3 = { 51 53 6a00 6a00 6a02 ffd0 }
            // n = 6, score = 1400
            //   51                   | push                ecx
            //   53                   | push                ebx
            //   6a00                 | push                0
            //   6a00                 | push                0
            //   6a02                 | push                2
            //   ffd0                 | call                eax

        $sequence_4 = { 55 8bec 8b450c 81780402700000 }
            // n = 4, score = 1400
            //   55                   | push                ebp
            //   8bec                 | mov                 ebp, esp
            //   8b450c               | mov                 eax, dword ptr [ebp + 0xc]
            //   81780402700000       | cmp                 dword ptr [eax + 4], 0x7002

        $sequence_5 = { 55 8bec a1???????? 83ec5c 53 }
            // n = 5, score = 1400
            //   55                   | push                ebp
            //   8bec                 | mov                 ebp, esp
            //   a1????????           |                     
            //   83ec5c               | sub                 esp, 0x5c
            //   53                   | push                ebx

        $sequence_6 = { 33d2 f7f3 33d2 8945fc }
            // n = 4, score = 1400
            //   33d2                 | xor                 edx, edx
            //   f7f3                 | div                 ebx
            //   33d2                 | xor                 edx, edx
            //   8945fc               | mov                 dword ptr [ebp - 4], eax

        $sequence_7 = { e8???????? 85c0 7508 e8???????? 8945fc }
            // n = 5, score = 1000
            //   e8????????           |                     
            //   85c0                 | test                eax, eax
            //   7508                 | jne                 0xa
            //   e8????????           |                     
            //   8945fc               | mov                 dword ptr [ebp - 4], eax

        $sequence_8 = { e8???????? 3de5030000 7407 e8???????? }
            // n = 4, score = 1000
            //   e8????????           |                     
            //   3de5030000           | cmp                 eax, 0x3e5
            //   7407                 | je                  9
            //   e8????????           |                     

        $sequence_9 = { 85c0 7413 e8???????? 3de5030000 }
            // n = 4, score = 1000
            //   85c0                 | test                eax, eax
            //   7413                 | je                  0x15
            //   e8????????           |                     
            //   3de5030000           | cmp                 eax, 0x3e5

        $sequence_10 = { e8???????? 85c0 7407 b84f050000 }
            // n = 4, score = 900
            //   e8????????           |                     
            //   85c0                 | test                eax, eax
            //   7407                 | je                  9
            //   b84f050000           | mov                 eax, 0x54f

        $sequence_11 = { 50 ff15???????? a3???????? 8b4d18 }
            // n = 4, score = 900
            //   50                   | push                eax
            //   ff15????????         |                     
            //   a3????????           |                     
            //   8b4d18               | mov                 ecx, dword ptr [ebp + 0x18]

        $sequence_12 = { e8???????? 85c0 750a e8???????? 8945fc }
            // n = 5, score = 800
            //   e8????????           |                     
            //   85c0                 | test                eax, eax
            //   750a                 | jne                 0xc
            //   e8????????           |                     
            //   8945fc               | mov                 dword ptr [ebp - 4], eax

        $sequence_13 = { 85c0 750d e8???????? 8945f4 }
            // n = 4, score = 700
            //   85c0                 | test                eax, eax
            //   750d                 | jne                 0xf
            //   e8????????           |                     
            //   8945f4               | mov                 dword ptr [ebp - 0xc], eax

        $sequence_14 = { 51 6a00 6800100000 6800100000 68ff000000 6a00 6803000040 }
            // n = 7, score = 600
            //   51                   | push                ecx
            //   6a00                 | push                0
            //   6800100000           | push                0x1000
            //   6800100000           | push                0x1000
            //   68ff000000           | push                0xff
            //   6a00                 | push                0
            //   6803000040           | push                0x40000003

        $sequence_15 = { 50 ff75e8 6802000080 e8???????? }
            // n = 4, score = 500
            //   50                   | push                eax
            //   ff75e8               | push                dword ptr [ebp - 0x18]
            //   6802000080           | push                0x80000002
            //   e8????????           |                     

        $sequence_16 = { 55 53 57 56 ffd0 }
            // n = 5, score = 400
            //   55                   | push                ebp
            //   53                   | push                ebx
            //   57                   | push                edi
            //   56                   | push                esi
            //   ffd0                 | call                eax

        $sequence_17 = { 89742434 89f1 8b442434 e8???????? }
            // n = 4, score = 400
            //   89742434             | mov                 dword ptr [esp + 0x34], esi
            //   89f1                 | mov                 ecx, esi
            //   8b442434             | mov                 eax, dword ptr [esp + 0x34]
            //   e8????????           |                     

        $sequence_18 = { 6808020000 6a00 ff74242c e8???????? }
            // n = 4, score = 400
            //   6808020000           | push                0x208
            //   6a00                 | push                0
            //   ff74242c             | push                dword ptr [esp + 0x2c]
            //   e8????????           |                     

        $sequence_19 = { 89442424 8b442424 6808020000 6a00 }
            // n = 4, score = 400
            //   89442424             | mov                 dword ptr [esp + 0x24], eax
            //   8b442424             | mov                 eax, dword ptr [esp + 0x24]
            //   6808020000           | push                0x208
            //   6a00                 | push                0

        $sequence_20 = { 50 56 ffb42480000000 ff15???????? }
            // n = 4, score = 400
            //   50                   | push                eax
            //   56                   | push                esi
            //   ffb42480000000       | push                dword ptr [esp + 0x80]
            //   ff15????????         |                     

        $sequence_21 = { 6808020000 6a00 ff74245c e8???????? }
            // n = 4, score = 300
            //   6808020000           | push                0x208
            //   6a00                 | push                0
            //   ff74245c             | push                dword ptr [esp + 0x5c]
            //   e8????????           |                     

        $sequence_22 = { bbe6000000 89d7 83e219 f7d7 }
            // n = 4, score = 300
            //   bbe6000000           | mov                 ebx, 0xe6
            //   89d7                 | mov                 edi, edx
            //   83e219               | and                 edx, 0x19
            //   f7d7                 | not                 edi

        $sequence_23 = { c6410c00 e8???????? 31db 57 53 }
            // n = 5, score = 300
            //   c6410c00             | mov                 byte ptr [ecx + 0xc], 0
            //   e8????????           |                     
            //   31db                 | xor                 ebx, ebx
            //   57                   | push                edi
            //   53                   | push                ebx

        $sequence_24 = { c3 b8???????? c3 50 64a118000000 }
            // n = 5, score = 300
            //   c3                   | ret                 
            //   b8????????           |                     
            //   c3                   | ret                 
            //   50                   | push                eax
            //   64a118000000         | mov                 eax, dword ptr fs:[0x18]

        $sequence_25 = { 6a5c ff74241c e8???????? 83c408 }
            // n = 4, score = 300
            //   6a5c                 | push                0x5c
            //   ff74241c             | push                dword ptr [esp + 0x1c]
            //   e8????????           |                     
            //   83c408               | add                 esp, 8

    condition:
        7 of them and filesize < 1284096
}