Question
Which of the following best describes the mechanism of a
Cross-Site Scripting (XSS) attack?Solution
A Cross-Site Scripting (XSS) attack involves injecting malicious scripts, typically JavaScript, into web pages that are later viewed by other users. This attack exploits vulnerabilities in web applications that fail to properly validate or sanitize user inputs. When a victim visits the compromised web page, the malicious script executes in their browser, potentially stealing sensitive data, hijacking sessions, or defacing websites. XSS is categorized into three types: reflected, stored, and DOM-based. Stored XSS is particularly dangerous because the malicious script is permanently stored on the server and served to multiple users. For instance, attackers might inject a script into a comment section of a blog, and every user viewing the comments becomes a victim. Proper input validation, output encoding, and Content Security Policy (CSP) implementation are essential defenses against XSS. Why Other Options Are Incorrect :
- Exploiting vulnerabilities in a database to inject malicious SQL queries : This describes SQL Injection, which targets backend databases rather than injecting scripts into web pages.
- Tricking users into executing unintended actions on a web application they are authenticated with : This is a Cross-Site Request Forgery (CSRF) attack, not XSS.
- Overwhelming a server with excessive traffic to disrupt service availability : This refers to Distributed Denial-of-Service (DDoS) attacks, unrelated to injecting scripts.
- Using trial-and-error methods to guess valid user credentials : This describes a Brute Force attack, which involves guessing passwords and does not involve script injection.
Two cyclists, βPβ and βQβ, started from locations βLβ and βRβ towards each other at the same time. When they met after 4 hours, cyclist ...
Average speed of βAβ during a 24-hour journey is 32 km/h. If he covered the first 160 km of his journey at a speed of 20 km/h, then find the speed a...
Ravi travels the first 40% of a certain distance at a speed of 20 km/h, the next 30% at 10 km/h, and covers the remaining 30% at 12 km/h. Calculate Ravi...
- A windmill rotates 60 times in 1.5 hours. Find the number of rotations made by the windmill in 36 minutes.
A bus takes 6 hours to travel from city P to city Q. If the speed was reduced by 10% after covering 120 km, it takes 30 more minu...
The speed of two cars A and B are in the ratio of 8:11 respectively. Car A travels 18 km less than the car B in the same time duration. What was the dis...
A car travels at a speed of 90 km/h and takes 4.5 hours to cover a specific distance. A train can cover the same distance in 3 hours. If the speed of th...
In an examination, the average marks obtained by the students is 75. After correcting the quantitative mistakes, the average of 100 students is reduced ...
The distance between two stations is 1520 km. Train A takes 9 hours longer than Train B to cover this distance. If Train B travels 72 km/h faster than T...
Resham travels 60 km at 20 km/h by cycle, 120 km at 60 km/h by car, and the remaining 10 km on foot at 2.5 km/h. Find her average speed for the whole jo...