Regex Protection(Bypassing to XSS or Open Redirect) - Javascript -



Regex Protection(Bypassing to XSS or Open Redirect) - Javascript -

anyone in universe can help me finding out function.what done regex string

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

when passed javascript statement this.

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

and possible bypass regex string may making xss attack or open redirect?

edit :-

ok iam going more accurate. goal break above regex match create xss or open redirect.(only education purpose,like crackme).

so eg:- if used #!stackoverflow.com browser redirects current domain plus stackoverflow.com like

domain.com/foo/#!stackoverflow.com

it redirects domain.com/stackoverflow.com.

so tried putting #!//stackoverflow.com regex match fails.

is there anyway bypass create open redirect stackoverflow.com(any kinda character encodings or else).

if else possible create xss in current context.

thank you.

it must :

start # (a hash in url) then maybe "~" (one or zero) then "!" then 1 ore more letters (\w ) or dots (.) or dash (-) then maybe "slash" (one or zero) then "?" or end of string

this means matches url

http://yourdomain/foo/#!bar?etc

and replace current url with

http://yourdomain/foo/bar?etc

to seek access straight file "bar" if exists

the risk if site in ajax, , create somewhere direct , blind include() of in hash.

javascript regex string redirect xss

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -