As others have said, this happens when the HTTP response contains a string of JavaScript and / or HTML, also contained in the request. This is usually caused by entering JS or HTML in the form field, but it can also be launched in other ways, such as manually adjusting the URL parameters.
The problem is that someone with bad intentions can put any JS that they want as a value, link to this URL with a malicious JS value and cause problems with their users.
In almost every case, this can be fixed using HTML encoding the response , although there are exceptions. For example, it will not be safe for content inside the <script> . Other specific cases can be handled differently - for example, entering input into a URL is better served by URL encoding.
As Kendall Hopkins mentioned, there may be several occasions when you really want JavaScript from the form inputs to execute, for example, creating an application like JSFiddle . In such cases, I would recommend that you at least wash the input in your backend code before writing it blindly. After that, you can use the method that he mentioned to prevent XSS blocking (at least in Chrome), but keep in mind that it reveals intruders to you.
sfarbota Jul 07 '15 at 2:16 2015-07-07 02:16
source share