search

Home  >  Q&A  >  body text

JavaScript Code Vulnerability Fix: Important Steps You Need to Know

I'm not the strongest JS user, but I need it and wrote some code for my web page that works on Apache and PHP. In my ajax request I have the following code:

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

If I use XSStrike to check for potential vulnerabilities on my system, I get messages that may be injectable.

Can someone help me fix it? Do I need like a freeze or something to fix it? Sorry, I don't know how an attacker can use this. Thanks for any helpful help. good luck.

What have I tried? I tried asking on that channel? !

P粉463418483P粉463418483464 days ago778

reply all(4)I'll reply

  • 尊渡假赌尊渡假赌尊渡假赌

    尊渡假赌尊渡假赌尊渡假赌2023-11-20 17:13:18

    test. .

    reply
    0
  • 尊渡假赌尊渡假赌尊渡假赌

    尊渡假赌尊渡假赌尊渡假赌2023-11-20 17:12:03

    test. . .

    reply
    0
  • P粉739079318

    P粉7390793182023-09-21 11:34:55

    If <domain> can contain arbitrary unchecked strings, then if an attacker has previously successfully saved any string they wanted as "domain", they will gain access to your page scope . In this case, it's highly questionable what they could do except redirect to their server, since the code in <domain> won't be executed due to the page change. I'm not sure about a location

    window.location.href = '';executeSomethingNasty()
    Or just change the hash
    window.location.href = window.location.href+'#stayonthepage';executeSomethingNasty()

    reply
    0
  • 尊渡假赌尊渡假赌尊渡假赌

    尊渡假赌尊渡假赌尊渡假赌2023-09-21 15:23:17

    Such an answer

    reply
    1
  • Cancelreply