<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by M4D peace on Medium]]></title>
        <description><![CDATA[Stories by M4D peace on Medium]]></description>
        <link>https://medium.com/@m4dpeace?source=rss-9baa98f21d70------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*eT1yBv4jjfGlBf7U</url>
            <title>Stories by M4D peace on Medium</title>
            <link>https://medium.com/@m4dpeace?source=rss-9baa98f21d70------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 12:16:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@m4dpeace/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Mac Malware Analysis (Investigating a Stealthy Info Stealer)]]></title>
            <link>https://medium.com/@m4dpeace/mac-malware-analysis-investigating-a-stealthy-info-stealer-2a2ab80b4075?source=rss-9baa98f21d70------2</link>
            <guid isPermaLink="false">https://medium.com/p/2a2ab80b4075</guid>
            <category><![CDATA[malware-analysis]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[infostealer]]></category>
            <category><![CDATA[reverse-engineering]]></category>
            <category><![CDATA[mac-malware]]></category>
            <dc:creator><![CDATA[M4D peace]]></dc:creator>
            <pubDate>Sat, 15 Feb 2025 11:01:10 GMT</pubDate>
            <atom:updated>2025-02-15T11:01:10.395Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*dLDiJZ9AP7qDr71E466Cdg.png" /><figcaption>MACOS</figcaption></figure><p>In this blog, we’ll analyze a macOS malware sample, dissecting its structure, functionality, and potential impact. The sample showcases obfuscation techniques, network communication, and information-stealing capabilities. Let’s break it down step by step.</p><h3>Malware File Details</h3><ul><li><strong>SHA-256 Hash</strong>: <a href="https://www.virustotal.com/gui/file/fa1ffa024184f8ade3ef294b5a7a485a48f52361fbf53d37635c2079c57ebcbb">fa1ffa024184f8ade3ef294b5a7a485a48f52361fbf53d37635c2079c57ebcbb</a></li><li><strong>Target Architecture</strong>: x86_64:Mach-O 64-bit</li><li><strong>Target Platform</strong>: Mac-OS</li></ul><h3>String Analysis</h3><h4>Legitimate macOS Libraries and Frameworks</h4><p>The sample imports several standard macOS libraries, making it appear legitimate:</p><blockquote>/usr/lib/dyld</blockquote><blockquote>/usr/lib/libcurl.4.dylib</blockquote><blockquote>/System/Library/Frameworks/CoreServices.framework</blockquote><blockquote>/System/Library/Frameworks/Foundation.framework</blockquote><p>These libraries are commonly used by macOS applications, but their presence does not necessarily indicate malicious intent.</p><h3>Potentially Suspicious Strings</h3><p>A few suspicious string patterns hint at the malware’s true purpose:</p><p><strong>File Extensions Targeted</strong>:</p><blockquote>txt, rtf, doc, docx, xls, xlsx, key, wallet, jpg, dat, pdf, pem, asc, ppk, rdp, sql, ovpn, kdbx, conf, json</blockquote><ul><li>These indicate the malware might be looking for sensitive documents, credentials, and cryptographic keys.</li></ul><p><strong>System Identification</strong>:</p><blockquote>IOPlatformUUID</blockquote><ul><li>It<strong> </strong>is a system property that retrieves the hardware UUID of the Mac.<br>Malware’s often uses this to uniquely identify the infected machine.</li></ul><p><strong>Obfuscated String</strong>:</p><blockquote>W7OjgbbFEbldVawIct2EuURcH360QHxJS7</blockquote><ul><li>be a hardcoded encryption key, C2 (Command and Control) server address, or a unique identifier for the malware. I also got this ‘<a href="https://x.com/L0Psec/status/1877351111016792331">X</a>’ post by LOPsec.</li></ul><p><strong>Libcurl Function:</strong></p><blockquote>_curl_easy_init<br>_curl_easy_perform<br>_curl_easy_setopt</blockquote><ul><li>These functions are part of libcurl, a library used for network communication. Malware can use this libcurl to communicate with C2 servers or download additional payloads.</li></ul><p><strong>Suspicious Function Calls</strong></p><blockquote>_fcopyfile, _fopen, _fread, _fwrite</blockquote><ul><li>These file-related functions could indicate that the malware is reading, writing, or copying files, which is common in data-stealing or ransomware.</li></ul><p><strong>Plist Manipulation</strong></p><blockquote>&lt;?xml version=”1.0&quot; encoding=”UTF-8&quot;?&gt;<br>&lt;!DOCTYPE plist<br>PUBLIC<br>“-//Apple//DTD PLIST 1.0//EN”<br>“http://www.apple.com/DTDs/PropertyList-1.0.dtd&quot;&gt;<br>&lt;plist version=”1.0&quot;&gt;<br>&lt;dict/&gt;&lt;/plist&gt;</blockquote><ul><li>This is a template for a macOS property list (plist) file Which can be used for legitimate as well as for malicious purposes. Plist files are often used by malware to achieve persistence (e.g., by creating a LaunchAgent or LaunchDaemon).</li></ul><p><strong>Environment and System Calls</strong></p><blockquote>_getenv, _gethostname, _getpwuid, _getuid</blockquote><ul><li>These indicate reconnaissance activities, checking user and system details.</li></ul><h3>Static Code Analysis</h3><p>We used <strong>Ghidra</strong> to decompile the malware and analyze its core functions.</p><h3>Entry Function Analysis</h3><p>The entry function:</p><ul><li>Takes two parameters: an integer and a long integer.</li><li>Opens and locks files using _open and _flock, exiting on failure.</li><li>Calls FUN_10001669c, which processes arrays, likely encoding or encrypting data.</li><li>Calls FUN_100004bdc and FUN_100004e1c, which handle file manipulation, user info retrieval, and network communications.</li></ul><h4>Key Function Breakdown</h4><p><strong>1. FUN_10001669c — XOR Decryption</strong></p><ul><li>Iterates through a byte array and XORs it using the hardcoded string <strong>W7OjgbbFEbldVawIct2EuURcH360QHxJS7</strong>.</li><li>Used cyclically for longer inputs, suggesting it decrypts obfuscated commands or data.</li></ul><p><strong>2. FUN_100004bdc — User Info &amp; File Operations</strong></p><ul><li>Retrieves <strong>user ID</strong> via _getuid and _getpwuid.</li><li>Checks for directories and creates them using _mkdir.</li><li>Uses FUN_100002f80 for <strong>Base64 decoding</strong>.</li><li>Calls FUN_100016d14, which interacts with <strong>Core Foundation &amp; Collaboration frameworks</strong> for user authentication.</li><li>After the validation this function writes the processed data to a file and calls FUN_100015c9c with the processed data which likely performs additional operations.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/449/1*z2x8R4pko96rIzsDXYmKbg.png" /><figcaption>FUN_100004bdc</figcaption></figure><p><strong>3. FUN_100004e1c — Network &amp; Command Execution</strong></p><p>This Function performs data manipulation, network communication and thread management. The function processes different commands based on the value of the first token (pcVar8):</p><ul><li><strong>Case 0x67 or 0x68: </strong>Decodes data using FUN_100002f80(likely a Base64 decoder). Performs additional processing and sends a response using FUN_100003f24 .</li><li><strong>Case 0x69:</strong> Processes a hardcoded value and calls FUN_10001669c and FUN_10001647c.</li><li><strong>Case 0x71:</strong> Creates a new thread using _pthread_create to execute FUN_1000045a0with the parsed data as an argument.</li><li><strong>Case 0x72</strong>: Modifies a global variable (DAT_100020510), possibly a kill-switch.</li><li><strong>Case 0x73</strong>: Calls FUN_100004bdc, likely for further processing.</li></ul><p>It also performs a variety of operations based on input commands, including string manipulation, system calls, thread creation, and command execution. It uses _clock_gettime for fetching the system time. The function processes input commands using FUN_10003f24. If the command is valid, it performs specific actions based on the command type. The function handles specific commands using a switch statement. Each command type triggers specific actions, such as executing shell commands, creating threads, or modifying system settings. The function creates a thread to execute FUN_1000045a0 with the provided input.</p><p><strong>4. FUN_10016590 — Retrieving macOS UUID</strong></p><p>This function is used in the entry function of the mac malware sample. This is a platform specfic function that intreacts with the I/O registry in MacOS to retrieve IOPlatformUUID (this function call was also in the strings of the sample).</p><blockquote><strong>Key Operations:</strong><br>1. Initializes a buffer with obfuscated data.<br>2. Decrypts the buffer using a hardcoded XOR Key (“W7OjgbbFEbldVawIct2EuURcH360QHxJS7”).<br>3. Uses macOS-specific I/O Kit functions to query the I/O Registry.<br>4. Retrieves the IOPlatformUUID and stores it in the provided buffer (param_1).<br>5. Performs cleanup and error handling.</blockquote><p><strong>5. FUN_10001647c — Shell Command Execution</strong></p><ul><li>Uses _popen to execute shell commands and retrieve output.</li><li>Called by multiple functions, confirming its role in executing attacker-supplied commands.</li></ul><p><strong>6. FUN_1000038c — File Copying &amp; Directory Manipulation</strong></p><ul><li>Decrypts obfuscated strings.</li><li>Copies files across directories.</li><li>Executes shell commands using FUN_10001647c.</li></ul><p><strong>7. FUN_1000431c</strong><br>This function performs operations such as string manipulation and system information retrieval and data processing.</p><p>Key Operations:</p><ul><li>Decrypts obfuscated strings using FUN_10001669c.</li><li>Executes a shell command and processes its output. This function also makes use of FUN_10001647c for executing shell commands which is like function FUN_1000038c.</li><li>Retrieves system information (e.g., user ID, hostname) using _getuid, _getpwuid and _gethostname.</li><li>Formats and processes data using XOR encryption.</li><li>Calls another function (FUN_100003f24) to process the formatted data.</li></ul><p><strong>8. FUN_10001647c</strong><br>This function is used by 2 other functions which are present in the entry function and those 2 functions pass some commands or strings which are executed by this function. Now this function makes use of _popen for Opening a pipe to execute the shell command, then it captures the output<br>and returns the result.</p><p><strong>9. FUN_1000045a0</strong><br>The function handles network Connection, file operations and command execution. This function makes waits for incoming connections using FUN_1000031a8 which establishes a TCP connection to a remote server, sends data and returns the socket description. It makes use of socket calls for making the connection to the server and _send to send the data to the connected remote server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*tG623A2ofoHnGaIBmH6bng.png" /><figcaption>FUN_1000045a0</figcaption></figure><h3>Conclusion</h3><p>This sample is a classic <strong>Info Stealer Malware</strong> for macOS, employing:</p><p>✅ <strong>Obfuscation</strong> (XOR encryption to hide commands).<br>✅ <strong>System Fingerprinting</strong> (retrieves UUID, user info).<br>✅ <strong>File Theft</strong> (targets sensitive file types).<br>✅ <strong>Command Execution</strong> (via _popen).<br>✅ <strong>Network Communication</strong> (exfiltrates stolen data).</p><p>The presence of <strong>encrypted command execution, user credential access, and network exfiltration</strong> makes this a severe threat. Further research is needed to determine its full scope, including possible connections to larger malware campaigns.</p><p>🛡️<strong>Stay safe, and always keep backups of critical data!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2a2ab80b4075" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Linux Malware Analysis of Brain Cipher Ransomware]]></title>
            <link>https://medium.com/@m4dpeace/linux-malware-analysis-for-brain-cipher-ransomware-e307a94279f0?source=rss-9baa98f21d70------2</link>
            <guid isPermaLink="false">https://medium.com/p/e307a94279f0</guid>
            <category><![CDATA[brain-cipher-ransomware]]></category>
            <category><![CDATA[yara]]></category>
            <category><![CDATA[linux-malware]]></category>
            <category><![CDATA[ransomware]]></category>
            <category><![CDATA[malware-analysis]]></category>
            <dc:creator><![CDATA[M4D peace]]></dc:creator>
            <pubDate>Sat, 15 Feb 2025 07:49:35 GMT</pubDate>
            <atom:updated>2025-02-15T07:50:39.575Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/616/1*2_kYObWiDtB5mX3Q6uPSJQ.png" /><figcaption>Brain Cipher</figcaption></figure><p>This blog covers the analysis and steps I followed during my investigation. Please share your thoughts and any techniques I should have used for the analysis, and feel free to point out any mistakes I should improve upon.</p><p><strong>Note:</strong> <em>If you are performing malware analysis, please use a sandbox environment or isolated VMs to prevent infection.</em></p><p><strong>Malware File:</strong><br>SHA-256: <a href="https://www.virustotal.com/gui/file/f0a47eb439647506b9bcbea84a4811da5dc3838df6f585cf3cc362dc41919c67/">f0a47eb439647506b9bcbea84a4811da5dc3838df6f585cf3cc362dc41919c67</a></p><p><strong>Target Architecture:</strong> x86_64<br><strong>Target Platform:</strong> Linux</p><p>The ELF file was analyzed using the file command, confirming that it is built for x86_64 architecture. Running strings on the binary revealed the full ransomware message, including two onion links and an encrypted ID, identifying it as Brain Cipher Ransomware.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7G3K0uKG3BE0YQKgrzlkaQ.png" /></figure><h3>Static Code Analysis</h3><h4>Entry Point Analysis</h4><p>The malware execution begins at the entry function:</p><pre>__libc_start_main(FUN_004022d7, param_2, FUN_0040d020, param_1, auStack_8);</pre><ul><li>FUN_004022d7: This is the main function as it called by the entry function.</li><li>param_2: Likely command-line arguments or environment pointers.</li><li>&amp;stack0x00000008: Points to the stack, likely providing a context for the function arguments.</li><li>FUN_0040d030 and FUN_0040d020: Callback functions or handlers.</li><li>param_1: May be a program-specific initialization parameter.</li><li>auStack_8: May serve as an auxiliary value or context.</li></ul><h4>File Encryption Process</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*47d3RFt4WLQ6ykpxq6Pijw.png" /><figcaption>FUN_004022d7 -&gt; main function</figcaption></figure><p>The main function (FUN_004022d7) contains:</p><ul><li>Instructions for usage.</li><li>Calls to functions responsible for file encryption.</li><li>Statistics reporting functions (e.g., encrypted/skipped file messages).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/815/1*uaEjJWjnylFzAKcOMm-FJg.png" /><figcaption>FUN_00401c54 Part 1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/1*esD_FnI-oG_JB2nZpJezpA.png" /><figcaption>FUN_00401c54 Part 2</figcaption></figure><p>One crucial function, FUN_00401c54, executes the following steps:</p><ol><li>Allocates memory.</li><li>Creates a ransom note (How to Restore Your Files.txt) containing instructions and TOR links.</li><li>Recursively scans directories, targeting files with specific extensions:</li></ol><ul><li>.log, .vmdk, .vmem, .vswp, .vmsn</li></ul><p>4. Calls two more functions for encryption:</p><ul><li>FUN_0040c69d: Allocates memory.</li><li>FUN_0040188f: Begins encryption.</li></ul><h4>Impact of File Encryption</h4><ul><li>Encrypting .vmdk files locks the entire virtual machine&#39;s storage.</li><li>Encrypting .vmem and .vswp files prevents VM resumption.</li><li>Encrypting .vmsn files removes the ability to restore VM states.</li><li>Encrypting .log files erases incident response records.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/351/1*9MDqhfw5-_nbb7oS8QvIcg.png" /><figcaption>FUN_00401c54 Part3</figcaption></figure><h4>Encryption Process (FUN_0040188f)</h4><p>The malware modifies file content using cryptographic transformations, appends metadata, and renames the file with the .encrptd extension. Three functions handle encryption:</p><ol><li>FUN_0040c095: Initializes constants and counters.</li><li>FUN_0040c110: Processes data in chunks.</li><li>FUN_0040c205: Finalizes processing, applies padding, and extracts the encrypted output.</li></ol><h4>Virtual Machine Manipulation (FUN_002020ca)</h4><p>This function interacts with virtual machines (VMs), listing and manipulating their power states:</p><ol><li>Lists running VMs using vim-cmd vmsvc/getallvms.</li><li>Saves VM IDs in /tmp/running_vms.txt.</li><li>Shuts down running VMs.</li><li>Proceeds with file encryption.</li><li>Deletes /tmp/running_vms.txt to cover its tracks.</li></ol><h3>Dynamic Analysis</h3><p>To verify its behavior, test files were created:</p><ul><li>A .vmdk file.</li><li>A .log file.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/951/1*SnBsEEg0Cb9KRR4mDJy_yg.png" /><figcaption>Execution of Sample</figcaption></figure><p>After execution, the ransomware:</p><ul><li>Encrypted both files and appended the .encrptd extension.</li><li>Dropped a ransom note (How To Restore Your Files.txt).</li><li>Ignored unrelated files (e.g., .txt, .elf).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/585/1*S9vmMmBJdlS3lHEo6AtcZg.png" /><figcaption>Listing Directory</figcaption></figure><p>Using strace, the malware&#39;s workflow was observed:</p><ol><li>Creates the ransom note.</li><li>Scans the specified directory.</li><li>Encrypts valid target files.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qG-F6T7y8Lfok__NgX1cDw.png" /></figure><h4>GDB Debugging Insights</h4><p>Breakpoints were placed at crucial points:</p><blockquote>0x401c54: Entry point for encryption logic.</blockquote><blockquote>0x401d48: Creates the ransom note.</blockquote><blockquote>0x401d58: Writes ransom note content.</blockquote><blockquote>0x401d7a: Closes the ransom note file.</blockquote><blockquote>0x40c69d: Allocates memory.</blockquote><blockquote>0x40188f: Starts encryption.</blockquote><p>During analysis in gdb I first added a break point at <em>0x401c54</em> from where the actual code starts and then from there on, I ran instructions step by step. So, when I was at <em>0x401c65</em> it made a call to new function <em>0x40184b</em>. ( The function <em>FUN_0040184b</em> is designed to calculate the length of a string in memory, up to a maximum of 32 bytes. This I saw during the static analysis. ) Then it calls other functions like strcmp, malloc, check_match, do_lookup, etc. Then after more processing it goes back to the previous function.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/446/1*rLYgJU2gFMb7c7QyYaKSlw.png" /><figcaption>Dynamic Analysis using GDB Part 1</figcaption></figure><p>Now the next breakpoint at <em>0x401d48</em> this is where the sample opens/creates a file and at <em>0x401d58</em> address it puts the ransom note in the file and at <em>0x401d7a</em> it closes the opened file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*3VzLpsLY2QzLglOe1PWyug.png" /><figcaption>Dynamic Analysis using GDB Part 2</figcaption></figure><p>This is screenshot of before and after going through <em>0x401d58</em> instruction. And as assumed it first creates the ransom note and then after it proceeds with file encryption.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*mb-zI6sRAgjLk5OPzMH2yg.png" /><figcaption>Listing Directory</figcaption></figure><p>The analysis confirmed:</p><ul><li>The encryption order is random.</li><li>The Ransom note is dropped before encryption starts</li><li>The malware avoids encrypting files outside its target list.</li><li>Statistics are printed at the end.</li></ul><h3>YARA Rule for Detection</h3><p>To detect Brain Cipher Ransomware, the following YARA rule can be used:</p><pre>rule BrainCipher {<br>    strings:<br>        $elf_hex = { 7f 45 4c 46 02 01 01 00 }<br>        $str1 = &quot;.encrptd&quot;<br>        $str2 = &quot;.log&quot;<br>        $str3 = &quot;.vmdk&quot;<br>        $str4 = &quot;.vmem&quot;<br>        $str5 = &quot;.vswp&quot;<br>        $str6 = &quot;.vmsn&quot;<br>        $vm_stat1 = &quot;vim-cmd vmsvc/getallvms&quot;<br>        $vm_stat2 = &quot;rm /tmp/running_vms.txt&quot;<br>    condition:<br>        $elf_hex and ($str1 or $str2 or $str3 or $str4 or $str5 or $str6 or $vm_stat1 or $vm_stat2)<br>}</pre><h3>Conclusion</h3><p>Brain Cipher Ransomware is a sophisticated malware that specifically targets virtual machine files, making recovery difficult. With its selective encryption and VM shutdown tactics, it poses a serious risk to cloud and enterprise environments.</p><p>Using tools like Ghidra, strace, and GDB, we uncovered its inner workings and developed a YARA rule to aid in detection.</p><p>Defending against such threats requires a proactive approach, including:</p><ul><li><strong>Regular backups</strong> to mitigate damage.</li><li><strong>Network segmentation</strong> to limit ransomware spread.</li><li><strong>Strict access controls</strong> to prevent unauthorized execution.</li><li><strong>Security monitoring</strong> for early threat detection.</li></ul><p>Stay vigilant and keep your systems secure! 🚀</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e307a94279f0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Linux Malware Analysis (Blackbasta Ransomware)]]></title>
            <link>https://medium.com/@m4dpeace/linux-malware-analysis-blackbasta-ransomware-6dee4d580f25?source=rss-9baa98f21d70------2</link>
            <guid isPermaLink="false">https://medium.com/p/6dee4d580f25</guid>
            <category><![CDATA[linux-malware]]></category>
            <category><![CDATA[malware-analysis]]></category>
            <category><![CDATA[encryption]]></category>
            <category><![CDATA[ransomware]]></category>
            <category><![CDATA[detection]]></category>
            <dc:creator><![CDATA[M4D peace]]></dc:creator>
            <pubDate>Sat, 15 Feb 2025 06:31:40 GMT</pubDate>
            <atom:updated>2025-02-15T06:31:40.329Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*AmG3xm2uql69dIIGiaI5PQ.png" /></figure><p>This blog covers the analysis and steps I followed during my investigation. Please share your thoughts and any techniques I should have used for the analysis, and feel free to point out any mistakes I should improve upon.</p><p><strong>Note:</strong> <em>If you are performing malware analysis, please use a sandbox environment or isolated VMs to prevent infection.</em></p><p><strong>Malware File:</strong><br>SHA256: 0d6c3de5aebbbe85939d7588150edf7b7bdc712fceb6a83d79e65b6f79bfc2ef<br>Target Architecture: x86_64<br>Target Platform: Linux</p><p>In this analysis, we examine a ransomware sample named 0d6c3de5aebbbe85939d7588150edf7b7bdc712fceb6a83d79e65b6f79bfc2ef.elf to understand its behavior, encryption methods, and impact on a system.</p><h3>Initial Analysis</h3><p>To begin, I used binwalk to analyze the ELF file structure. This revealed details about the encryption algorithm used within the malware.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*KiTcoU_AIKXWg4p-dqa8QQ.png" /><figcaption>Binwalk</figcaption></figure><h3>Static Analysis with Ghidra</h3><p>I then performed a static analysis using Ghidra and extracted several suspicious strings:</p><blockquote><strong>“ENCRYPTION”</strong></blockquote><blockquote><strong>“C:/Users/dssd/Desktop/src”</strong></blockquote><blockquote><strong>“/vmfs/volumes”</strong></blockquote><blockquote><strong>“-forcepath”</strong></blockquote><blockquote><strong>“Forced path: “</strong></blockquote><blockquote><strong>“OUT.txt”</strong></blockquote><blockquote><strong>“readme.txt”</strong></blockquote><blockquote><strong>“.basta”</strong></blockquote><blockquote><strong>A long encoded string, likely encryption-related.</strong></blockquote><p>One particularly alarming string was:</p><blockquote><em>“Your data are stolen and encrypted. The data will be published on a TOR website if you do not pay the ransom.”</em></blockquote><p>This message indicated that the malware was part of a <strong>ransomware campaign</strong>, threatening to leak stolen data on the dark web if the ransom was not paid.</p><h3>Key Functions Identified in Static Analysis</h3><h4>1. EncryptFolder()</h4><ul><li>Initiates multiple threads for processing files in a directory.</li><li>Each thread iterates over directory entries, encrypting files within.</li></ul><h4>2. EncryptFileBytes()</h4><ul><li>Uses specific constants that suggest the malware is implementing <strong>ChaCha</strong> or <strong>Salsa</strong> encryption.</li><li>These constants include:</li></ul><blockquote>0x61707865 = &quot;expansion&quot;</blockquote><blockquote>0x3320646e = &quot;3 dn&quot;</blockquote><blockquote>0x79622d32 = &quot;by-2&quot;</blockquote><blockquote>0x6b206574 = &quot;k et&quot;</blockquote><ul><li>Performs bitwise operations like XOR, shifts, and additions, similar to ChaCha20.</li></ul><h4>3. EncryptWithRSA() &amp; EncryptRSAGMP()</h4><ul><li>Uses modular exponentiation for RSA encryption:</li></ul><blockquote>ciphertext = message^e mod n</blockquote><ul><li>Converts plaintext into GMP integers before encryption.</li><li>No direct reference found for <strong>RSA encryption usage</strong> in the malware’s execution flow.</li></ul><h4>4. DecryptWithRSA() &amp; DecryptRSAGMP()</h4><ul><li>Performs RSA decryption using the private key.</li><li>Implements modular exponentiation:</li></ul><blockquote>plaintext = ciphertext^d mod n</blockquote><ul><li>Converts decrypted data back into a readable byte array.</li></ul><h3>Dynamic Analysis</h3><p>Upon execution, the ransomware displayed the error:</p><blockquote><em>“Path not exists in this system.”</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*s4gx7gVuuiJM-8sU9o9nXA.png" /><figcaption>Executing the sample</figcaption></figure><p>This suggested that the malware was looking for a specific path before executing its payload.</p><p>Since the malware referenced the /vmfs/volumes directory, I created this directory and re-executed the ELF file. Here are my observations:</p><ul><li>Running the malware <strong>without sudo privileges</strong> did <strong>not</strong> encrypt the files inside /vmfs/volumes.</li><li>Running the malware <strong>with sudo privileges</strong> <strong>successfully encrypted</strong> the contents of /vmfs/volumes.</li><li>After execution, the files inside /vmfs/volumes were given the <strong>.basta</strong> extension.</li><li>A readme.txt file appeared in the directory, containing the ransom note.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z9PWTXyR03T4i78V62VPPQ.png" /><figcaption>Executing the sample</figcaption></figure><h3>Conclusion</h3><p>This analysis uncovered a <strong>Linux-based ransomware</strong> that encrypts files in a specific directory (/vmfs/volumes) and demands a ransom through a TOR-based payment system. The malware appears to use a mix of <strong>ChaCha20/Salsa20 encryption</strong> and possibly <strong>RSA</strong> for key management.</p><p>Key Takeaways:</p><ul><li>The malware requires <strong>root privileges</strong> to encrypt files.</li><li>It leaves a <strong>ransom note</strong> with instructions for payment and decryption.</li></ul><p>Further research into <strong>how the RSA keys are generated and stored</strong> could provide more insight into potential decryption strategies.</p><p><strong>Stay safe, and always keep backups of critical data!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6dee4d580f25" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>