Web front-end security: XSS cross-site scripting, CSRF cross-site request forgery, SQL injection, and more

Source: Internet
Author: User
Tags script tag sql injection attack xpath

Introduces several front-end security attack methods, as well as the prevention method:

1. XSS

XSS (Cross site Scripting), the principle of XSS is to inject script into HTML, HTML specifies script tag.

XSS attacks fall into two categories

1. Attacks from within, mainly refers to the use of the program's own vulnerabilities, the construction of cross-site statements. 2. Attacks from outside, mainly refers to their own construction of the XSS cross-Site Vulnerability Web page or to find a non-target outside the Web site has a cross-site vulnerability. If we are going to infiltrate a site, we construct a Web page with a cross-site vulnerability, and then construct the cross-site statement, which, by combining other technologies, such as social engineering, will trick the administrator of the target server into opening.

Prevention: Actively filter user input, never trust users

2.CSRF

CSRF (Cross-site request forgery) cross-site requests forgery, also known as "one click Attack" or "session riding", usually abbreviated to CSRF or XSRF, is a malicious use of the site.

Although it sounds like a cross-site script (XSS), it is very different from XSS and is almost at odds with the way it is attacked. XSS leverages trusted users within the site, while CSRF leverages trusted sites by disguising requests from trusted users. Compared to XSS attacks, csrf attacks are often less prevalent (and therefore have very few resources to protect against them) and are difficult to guard against, so they are considered more dangerous than XSS.

specifically refer to this article:http://www.cnblogs.com/hyddd/archive/2009/04/09/1432744.html

Prevention: Use the POST request of HTTP to perform all important operations, or use a dynamically generated token: A hidden field is assigned a dynamic value that is also added to the user session information, and the server side receives the client request. The server checks whether the hidden variables for post and user session information get the same.

3. SQL injection attacks

SQL injection attack is one of the common means for hackers to attack the database. Quite a few programmers write code without judging the legality of the user's input data, so that the application has a security risk. The user can submit a database query code, according to the results returned by the program, to obtain some of the data he wants to know, this is called SQL injection, that is, SQL injection.

Reference: http://baike.baidu.com/view/983303.htm

Prevention: Before saving to the database, the user input data to judge the legality

4. JavaScript hijacking

Reference: http://www.cnblogs.com/hyddd/archive/2009/07/02/1515768.html

5. XPath injection

An XPath injection attack is a loosely-typed and fault-tolerant feature of an XPath parser that can be accompanied by malicious XPath query code on a URL, form, or other information to gain access to permission information and change that information.

An XPath injection attack is a new attack method applied to a Web service that allows an attacker to obtain the full content of an XML document through an XPath query without prior knowledge of the XPath query.

Reference: http://www.2cto.com/Article/201203/122201.html

Web front-end security: XSS cross-site scripting, CSRF cross-site request forgery, SQL injection, and more

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.