rule win_whiskerspy_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-05-04"
        version = "1"
        description = "Detects win.whiskerspy."
        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.whiskerspy"
        malpedia_rule_date = "20260422"
        malpedia_hash = "a182e35da64e6d71cb55f125c4d4225196523f14"
        malpedia_version = "20260504"
        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 = { 33ff 8b06 8bcf d3e8 a801 }
            // n = 5, score = 300
            //   33ff                 | xor                 edi, edi
            //   8b06                 | mov                 eax, dword ptr [esi]
            //   8bcf                 | mov                 ecx, edi
            //   d3e8                 | shr                 eax, cl
            //   a801                 | test                al, 1

        $sequence_1 = { 8d4a28 8d5301 e8???????? 488bf8 }
            // n = 4, score = 200
            //   8d4a28               | movzx               eax, byte ptr [ecx + 1]
            //   8d5301               | mov                 byte ptr [ebp - 0x1e], al
            //   e8????????           |                     
            //   488bf8               | mov                 edx, 0x2d1c9add

        $sequence_2 = { 2c05 3441 88840d080b0000 48ffc1 }
            // n = 4, score = 200
            //   2c05                 | mov                 ebp, eax
            //   3441                 | dec                 eax
            //   88840d080b0000       | mov                 dword ptr [ebp - 0x39], eax
            //   48ffc1               | sub                 al, 5

        $sequence_3 = { 8845e0 0fb64102 8845e1 0fb64101 8845e2 }
            // n = 5, score = 200
            //   8845e0               | xor                 al, 0x41
            //   0fb64102             | mov                 byte ptr [ebp + ecx + 0xb08], al
            //   8845e1               | dec                 eax
            //   0fb64101             | inc                 ecx
            //   8845e2               | mov                 byte ptr [ebp - 0x20], al

        $sequence_4 = { ba01000000 8bca e8???????? 4c8be8 488945c7 }
            // n = 5, score = 200
            //   ba01000000           | movups              xmm1, xmmword ptr [ebp - 1]
            //   8bca                 | mov                 edx, 1
            //   e8????????           |                     
            //   4c8be8               | mov                 ecx, edx
            //   488945c7             | dec                 esp

        $sequence_5 = { e8???????? badd9a1c2d 488905???????? 488bce e8???????? }
            // n = 5, score = 200
            //   e8????????           |                     
            //   badd9a1c2d           | movzx               eax, byte ptr [ecx + 2]
            //   488905????????       |                     
            //   488bce               | mov                 byte ptr [ebp - 0x1f], al
            //   e8????????           |                     

        $sequence_6 = { 6689480c 0f1045ef 488b03 0f11400e 0f104dff }
            // n = 5, score = 200
            //   6689480c             | mov                 word ptr [eax + 0xc], cx
            //   0f1045ef             | movups              xmm0, xmmword ptr [ebp - 0x11]
            //   488b03               | dec                 eax
            //   0f11400e             | mov                 eax, dword ptr [ebx]
            //   0f104dff             | movups              xmmword ptr [eax + 0xe], xmm0

        $sequence_7 = { e8???????? c7474000000000 4c8d9c24b0010000 498b5b30 498b7340 }
            // n = 5, score = 200
            //   e8????????           |                     
            //   c7474000000000       | dec                 eax
            //   4c8d9c24b0010000     | mov                 ecx, esi
            //   498b5b30             | lea                 ecx, [edx + 0x28]
            //   498b7340             | lea                 edx, [ebx + 1]

        $sequence_8 = { 0175d0 eb0c 51 8d4dcc }
            // n = 4, score = 100
            //   0175d0               | add                 dword ptr [ebp - 0x30], esi
            //   eb0c                 | jmp                 0xe
            //   51                   | push                ecx
            //   8d4dcc               | lea                 ecx, [ebp - 0x34]

        $sequence_9 = { 015508 85ff 0f8f6cffffff 7c08 }
            // n = 4, score = 100
            //   015508               | add                 dword ptr [ebp + 8], edx
            //   85ff                 | test                edi, edi
            //   0f8f6cffffff         | jg                  0xffffff72
            //   7c08                 | jl                  0xa

        $sequence_10 = { 015dd0 eb09 51 8d4dcc }
            // n = 4, score = 100
            //   015dd0               | add                 dword ptr [ebp - 0x30], ebx
            //   eb09                 | jmp                 0xb
            //   51                   | push                ecx
            //   8d4dcc               | lea                 ecx, [ebp - 0x34]

        $sequence_11 = { 015de8 eb09 50 8d4de4 }
            // n = 4, score = 100
            //   015de8               | add                 dword ptr [ebp - 0x18], ebx
            //   eb09                 | jmp                 0xb
            //   50                   | push                eax
            //   8d4de4               | lea                 ecx, [ebp - 0x1c]

        $sequence_12 = { 01742418 83c40c 8b412c 2930 }
            // n = 4, score = 100
            //   01742418             | add                 dword ptr [esp + 0x18], esi
            //   83c40c               | add                 esp, 0xc
            //   8b412c               | mov                 eax, dword ptr [ecx + 0x2c]
            //   2930                 | sub                 dword ptr [eax], esi

        $sequence_13 = { 0144241c 2bd8 83c410 8bd3 }
            // n = 4, score = 100
            //   0144241c             | add                 dword ptr [esp + 0x1c], eax
            //   2bd8                 | sub                 ebx, eax
            //   83c410               | add                 esp, 0x10
            //   8bd3                 | mov                 edx, ebx

        $sequence_14 = { 0130 8b7510 83794c00 8bd3 7451 e8???????? 8bd3 }
            // n = 7, score = 100
            //   0130                 | add                 dword ptr [eax], esi
            //   8b7510               | mov                 esi, dword ptr [ebp + 0x10]
            //   83794c00             | cmp                 dword ptr [ecx + 0x4c], 0
            //   8bd3                 | mov                 edx, ebx
            //   7451                 | je                  0x53
            //   e8????????           |                     
            //   8bd3                 | mov                 edx, ebx

    condition:
        7 of them and filesize < 591872
}