Hack Forums
Regex Protection(Bypassing to XSS or Open Redirect) - Javascript - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Hacks, Exploits, and Various Discussions (https://hackforums.net/forumdisplay.php?fid=45)
+--- Forum: Whitehat • Blue Team • Defensive Security (https://hackforums.net/forumdisplay.php?fid=448)
+---- Forum: Pentesting and Forensics (https://hackforums.net/forumdisplay.php?fid=231)
+---- Thread: Regex Protection(Bypassing to XSS or Open Redirect) - Javascript (/showthread.php?tid=4504823)



Regex Protection(Bypassing to XSS or Open Redirect) - Javascript - ShihabSoft - Oct 24, 2014

Hello there,
Anyone in the universe can help me finding out the function.What will be done with this regex string

Quote:/^#~?!(?:\/?[\w\.-])+\/?(?:\?|$)/


When it passed to this javascript statement like this.

Code
(/^#~?!(?:\/?[\w\.-])+\/?(?:\?|$)/).test(location.hash)&&location.replace(location.hash.substr(location.hash.indexOf('!')+1));

And is it possible to bypass this regex string may be making an xss attack or an open redirect?