rule win_sobig_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.sobig."
        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.sobig"
        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 = { 50 e8???????? 59 59 ff7508 8d4dd4 e8???????? }
            // n = 7, score = 100
            //   50                   | push                eax
            //   e8????????           |                     
            //   59                   | pop                 ecx
            //   59                   | pop                 ecx
            //   ff7508               | push                dword ptr [ebp + 8]
            //   8d4dd4               | lea                 ecx, [ebp - 0x2c]
            //   e8????????           |                     

        $sequence_1 = { 7c20 3bce 741c 3bc2 7409 8b09 }
            // n = 6, score = 100
            //   7c20                 | jl                  0x22
            //   3bce                 | cmp                 ecx, esi
            //   741c                 | je                  0x1e
            //   3bc2                 | cmp                 eax, edx
            //   7409                 | je                  0xb
            //   8b09                 | mov                 ecx, dword ptr [ecx]

        $sequence_2 = { 8d4dd8 e8???????? 3bc6 7c57 57 8d4580 53 }
            // n = 7, score = 100
            //   8d4dd8               | lea                 ecx, [ebp - 0x28]
            //   e8????????           |                     
            //   3bc6                 | cmp                 eax, esi
            //   7c57                 | jl                  0x59
            //   57                   | push                edi
            //   8d4580               | lea                 eax, [ebp - 0x80]
            //   53                   | push                ebx

        $sequence_3 = { c745f810000000 f3a5 6a07 8bf3 }
            // n = 4, score = 100
            //   c745f810000000       | mov                 dword ptr [ebp - 8], 0x10
            //   f3a5                 | rep movsd           dword ptr es:[edi], dword ptr [esi]
            //   6a07                 | push                7
            //   8bf3                 | mov                 esi, ebx

        $sequence_4 = { 8d4dcc e9???????? 8d8d40ffffff e9???????? 8d8decfdffff e9???????? 8d4d8c }
            // n = 7, score = 100
            //   8d4dcc               | lea                 ecx, [ebp - 0x34]
            //   e9????????           |                     
            //   8d8d40ffffff         | lea                 ecx, [ebp - 0xc0]
            //   e9????????           |                     
            //   8d8decfdffff         | lea                 ecx, [ebp - 0x214]
            //   e9????????           |                     
            //   8d4d8c               | lea                 ecx, [ebp - 0x74]

        $sequence_5 = { ff15???????? 53 ff15???????? eb1e 56 ff15???????? }
            // n = 6, score = 100
            //   ff15????????         |                     
            //   53                   | push                ebx
            //   ff15????????         |                     
            //   eb1e                 | jmp                 0x20
            //   56                   | push                esi
            //   ff15????????         |                     

        $sequence_6 = { ff561c 59 885dfc 53 8d4ddc e8???????? 834dfcff }
            // n = 7, score = 100
            //   ff561c               | call                dword ptr [esi + 0x1c]
            //   59                   | pop                 ecx
            //   885dfc               | mov                 byte ptr [ebp - 4], bl
            //   53                   | push                ebx
            //   8d4ddc               | lea                 ecx, [ebp - 0x24]
            //   e8????????           |                     
            //   834dfcff             | or                  dword ptr [ebp - 4], 0xffffffff

        $sequence_7 = { a1???????? 5f 5e 5b c9 c20c00 b8???????? }
            // n = 7, score = 100
            //   a1????????           |                     
            //   5f                   | pop                 edi
            //   5e                   | pop                 esi
            //   5b                   | pop                 ebx
            //   c9                   | leave               
            //   c20c00               | ret                 0xc
            //   b8????????           |                     

        $sequence_8 = { 8d3c8520bc4100 8bc1 83e01f 8d34c0 8b07 c1e602 03c6 }
            // n = 7, score = 100
            //   8d3c8520bc4100       | lea                 edi, [eax*4 + 0x41bc20]
            //   8bc1                 | mov                 eax, ecx
            //   83e01f               | and                 eax, 0x1f
            //   8d34c0               | lea                 esi, [eax + eax*8]
            //   8b07                 | mov                 eax, dword ptr [edi]
            //   c1e602               | shl                 esi, 2
            //   03c6                 | add                 eax, esi

        $sequence_9 = { 50 68???????? 57 53 6a09 ff15???????? 8b86b0000000 }
            // n = 7, score = 100
            //   50                   | push                eax
            //   68????????           |                     
            //   57                   | push                edi
            //   53                   | push                ebx
            //   6a09                 | push                9
            //   ff15????????         |                     
            //   8b86b0000000         | mov                 eax, dword ptr [esi + 0xb0]

    condition:
        7 of them and filesize < 262144
}