rule win_ransomexx_auto {

    meta:
        author = "Felix Bilstein - yara-signator at cocacoding dot com"
        date = "2026-09-17"
        version = "1"
        description = "Detects win.ransomexx."
        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.ransomexx"
        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 57 8b7d08 33db 895dfc 85ff 0f84da010000 }
            // n = 7, score = 100
            //   56                   | push                esi
            //   57                   | push                edi
            //   8b7d08               | mov                 edi, dword ptr [ebp + 8]
            //   33db                 | xor                 ebx, ebx
            //   895dfc               | mov                 dword ptr [ebp - 4], ebx
            //   85ff                 | test                edi, edi
            //   0f84da010000         | je                  0x1e0

        $sequence_1 = { 85c0 7403 50 ffd7 5f 85f6 7532 }
            // n = 7, score = 100
            //   85c0                 | test                eax, eax
            //   7403                 | je                  5
            //   50                   | push                eax
            //   ffd7                 | call                edi
            //   5f                   | pop                 edi
            //   85f6                 | test                esi, esi
            //   7532                 | jne                 0x34

        $sequence_2 = { 7410 817df8f0070000 7507 56 ff15???????? 5b 56 }
            // n = 7, score = 100
            //   7410                 | je                  0x12
            //   817df8f0070000       | cmp                 dword ptr [ebp - 8], 0x7f0
            //   7507                 | jne                 9
            //   56                   | push                esi
            //   ff15????????         |                     
            //   5b                   | pop                 ebx
            //   56                   | push                esi

        $sequence_3 = { 85c0 7435 5f 5e 5b 8be5 }
            // n = 6, score = 100
            //   85c0                 | test                eax, eax
            //   7435                 | je                  0x37
            //   5f                   | pop                 edi
            //   5e                   | pop                 esi
            //   5b                   | pop                 ebx
            //   8be5                 | mov                 esp, ebp

        $sequence_4 = { 742b 3bfe 7227 8b4d08 56 51 8d541818 }
            // n = 7, score = 100
            //   742b                 | je                  0x2d
            //   3bfe                 | cmp                 edi, esi
            //   7227                 | jb                  0x29
            //   8b4d08               | mov                 ecx, dword ptr [ebp + 8]
            //   56                   | push                esi
            //   51                   | push                ecx
            //   8d541818             | lea                 edx, [eax + ebx + 0x18]

        $sequence_5 = { 33c9 8908 894804 894808 89480c c74010d89e05c1 }
            // n = 6, score = 100
            //   33c9                 | xor                 ecx, ecx
            //   8908                 | mov                 dword ptr [eax], ecx
            //   894804               | mov                 dword ptr [eax + 4], ecx
            //   894808               | mov                 dword ptr [eax + 8], ecx
            //   89480c               | mov                 dword ptr [eax + 0xc], ecx
            //   c74010d89e05c1       | mov                 dword ptr [eax + 0x10], 0xc1059ed8

        $sequence_6 = { 8b5510 51 8b4f04 52 8b5014 51 ffd2 }
            // n = 7, score = 100
            //   8b5510               | mov                 edx, dword ptr [ebp + 0x10]
            //   51                   | push                ecx
            //   8b4f04               | mov                 ecx, dword ptr [edi + 4]
            //   52                   | push                edx
            //   8b5014               | mov                 edx, dword ptr [eax + 0x14]
            //   51                   | push                ecx
            //   ffd2                 | call                edx

        $sequence_7 = { 735c 8d3c40 2bd0 8dbcbda0f9ffff }
            // n = 4, score = 100
            //   735c                 | jae                 0x5e
            //   8d3c40               | lea                 edi, [eax + eax*2]
            //   2bd0                 | sub                 edx, eax
            //   8dbcbda0f9ffff       | lea                 edi, [ebp + edi*4 - 0x660]

        $sequence_8 = { 89542414 8b3d???????? 56 6a00 ffd7 50 ff15???????? }
            // n = 7, score = 100
            //   89542414             | mov                 dword ptr [esp + 0x14], edx
            //   8b3d????????         |                     
            //   56                   | push                esi
            //   6a00                 | push                0
            //   ffd7                 | call                edi
            //   50                   | push                eax
            //   ff15????????         |                     

        $sequence_9 = { 83e63f 8845ff 884dfd 8855fe b838000000 83fe38 }
            // n = 6, score = 100
            //   83e63f               | and                 esi, 0x3f
            //   8845ff               | mov                 byte ptr [ebp - 1], al
            //   884dfd               | mov                 byte ptr [ebp - 3], cl
            //   8855fe               | mov                 byte ptr [ebp - 2], dl
            //   b838000000           | mov                 eax, 0x38
            //   83fe38               | cmp                 esi, 0x38

    condition:
        7 of them and filesize < 372736
}