SlideShare a Scribd company logo
Web Client Side
Security -
Script Injection
Tal Be’ery
@Verint
2013
SOP Threat Model
Communicati
on
Custom Code
Accounts
Finance
Administratio
n
Transactions
Knowledge
Mgmt
E-Commerce
Bus.
Functions
Victim Application
3
Vulnerable site sees
legitimate request
from victim
performs the action
requested
And sends a
response
Attacker sets the trap on some website on the internet1
2
While logged into vulnerable site,
victim views attacker site
Victim site interaction
Some interaction
with victim site
Injecting Script to Defeat SOP
O So SOP does not allow scripts from a
different origin to access target origin’s
data?
O Then, attacker must get the script to run
from target’s origin!
Getting The Script In
O Malvertising: Paying the server to show
content (Malicious Ads)
O XSS :Abusing the application’s to serve
user content
O Breaking into the server to change content
O Mass injection
O Watering Hole attacks
O Injecting onto the connection (MitM)
Malvertising a Script
Paying the target site
O Paying the target site to serve attacker
controlled messages to its clients
O Paying for displaying content = advertising
Online advertising
O The business engine for the web
http://blogs-images.forbes.com/roberthof/files/2012/06/iabadrev.gif
Online advertising
O Many parties are involved
http://blogs.wsj.com/digits/2011/06/06/online-ads-where-1240-companies-fit-in/
Malvertising
O Malware advertising
O Usually in the context of malware
spreading
O If it allows scripting, can create XSS
http://2.bp.blogspot.com/-qyWHGQxwkPc/Tl0dNR-1g1I/AAAAAAAACdg/wsYFRVfM3NQ/s1600/malvertising%2Byieldmanager%2Bziddu%2Bwebsite.png
Targeting Ads
O Web ads can be highly targeted
O “C level” in “Israel” in the “security
industry”
Injecting a Script (XSS)
XSS = Script Injection
O Victim server embeds unsanitized user’s
Input in served content
O Served content can contain a script
invocation
O The script is from the origin of the victim
server and thus can access all of the
origin’s data
Stored XSS
O The victim server stores user generated
content
O Comments
O Profile in social network
O Reviews
O The content is displayed to other users
O If not properly sanitized the content can
contain a script
Stored XSS Illustrated
Attacker sets the trap – update my
profile
Attacker enters
a malicious
script into a
web page that
stores the data
on the server
1
Application
with stored
XSS
vulnerability
Custom Code
Accounts
Finance
Administratio
nTransactions
Communicati
onKnowledge
MgmtE-CommerceBus.
Functions
2 Victim views page – sees
attacker profile
Script runs
inside victim’s
browser with
full access to
the DOM and
cookies
3 Script silently sends attacker Victim’s session
cookie
1
Reflected XSS
O The victim sends back (reflects) user
generated content to the user
O “search results for <sent term>”
O “The form details you just filled <form
data>”
O The content is displayed to the user
O If not properly sanitized the content can
invoke a script
Reflected XSS
O Why should I attack myself?
O The attacker “convinces” the victim to
attack itself
O Link is embedded in attacker site
O Phishing email
Reflected XSS Demo
Reflected XSS Demo - testing
O Search page is a classic!
O /sitesearch/index.aspx?q=bbbbbbbbbbbb
Reflected XSS Demo – XSS!
O /index.aspx?q=<script> alert(
document.cookie); </script>
DOM Based XSS
O Javascript can change inner HTML
through the DOM
O If the script in victim server’s page accepts
input from user without sanitizing it and
changes the DOM than a script can be
invoked.
Javascript Invocation
O Direct Script Injection
O Event handler injection
O Javascript protocol injection
O Injecting into an existing script
Injection
O Injection happens when attacker is able to
make a cross over from data area to
control/code area
O All Injections (Script injections, but also
SQL injection, XML injection, LDAP
injection, etc.) share the same
characteristics:
O A token that ends the data part
O Some malicious code
O A token that returns to data part (optional)
Direct Script Injection
O <script>alert(1)</script>
O HTML parsers are usually very relaxed
and forgiving
Event handler injection
O Example:
O Original application:
O <img src="url" alt="some_user_text">
O Attacker:
O <img src="url" alt="” onload=“evil()">
Javascript protocol injection
O Injecting the javascript pseudo protocol in
places intended for URLs
O Original application:
O <iframe src="user supplied url" >
O Attacker:
O <iframe src=“Javascript:evil()" >
Injecting into an existing
script
O Input is embedded into existing script.
O Script must remain syntactically correct for
the malicious payload to execute
Injecting Into an Existing
Script – In the Wild
O The value of the locale HTTP parameter is
included directly in a javascript within the
response and assigned to the s_prop18
variable:
O <script>…var s_prop18="";alert(1);//“ …
</script>
XSS Attacker’s Tools
Vulnerability Scanners
O Many commercial tools
O IBM AppScan
O HP WebInspect
O Etc.
O Many free tools
Exploitation tools: BeEF
O The Browser Exploitation Framework
BeEF Demo!
XSS Protection
Input/Output Sanitizaiton
O Remove “bad” characters
O Encode “bad” characters
O Context dependent!
O When input is given the code does not
know in which context it would be
displayed
O When output is presented, the context is
known, but coder may forget its untrusted
origin
Too many contexts…
HTML Style Property
Values
(e.g., .pdiv a:hover {color: red; text-
decoration: underline} )
JavaScript Data
(e.g., <script> some javascript
</script> )
HTML Attribute Values
(e.g., <input name='person'
type='TEXT' value='defaultValue'> )
HTML Element
Content
(e.g., <div> some text to display
</div> )
URI Attribute Values
(e.g., <a href="javascript:toggle('lesson')"
)
#4: All non-alphanumeric < 256  HH
ESAPI: encodeForCSS()
#3: All non-alphanumeric < 256  xHH
ESAPI: encodeForJavaScript()
#1: ( &, <, >, " )  &entity; ( ', / )  &#xHH;
ESAPI: encodeForHTML()
#2: All non-alphanumeric < 256  &#xHH
ESAPI: encodeForHTMLAttribute()
#5: All non-alphanumeric < 256  %HH
ESAPI: encodeForURL()
CSP
O Content Security Policy
O Enables the website to specify with
custom headers the allowed scripts in the
page, so no new script can be injected
O In order for CSP to be effective, the
website code has to be refactored.
NoScript
O Client side plugin
O Stops scripts, but usually kills user
experience too
Web Application Firewalls
O Stop XSS vectors
O Both reflected and persistent
O Examples:
O Imperva SecureSphere
O ModSecurity
Browser XSS filter
O Checks for script invocation in user
supplied data
O Only effective against reflected XSS
XSS in the wild
XSSed.com
O http://xssed.com/
Scanners Stats
https://www.whitehatsec.com/assets/WPst
atsReport_052013.pdf
XSS in Google
http://www.acunetix.com/blog/web-security-zone/articles/xss-vulnerability-injected-google-analytics-executed-ioss-gmail-
application/
Breaking into the server
Watering Hole
O Waiting for the victim to come to the
attacker
http://tpzoo.files.wordpress.com/2013/02/lion-zebra-water-hole.jpg
Watering Hole Attack
O Break into a website
O Plant a malicious script in it
http://eromang.zataz.com/2013/02/20/facebook-apple-twitter-watering-hole-attack-additional-informations/
MITM
MITM
MITM Can Inject Scripts
O The victim requests “good.com”
O The attacker serves arbitrary content as a
response
O Scripts served that way, are considered by
the browser as coming from “good.com”
context
Attacker Don’t Have to Be
MITM
O Full MITM capabilities are not needed
O “Man on the Side” is enough
O It’s enough to be able:
O Eavesdrop for requests
O Be able to inject false responses
O No need to stop messages
The NSA Did It!
O QUANTUM program
O “..NSA relies on its secret partnerships with
US telecoms companies… the NSA places
secret servers, codenamed Quantum, at key
places on the Internet backbone. This
placement ensures that they can react faster
than other websites can. By exploiting that
speed difference, these servers can
impersonate a visited website to the target
before the legitimate website can respond..
https://www.schneier.com/blog/archives/2013/10
/how_the_nsa_att.html
Web Client Side
Security -
Implementation Bugs
Bugs In SOP
O 2004: Malicious redirects break IE’s SOP
implementation
Universal XSS
O Browser is not just the browser
O Addons, extensions, plugins…
O Some of them may have bugs in SOP
Adobe PDF Universal XSS
O Adobe PDF Reader universal XSS
O http://host/file.pdf#anyname=javascript:yo
ur_code_here
O If a site hosts a PDF it has XSS
vulnerability
https://www.owasp.org/images/4/4b/OWASP_IL_The_Universal_XSS_PDF_Vulnerability.pdf
Client Side Vulnerability
Black Hole Exploit Kit
Exploit Delivery
O Introduced with a script
O One of the Aforementioned Script Injection
techniques
O Checks for browser vendor, version and
installed component to use the right
exploit
O Creates the exploited object
Obfuscated Javascript
https://sophosnews.files.wordpress.com/2012/03/blackhole_paper_mar2012.pdf
Detect Vulnerabilities
PDF Exploit

More Related Content

PPTX
Client sidesec 2013 - non js
Tal Be'ery
 
PPTX
Client sidesec 2013-intro
Tal Be'ery
 
PPTX
Dom based xss
Lê Giáp
 
PDF
XSS-Alert-Pentration testing tool
Arjun Jain
 
PDF
Shreeraj-Hacking_Web_2
guest66dc5f
 
PDF
Rahul-Analysis_of_Adversarial_Code
guest66dc5f
 
PPT
Front end-security
Miao Siyu
 
KEY
Application Security for Rich Internet Applicationss (Jfokus 2012)
johnwilander
 
Client sidesec 2013 - non js
Tal Be'ery
 
Client sidesec 2013-intro
Tal Be'ery
 
Dom based xss
Lê Giáp
 
XSS-Alert-Pentration testing tool
Arjun Jain
 
Shreeraj-Hacking_Web_2
guest66dc5f
 
Rahul-Analysis_of_Adversarial_Code
guest66dc5f
 
Front end-security
Miao Siyu
 
Application Security for Rich Internet Applicationss (Jfokus 2012)
johnwilander
 

What's hot (20)

PPTX
MITM Attacks on HTTPS: Another Perspective
GreenD0g
 
PPTX
Web Application Security in front end
Erlend Oftedal
 
PDF
XXE Exposed: SQLi, XSS, XXE and XEE against Web Services
Abraham Aranguren
 
PPTX
Its all about CSRF - null Mumbai Meet 10 January 2015 Null/OWASP Chapter
Nilesh Sapariya
 
PDF
Grey H@t - Cross-site Request Forgery
Christopher Grayson
 
KEY
Application Security for RIAs
johnwilander
 
PDF
Owasp eee 2015 csrf
Aurelijus Stanislovaitis
 
PPTX
Reflective and Stored XSS- Cross Site Scripting
InMobi Technology
 
PPTX
Java script, security and you - Tri-Cities Javascript Developers Group
Adam Caudill
 
PDF
DEfcon15 XXE XXS
pentest pentest
 
PDF
Linkedin.com DomXss 04-08-2014
Giorgio Fedon
 
PPTX
Web application security
Jin Castor
 
PPTX
Xss (cross site scripting)
vinayh.vaghamshi _
 
PPTX
Owasp Top 10 A3: Cross Site Scripting (XSS)
Michael Hendrickx
 
PDF
Top Ten Web Hacking Techniques (2008)
Jeremiah Grossman
 
PPTX
Understanding Cross-site Request Forgery
Daniel Miessler
 
PPTX
CSRF Attack and Its Prevention technique in ASP.NET MVC
Suvash Shah
 
PPT
(In)Security Implication in the JS Universe
Stefano Di Paola
 
PDF
Html5 localstorage attack vectors
Shreeraj Shah
 
PPTX
Preventing In-Browser Malicious Code Execution
Stefano Di Paola
 
MITM Attacks on HTTPS: Another Perspective
GreenD0g
 
Web Application Security in front end
Erlend Oftedal
 
XXE Exposed: SQLi, XSS, XXE and XEE against Web Services
Abraham Aranguren
 
Its all about CSRF - null Mumbai Meet 10 January 2015 Null/OWASP Chapter
Nilesh Sapariya
 
Grey H@t - Cross-site Request Forgery
Christopher Grayson
 
Application Security for RIAs
johnwilander
 
Owasp eee 2015 csrf
Aurelijus Stanislovaitis
 
Reflective and Stored XSS- Cross Site Scripting
InMobi Technology
 
Java script, security and you - Tri-Cities Javascript Developers Group
Adam Caudill
 
DEfcon15 XXE XXS
pentest pentest
 
Linkedin.com DomXss 04-08-2014
Giorgio Fedon
 
Web application security
Jin Castor
 
Xss (cross site scripting)
vinayh.vaghamshi _
 
Owasp Top 10 A3: Cross Site Scripting (XSS)
Michael Hendrickx
 
Top Ten Web Hacking Techniques (2008)
Jeremiah Grossman
 
Understanding Cross-site Request Forgery
Daniel Miessler
 
CSRF Attack and Its Prevention technique in ASP.NET MVC
Suvash Shah
 
(In)Security Implication in the JS Universe
Stefano Di Paola
 
Html5 localstorage attack vectors
Shreeraj Shah
 
Preventing In-Browser Malicious Code Execution
Stefano Di Paola
 
Ad

Viewers also liked (18)

PDF
JL Mealer's Emergency Sessions of the 115th Congress Anti Gov't Fraud Bill.
Candidate US Senate 2016
 
PDF
C# application integration
Muhammad Zaman
 
PPTX
Presentación1elsy
ingridcld
 
DOCX
nik cv
Nikhit Pawar
 
PDF
CADZINE n° 1, giugno 2014, ANNO I
CADZINE
 
PPTX
Adab adab mkn
Nurul Majid
 
PPT
De la subversión a la inclusión: movimientos de mujeres de la segunda ola en ...
Universidad Autonoma de Bucaramanga
 
DOC
ABUBACKER SIDDIQ CV
ABUBACKER SIDDIQ
 
PDF
reinvestment allowance 2008-inland revenue
sakura rena
 
PPTX
Nutrición y riesgo cardiovascular
Rodrigo Maureira López
 
PDF
Endolls de 220v adaptats
baixcost
 
PPS
Llave de oro
Kuky
 
PPTX
E portafolio Nataly Ruiz Grupo 201512_190
LNatalyRuiz
 
PDF
Content Marketing BeautyfulDays Mai 2016
Kresse & Discher GmbH
 
PDF
Oktoberfeststammtisch münchen 2012
Austrian National Tourist Office
 
PDF
6 Schritte, damit sich Kunden in Dein Produkt verlieben
Daniel Bartel
 
JL Mealer's Emergency Sessions of the 115th Congress Anti Gov't Fraud Bill.
Candidate US Senate 2016
 
C# application integration
Muhammad Zaman
 
Presentación1elsy
ingridcld
 
nik cv
Nikhit Pawar
 
CADZINE n° 1, giugno 2014, ANNO I
CADZINE
 
Adab adab mkn
Nurul Majid
 
De la subversión a la inclusión: movimientos de mujeres de la segunda ola en ...
Universidad Autonoma de Bucaramanga
 
ABUBACKER SIDDIQ CV
ABUBACKER SIDDIQ
 
reinvestment allowance 2008-inland revenue
sakura rena
 
Nutrición y riesgo cardiovascular
Rodrigo Maureira López
 
Endolls de 220v adaptats
baixcost
 
Llave de oro
Kuky
 
E portafolio Nataly Ruiz Grupo 201512_190
LNatalyRuiz
 
Content Marketing BeautyfulDays Mai 2016
Kresse & Discher GmbH
 
Oktoberfeststammtisch münchen 2012
Austrian National Tourist Office
 
6 Schritte, damit sich Kunden in Dein Produkt verlieben
Daniel Bartel
 
Ad

Similar to Client sidesec 2013 - script injection (20)

PPTX
A Survey of Exploitation and Detection Methods of XSS Vulnerabilities.pptx
Gitam Gadtaula
 
PPTX
Deep understanding on Cross-Site Scripting and SQL Injection
Vishal Kumar
 
PPTX
Cross Site Scripting
Ali Mattash
 
PPTX
Secure Code Warrior - Cross site scripting
Secure Code Warrior
 
PPT
4.Xss
phanleson
 
PPTX
XSS: From alert(1) to crypto mining malware
Omer Meshar
 
PDF
Xss 101 by-sai-shanthan
Raghunath G
 
DOCX
Continuing in your role as a human service provider for your local.docx
richardnorman90310
 
PDF
XSS Exploitation
Hacking Articles
 
PPTX
Xss attack
Manjushree Mashal
 
PPTX
Cross Site Scripting ( XSS)
Amit Tyagi
 
PPTX
Xss ppt
penetration Tester
 
PPT
144205230-Cross-Site-Scripting-XSS-ppt.ppt
SyedAliShahid3
 
PPTX
Cross Site Scripting Defense Presentation
Ikhade Maro Igbape
 
PPTX
Cross Site Scripting(XSS)
Nabin Dutta
 
PDF
SeanRobertsThesis
Sean Roberts
 
PDF
xss-100908063522-phpapp02.pdf
yashvirsingh48
 
PPTX
15 owasp top 10 - a3-xss
appsec
 
PPTX
Understanding dom based xss
Potato
 
A Survey of Exploitation and Detection Methods of XSS Vulnerabilities.pptx
Gitam Gadtaula
 
Deep understanding on Cross-Site Scripting and SQL Injection
Vishal Kumar
 
Cross Site Scripting
Ali Mattash
 
Secure Code Warrior - Cross site scripting
Secure Code Warrior
 
4.Xss
phanleson
 
XSS: From alert(1) to crypto mining malware
Omer Meshar
 
Xss 101 by-sai-shanthan
Raghunath G
 
Continuing in your role as a human service provider for your local.docx
richardnorman90310
 
XSS Exploitation
Hacking Articles
 
Xss attack
Manjushree Mashal
 
Cross Site Scripting ( XSS)
Amit Tyagi
 
144205230-Cross-Site-Scripting-XSS-ppt.ppt
SyedAliShahid3
 
Cross Site Scripting Defense Presentation
Ikhade Maro Igbape
 
Cross Site Scripting(XSS)
Nabin Dutta
 
SeanRobertsThesis
Sean Roberts
 
xss-100908063522-phpapp02.pdf
yashvirsingh48
 
15 owasp top 10 - a3-xss
appsec
 
Understanding dom based xss
Potato
 

More from Tal Be'ery (15)

PPTX
2 Become One, 1 Becomes Two: Attacking and Protecting 2FA Tokens
Tal Be'ery
 
PDF
Give me some (key) space!
Tal Be'ery
 
PPTX
Web3’s red pill: Smashing Web3 transaction simulations for fun and profit
Tal Be'ery
 
PDF
Understanding Compound‘s Liquidation
Tal Be'ery
 
PDF
Web3 Security: The Blockchain is Your SIEM
Tal Be'ery
 
PPTX
The Color of Money
Tal Be'ery
 
PDF
Open Sesame: Picking Locks with Cortana
Tal Be'ery
 
PPTX
THE VOICE OF ESAU: HACKING ENTERPRISES THROUGH VOICE INTERFACES
Tal Be'ery
 
PDF
Automate or Die: How Automation Reshapes Cybersecurity
Tal Be'ery
 
PDF
The Industrial Revolution of Lateral Movement
Tal Be'ery
 
PPTX
The Enemy Within: Stopping Advanced Attacks Against Local Users
Tal Be'ery
 
PDF
Target Breach Analysis
Tal Be'ery
 
PPTX
Battlefield network
Tal Be'ery
 
PPTX
One Key to Rule Them All: Detecting the Skeleton Key Malware
Tal Be'ery
 
PPTX
Skeleton key malware detection owasp
Tal Be'ery
 
2 Become One, 1 Becomes Two: Attacking and Protecting 2FA Tokens
Tal Be'ery
 
Give me some (key) space!
Tal Be'ery
 
Web3’s red pill: Smashing Web3 transaction simulations for fun and profit
Tal Be'ery
 
Understanding Compound‘s Liquidation
Tal Be'ery
 
Web3 Security: The Blockchain is Your SIEM
Tal Be'ery
 
The Color of Money
Tal Be'ery
 
Open Sesame: Picking Locks with Cortana
Tal Be'ery
 
THE VOICE OF ESAU: HACKING ENTERPRISES THROUGH VOICE INTERFACES
Tal Be'ery
 
Automate or Die: How Automation Reshapes Cybersecurity
Tal Be'ery
 
The Industrial Revolution of Lateral Movement
Tal Be'ery
 
The Enemy Within: Stopping Advanced Attacks Against Local Users
Tal Be'ery
 
Target Breach Analysis
Tal Be'ery
 
Battlefield network
Tal Be'ery
 
One Key to Rule Them All: Detecting the Skeleton Key Malware
Tal Be'ery
 
Skeleton key malware detection owasp
Tal Be'ery
 

Recently uploaded (20)

PPTX
Microsoft PowerPoint Student PPT slides.pptx
Garleys Putin
 
PPTX
ppt lighfrsefsefesfesfsefsefsefsefserrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrt.pptx
atharvawafgaonkar
 
PPT
Transformaciones de las funciones elementales.ppt
rirosel211
 
PPTX
Different Generation Of Computers .pptx
divcoder9507
 
PDF
PDF document: World Game (s) Great Redesign.pdf
Steven McGee
 
PPTX
Crypto Recovery California Services.pptx
lionsgate network
 
PDF
BGP Security Best Practices that Matter, presented at PHNOG 2025
APNIC
 
PPTX
The Monk and the Sadhurr and the story of how
BeshoyGirgis2
 
PDF
KIPER4D situs Exclusive Game dari server Star Gaming Asia
hokimamad0
 
PDF
Generative AI Foundations: AI Skills for the Future of Work
hemal sharma
 
PDF
Project English Paja Jara Alejandro.jpdf
AlejandroAlonsoPajaJ
 
PPTX
AI ad its imp i military life read it ag
ShwetaBharti31
 
PPTX
EthicalHack{aksdladlsfsamnookfmnakoasjd}.pptx
dagarabull
 
PPTX
Unlocking Hope : How Crypto Recovery Services Can Reclaim Your Lost Funds
lionsgate network
 
PPTX
LESSON-2-Roles-of-ICT-in-Teaching-for-learning_123922 (1).pptx
renavieramopiquero
 
PDF
KIPER4D situs Exclusive Game dari server Star Gaming Asia
hokimamad0
 
PPTX
原版北不列颠哥伦比亚大学毕业证文凭UNBC成绩单2025年新版在线制作学位证书
e7nw4o4
 
PPTX
谢尔丹学院毕业证购买|Sheridan文凭不见了怎么办谢尔丹学院成绩单
mookxk3
 
PDF
LOGENVIDAD DANNYFGRETRRTTRRRTRRRRRRRRR.pdf
juan456ytpro
 
PDF
Slides: PDF Eco Economic Epochs for World Game (s) pdf
Steven McGee
 
Microsoft PowerPoint Student PPT slides.pptx
Garleys Putin
 
ppt lighfrsefsefesfesfsefsefsefsefserrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrt.pptx
atharvawafgaonkar
 
Transformaciones de las funciones elementales.ppt
rirosel211
 
Different Generation Of Computers .pptx
divcoder9507
 
PDF document: World Game (s) Great Redesign.pdf
Steven McGee
 
Crypto Recovery California Services.pptx
lionsgate network
 
BGP Security Best Practices that Matter, presented at PHNOG 2025
APNIC
 
The Monk and the Sadhurr and the story of how
BeshoyGirgis2
 
KIPER4D situs Exclusive Game dari server Star Gaming Asia
hokimamad0
 
Generative AI Foundations: AI Skills for the Future of Work
hemal sharma
 
Project English Paja Jara Alejandro.jpdf
AlejandroAlonsoPajaJ
 
AI ad its imp i military life read it ag
ShwetaBharti31
 
EthicalHack{aksdladlsfsamnookfmnakoasjd}.pptx
dagarabull
 
Unlocking Hope : How Crypto Recovery Services Can Reclaim Your Lost Funds
lionsgate network
 
LESSON-2-Roles-of-ICT-in-Teaching-for-learning_123922 (1).pptx
renavieramopiquero
 
KIPER4D situs Exclusive Game dari server Star Gaming Asia
hokimamad0
 
原版北不列颠哥伦比亚大学毕业证文凭UNBC成绩单2025年新版在线制作学位证书
e7nw4o4
 
谢尔丹学院毕业证购买|Sheridan文凭不见了怎么办谢尔丹学院成绩单
mookxk3
 
LOGENVIDAD DANNYFGRETRRTTRRRTRRRRRRRRR.pdf
juan456ytpro
 
Slides: PDF Eco Economic Epochs for World Game (s) pdf
Steven McGee
 

Client sidesec 2013 - script injection

  • 1. Web Client Side Security - Script Injection Tal Be’ery @Verint 2013
  • 2. SOP Threat Model Communicati on Custom Code Accounts Finance Administratio n Transactions Knowledge Mgmt E-Commerce Bus. Functions Victim Application 3 Vulnerable site sees legitimate request from victim performs the action requested And sends a response Attacker sets the trap on some website on the internet1 2 While logged into vulnerable site, victim views attacker site Victim site interaction Some interaction with victim site
  • 3. Injecting Script to Defeat SOP O So SOP does not allow scripts from a different origin to access target origin’s data? O Then, attacker must get the script to run from target’s origin!
  • 4. Getting The Script In O Malvertising: Paying the server to show content (Malicious Ads) O XSS :Abusing the application’s to serve user content O Breaking into the server to change content O Mass injection O Watering Hole attacks O Injecting onto the connection (MitM)
  • 6. Paying the target site O Paying the target site to serve attacker controlled messages to its clients O Paying for displaying content = advertising
  • 7. Online advertising O The business engine for the web http://blogs-images.forbes.com/roberthof/files/2012/06/iabadrev.gif
  • 8. Online advertising O Many parties are involved http://blogs.wsj.com/digits/2011/06/06/online-ads-where-1240-companies-fit-in/
  • 9. Malvertising O Malware advertising O Usually in the context of malware spreading O If it allows scripting, can create XSS http://2.bp.blogspot.com/-qyWHGQxwkPc/Tl0dNR-1g1I/AAAAAAAACdg/wsYFRVfM3NQ/s1600/malvertising%2Byieldmanager%2Bziddu%2Bwebsite.png
  • 10. Targeting Ads O Web ads can be highly targeted O “C level” in “Israel” in the “security industry”
  • 12. XSS = Script Injection O Victim server embeds unsanitized user’s Input in served content O Served content can contain a script invocation O The script is from the origin of the victim server and thus can access all of the origin’s data
  • 13. Stored XSS O The victim server stores user generated content O Comments O Profile in social network O Reviews O The content is displayed to other users O If not properly sanitized the content can contain a script
  • 14. Stored XSS Illustrated Attacker sets the trap – update my profile Attacker enters a malicious script into a web page that stores the data on the server 1 Application with stored XSS vulnerability Custom Code Accounts Finance Administratio nTransactions Communicati onKnowledge MgmtE-CommerceBus. Functions 2 Victim views page – sees attacker profile Script runs inside victim’s browser with full access to the DOM and cookies 3 Script silently sends attacker Victim’s session cookie 1
  • 15. Reflected XSS O The victim sends back (reflects) user generated content to the user O “search results for <sent term>” O “The form details you just filled <form data>” O The content is displayed to the user O If not properly sanitized the content can invoke a script
  • 16. Reflected XSS O Why should I attack myself? O The attacker “convinces” the victim to attack itself O Link is embedded in attacker site O Phishing email
  • 18. Reflected XSS Demo - testing O Search page is a classic! O /sitesearch/index.aspx?q=bbbbbbbbbbbb
  • 19. Reflected XSS Demo – XSS! O /index.aspx?q=<script> alert( document.cookie); </script>
  • 20. DOM Based XSS O Javascript can change inner HTML through the DOM O If the script in victim server’s page accepts input from user without sanitizing it and changes the DOM than a script can be invoked.
  • 21. Javascript Invocation O Direct Script Injection O Event handler injection O Javascript protocol injection O Injecting into an existing script
  • 22. Injection O Injection happens when attacker is able to make a cross over from data area to control/code area O All Injections (Script injections, but also SQL injection, XML injection, LDAP injection, etc.) share the same characteristics: O A token that ends the data part O Some malicious code O A token that returns to data part (optional)
  • 23. Direct Script Injection O <script>alert(1)</script> O HTML parsers are usually very relaxed and forgiving
  • 24. Event handler injection O Example: O Original application: O <img src="url" alt="some_user_text"> O Attacker: O <img src="url" alt="” onload=“evil()">
  • 25. Javascript protocol injection O Injecting the javascript pseudo protocol in places intended for URLs O Original application: O <iframe src="user supplied url" > O Attacker: O <iframe src=“Javascript:evil()" >
  • 26. Injecting into an existing script O Input is embedded into existing script. O Script must remain syntactically correct for the malicious payload to execute
  • 27. Injecting Into an Existing Script – In the Wild O The value of the locale HTTP parameter is included directly in a javascript within the response and assigned to the s_prop18 variable: O <script>…var s_prop18="";alert(1);//“ … </script>
  • 29. Vulnerability Scanners O Many commercial tools O IBM AppScan O HP WebInspect O Etc. O Many free tools
  • 30. Exploitation tools: BeEF O The Browser Exploitation Framework
  • 33. Input/Output Sanitizaiton O Remove “bad” characters O Encode “bad” characters O Context dependent! O When input is given the code does not know in which context it would be displayed O When output is presented, the context is known, but coder may forget its untrusted origin
  • 34. Too many contexts… HTML Style Property Values (e.g., .pdiv a:hover {color: red; text- decoration: underline} ) JavaScript Data (e.g., <script> some javascript </script> ) HTML Attribute Values (e.g., <input name='person' type='TEXT' value='defaultValue'> ) HTML Element Content (e.g., <div> some text to display </div> ) URI Attribute Values (e.g., <a href="javascript:toggle('lesson')" ) #4: All non-alphanumeric < 256  HH ESAPI: encodeForCSS() #3: All non-alphanumeric < 256  xHH ESAPI: encodeForJavaScript() #1: ( &, <, >, " )  &entity; ( ', / )  &#xHH; ESAPI: encodeForHTML() #2: All non-alphanumeric < 256  &#xHH ESAPI: encodeForHTMLAttribute() #5: All non-alphanumeric < 256  %HH ESAPI: encodeForURL()
  • 35. CSP O Content Security Policy O Enables the website to specify with custom headers the allowed scripts in the page, so no new script can be injected O In order for CSP to be effective, the website code has to be refactored.
  • 36. NoScript O Client side plugin O Stops scripts, but usually kills user experience too
  • 37. Web Application Firewalls O Stop XSS vectors O Both reflected and persistent O Examples: O Imperva SecureSphere O ModSecurity
  • 38. Browser XSS filter O Checks for script invocation in user supplied data O Only effective against reflected XSS
  • 39. XSS in the wild
  • 44. Watering Hole O Waiting for the victim to come to the attacker http://tpzoo.files.wordpress.com/2013/02/lion-zebra-water-hole.jpg
  • 45. Watering Hole Attack O Break into a website O Plant a malicious script in it http://eromang.zataz.com/2013/02/20/facebook-apple-twitter-watering-hole-attack-additional-informations/
  • 46. MITM
  • 47. MITM
  • 48. MITM Can Inject Scripts O The victim requests “good.com” O The attacker serves arbitrary content as a response O Scripts served that way, are considered by the browser as coming from “good.com” context
  • 49. Attacker Don’t Have to Be MITM O Full MITM capabilities are not needed O “Man on the Side” is enough O It’s enough to be able: O Eavesdrop for requests O Be able to inject false responses O No need to stop messages
  • 50. The NSA Did It! O QUANTUM program O “..NSA relies on its secret partnerships with US telecoms companies… the NSA places secret servers, codenamed Quantum, at key places on the Internet backbone. This placement ensures that they can react faster than other websites can. By exploiting that speed difference, these servers can impersonate a visited website to the target before the legitimate website can respond.. https://www.schneier.com/blog/archives/2013/10 /how_the_nsa_att.html
  • 51. Web Client Side Security - Implementation Bugs
  • 52. Bugs In SOP O 2004: Malicious redirects break IE’s SOP implementation
  • 53. Universal XSS O Browser is not just the browser O Addons, extensions, plugins… O Some of them may have bugs in SOP
  • 54. Adobe PDF Universal XSS O Adobe PDF Reader universal XSS O http://host/file.pdf#anyname=javascript:yo ur_code_here O If a site hosts a PDF it has XSS vulnerability https://www.owasp.org/images/4/4b/OWASP_IL_The_Universal_XSS_PDF_Vulnerability.pdf
  • 57. Exploit Delivery O Introduced with a script O One of the Aforementioned Script Injection techniques O Checks for browser vendor, version and installed component to use the right exploit O Creates the exploited object

Editor's Notes

  • #8: http://blogs-images.forbes.com/roberthof/files/2012/06/iabadrev.gif
  • #9: http://blogs.wsj.com/digits/2011/06/06/online-ads-where-1240-companies-fit-in/
  • #10: http://2.bp.blogspot.com/-qyWHGQxwkPc/Tl0dNR-1g1I/AAAAAAAACdg/wsYFRVfM3NQ/s1600/malvertising%2Byieldmanager%2Bziddu%2Bwebsite.png
  • #26: http://www.w3schools.com/tags/ref_eventattributes.asp
  • #28: http://www.xssed.com/mirror/62826/
  • #32: http://192.168.43.130:3000/demos/butcher/index.html http://192.168.43.130:3000/ui/authentication
  • #42: https://www.whitehatsec.com/assets/WPstatsReport_052013.pdf
  • #43: http://www.acunetix.com/blog/web-security-zone/articles/xss-vulnerability-injected-google-analytics-executed-ioss-gmail-application/
  • #46: http://eromang.zataz.com/2013/02/20/facebook-apple-twitter-watering-hole-attack-additional-informations/
  • #53: https://www.kb.cert.org/vuls/id/713878