I was recently figuring out thing in a web application and found that the URL is reflected among the source of the page, which make it bit obvious for XSS, but the input from URL which is reflected on source is assigned inside a <script>
tag.
URL:
http://www.xyz.com/back?majorID=usdfg&Action=Themesdig&pbPage=vulnerable area&QI.fd_id=random.3232
Code:
<script type="text/javascript">
var _TM = {
cc : 'RUP'
,ll : 'en-US'
,mkt : 'IN'
,geo : 'IN'
,pagename : 'vulnerable area'
,pagetype : 'Custom'
,channel : 'Custom'
}
</script>
So at first moment, I thought an alert('xxx')
is enough to create a POC, but inserting alert or anything else is leading the code to become faulty and not renderable and I cannot close the script tag as the application is sanitizing <
, >
and '
to their HTML representative.
And the webapp is also accepting hex values. I entered Carriage Return %0D (just to confirm they are accepting) and it worked.
So how can I run JavaScript in this situation and create POC?
During these days, I got a near to complete answer ' };alert(13);var misc={a:b
, but the only problem is '
at the beginning. There must be some way to overcome with issue too.