Sigma Academy

Sigma Academy

  • Home
  • Học Tiếng Anh
  • Học tiếng Nhật
  • Luyện thi Ielts
  • Giáo Dục
  • Tin tức
    • Bất động sản
    • Phong Thuỷ
    • Công Nghệ
    • Ẩm thực
    • Làm Đẹp
You are here: Home / Công Nghệ / 3 Types of Cross-Site Scripting (XSS) Attacks

3 Types of Cross-Site Scripting (XSS) Attacks

06/10/2023 06/10/2023 Sigma Academy

Security is a major concern in the cyber world. Without appropriate security measures in place, websites are vulnerable to cybercriminals via multiple attack vectors. Security breaches can cause:

Có thể bạn quan tâm
  • Thu mua loa cũ, thu mua giá cao, thu tận nơi
  • Hướng dẫn cài macOS bằng USB miễn phí – ĐƠN GIẢN
  • 10 nhân vật mạnh nhất Bleach
  • Bình nóng lạnh bị nhảy chống giật: Nguyên nhân và cách khắc phục
  • USB mất dữ liệu – 4 nguyên nhân phổ biến và cách khắc phục
  • Database destruction or corruption
  • Loss of confidential information
  • Intellectual property theft
  • Costs incurred by legal and regulatory breaches

To avoid these consequences, you should employ best practices and the right tools.

Bạn đang xem: 3 Types of Cross-Site Scripting (XSS) Attacks

This article explores one common type of cyberattack: the cross-site scripting (XSS) attack. You’ll learn about the various types of XSS attacks, how they overlap, and how you can mitigate XSS vulnerabilities in your projects.

The concept of cross-site scripting

To carry out an XSS attack, the hacker inserts a malicious script into a website. Depending on the type of XSS attack, this script is then either transmitted to the victim or the website. The victim visits the website or tries to retrieve some data from the web server, launching the malicious script. The script usually introduces malware that steals sensitive data from the victim’s web server or browser or to change the website’s content.

There are numerous ways that hackers can exploit website vulnerabilities, as well as many strategies for counteracting them. If they aren’t quickly found and repaired, XSS vulnerabilities can lead to highly damaging attacks.

Types of XSS attacks

According to the Open Web Application Security Project (OWASP), XSS attacks fall into one of three categories: reflected XSS, stored XSS, and Document Object Model (DOM) XSS. These are detailed below.

Reflected cross-site scripting attack (non-persistent)

A reflected XSS attack occurs when a hacker delivers a malicious script to a vulnerable web application, which the server then returns in the HTTP response. The victim’s browser executes the malicious script as part of the HTTP response, compromising the legitimate user and sending private information back to the hacker.

Reflected XSS attacks typically target error messages or search engine result pages, as it’s easy to send a malicious email with a link that many users will click. When the user clicks the link, the server receives the request containing the malicious script, and since it’s not stored, it responds by sending a code back to the user. When user inputs aren’t adequately validated and sanitized, or when data is unsafely duplicated from a request, there’s a risk of reflected XSS vulnerabilities.

Xem thêm : Sự giống và khác nhau giữa dữ liệu và thông tin

The first line of defense against XSS attacks is to filter content and verify user inputs. You can use script suppliers’ safelists and blocklists to reject risky data patterns.

Additionally, you can implement a stringent Content Security Policy (CSP) to help you identify the source of inline scripts, reducing the risk of reflected XSS attacks. A strong CSP gives you control of scripts and the web page locations where they may be loaded and run.

Stored cross-site scripting attack (persistent)

In a stored XSS attack, a malicious script saves user input to the target server. Unlike a reflected XSS attack, which executes on the server, a stored XSS attack executes on the user’s browser. Attackers then use modern HTML5 applications, typically employing HTML databases, to permanently store harmful scripts on the browser.

In a stored XSS attack, the script is saved and executed on the server every time the user accesses the affected website. It’s easy for an attacker to target a large number of victims, and the result is persistent. Stored XSS attacks can also occur when untrained users try to extract data from the software without taking any sanitization or validation precautions.

Stored XSS attacks aim to reflect a malicious script to a user, so the easiest way to prevent them is to sanitize user data and handle inputs carefully—and the best way to prevent them is to use appropriate parameter binding.

You can sanitize data with an auto-escaping template system or HTML encoding. You should encode data intended for output to prevent the server from interpreting it as active content. This means the application will handle special characters in its saved data as HTML tag content, rather than plain HTML.

Data parameter (data) binding varies according to the vector, but you can always pass variables as additional values outside the normal functionality of the function. You can also use appropriate response headers to prevent attacks, typically by just adding a few lines of code.

Another technique to stop XSS attacks from occurring in real time is to employ dynamic security that actively searches for exploitation attempts. By blocking known patterns, you can stop attackers from exploiting existing loopholes.

Finally, you can use Web Application Firewalls (WAFs) for real-time XSS attack detection and mitigation.

Document Object Model (DOM) cross-site scripting attack

The DOM interface enables the processing and manipulation of web page contents by reading and modifying HTML and XML documents. DOM-based XSS attacks introduce malicious changes to the DOM context of the victim’s browser, causing the client-side code to be executed in unintended ways.

Xem thêm : 【FIX】Khắc phục mất quyền administrator Windows 7

DOM-based XSS attacks, unlike reflected and stored XSS attacks, do not store the malicious script or deliver it to the server. In this attack, the victim’s browser is the sole vulnerability. Since they’re more difficult to understand than other categories, DOM-based vulnerabilities are uncommon, sophisticated, and challenging to overcome. Moreover, automated vulnerability scanners and web application firewalls can’t easily identify them.

You can use the same techniques to prevent this attack as those for the other two, but you must take extra care to sanitize the client-side code. Two effective solutions are to prevent user-controlled sources from changing potentially dangerous JavaScript functions (known as sinks) or to allow only trustworthy content by using a safelist. With these precautions, strings that might endanger the DOM won’t be sent to sinks. You can also sanitize the data using built-in browser functionality, reducing the risk of parser change-related problems.

A novel defense against this type of attack is to use trusted types. This is a browser security mechanism that ensures that all risky parts of the DOM can only be used by data that has passed a predefined policy. It prevents arbitrary strings from being passed to potentially dangerous sinks, which helps the browser differentiate between code and data—removing the main source of vulnerability.

Server-side XSS versus client-side XSS

XSS attacks are categorized as either server XSS or client XSS. Client-side programs run on the client’s device or browser and take care of the user interface and any other processing that takes place on the client’s device. Server-side programs operate on servers and create the contents of a webpage.

Server-side XSS occurs when all the server-side code is vulnerable and the browser renders the response and runs any legitimate scripts embedded in it. On the other hand, client-side XSS executes on the user’s device and modifies a webpage after it has loaded.

An XSS attack is possible anywhere there is HTML. Whether they’re stored, reflected, or DOM-based, all XSS attacks have the same effect: An attacker gains complete control of a web session.

These XSS attacks can also overlap, and a website may be vulnerable to all three simultaneously. In the case of a single website or an offline application, all three attack types might present themselves directly in the browser. However, their behavior may differ when the data is saved on the server compared to when it’s reflected from the server.

Conclusion

OWASP lists XSS as one of the top web application security risks due to its prevalence, far-reaching impacts, and different methods through which the attacks can be executed.

Attackers employ a range of strategies to deceive users. Each variety of XSS attack exploits a separate weakness, but they aren’t mutually exclusive. In some scenarios, a DOM-based XSS attack is combined with a reflected or stored XSS attack.

Although the techniques for preventing different XSS attacks are similar, a single strategy won’t completely eradicate the risks. You should employ appropriate defensive tactics for every type of XSS attack.

Nguồn: https://sigma.edu.vn
Danh mục: Công Nghệ

Bài viết liên quan

Hóa Đại Cương – HIỆU ỨNG NHIỆT CỦA CÁC QUÁ TRÌNH HÓA HỌC
Tổng hợp đầy đủ font chữ biển số xe máy, ô tô 2023
Extension Marketplace
Extension Marketplace
Nội lực là gì? Điểm giống nhau giữa nội lực và ngoại lực là gì?
Hướng dẫn cách thay ổ cứng laptop đơn giản trong một nốt nhạc
Automation Test Là Gì? Kỹ Năng Cần Có Của Một Automation Tester
Automation Test Là Gì? Kỹ Năng Cần Có Của Một Automation Tester
Cách chuyển hình ảnh thành vector trong Illustrator (AI) nhanh chóng
Cách chuyển hình ảnh thành vector trong Illustrator (AI) nhanh chóng
TẠI SAO GỌI NƯỚC NGA LÀ XỨ SỞ BẠCH DƯƠNG?
Hướng dẫn thiết lập cài đặt gốc trên HTC One M8
PHÂN BIỆT BLACK BOX TEST VÀ WHITE BOX TEST, SƠ LƯỢC MỘT SỐ KỸ THUẬT TRONG BLACK BOX TEST
PHÂN BIỆT BLACK BOX TEST VÀ WHITE BOX TEST, SƠ LƯỢC MỘT SỐ KỸ THUẬT TRONG BLACK BOX TEST

Chuyên mục: Công Nghệ

About Sigma Academy

Previous Post: « Danh sách siêu thị, trung tâm thương mại Quận 8
Next Post: Làm Sổ hồng chung cư: Thủ tục thế nào? Phí bao nhiêu? »

Primary Sidebar

Bài viết nổi bật

Bảo vệ: Tổng hợp thông tin các ngành của Đại học Quốc gia Hà Nội

03/07/2024

TB Tuyển sinh Thạc Sĩ Chuyên ngành Khoa học Điều dưỡng – Khoá 3

27/06/2024

Thích ứng với chương trình lớp 10 mới: Đòi hỏi những thay đổi trong dạy và học

25/06/2024

Cập nhật nội dung & những thay đổi trong chương trình lớp 1 mới

Cập nhật nội dung & những thay đổi trong chương trình lớp 1 mới

24/06/2024

Giáo dục công dân lớp 9 – Giải bài tập sgk GDCD 9 ngắn nhất

24/06/2024

Các loại bằng thạc sĩ và cách phân biệt

24/06/2024

Giáo án Giáo dục địa phương lớp 6 năm 2023 – 2024 KHBD môn Giáo dục địa phương (Hà Nội, Hồ Chí Minh, Vĩnh Long, Thanh Hóa)

24/06/2024

[:vi]TOP CÁC TRƯỜNG ĐÀO TẠO NGÀNH KỸ THUẬT XÂY DỰNG CHẤT LƯỢNG[:]

[:vi]TOP CÁC TRƯỜNG ĐÀO TẠO NGÀNH KỸ THUẬT XÂY DỰNG CHẤT LƯỢNG[:]

24/06/2024

Thông báo tuyển sinh đào tạo Thạc sĩ Luật Khóa 37 (2023 - 2025)

Thông báo tuyển sinh đào tạo Thạc sĩ Luật Khóa 37 (2023 – 2025)

24/06/2024

Giải đáp về Chương trình Giáo dục Vinschool

24/06/2024

Ngành cơ điện tử: Học gì, học ở đâu và cơ hội nghề nghiệp

24/06/2024

3 nguyên tắc - 4 phương pháp giáo dục cảm xúc cho trẻ mầm non ba mẹ cần biết

3 nguyên tắc – 4 phương pháp giáo dục cảm xúc cho trẻ mầm non ba mẹ cần biết

24/06/2024

Ngành Logistics học trường nào sẽ dễ xin việc?

Ngành Logistics học trường nào sẽ dễ xin việc?

24/06/2024

Khoa Sau Đại học – Trường Đại học Mở Tp.HCM

24/06/2024

Chương trình liên kết quốc tế là gì? Hình thức liên kết phổ biến hiện nay

Chương trình liên kết quốc tế là gì? Hình thức liên kết phổ biến hiện nay

24/06/2024

Ngành An toàn thông tin

24/06/2024

Học thạc sĩ giáo dục tiểu học ở đâu? Điều kiện thi thạc sĩ giáo dục?

Học thạc sĩ giáo dục tiểu học ở đâu? Điều kiện thi thạc sĩ giáo dục?

24/06/2024

Ngành Digital Marketing học trường nào? Top 25+ trường đào tạo tốt nhất

Ngành Digital Marketing học trường nào? Top 25+ trường đào tạo tốt nhất

24/06/2024

Bộ GDĐT ban hành khung kế hoạch thời gian năm học 2022-2023

24/06/2024

3 nguyên tắc - 4 phương pháp giáo dục cảm xúc cho trẻ mầm non ba mẹ cần biết

3 nguyên tắc – 4 phương pháp giáo dục cảm xúc cho trẻ mầm non ba mẹ cần biết

24/06/2024

Footer

Về chúng tôi

Sigma Academy – sigma.edu.vn là tổ chức giáo dục kỹ năng cho trẻ. Đồng thời là thông tin tự động cập nhật Google chuyên cung cấp kiến thức về tất cả lĩnh vực. Website chúng tôi là web site cập nhật nội dung tự động từ google.com. Nếu có vấn đề gì về bản quyền vui lòng liên hệ: contact@sigma.edu.vn.

  • Điều khoản sử dụng
  • Chính sách bảo mật
  • Liên hệ

Mạng xã hội

  • Facebook
  • Zalo
  • Website
  • Google maps

Theo dõi chúng tôi tại Google News

Địa Chỉ

Trụ sở chính: 116/12 Tân Mỹ, phường Tân Thuận Tây, quận 7, Ho Chi Minh City, Vietnam
Điện thoại: 097.331.14.49 | Email: contact@sigma.edu.vn

Map

Bản quyền © 2025