XSS (Cross site scripting) attack

Novice User asked on September 5, 2024 00:30

How do you prevent a XSS attack when a browser URL is like

https://www.somesote.com/search?input=%22%3E%3Cimg%20src=x%20onerror=alert(document.domain)%3E

This runs in the browser and brings up the alert . I have used URL encode in the search condition while getting input parameter as

Name:({% UrlEncode(Querystring["input"]) #%})

How can I prevent running that script and stop the alert box

Recent Answers


Laura Frese answered on October 3, 2024 00:13

Perhaps consider Imperva or cloudflare.

0 votesVote for this answer Mark as a Correct answer

   Please, sign in to be able to submit a new answer.