Home > Operation and Maintenance > Safety > What are the three major types of cross-site scripting attacks?

What are the three major types of cross-site scripting attacks?

王林
Release: 2020-06-28 16:48:56
Original
13134 people have browsed it

There are three major types of cross-site scripting attacks on XSS: 1. Persistent cross-site; 2. Non-persistent cross-site; 3. DOM cross-site. Persistent cross-site is the most direct type of hazard, and the cross-site code is stored on the server; non-persistent cross-site is a reflective cross-site scripting vulnerability, which is the most common type.

What are the three major types of cross-site scripting attacks?

1. Cross-site scripting attack types:

(1) Persistent cross-site: the most direct type of harm, cross-site code storage on the server (database).

(2) Non-persistent cross-site: Reflected cross-site scripting vulnerability, the most common type. User accesses the server-cross-site link-returns cross-site code.

(3) DOM cross-site (DOM XSS): DOM (document object model document object model), security issues caused by client script processing logic.

(If you want to know more about related issues, you can visit php Chinese website.)

2. How to prevent?

From the perspective of website developers, how to protect against XSS attacks?

The best protection against XSS should combine the following two methods:

1. Verify all input data to effectively detect attacks;

2. Encode all output data appropriately to prevent any successfully injected script from running on the browser side.

The details are as follows:

Input validation: Before a certain data is accepted as being displayed or stored, the standard input validation mechanism is used to verify the length, type, syntax and business rules of all input data. .

Output encoding: Before data output, ensure that the data submitted by the user has been correctly entity-encoded. It is recommended to encode all characters and not just be limited to a certain subset.

Explicitly specify the encoding of the output: Don't allow attackers to choose the encoding for your users (such as ISO 8859-1 or UTF 8).

Note: Limitations of the blacklist verification method: just finding or replacing some characters (such as "<" ">" or keywords similar to "script") can easily be bypassed by XSS variant attacks Verification mechanism.

Beware of normalization errors: Before validating input, it must be decoded and normalized to conform to the application's current internal representation. Please make sure that the application does not decode the same input twice.

From the perspective of website users, how to protect against XSS attacks?

When you open an email or attachment or browse a forum post, malicious scripts may be automatically executed, so , you must be particularly careful when doing these operations. It is recommended to turn off JavaScript in your browser settings. If using IE browser, set the security level to "High".

What needs to be reminded here again is that XSS attacks are actually accompanied by the successful application of social engineering. It is necessary to enhance security awareness and only trust trustworthy sites or content. You can use some detection tools to detect XSS vulnerabilities. The harm caused by XSS vulnerabilities is huge. If any vulnerabilities are discovered, they should be repaired immediately.

The above is the detailed content of What are the three major types of cross-site scripting attacks?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template