Cross Site Scripting XSS
Cross Site Scripting XSS
(XSS)
Presented by:
MANOJ BOGA
Understanding Cross-
Site Scripting (XSS)
Cross-Site Scripting (XSS) is a type of cyber attack where malicious scripts are
injected into web pages, allowing attackers to hijack user sessions, steal sensitive
information, and more. It's a critical vulnerability that every web developer
should understand and mitigate.
How XSS Works
1 Injection
The attacker injects malicious code, typically JavaScript, into a web page or
application.
2 Execution
When the page loads, the malicious script executes, giving the attacker control over
the user's session and data.
3 Exploitation
The attacker can then steal sensitive information, hijack user accounts, or perform
other malicious actions.
Types of XSS Attacks
1 Reflected XSS 2 Stored XSS 3 DOM-based XSS
Where the malicious script Where the malicious script Where the vulnerability
is reflected back to the user is permanently stored on exists in the client-side
through the vulnerable web the server and executed by JavaScript code that
application. every user who views the processes user input.
page.
Identifying XSS Vulnerabilities
Input Validation Output Encoding Code Auditing
Carefully validate and sanitize Properly encode and escape all Regularly audit your codebase to
all user input to prevent the output to prevent the execution identify and fix any potential
injection of malicious scripts. of injected scripts. XSS vulnerabilities.
Preventing XSS Attacks
Input Validation Output Encoding
Validate and sanitize all user input using input Properly encode and escape all output to prevent
validation libraries and techniques. the execution of injected scripts.
GitHub XSS
In 2018, an XSS vulnerability in GitHub's Gist feature allowed attackers to steal user
data.
Facebook XSS
In 2019, a critical XSS flaw in Facebook's search functionality allowed attackers to
steal user data.
Importance of XSS Security
Data Theft XSS attacks can be used to steal sensitive user data,
such as login credentials, financial information, and
personal details.
Account Hijacking Attackers can hijack user sessions and take control
of their accounts, allowing them to perform
unauthorized actions.