Do not underestimate the comments out of JS caused by security problems _javascript skills

Source: Internet
Author: User
One is the header insertion problem.
The other is the \ r \ n issue.
Let's look at a piece of code like this:
1. Test
2. <script>
3.//alert (' <%=request.getparameter ("username")%> ');
4. </script>
As you can see, there seems to be a loophole, but it has been made up and commented out.
So since the notes are off, shouldn't there be any problems?
No.
Look at this URL again.
Http://localhost/index.jsp?username=kxlzx%0d%0a%0d%0aalert (' Kxlzx
Very helpless, huh?
The following code was generated:
Test
<script>
Alert (' Kxlzx
Alert (' Kxlzx ');
</script>
Commented out of JS, also executed.
So, do not put useless code, commented out of JS, etc., thrown into the HTML.
Code audits are a WINS, and any omissions are worth noting.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.