rule win_vawtrak_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.vawtrak."
        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.vawtrak"
        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 = { 6a01 ff35???????? 6a04 6a01 50 ff15???????? 85c0 }
            // n = 7, score = 2700
            //   6a01                 | push                1
            //   ff35????????         |                     
            //   6a04                 | push                4
            //   6a01                 | push                1
            //   50                   | push                eax
            //   ff15????????         |                     
            //   85c0                 | test                eax, eax

        $sequence_1 = { 6a00 6a00 e8???????? 50 ff15???????? }
            // n = 5, score = 2600
            //   6a00                 | push                1
            //   6a00                 | push                eax
            //   e8????????           |                     
            //   50                   | test                eax, eax
            //   ff15????????         |                     

        $sequence_2 = { b900000080 40 8901 81e900100000 75f6 c20400 55 }
            // n = 7, score = 2400
            //   b900000080           | push                1
            //   40                   | push                4
            //   8901                 | push                1
            //   81e900100000         | push                eax
            //   75f6                 | push                4
            //   c20400               | push                1
            //   55                   | push                eax

        $sequence_3 = { ba00ff0000 8bc1 23c2 3bc2 }
            // n = 4, score = 2400
            //   ba00ff0000           | push                1
            //   8bc1                 | push                4
            //   23c2                 | push                1
            //   3bc2                 | push                4

        $sequence_4 = { 803d????????00 7405 e8???????? e8???????? e8???????? e8???????? }
            // n = 6, score = 2200
            //   803d????????00       |                     
            //   7405                 | push                1
            //   e8????????           |                     
            //   e8????????           |                     
            //   e8????????           |                     
            //   e8????????           |                     

        $sequence_5 = { 85c0 7516 c705????????02000000 c705????????03000000 eb14 }
            // n = 5, score = 2200
            //   85c0                 | push                1
            //   7516                 | push                eax
            //   c705????????02000000     |     
            //   c705????????03000000     |     
            //   eb14                 | push                4

        $sequence_6 = { ff15???????? a3???????? 85c0 74e7 }
            // n = 4, score = 2100
            //   ff15????????         |                     
            //   a3????????           |                     
            //   85c0                 | test                eax, eax
            //   74e7                 | je                  0xffffffe9

        $sequence_7 = { 7528 68???????? ff15???????? 85c0 7504 }
            // n = 5, score = 2100
            //   7528                 | jne                 0x2a
            //   68????????           |                     
            //   ff15????????         |                     
            //   85c0                 | test                eax, eax
            //   7504                 | jne                 6

        $sequence_8 = { 6a08 68???????? 56 ffd7 85c0 }
            // n = 5, score = 2100
            //   6a08                 | push                8
            //   68????????           |                     
            //   56                   | push                esi
            //   ffd7                 | call                edi
            //   85c0                 | test                eax, eax

        $sequence_9 = { e8???????? 33d2 b9ff3f0000 f7f1 }
            // n = 4, score = 2000
            //   e8????????           |                     
            //   33d2                 | xor                 edx, edx
            //   b9ff3f0000           | mov                 ecx, 0x3fff
            //   f7f1                 | div                 ecx

        $sequence_10 = { 59 57 8bf0 ff15???????? 8bc6 }
            // n = 5, score = 2000
            //   59                   | pop                 ecx
            //   57                   | push                edi
            //   8bf0                 | mov                 esi, eax
            //   ff15????????         |                     
            //   8bc6                 | mov                 eax, esi

        $sequence_11 = { 8bc6 8703 3bc6 74f8 }
            // n = 4, score = 1900
            //   8bc6                 | mov                 eax, esi
            //   8703                 | xchg                dword ptr [ebx], eax
            //   3bc6                 | cmp                 eax, esi
            //   74f8                 | je                  0xfffffffa

        $sequence_12 = { 3c0f 7705 80ea61 eb0a }
            // n = 4, score = 1700
            //   3c0f                 | push                eax
            //   7705                 | test                eax, eax
            //   80ea61               | push                1
            //   eb0a                 | push                4

        $sequence_13 = { f3aa 5f 5d c3 55 8bec 51 }
            // n = 7, score = 1600
            //   f3aa                 | rep stosb           byte ptr es:[edi], al
            //   5f                   | pop                 edi
            //   5d                   | pop                 ebp
            //   c3                   | ret                 
            //   55                   | push                ebp
            //   8bec                 | mov                 ebp, esp
            //   51                   | push                ecx

        $sequence_14 = { ff7510 ff750c ff7508 e8???????? 83c40c 8d45fc }
            // n = 6, score = 1600
            //   ff7510               | push                dword ptr [ebp + 0x10]
            //   ff750c               | push                dword ptr [ebp + 0xc]
            //   ff7508               | push                dword ptr [ebp + 8]
            //   e8????????           |                     
            //   83c40c               | add                 esp, 0xc
            //   8d45fc               | lea                 eax, [ebp - 4]

        $sequence_15 = { c1e910 e9???????? 8ac1 c1e904 }
            // n = 4, score = 1200
            //   c1e910               | shr                 ecx, 0x10
            //   e9????????           |                     
            //   8ac1                 | mov                 al, cl
            //   c1e904               | shr                 ecx, 4

        $sequence_16 = { 8ac8 240f 80e1f0 80c110 }
            // n = 4, score = 900
            //   8ac8                 | mov                 cl, al
            //   240f                 | and                 al, 0xf
            //   80e1f0               | and                 cl, 0xf0
            //   80c110               | add                 cl, 0x10

        $sequence_17 = { 3c41 7c11 3c46 7f0d }
            // n = 4, score = 800
            //   3c41                 | cmp                 al, 0x41
            //   7c11                 | jl                  0x13
            //   3c46                 | cmp                 al, 0x46
            //   7f0d                 | jg                  0xf

        $sequence_18 = { 488b4a08 b801000000 874108 83f801 }
            // n = 4, score = 700
            //   488b4a08             | mov                 ecx, dword ptr [ebx]
            //   b801000000           | dec                 eax
            //   874108               | mov                 ecx, ebx
            //   83f801               | dec                 eax

        $sequence_19 = { 4883c602 03ea 03ff 03db }
            // n = 4, score = 700
            //   4883c602             | cmp                 eax, 1
            //   03ea                 | dec                 eax
            //   03ff                 | mov                 ecx, dword ptr [edx + 8]
            //   03db                 | mov                 eax, 1

        $sequence_20 = { 4883ec20 488b05???????? 488bda 488bf9 4885c0 7535 }
            // n = 6, score = 700
            //   4883ec20             | xchg                dword ptr [ecx + 8], eax
            //   488b05????????       |                     
            //   488bda               | cmp                 eax, 1
            //   488bf9               | je                  0xfffffffc
            //   4885c0               | dec                 eax
            //   7535                 | mov                 ecx, dword ptr [edx + 8]

        $sequence_21 = { 4885c0 7523 488b0b ff15???????? }
            // n = 4, score = 700
            //   4885c0               | dec                 eax
            //   7523                 | test                eax, eax
            //   488b0b               | jne                 0x25
            //   ff15????????         |                     

    condition:
        7 of them and filesize < 1027072
}