Click here to Skip to main content
15,891,840 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I have script added in Editor and its giving me Alert on Page Load

<script>alert("XSS-1")</script> 


%uff1cscript%uff1ealert(11);%uff1c/script%uff1e


What I have tried:

I have script added in Editor and its giving me Alert on Page Load

<pre><script>alert("XSS-1")</script> 


%uff1cscript%uff1ealert(11);%uff1c/script%uff1e
Posted
Updated 13-Mar-20 4:23am

1 solution

You're copying user input directly into the HTML document. You need to ensure that it's properly encoded first.

Since you're using jQuery, you can use the text method[^] instead of the html method[^] to update the target element:
JavaScript
$("#someElement").text(untrustedUserInput);
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900