search
HomeOperation and MaintenanceSafetyWhat are the three major types of cross-site scripting attacks?

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

Jun 28, 2020 pm 04:48 PM
xssCross-site scripting attack

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!

Statement
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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Atom editor mac version download

Atom editor mac version download

The most popular open source editor