SlideShare a Scribd company logo
1 of 41
Download to read offline
CNIT 129S: Securing
Web Applications
Ch 12: Attacking Users:
Cross-Site Scripting (XSS)
Part 1
Attacking Clients
• Vulnerabilities in browsers
• May result in session hijacking,
unauthorized actions, and disclosure of
personal data, keylogging, remote code
execution
• XSS is the most prevalent web
application vulnerability in the world
Varieties of XSS
• Reflected XSS
• Stored XSS
• DOM-Based XSS
Reflected XSS
• Example: an error message that takes text from
user and displays it back to the user in its
response
• 75% of all XSS vulnerabilities are this type
Persistent Cookies
• If user has a persistent cookie, implementing
"remember me"
• Step 1 is not needed
• User need not be currently logged in
Same-Origin Policy
• evil.com cannot get your target.com cookies
from your browser
• Only a page in the same domain (arget.com)
• But XSS lets the attacker add scripting to a page
that comes from target.com
• Hence the name Cross-Site Scripting
Stored XSS Vulnerabilities
• A message is stored
• Executed on any user who views it
• May attack a large number of users
DOM-Based XSS
The Vulnerability
• Client-side JavaScript can access the browser's
Document Object Model
• Can determine the URL used to load the current
page
• A script the developer put there may extract
data from the URL and display it, dynamically
updating the page's contents
Example: Dynamically
Generated Error Message
• Writes message to page
• Can also write script to page
Real-World XSS Attacks
Apache (2010)
• XSS in issue-tracking application
• Attacker injected code, obscured it with a URL
shortener
• Administrator clicked the link
• Attacker stole the administrator's cookie
• Attacker altered the upload folder for the project
and placed a Trojan login form there
Apache (2010)
• Attacker captured usernames and passwords
for Apache privileged users
• Found passwords that were re-used on other
systems within the infrastructure
• Fully compromised those systems, escalating
the attack beyond the vulnerable Web
application
• Link Ch 12a
MySpace (2005)
• Samy evaded filters intended to block XSS
• Added JavaScript to his user profile, that
made every viewer
• Add Samy as a friend
• Copied the script to the user's profile
• Gained over 1 million friends within hours
• Link Ch 12b
• Stored XSS in email allowed attackers to send a
malicious email to the CEO
• Stealing his session cookie
Twitter (2009)
• Link Ch 12d
Other Payloads for XSS
• Virtual Defacement
• Add images, code, or other content to a page
Injecting Trojan Functionality
• Inject actual working functionality into the
vulnerable application
• Such as a fake login form to capture credentials
• Or the fake Google purchase form on the next
slide, from 2004
Disadvantages of Session
Hijacking
• Attacker must monitor her server and collect
cookies
• Then carry out actions on behalf of target users
• Labor-intensive
• Leaves traces in server logs
Inducing User Actions
• Use attack payload script to carry out actions
directly
• If the goal is to perform an administrator action,
each user can be forced to try it until an
administrator is compromised
• MySpace XSS worm did this
Exploiting Trust Relationships
• Browsers trust JavaScript with cookies from the
same website
• Autocomplete in the browser can fill in fields,
which are then read by JavaScript
• Some sites require being added to Internet
Explorer's "Trusted Sites"; those sites can run
arbitrary code like this
Exploiting Trust Relationships
• ActiveX controls often contain powerful
methods
• They may check to see that requests came
from the expected site
• With XSS, that condition is satisfied
Escalating the Client-Side
Attack
• Website may attack users by
• Logging keystrokes
• Capturing browsing history
• Port-scanning the local network
Delivery Mechanisms for
XSS Attacks
Delivering Reflected and
COM-Based XSS Attacks
• Phishing email containing a crafted URL
• Targeted attack with custom email
• Instant message containing a URL
• Code posted on websites that allow user to post
HTML
Watering Hole Attack
• Attacker creates a website with content that will
interest the target users
• Use search engine optimization to attract
viewers
• Page contains content that causes the user's
browser to make requests containing XSS
payloads to the vulnerable application
• Purchase ad space, put malicious URL in the ad
• The ad may appear in pages about the app you
are attacking, because of keyword matches
• Web apps often have "tell a friend" or "send
feedback" features
• Leverage this to deliver an XSS attack via an
email that originate from the organization's
server
Delivering Reflected and
DOM-Based XSS Attacks
Delivering Stored XSS
Attacks
• In-band (most common)
Delivering Stored XSS
Attacks
• Out-of-band (most common)
• Anything other than viewing the target app
• Such as email from its server
Chaining XSS
• XSS vulnerability itself may be low-risk
• But chaining it together with other
vulnerabilities can cause serious compromise
Example
• XSS allows script to be inserted into user's
displayed name
• Access control flaw lets attacker change other
users' names
• Add token-stealing XSS to every username
• Gain administrator credentials: total control of
application

More Related Content

What's hot

What's hot (20)

Ch 10: Attacking Back-End Components
Ch 10: Attacking Back-End ComponentsCh 10: Attacking Back-End Components
Ch 10: Attacking Back-End Components
 
CNIT 129S: 8: Attacking Access Controls
CNIT 129S: 8: Attacking Access ControlsCNIT 129S: 8: Attacking Access Controls
CNIT 129S: 8: Attacking Access Controls
 
CNIT 129S Ch 4: Mapping the Application
CNIT 129S Ch 4: Mapping the ApplicationCNIT 129S Ch 4: Mapping the Application
CNIT 129S Ch 4: Mapping the Application
 
Ch 12 Attacking Users - XSS
Ch 12 Attacking Users - XSSCh 12 Attacking Users - XSS
Ch 12 Attacking Users - XSS
 
4 Mapping the Application
4 Mapping the Application4 Mapping the Application
4 Mapping the Application
 
Ch 9 Attacking Data Stores (Part 2)
Ch 9 Attacking Data Stores (Part 2)Ch 9 Attacking Data Stores (Part 2)
Ch 9 Attacking Data Stores (Part 2)
 
Ch 1: Web Application (In)security & Ch 2: Core Defense Mechanisms
Ch 1: Web Application (In)security & Ch 2: Core Defense MechanismsCh 1: Web Application (In)security & Ch 2: Core Defense Mechanisms
Ch 1: Web Application (In)security & Ch 2: Core Defense Mechanisms
 
Ch 1: Web Application (In)security & Ch 2: Core Defense Mechanisms
Ch 1: Web Application (In)security & Ch 2: Core Defense Mechanisms Ch 1: Web Application (In)security & Ch 2: Core Defense Mechanisms
Ch 1: Web Application (In)security & Ch 2: Core Defense Mechanisms
 
CNIT 129S: Securing Web Applications Ch 1-2
CNIT 129S: Securing Web Applications Ch 1-2CNIT 129S: Securing Web Applications Ch 1-2
CNIT 129S: Securing Web Applications Ch 1-2
 
CNIT 129S: Ch 6: Attacking Authentication
CNIT 129S: Ch 6: Attacking AuthenticationCNIT 129S: Ch 6: Attacking Authentication
CNIT 129S: Ch 6: Attacking Authentication
 
CNIT 129S: 9: Attacking Data Stores (Part 1 of 2)
CNIT 129S: 9: Attacking Data Stores (Part 1 of 2)CNIT 129S: 9: Attacking Data Stores (Part 1 of 2)
CNIT 129S: 9: Attacking Data Stores (Part 1 of 2)
 
Waf bypassing Techniques
Waf bypassing TechniquesWaf bypassing Techniques
Waf bypassing Techniques
 
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ BehaviourWAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
WAF Bypass Techniques - Using HTTP Standard and Web Servers’ Behaviour
 
CNIT 129S: 9: Attacking Data Stores (Part 2 of 2)
CNIT 129S: 9: Attacking Data Stores (Part 2 of 2)CNIT 129S: 9: Attacking Data Stores (Part 2 of 2)
CNIT 129S: 9: Attacking Data Stores (Part 2 of 2)
 
Secure Session Management
Secure Session ManagementSecure Session Management
Secure Session Management
 
CNIT 129S - Ch 3: Web Application Technologies
CNIT 129S - Ch 3: Web Application TechnologiesCNIT 129S - Ch 3: Web Application Technologies
CNIT 129S - Ch 3: Web Application Technologies
 
OAuth2 - Introduction
OAuth2 - IntroductionOAuth2 - Introduction
OAuth2 - Introduction
 
CNIT 129S: Ch 7: Attacking Session Management
CNIT 129S: Ch 7: Attacking Session Management CNIT 129S: Ch 7: Attacking Session Management
CNIT 129S: Ch 7: Attacking Session Management
 
Building Advanced XSS Vectors
Building Advanced XSS VectorsBuilding Advanced XSS Vectors
Building Advanced XSS Vectors
 
Digital signature & eSign overview
Digital signature & eSign overviewDigital signature & eSign overview
Digital signature & eSign overview
 

Viewers also liked

Viewers also liked (20)

CNIT 129S: Ch 5: Bypassing Client-Side Controls
CNIT 129S: Ch 5: Bypassing Client-Side ControlsCNIT 129S: Ch 5: Bypassing Client-Side Controls
CNIT 129S: Ch 5: Bypassing Client-Side Controls
 
CNIT 121: 11 Analysis Methodology
CNIT 121: 11 Analysis MethodologyCNIT 121: 11 Analysis Methodology
CNIT 121: 11 Analysis Methodology
 
CNIT 121: 12 Investigating Windows Systems (Part 2 of 3)
CNIT 121: 12 Investigating Windows Systems (Part 2 of 3)CNIT 121: 12 Investigating Windows Systems (Part 2 of 3)
CNIT 121: 12 Investigating Windows Systems (Part 2 of 3)
 
CNIT 121: 2 IR Management Handbook
CNIT 121: 2 IR Management HandbookCNIT 121: 2 IR Management Handbook
CNIT 121: 2 IR Management Handbook
 
CNIT 121: 4 Getting the Investigation Started on the Right Foot & 5 Initial D...
CNIT 121: 4 Getting the Investigation Started on the Right Foot & 5 Initial D...CNIT 121: 4 Getting the Investigation Started on the Right Foot & 5 Initial D...
CNIT 121: 4 Getting the Investigation Started on the Right Foot & 5 Initial D...
 
CNIT 121: 12 Investigating Windows Systems (Part 3)
CNIT 121: 12 Investigating Windows Systems (Part 3)CNIT 121: 12 Investigating Windows Systems (Part 3)
CNIT 121: 12 Investigating Windows Systems (Part 3)
 
CNIT 40: 6: DNSSEC and beyond
CNIT 40: 6: DNSSEC and beyondCNIT 40: 6: DNSSEC and beyond
CNIT 40: 6: DNSSEC and beyond
 
CNIT 121: Computer Forensics Ch 1
CNIT 121: Computer Forensics Ch 1CNIT 121: Computer Forensics Ch 1
CNIT 121: Computer Forensics Ch 1
 
CNIT 121: 3 Pre-Incident Preparation
CNIT 121: 3 Pre-Incident PreparationCNIT 121: 3 Pre-Incident Preparation
CNIT 121: 3 Pre-Incident Preparation
 
CNIT 121: 6 Discovering the Scope of the Incident & 7 Live Data Collection
CNIT 121: 6 Discovering the Scope of the Incident & 7 Live Data CollectionCNIT 121: 6 Discovering the Scope of the Incident & 7 Live Data Collection
CNIT 121: 6 Discovering the Scope of the Incident & 7 Live Data Collection
 
CNIT 128 Ch 4: Android
CNIT 128 Ch 4: AndroidCNIT 128 Ch 4: Android
CNIT 128 Ch 4: Android
 
CNIT 40: 3: DNS vulnerabilities
CNIT 40: 3: DNS vulnerabilitiesCNIT 40: 3: DNS vulnerabilities
CNIT 40: 3: DNS vulnerabilities
 
CNIT 127 Ch Ch 1: Before you Begin
CNIT 127 Ch Ch 1: Before you BeginCNIT 127 Ch Ch 1: Before you Begin
CNIT 127 Ch Ch 1: Before you Begin
 
Is Your Mobile App Secure?
Is Your Mobile App Secure?Is Your Mobile App Secure?
Is Your Mobile App Secure?
 
Practical Malware Analysis Ch 14: Malware-Focused Network Signatures
Practical Malware Analysis Ch 14: Malware-Focused Network SignaturesPractical Malware Analysis Ch 14: Malware-Focused Network Signatures
Practical Malware Analysis Ch 14: Malware-Focused Network Signatures
 
CNIT 128 Ch 3: iOS
CNIT 128 Ch 3: iOSCNIT 128 Ch 3: iOS
CNIT 128 Ch 3: iOS
 
CNIT 127 Ch 5: Introduction to heap overflows
CNIT 127 Ch 5: Introduction to heap overflowsCNIT 127 Ch 5: Introduction to heap overflows
CNIT 127 Ch 5: Introduction to heap overflows
 
CNIT 40: 4: Monitoring and detecting security breaches
CNIT 40: 4: Monitoring and detecting security breachesCNIT 40: 4: Monitoring and detecting security breaches
CNIT 40: 4: Monitoring and detecting security breaches
 
Practical Malware Analysis: Ch 4 A Crash Course in x86 Disassembly
Practical Malware Analysis: Ch 4 A Crash Course in x86 Disassembly Practical Malware Analysis: Ch 4 A Crash Course in x86 Disassembly
Practical Malware Analysis: Ch 4 A Crash Course in x86 Disassembly
 
CNIT 40: 2: DNS Protocol and Architecture
CNIT 40: 2: DNS Protocol and ArchitectureCNIT 40: 2: DNS Protocol and Architecture
CNIT 40: 2: DNS Protocol and Architecture
 

Similar to CNIT 129S: 12: Attacking Users: Cross-Site Scripting (Part 1 of 2)

Similar to CNIT 129S: 12: Attacking Users: Cross-Site Scripting (Part 1 of 2) (20)

CNIT 129S: Ch 12: Attacking Users: Cross-Site Scripting
CNIT 129S: Ch 12: Attacking Users: Cross-Site ScriptingCNIT 129S: Ch 12: Attacking Users: Cross-Site Scripting
CNIT 129S: Ch 12: Attacking Users: Cross-Site Scripting
 
Cross site scripting XSS
Cross site scripting XSSCross site scripting XSS
Cross site scripting XSS
 
Chapter 13 web security
Chapter 13 web securityChapter 13 web security
Chapter 13 web security
 
Vulnerabilities in Web Applications
Vulnerabilities in Web ApplicationsVulnerabilities in Web Applications
Vulnerabilities in Web Applications
 
www.webre24h.com - Ajax security
www.webre24h.com - Ajax securitywww.webre24h.com - Ajax security
www.webre24h.com - Ajax security
 
Browser Security 101
Browser Security 101 Browser Security 101
Browser Security 101
 
Web Security
Web SecurityWeb Security
Web Security
 
Secure Coding BSSN Semarang Material.pdf
Secure Coding BSSN Semarang Material.pdfSecure Coding BSSN Semarang Material.pdf
Secure Coding BSSN Semarang Material.pdf
 
Web application security part 01
Web application security part 01Web application security part 01
Web application security part 01
 
Cross site scripting
Cross site scripting Cross site scripting
Cross site scripting
 
Website hacking and prevention (All Tools,Topics & Technique )
Website hacking and prevention (All Tools,Topics & Technique )Website hacking and prevention (All Tools,Topics & Technique )
Website hacking and prevention (All Tools,Topics & Technique )
 
Django (Web Applications that are Secure by Default)
Django �(Web Applications that are Secure by Default�)Django �(Web Applications that are Secure by Default�)
Django (Web Applications that are Secure by Default)
 
Web application security
Web application securityWeb application security
Web application security
 
Owasp top 10 vulnerabilities 2013
Owasp top 10 vulnerabilities   2013Owasp top 10 vulnerabilities   2013
Owasp top 10 vulnerabilities 2013
 
Advanced Client Side Exploitation Using BeEF
Advanced Client Side Exploitation Using BeEFAdvanced Client Side Exploitation Using BeEF
Advanced Client Side Exploitation Using BeEF
 
Isys20261 lecture 09
Isys20261 lecture 09Isys20261 lecture 09
Isys20261 lecture 09
 
Internet Security
Internet SecurityInternet Security
Internet Security
 
Cross Site Scripting Defense Presentation
Cross Site Scripting Defense Presentation Cross Site Scripting Defense Presentation
Cross Site Scripting Defense Presentation
 
Top 10 web application security risks akash mahajan
Top 10 web application security risks   akash mahajanTop 10 web application security risks   akash mahajan
Top 10 web application security risks akash mahajan
 
Web Application Security
Web Application SecurityWeb Application Security
Web Application Security
 

More from Sam Bowne

More from Sam Bowne (20)

Cyberwar
CyberwarCyberwar
Cyberwar
 
3: DNS vulnerabilities
3: DNS vulnerabilities 3: DNS vulnerabilities
3: DNS vulnerabilities
 
8. Software Development Security
8. Software Development Security8. Software Development Security
8. Software Development Security
 
3. Attacking iOS Applications (Part 2)
 3. Attacking iOS Applications (Part 2) 3. Attacking iOS Applications (Part 2)
3. Attacking iOS Applications (Part 2)
 
12 Elliptic Curves
12 Elliptic Curves12 Elliptic Curves
12 Elliptic Curves
 
11. Diffie-Hellman
11. Diffie-Hellman11. Diffie-Hellman
11. Diffie-Hellman
 
2a Analyzing iOS Apps Part 1
2a Analyzing iOS Apps Part 12a Analyzing iOS Apps Part 1
2a Analyzing iOS Apps Part 1
 
9 Writing Secure Android Applications
9 Writing Secure Android Applications9 Writing Secure Android Applications
9 Writing Secure Android Applications
 
12 Investigating Windows Systems (Part 2 of 3)
12 Investigating Windows Systems (Part 2 of 3)12 Investigating Windows Systems (Part 2 of 3)
12 Investigating Windows Systems (Part 2 of 3)
 
10 RSA
10 RSA10 RSA
10 RSA
 
12 Investigating Windows Systems (Part 1 of 3
12 Investigating Windows Systems (Part 1 of 312 Investigating Windows Systems (Part 1 of 3
12 Investigating Windows Systems (Part 1 of 3
 
9. Hard Problems
9. Hard Problems9. Hard Problems
9. Hard Problems
 
8 Android Implementation Issues (Part 1)
8 Android Implementation Issues (Part 1)8 Android Implementation Issues (Part 1)
8 Android Implementation Issues (Part 1)
 
11 Analysis Methodology
11 Analysis Methodology11 Analysis Methodology
11 Analysis Methodology
 
8. Authenticated Encryption
8. Authenticated Encryption8. Authenticated Encryption
8. Authenticated Encryption
 
7. Attacking Android Applications (Part 2)
7. Attacking Android Applications (Part 2)7. Attacking Android Applications (Part 2)
7. Attacking Android Applications (Part 2)
 
7. Attacking Android Applications (Part 1)
7. Attacking Android Applications (Part 1)7. Attacking Android Applications (Part 1)
7. Attacking Android Applications (Part 1)
 
5. Stream Ciphers
5. Stream Ciphers5. Stream Ciphers
5. Stream Ciphers
 
6 Scope & 7 Live Data Collection
6 Scope & 7 Live Data Collection6 Scope & 7 Live Data Collection
6 Scope & 7 Live Data Collection
 
4. Block Ciphers
4. Block Ciphers 4. Block Ciphers
4. Block Ciphers
 

Recently uploaded

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 

Recently uploaded (20)

Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural ResourcesEnergy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
Energy Resources. ( B. Pharmacy, 1st Year, Sem-II) Natural Resources
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 

CNIT 129S: 12: Attacking Users: Cross-Site Scripting (Part 1 of 2)

  • 1. CNIT 129S: Securing Web Applications Ch 12: Attacking Users: Cross-Site Scripting (XSS) Part 1
  • 2. Attacking Clients • Vulnerabilities in browsers • May result in session hijacking, unauthorized actions, and disclosure of personal data, keylogging, remote code execution • XSS is the most prevalent web application vulnerability in the world
  • 3. Varieties of XSS • Reflected XSS • Stored XSS • DOM-Based XSS
  • 4. Reflected XSS • Example: an error message that takes text from user and displays it back to the user in its response • 75% of all XSS vulnerabilities are this type
  • 5.
  • 6.
  • 7.
  • 8.
  • 9. Persistent Cookies • If user has a persistent cookie, implementing "remember me" • Step 1 is not needed • User need not be currently logged in
  • 10. Same-Origin Policy • evil.com cannot get your target.com cookies from your browser • Only a page in the same domain (arget.com) • But XSS lets the attacker add scripting to a page that comes from target.com • Hence the name Cross-Site Scripting
  • 11. Stored XSS Vulnerabilities • A message is stored • Executed on any user who views it • May attack a large number of users
  • 12.
  • 13.
  • 15. The Vulnerability • Client-side JavaScript can access the browser's Document Object Model • Can determine the URL used to load the current page • A script the developer put there may extract data from the URL and display it, dynamically updating the page's contents
  • 16. Example: Dynamically Generated Error Message • Writes message to page • Can also write script to page
  • 17.
  • 18.
  • 20. Apache (2010) • XSS in issue-tracking application • Attacker injected code, obscured it with a URL shortener • Administrator clicked the link • Attacker stole the administrator's cookie • Attacker altered the upload folder for the project and placed a Trojan login form there
  • 21. Apache (2010) • Attacker captured usernames and passwords for Apache privileged users • Found passwords that were re-used on other systems within the infrastructure • Fully compromised those systems, escalating the attack beyond the vulnerable Web application • Link Ch 12a
  • 22. MySpace (2005) • Samy evaded filters intended to block XSS • Added JavaScript to his user profile, that made every viewer • Add Samy as a friend • Copied the script to the user's profile • Gained over 1 million friends within hours • Link Ch 12b
  • 23. • Stored XSS in email allowed attackers to send a malicious email to the CEO • Stealing his session cookie
  • 25. Other Payloads for XSS • Virtual Defacement • Add images, code, or other content to a page
  • 26.
  • 27. Injecting Trojan Functionality • Inject actual working functionality into the vulnerable application • Such as a fake login form to capture credentials • Or the fake Google purchase form on the next slide, from 2004
  • 28.
  • 29. Disadvantages of Session Hijacking • Attacker must monitor her server and collect cookies • Then carry out actions on behalf of target users • Labor-intensive • Leaves traces in server logs
  • 30. Inducing User Actions • Use attack payload script to carry out actions directly • If the goal is to perform an administrator action, each user can be forced to try it until an administrator is compromised • MySpace XSS worm did this
  • 31. Exploiting Trust Relationships • Browsers trust JavaScript with cookies from the same website • Autocomplete in the browser can fill in fields, which are then read by JavaScript • Some sites require being added to Internet Explorer's "Trusted Sites"; those sites can run arbitrary code like this
  • 32. Exploiting Trust Relationships • ActiveX controls often contain powerful methods • They may check to see that requests came from the expected site • With XSS, that condition is satisfied
  • 33. Escalating the Client-Side Attack • Website may attack users by • Logging keystrokes • Capturing browsing history • Port-scanning the local network
  • 35. Delivering Reflected and COM-Based XSS Attacks • Phishing email containing a crafted URL • Targeted attack with custom email • Instant message containing a URL • Code posted on websites that allow user to post HTML
  • 36. Watering Hole Attack • Attacker creates a website with content that will interest the target users • Use search engine optimization to attract viewers • Page contains content that causes the user's browser to make requests containing XSS payloads to the vulnerable application
  • 37. • Purchase ad space, put malicious URL in the ad • The ad may appear in pages about the app you are attacking, because of keyword matches • Web apps often have "tell a friend" or "send feedback" features • Leverage this to deliver an XSS attack via an email that originate from the organization's server Delivering Reflected and DOM-Based XSS Attacks
  • 38. Delivering Stored XSS Attacks • In-band (most common)
  • 39. Delivering Stored XSS Attacks • Out-of-band (most common) • Anything other than viewing the target app • Such as email from its server
  • 40. Chaining XSS • XSS vulnerability itself may be low-risk • But chaining it together with other vulnerabilities can cause serious compromise
  • 41. Example • XSS allows script to be inserted into user's displayed name • Access control flaw lets attacker change other users' names • Add token-stealing XSS to every username • Gain administrator credentials: total control of application