<?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 ሳቶሽ  አዳኝ on Medium]]></title>
        <description><![CDATA[Stories by ሳቶሽ  አዳኝ on Medium]]></description>
        <link>https://medium.com/@shinkurt?source=rss-c33db6932463------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by ሳቶሽ  አዳኝ on Medium</title>
            <link>https://medium.com/@shinkurt?source=rss-c33db6932463------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 15:34:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shinkurt/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[Facebook CTF 2019 — Product Manger Writeup]]></title>
            <link>https://shinkurt.medium.com/facebook-ctf-2019-product-manger-writeup-ac7ff6a13f4?source=rss-c33db6932463------2</link>
            <guid isPermaLink="false">https://medium.com/p/ac7ff6a13f4</guid>
            <category><![CDATA[sqli]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[cybersecurity]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <dc:creator><![CDATA[ሳቶሽ  አዳኝ]]></dc:creator>
            <pubDate>Mon, 03 Jun 2019 22:51:28 GMT</pubDate>
            <atom:updated>2019-06-03T22:53:13.483Z</atom:updated>
            <content:encoded><![CDATA[<h3>Facebook CTF 2019 — Product Manger Writeup</h3><p>I had a lot of fun playing the web challenges from the FBCTF 2019 — even for a little while. In this post I will talk about my thought process and the things that I tried.</p><p>This one is about the first challenge called Product Manger, I thought it was a nice and well made challenge that highlighted and used a lesser-known MySQL feature for a nice advantage.</p><p>Believe it or not, the first authentication bypass bug I ever found was caused by something similar. I don’t know how many people in InfoSec now know the wonderful (<em>all dead for a while now)</em> Infinity Exists, SecurityOverride.org and EvilZone — I remember seeing a tiny post by a user called CrashOverride about MySQL features that documented a nasty MySQL trick around 2010. That was a long time ago, it reminds me of all the significant turning points in my life where I realized I wanted to do security thanks to all the incredible and helpful friends I made over IRC. InfoSec today is different, bug bounties and zeroday industry are killing how many people are willing to share. But lets not get into that.</p><p><strong>Details</strong></p><p>With the challenge we are given a tar file that contains the source code of the challenge. In there we have 6 php files. It seems the application lets you create and hide a secret description with a password and name.</p><p>In <em>db.php</em> we see a comment the flag (secret) is stored in a table name called <strong><em>facebook</em></strong>. We can view other tables if we know their password and name. We know the product’s name is facebook, we are looking for a way to find the secret.</p><p>This is<em> view.php</em>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*r89zA0E_zlJP1xkxGVpwRQ.png" /></figure><p>and <strong><em>check_name_secret()</em></strong> looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0vP9UoE2F3LosLIZ71qbiQ.png" /></figure><p>At first I thought it might be a misconfigured PDO for SQLi. But PDO is well used and everything is sanitized properly.</p><p>What we want to do is call <strong><em>get_product(“facebook”)</em></strong> on line 8 but that isn’t possible because of <strong><em>check_name_secret()</em></strong><em> </em>requiring secret. All we need is for <strong><em>check_name_secret()</em></strong> to return <em>True</em> and we can get to that call. That basically means tricking the SQL statement to return any kind of response (anything thats not <em>null</em>) — I initially spent few minutes trying to trick the SQL to generate some kind of error so it bypasses</p><blockquote><strong>if($rest-&gt;fetch_assoc() !== null){</strong></blockquote><blockquote><strong>$valid = true;</strong></blockquote><blockquote>}</blockquote><p>I was thinking if we can get it to throw any kind of error, we can turn <strong><em>$valid</em></strong> into <em>true</em>, and control a to call to<strong> <em>get_products()</em></strong> but that turned out to be a goose chase because of the error reporting being off.</p><p>My second idea was if we did:</p><p><strong><em>SELECT name FROM products WHERE name = facebook AND secret = a%</em></strong></p><p><strong><em>SELECT name FROM products WHERE name = facebook AND secret = b%</em></strong></p><p>Those statements would also be true because <strong><em>%</em> </strong>is a wildcard in MySQL that means <strong><em>LIKE</em></strong> everything that starts with <em>a-</em> or <em>b-</em> in the table and return some kind of data, also turning <strong><em>$valid</em></strong> to <em>true</em>. This approach also won’t work thanks to PDO turning the user controlled values to strings.</p><p>My next approach was clear after noticing <strong><em>insert_product()</em></strong> — seeing that data is written and retrieved by name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eo62becoTrBKPZUueTA4ww.png" /></figure><p>So if we created a product called “<strong><em>facebook</em></strong>” with our own secret, when we go to <em>view.php</em> and try to open it with our <em>secret</em>, MySQL would actually retrieve the first “<em>facebook</em>” row’s value. (not ours)</p><p>Then I tried doing that, it was no luck because of a certain code in <em>add.php</em>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZpLoYy-fciaAObEU_z_42w.png" /></figure><p>Here is where the MySQL trick that comes to play, when querying data with MySQL, trailing whitespaces are ignored by default.</p><p>This means simply by creating a product called “<strong><em>facebook</em></strong><em> </em>“ (mind the space) with our <em>secret</em>, we can trick MySQL to create a product called “<strong><em>facebook</em></strong>” in the database.</p><p>After this tricking <strong><em>check_name_secret()</em></strong> to return true was straight forward, we use product name “<strong><em>facebook</em></strong>” and our secret and MySQL will query and open the first product instance called “<strong><em>facebook</em></strong>” (not ours!)</p><p>This gets us the <em>fb{}</em> flag!</p><p><strong>TAKE</strong></p><p>The problem here was how they used a user-controlled value as <em>key</em> to query data in and out of a database, instead of a server controlled “ID” or something that links and distinguishes one product from another.</p><p>My authentication bypass bug came with this flaw, by creating a user called “<em>admin ” (note the space) </em>with my <em>password</em>, I was able to login with the “<em>admin”</em> username thanks to insecure querying.</p><p>Most of the other web challenges were fun as well, I only got to solve the secret note one in time using browser-side channel attacks but maybe a story for another time.</p><p>Thanks for the nice CTF!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ac7ff6a13f4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploiting a tricky XSS in Zendesk]]></title>
            <link>https://shinkurt.medium.com/exploiting-a-tricky-xss-in-zendesk-80bdeaea4dad?source=rss-c33db6932463------2</link>
            <guid isPermaLink="false">https://medium.com/p/80bdeaea4dad</guid>
            <category><![CDATA[hacking]]></category>
            <category><![CDATA[zendesk]]></category>
            <category><![CDATA[bug-bounty]]></category>
            <category><![CDATA[security]]></category>
            <category><![CDATA[xs]]></category>
            <dc:creator><![CDATA[ሳቶሽ  አዳኝ]]></dc:creator>
            <pubDate>Sun, 17 Dec 2017 15:13:00 GMT</pubDate>
            <atom:updated>2017-12-17T15:23:37.679Z</atom:updated>
            <content:encoded><![CDATA[<p>Sometime ago in the past, while fuzzing Zendesk randomly, I came across a very odd kind of sanitization technique in a JSON endpoint and even though this was a black-box approach, I would assume this was what was happening in their back-end server, can you spot the bug?</p><p>$sanitized = [];</p><p>foreach ($_GET as $k =&gt; $v) {</p><p>$sanitized[$k] = <strong><em>json_encode(intval($v))</em></strong>;</p><p>}</p><p>$queryarray = array_map(function ($k, $v) {</p><p>return $k . ‘=’ . $v;</p><p>}, array_keys($sanitized), array_values($sanitized));</p><p>$query = implode(‘&amp;’, $queryarray);</p><p>echo $query;</p><p>I don’t know if you spotted the vulnerability above but it only sanitizes the the parameter value, not the parameter name, which looks like a common mistake to make for developers looking at similar sanitization loops on github. But also very tricky to exploit none the less because of odd json behaviors.</p><p>What was more interesting was how the application doesn’t return any <em>Content-Type</em> or <em>X-Content-Options</em> headers, so browsers like Chrome sniff content and that obviously makes cross site scripting attacks possible when they parse HTML tags.</p><p>Since Zendesk usually runs on subdomain’s of sensitive domains like support.domain.com, my initial exploitation scenario for this is to escalate this into a <a href="https://whitton.io/articles/xss-on-facebook-via-png-content-types/">host xss</a>.</p><p>forexample <em>?errorCod&lt;scipt&gt;domain=x;</em> will be <em>“errorCod&lt;script&gt;domain”:”x</em>. so you see the problem and why it is tricky to craft a payload out of.</p><h3><strong>Exploitation</strong></h3><p>I couldn’t assign anything other than trigger an alert. Since assigning usually required “=” and if zendesk finds one, they will change it to “:” so after closing the script tag, I begun my payload with &lt;svg&gt; because of its XML-ish nature. This means that once we use entities inside an SVG’s &lt;script&gt; element (or any other CDATA element), they will be parsed as if they were used in canonical representation. Therefore, to bypass the filter, or to call document.domain=0 with the equal sign char = encoded, i.e. = or even shorter D;.</p><p>Then I used 3 equal signs, <em>one will be stripped</em>, <em>one will be replace by : </em>and <em>one will be left for us</em>. so we came as far as <em>&lt;/script&gt;&lt;svg&gt;&lt;script&gt;/xz==/document.domain</em> by using comments to bypass 3 of the filters. even though the values after = gets entitied, it doesn’t matter since we are in &lt;svg&gt;&lt;script&gt; tag and this would mean anything in it will act like mXSS (mutation xss) even when its entitied.</p><p>After that, the next payload will look something like:</p><pre><strong>&lt;</strong>/script&gt;&lt;svg&gt;&lt;script&gt;/<strong>*</strong>xz&quot;:&quot;<strong>=*</strong>/document.domain=&amp;#39;hackerone.com&amp;#39;/<strong>/</strong></pre><p>the comment in the end is there because we can’t use semicollon ; to finish the document.domain line and anything following it will be commented out.</p><p>Then all whats left to do is create another json parameter name with values error_titlez&lt;/script&gt; and close our tag. then we shall have “hackerone.com” as our document.domain. and we can request/recieve to the main domain.<br> Final payload =</p><pre>&lt;/script&gt;&lt;svg&gt;&lt;script&gt;<em>/*xz&quot;:&quot;=*/</em>document.domain<strong>=&amp;</strong>#39;hackerone.com<strong>&amp;</strong>#39;<em>//&quot;,&quot;error_title&quot;:&quot;&quot;,&quot;error_titlez</em>&lt;/script&gt;&lt;script&gt;alert(document.domain)&lt;/script&gt;</pre><p>and we get our domain set to the main host, and we can do a lot more attacks starting there.</p><p>P.S: Jack Whitton did a <a href="https://whitton.io/articles/xss-on-facebook-via-png-content-types/">nice post</a> on how he turned a subdomain XSS on https://photos.facebook.com to one on <a href="https://facebook.com/">https://www.facebook.com</a> — its a good read.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=80bdeaea4dad" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>