skip to Main Content

i am not the strongest js user, but i need it and i wrote some code for my webpage which works on apache and php. in my ajax requests i have that code in

if (dataX['var1'] == '1.1' || dataX['var1'] == '2.1')
{
    window.location.href = '<domain>'
}

if i use XSStrike to check potential VULNERABILITIES on my system i get the message that maybe that part could be injected.

can someone help me to fix that if it is needed? do i need something like freeze or other stuff to fix that? Sry but i dont see how attackers could use that. thx for any usefull help. br

what i try? i try to ask on that channel?!

2

Answers


  1. If <domain> can contain arbitrary unchecked strings then the attacker would get access to the scope of your page if they previously managed to save "domain" with whatever string they wanted. In THIS case it is highly questionable what they could do other than redirect to their server since the code in <domain> would not be executed due to the page change
    I am not sure what a location

    window.location.href = '';executeSomethingNasty()
    

    or a change that only changes the hash

    window.location.href = window.location.href+'#stayonthepage';executeSomethingNasty()
    
    Login or Signup to reply.
  2. It’s safe when '<domain>' just a string. But when some value of location.href typed by user – it’s unsafe, because this construction can run javascript like javascript: alert(document.cookie) by specification.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search