rule win_vawtrak_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-05-04"
        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 = "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 = { 6a01 ff35???????? 6a04 6a01 50 }
            // n = 5, score = 2700
            //   6a01                 | push                1
            //   ff35????????         |                     
            //   6a04                 | push                4
            //   6a01                 | push                1
            //   50                   | push                eax

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

        $sequence_2 = { e8???????? 837d1040 752d 8b4d04 e8???????? 85c0 7421 }
            // n = 7, score = 2400
            //   e8????????           |                     
            //   837d1040             | push                4
            //   752d                 | push                1
            //   8b4d04               | push                4
            //   e8????????           |                     
            //   85c0                 | push                1
            //   7421                 | push                eax

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

        $sequence_4 = { 69d26d4ec641 81c239300000 2ac2 8801 }
            // n = 4, score = 2200
            //   69d26d4ec641         | push                1
            //   81c239300000         | push                eax
            //   2ac2                 | test                eax, eax
            //   8801                 | push                4

        $sequence_5 = { 0fb6c9 81c900ff0000 e8???????? 85c0 }
            // n = 4, score = 2200
            //   0fb6c9               | push                eax
            //   81c900ff0000         | test                eax, eax
            //   e8????????           |                     
            //   85c0                 | 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 = { eb04 8b01 8907 e8???????? }
            // n = 4, score = 1700
            //   eb04                 | push                eax
            //   8b01                 | push                4
            //   8907                 | push                1
            //   e8????????           |                     

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

        $sequence_14 = { 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_15 = { c1e910 e9???????? 8ac1 c1e904 c0e004 }
            // n = 5, score = 1200
            //   c1e910               | shr                 ecx, 0x10
            //   e9????????           |                     
            //   8ac1                 | mov                 al, cl
            //   c1e904               | shr                 ecx, 4
            //   c0e004               | shl                 al, 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 = { 488364242000 4c8d442430 4533c9 33d2 c744243001000000 c744243c02000000 }
            // n = 6, score = 700
            //   488364242000         | jne                 0x25
            //   4c8d442430           | dec                 eax
            //   4533c9               | mov                 ecx, dword ptr [ebx]
            //   33d2                 | dec                 eax
            //   c744243001000000     | mov                 ecx, ebx
            //   c744243c02000000     | dec                 eax

        $sequence_19 = { 40883c08 ff430c e9???????? 0f86bf000000 81c7fffeffff 83ff1d }
            // n = 6, score = 700
            //   40883c08             | dec                 eax
            //   ff430c               | mov                 ecx, ebx
            //   e9????????           |                     
            //   0f86bf000000         | xor                 eax, eax
            //   81c7fffeffff         | dec                 eax
            //   83ff1d               | and                 dword ptr [esp + 0x20], 0

        $sequence_20 = { 4885c0 7523 488b0b ff15???????? }
            // n = 4, score = 700
            //   4885c0               | lea                 esi, [eax + 1]
            //   7523                 | lea                 ecx, [esi + esi]
            //   488b0b               | dec                 eax
            //   ff15????????         |                     

        $sequence_21 = { 4885c9 7504 33c0 eb43 ff15???????? 8d7001 }
            // n = 6, score = 700
            //   4885c9               | dec                 eax
            //   7504                 | test                ecx, ecx
            //   33c0                 | jne                 6
            //   eb43                 | xor                 eax, eax
            //   ff15????????         |                     
            //   8d7001               | jmp                 0x45

    condition:
        7 of them and filesize < 1027072
}