
Should you learn to code before you learn to hack?
You will find a common pattern if you read blog posts or watch interviews with some of today’s top ethical hackers. When asked if coding …

A while ago I found a vulnerable endpoint with some fun limitations. I though it could be exciting to see how you would go about breaking it.
The URL looked like this:
/feed?id=0123AAAAAAAAAA&id=0456BBBBBBBBBB&id=0789CCCCCCCCCC
It responded with a feed as HTML. The feed looked like this:

The numbers in the beginning of every ID had to be there, which meant you only had 10 characters per parameter to inject something. There were no limitations to what characters that could be injected, apart from the amount of characters injected per parameter. Also, since the injection point was both in the start tag as well as in the end tag, the string you injected for every ID repeated itself.
Here’s some example code in PHP that does the same thing so you could simulate the real life scenario:
<? $q = urldecode($_SERVER['QUERY_STRING']); $qs = explode('&', $q); $qa = array(); $chars = 0; foreach($qs as $q) { $q = explode('=', $q); array_shift($q); $s = implode('=', $q); if(strlen($s) > 10) continue; $chars += strlen($s); $qa[] = $s; } foreach($qa as $q) { echo "<0123$q><b x="x">hejsan</b></0123$q>"; } echo '<!-- '.$chars.' chars long -->';
So these are the requirements which are included in the above PHP-code:
alert(1) without any interaction.<%s> and second time wrapped in </%s>. Payload could both take advantage of this or work without it.
If you have a working payload, send me an email at frans at detectify dot com with “Twins of Ten solution” as the subject. I have a few hoodies (three that is) to send out for the most shortest/creative solutions.
I was able to bypass it and I’ve created a secret gist at 6 Jun 2015 13:33:31 CEST with my own solution. I’ll post an explanation how I did it in this blog sometime next week, hopefully together with some fun contributions and versions of bypasses to this vulnerable code.

PS. I’ve also posted this over at the Bugcrowd Forum if you’d like to discuss it further.. 🙂

You will find a common pattern if you read blog posts or watch interviews with some of today’s top ethical hackers. When asked if coding …

SSL certificates mark the first step in a commitment to user safety and security and HTTPS, SMTPS, IMAPS, POP3S have become the standard protocol for …