SlideShare uma empresa Scribd logo
1 de 34
Baixar para ler offline
25 Million Flows Later – Large-scale
Detection of DOM-based XSS
CCS 2013, Berlin
Sebastian Lekies, Ben Stock, Martin Johns
Agenda
●  XSS & Attacker Scenario
●  WebSec guys: wake up once you see a cat
●  Motivation
●  Our contributions
●  Summary
2
Cross-Site Scripting
●  Execution of attacker-controlled code on the client in the
context of the vulnerable app
●  Three kinds:
●  Persistent XSS: guestbook, ...
●  Reflected XSS: search forms, ...
●  DOM-based XSS: also called local XSS
●  content dynamically added by JS (e.g. like button), ..
3
Server side
Client side
Cross-Site Scripting: attacker model
●  Attacker wants to inject own code into vuln. app
●  steal cookie
●  take abritrary action in the name of the user
●  pretend to be the server towards the user
●  ...
4
Source: http://blogs.sfweekly.com/thesnitch/
cookie_monster.jpg
Cross-Site Scripting: problem statement
●  Main problem: attacker‘s content ends in document and
is not properly filtered/encoded
●  common for server- and client-side flaws
●  Flow of data: from attacker-controllable source to security-
sensitive sink
●  Our Focus: client side JavaScript code
●  Sources: e.g. the URL
●  Sinks: e.g. document.write
5
Example of a DOMXSS vulnerability
●  Source: location.hash, Sink: document.write
●  Intended usage:
●  http://example.org/#mypage
●  <img src='//adve.rt/ise?hash=mypage'/>!
●  Exploiting the vuln:
●  http://example.org/#'/><script>alert(1)</script>
●  <img src='//adve.rt/ise?hash='/>

<script>alert(1)</script>

'/>
6
document.write("<img src='//adve.rt/ise?hash=" + location.hash.slice(1)+ "'/>");!
How does the attacker exploit this?
a.  Send a crafted link to the victim
b.  Embed vulnerable page with payload into his own page
7
h"p://ki"enpics.org	
  
Source: http://www.hd-gbpics.de/gbbilder/katzen/katzen2.jpg
Our motivation and contribution
●  Perform Large-scale analysis of DOMXSS vulnerabilities
●  Automated, dynamic detection of suspicious flows
●  Automated validation of vulnerabilities
●  Our key components
●  Taint-aware browsing engine
●  Crawling infrastructure
●  Context-specific exploit generator
●  Exploit verification using the crawler
8
Building a taint-aware browsing engine to find
suspicious flows
Our approach: use dynamic taint tracking
●  Taint tracking: Track the flow of marked data from source
to sink
●  Implementation: into Chromium (Blink+V8)
●  Requirements for taint tracking
●  Taint all relevent values / propagate taints
●  Report all sinks accesses
●  be as precise as possible
●  taint details on EVERY character
10
Representing sources
●  In terms of DOMXSS, we have 14 sources
●  additionally, three relevant, built-in encoding functions
●  escape, encodeURI and encodeURIComponent
●  .. may prevent XSS vulnerabilites if used properly
●  Goal: store source + bitmask of encoding functions for
each character
11
Representing sources (cntd)
●  14 sources è 4 bits sufficient
●  3 relevant built-in functions è 3 bits sufficient
7 bits < 1 byte
●  è 1 Byte sufficient to store source + encoding functions
●  encoding functions and counterparts set/unset bits
●  hard-coded characters have source 0
12
enconding functions Source
Representing sources (cntd)
●  Each source API (e.g. URL or cookie) attaches taint bytes
●  identifing the source of a char
●  var x = location.hash.slice(1);!
●  x = escape(x);!
13
t	
   e	
   s	
   '	
   1	
   1	
   1	
   1	
  
t	
   e	
   s	
   %	
   65	
   65	
   65	
   65	
  2	
   7	
   65	
   65	
  
0	
   1	
   0	
   0	
   0	
   0	
   0	
   1	
  
Detecting sink access
●  Taint propagated through all relevant functions
●  Security-sensitive sinks report flow and details
●  such as text, taint information, source code location
●  Chrome extension to handle reporting
●  keep core changes as small as possible
●  repack information in JavaScript
●  stub function directly inside V8
14
Extension
V8 JS eval report
WebKit document.write
Empirical study on suspicious flows
Crawling the Web (at University scale)
●  Crawler infrastructure constisting of
●  modified, taint-aware
browsing engine
●  browser extension
to direct the engine
●  Dispatching and
reporting backend
●  In total, we ran
6 machines Control'backend'
Background'script'
Tab'1'
content''
script'
Web'
page'''
&''
user'
script'
Tab'n'
content''
script'
Web'
page'''
&''
user'
script'…'
Background'script'
Tab'1'
content''
script'
Web'
page'''
&''
user'
script'
Tab'n'
content''
script'
Web'
page'''
&''
user'
script'…'…'
Browser'1' Browser'm'
16
Empirical study
●  Shallow crawl of Alexa Top 5000 Web Sites
●  Main page + first level of links
●  504,275 URLs scanned in roughly 5 days
●  on average containing ~8,64 frames
●  total of 4,358,031 analyzed documents
●  Step 1: Flow detection
●  24,474,306 data flows from possibly attacker-controllable input to
security-sensitive sinks
17
Context-Sensitive Generation of Cross-Site Scripting
Payloads
Validating vulnerabilities
●  Current Situation:
●  Taint-tracking engine delivers suspicious flows
●  Suspicious flow != Vulnerability
●  Why may suspicious flows not be exploitable?
●  e.g. custom filter, validation or encoding function
●  Validation needed: working exploit
<script>!
if (/^[a-z][0-9]+$/.test(location.hash.slice(1)) {!
document.write(location.hash.slice(1));!
}!
</script>
19
Anatomy of an XSS Exploit
●  Cross-Site Scripting exploits are context-specific:
●  HTML Context
●  Vulnerability:
●  Exploit:
●  JavaScript Context
●  Vulnerability:
●  Exploit:
eval("var x = '" + location.hash + "';");
'; alert(1); //
document.write("<img src='pic.jpg?hash=" !
!+ location.hash.slice(1) + "'>");
'><script>alert(1)</script><textarea>
20
Anatomy of an XSS Exploit
●  Context-Sensitivity
●  Breakout-Sequence: Highly context sensitive (generation is difficult)
●  Payload: Not context sensitive (arbitrary JavaScript code)
●  Comment Sequence: Very easy to generate (choose from a handful of
options)
Payload Break-in / Comment SequenceBreak-out Sequence
'; alert(1); //
'><script> alert(1); </script><textarea>
21
Breaking out of JavaScript contexts
●  JavaScript Context
●  Visiting http://example.org/ in our engine
<script>!
var code = 'function test(){' !
! + 'var x = "' + location.href + '";'!
! //inside function test!
! + 'doSomething(x);'!
! + '}'; !
//top level !
eval(code);!
</script>
eval('

function test() {!
var x = "http://example.org";!
doSomething(x);!
}

');
22
Syntax tree to working exploit
●  Two options here:
●  break out of string
●  break out of function
definition
●  Latter is more reliable
●  function test not
necessarily called
automatically on
„normal“ execution
23
Tainted	
  value	
  aka	
  
injecAon	
  point	
  
function test() {!
var x = "http://example.org";!
doSomething(x);!
}
Generating a valid exploit
●  Traverse the AST upwards and “end” the branches
●  Breakout Sequence: “;}
●  Comment: //
●  Exploit: ";}alert(1);//
●  Visit: http://example.org/#";}alert(1);//
}
;
“
24
function test() {!
var x = "http://example.org";!
}!
alert(1);//“; doSomething(x); }
Validating vulnerabilities
●  Our focus: directly controllable exploits
●  Sinks: direct execution sinks
●  HTML sinks (document.write, innerHTML ,...)
●  JavaScript sinks (eval, ...)
●  Sources: location and referrer
●  Only unencoded strings
●  Not in the focus (yet): second-order vulnerabilities
●  to cookie and from cookie to eval
●  ...
25
Empirical study
●  Step 2: Flow reduction
●  Only JavaScript and HTML sinks: 24,474,306 è 4,948,264
●  Only directly controllable sources: 4,948,264 è 1,825,598
●  Only unencoded flows: 1,825,598 è 313,794
●  Step 3: Precise exploit generation
●  Generated a total of 181,238 unique test cases
●  rest were duplicates (same URL and payload)
●  basically same vuln twice in same page
26
Empirical study
●  Step 4: Exploit validation
●  69,987 out of 181,238 unique test cases triggered a vulnerability
●  Step 5: Further analysis
●  8,163 unique vulnerabilities affecting 701 domains
●  …of all loaded frames (i.e. also from outside Top 5000)
●  6,167 unique vulnerabilities affecting 480 Alexa top 5000 domains
●  At least, 9.6 % of the top 5000 Web pages contain one or more XSS
problems
●  This number only represents the lower bound (!)
27
Limitations
●  No assured code coverage
●  e.g. debug GET-param needed?
●  also, not all pages visited (esp. stateful applications)
●  Fuzzing might get better results
●  does not scale as well
●  Not yet looking at the „harder“ flows
●  found one URL è Cookie è eval „by accident“
28
Summary
●  We built a tool capable of detecting flows
●  taint-aware Chromium
●  Chrome extension for crawling and reporting
●  We built an automated exploit generator
●  taking into account the exact taint information
●  ... and specific contexts
●  We found that at least 480 of the top 5000 domains carry
a DOM-XSS vuln
29
Thank you very much for your
attention!
Ben Stock
@kcotsneb
ben.stock@fau.de
31
URL	
   Cookie	
   Referrer	
   window.name	
   postMessage	
   WebStorage	
   Total	
  
HTML	
   1,356,796	
   1,535,299	
   240,341	
   35,446	
   35,103	
   16,387	
   3,219,392	
  
JavaScript	
   22,962	
   359,962	
   511	
   617,743	
   448,311	
   279,383	
   1,728,872	
  
URL	
   3,798,228	
   2,556,709	
   313,617	
   83,218	
   18,919	
   28,052	
   6,798,743	
  
Cookie	
   220,300	
   10,227,050	
   25,062	
   1,328,634	
   2,554	
   5,618	
   11,809,218	
  
post	
  Message	
   451,170	
   77,202	
   696	
   45,220	
   11,053	
   117,575	
   702,916	
  
Web	
  Storage	
   41,739	
   65,772	
   1,586	
   434	
   194	
   105,440	
   215,165	
  
Total	
   5,891,195	
   14,821,994	
   581,813	
   2,110,715	
   516,134	
   552,455	
   24,474,306	
  
Encoded	
   64,78%	
   52,81%	
   83,99%	
   57,69%	
   1,57%	
   30,31%	
  
Sinks Sources
Outlook on future work
32
URL	
   Cookie	
   Referrer	
   window.name	
   postMessage	
   WebStorage	
   Total	
  
HTML	
   1,356,796	
   1,535,299	
   240,341	
   35,446	
   35,103	
   16,387	
   3,219,392	
  
JavaScript	
   22,962	
   359,962	
   511	
   617,743	
   448,311	
   279,383	
   1,728,872	
  
URL	
   3,798,228	
   2,556,709	
   313,617	
   83,218	
   18,919	
   28,052	
   6,798,743	
  
Cookie	
   220,300	
   10,227,050	
   25,062	
   1,328,634	
   2,554	
   5,618	
   11,809,218	
  
post	
  Message	
   451,170	
   77,202	
   696	
   45,220	
   11,053	
   117,575	
   702,916	
  
Web	
  Storage	
   41,739	
   65,772	
   1,586	
   434	
   194	
   105,440	
   215,165	
  
Total	
   5,891,195	
   14,821,994	
   581,813	
   2,110,715	
   516,134	
   552,455	
   24,474,306	
  
Encoded	
   64,78%	
   52,81%	
   83,99%	
   57,69%	
   1,57%	
   30,31%	
  
Sinks Sources
Outlook on future work
33
URL	
   Cookie	
   Referrer	
   window.name	
   postMessage	
   WebStorage	
   Total	
  
HTML	
   1,356,796	
   1,535,299	
   240,341	
   35,446	
   35,103	
   16,387	
   3,219,392	
  
JavaScript	
   22,962	
   359,962	
   511	
   617,743	
   448,311	
   279,383	
   1,728,872	
  
URL	
   3,798,228	
   2,556,709	
   313,617	
   83,218	
   18,919	
   28,052	
   6,798,743	
  
Cookie	
   220,300	
   10,227,050	
   25,062	
   1,328,634	
   2,554	
   5,618	
   11,809,218	
  
post	
  Message	
   451,170	
   77,202	
   696	
   45,220	
   11,053	
   117,575	
   702,916	
  
Web	
  Storage	
   41,739	
   65,772	
   1,586	
   434	
   194	
   105,440	
   215,165	
  
Total	
   5,891,195	
   14,821,994	
   581,813	
   2,110,715	
   516,134	
   552,455	
   24,474,306	
  
Encoded	
   64,78%	
   52,81%	
   83,99%	
   57,69%	
   1,57%	
   30,31%	
  
Sinks Sources
Outlook on future work
34
URL	
   Cookie	
   Referrer	
   window.name	
   postMessage	
   WebStorage	
   Total	
  
HTML	
   1,356,796	
   1,535,299	
   240,341	
   35,446	
   35,103	
   16,387	
   3,219,392	
  
JavaScript	
   22,962	
   359,962	
   511	
   617,743	
   448,311	
   279,383	
   1,728,872	
  
URL	
   3,798,228	
   2,556,709	
   313,617	
   83,218	
   18,919	
   28,052	
   6,798,743	
  
Cookie	
   220,300	
   10,227,050	
   25,062	
   1,328,634	
   2,554	
   5,618	
   11,809,218	
  
post	
  Message	
   451,170	
   77,202	
   696	
   45,220	
   11,053	
   117,575	
   702,916	
  
Web	
  Storage	
   41,739	
   65,772	
   1,586	
   434	
   194	
   105,440	
   215,165	
  
Total	
   5,891,195	
   14,821,994	
   581,813	
   2,110,715	
   516,134	
   552,455	
   24,474,306	
  
Encoded	
   64,78%	
   52,81%	
   83,99%	
   57,69%	
   1,57%	
   30,31%	
  
Sinks Sources
Outlook on future work

Mais conteúdo relacionado

Mais procurados

Protecting Users Against XSS-based Password Manager Abuse
Protecting Users Against XSS-based Password Manager AbuseProtecting Users Against XSS-based Password Manager Abuse
Protecting Users Against XSS-based Password Manager AbuseBen Stock
 
Orion Context Broker NGSI-v2 Overview for Developers That Already Know Ngsi-v...
Orion Context Broker NGSI-v2 Overview for Developers That Already Know Ngsi-v...Orion Context Broker NGSI-v2 Overview for Developers That Already Know Ngsi-v...
Orion Context Broker NGSI-v2 Overview for Developers That Already Know Ngsi-v...Fermin Galan
 
Orion contextbroker ngs-iv2-overview-for-developers-that-already-know-ngsiv1-...
Orion contextbroker ngs-iv2-overview-for-developers-that-already-know-ngsiv1-...Orion contextbroker ngs-iv2-overview-for-developers-that-already-know-ngsiv1-...
Orion contextbroker ngs-iv2-overview-for-developers-that-already-know-ngsiv1-...Fermin Galan
 
NGSIv2 Overview for Developers That Already Know NGSIv1 20180928
NGSIv2 Overview for Developers That Already Know NGSIv1 20180928NGSIv2 Overview for Developers That Already Know NGSIv1 20180928
NGSIv2 Overview for Developers That Already Know NGSIv1 20180928Fermin Galan
 
NGSIv2 Overview for Developers That Already Know NGSIv1 20181218
NGSIv2 Overview for Developers That Already Know NGSIv1 20181218NGSIv2 Overview for Developers That Already Know NGSIv1 20181218
NGSIv2 Overview for Developers That Already Know NGSIv1 20181218Fermin Galan
 
Breaking AngularJS Javascript sandbox
Breaking AngularJS Javascript sandboxBreaking AngularJS Javascript sandbox
Breaking AngularJS Javascript sandboxMathias Karlsson
 
ngsiv2-overview-for-developers-that-already-know-ngsiv1-20190214
ngsiv2-overview-for-developers-that-already-know-ngsiv1-20190214ngsiv2-overview-for-developers-that-already-know-ngsiv1-20190214
ngsiv2-overview-for-developers-that-already-know-ngsiv1-20190214Fermin Galan
 
Orion Context Broker NGSIv2 Overview for Developers That Already Know NGSIv1 ...
Orion Context Broker NGSIv2 Overview for Developers That Already Know NGSIv1 ...Orion Context Broker NGSIv2 Overview for Developers That Already Know NGSIv1 ...
Orion Context Broker NGSIv2 Overview for Developers That Already Know NGSIv1 ...Fermin Galan
 
Web security: Securing untrusted web content at browsers
Web security: Securing untrusted web content at browsersWeb security: Securing untrusted web content at browsers
Web security: Securing untrusted web content at browsersPhú Phùng
 
Find maximum bugs in limited time
Find maximum bugs in limited timeFind maximum bugs in limited time
Find maximum bugs in limited timebeched
 
Orion Context Broker NGSIv2 Overview for Developers That Already Know NGSIv1 ...
Orion Context Broker NGSIv2 Overview for Developers That Already Know NGSIv1 ...Orion Context Broker NGSIv2 Overview for Developers That Already Know NGSIv1 ...
Orion Context Broker NGSIv2 Overview for Developers That Already Know NGSIv1 ...Fermin Galan
 
AREA41 - Anatomy of attacks aimed at financial sector by the Lazarus group
AREA41 - Anatomy of attacks aimed at financial sector by the Lazarus groupAREA41 - Anatomy of attacks aimed at financial sector by the Lazarus group
AREA41 - Anatomy of attacks aimed at financial sector by the Lazarus groupSeongsuPark8
 
A XSSmas carol
A XSSmas carolA XSSmas carol
A XSSmas carolcgvwzq
 
Real world blockchains
Real world blockchainsReal world blockchains
Real world blockchainsDmitry Meshkov
 
New Methods in Automated XSS Detection & Dynamic Exploit Creation
New Methods in Automated XSS Detection & Dynamic Exploit CreationNew Methods in Automated XSS Detection & Dynamic Exploit Creation
New Methods in Automated XSS Detection & Dynamic Exploit CreationKen Belva
 
How does cryptography work? by Jeroen Ooms
How does cryptography work?  by Jeroen OomsHow does cryptography work?  by Jeroen Ooms
How does cryptography work? by Jeroen OomsAjay Ohri
 
The innerHTML Apocalypse
The innerHTML ApocalypseThe innerHTML Apocalypse
The innerHTML ApocalypseMario Heiderich
 
Hunting Security Bugs in Modern Web Applications
Hunting Security Bugs in Modern Web ApplicationsHunting Security Bugs in Modern Web Applications
Hunting Security Bugs in Modern Web ApplicationsToe Khaing
 
Ruxmon feb 2013 what happened to rails
Ruxmon feb 2013   what happened to railsRuxmon feb 2013   what happened to rails
Ruxmon feb 2013 what happened to railssnyff
 

Mais procurados (20)

JWTs and JOSE in a flash
JWTs and JOSE in a flashJWTs and JOSE in a flash
JWTs and JOSE in a flash
 
Protecting Users Against XSS-based Password Manager Abuse
Protecting Users Against XSS-based Password Manager AbuseProtecting Users Against XSS-based Password Manager Abuse
Protecting Users Against XSS-based Password Manager Abuse
 
Orion Context Broker NGSI-v2 Overview for Developers That Already Know Ngsi-v...
Orion Context Broker NGSI-v2 Overview for Developers That Already Know Ngsi-v...Orion Context Broker NGSI-v2 Overview for Developers That Already Know Ngsi-v...
Orion Context Broker NGSI-v2 Overview for Developers That Already Know Ngsi-v...
 
Orion contextbroker ngs-iv2-overview-for-developers-that-already-know-ngsiv1-...
Orion contextbroker ngs-iv2-overview-for-developers-that-already-know-ngsiv1-...Orion contextbroker ngs-iv2-overview-for-developers-that-already-know-ngsiv1-...
Orion contextbroker ngs-iv2-overview-for-developers-that-already-know-ngsiv1-...
 
NGSIv2 Overview for Developers That Already Know NGSIv1 20180928
NGSIv2 Overview for Developers That Already Know NGSIv1 20180928NGSIv2 Overview for Developers That Already Know NGSIv1 20180928
NGSIv2 Overview for Developers That Already Know NGSIv1 20180928
 
NGSIv2 Overview for Developers That Already Know NGSIv1 20181218
NGSIv2 Overview for Developers That Already Know NGSIv1 20181218NGSIv2 Overview for Developers That Already Know NGSIv1 20181218
NGSIv2 Overview for Developers That Already Know NGSIv1 20181218
 
Breaking AngularJS Javascript sandbox
Breaking AngularJS Javascript sandboxBreaking AngularJS Javascript sandbox
Breaking AngularJS Javascript sandbox
 
ngsiv2-overview-for-developers-that-already-know-ngsiv1-20190214
ngsiv2-overview-for-developers-that-already-know-ngsiv1-20190214ngsiv2-overview-for-developers-that-already-know-ngsiv1-20190214
ngsiv2-overview-for-developers-that-already-know-ngsiv1-20190214
 
Orion Context Broker NGSIv2 Overview for Developers That Already Know NGSIv1 ...
Orion Context Broker NGSIv2 Overview for Developers That Already Know NGSIv1 ...Orion Context Broker NGSIv2 Overview for Developers That Already Know NGSIv1 ...
Orion Context Broker NGSIv2 Overview for Developers That Already Know NGSIv1 ...
 
Web security: Securing untrusted web content at browsers
Web security: Securing untrusted web content at browsersWeb security: Securing untrusted web content at browsers
Web security: Securing untrusted web content at browsers
 
Find maximum bugs in limited time
Find maximum bugs in limited timeFind maximum bugs in limited time
Find maximum bugs in limited time
 
Orion Context Broker NGSIv2 Overview for Developers That Already Know NGSIv1 ...
Orion Context Broker NGSIv2 Overview for Developers That Already Know NGSIv1 ...Orion Context Broker NGSIv2 Overview for Developers That Already Know NGSIv1 ...
Orion Context Broker NGSIv2 Overview for Developers That Already Know NGSIv1 ...
 
AREA41 - Anatomy of attacks aimed at financial sector by the Lazarus group
AREA41 - Anatomy of attacks aimed at financial sector by the Lazarus groupAREA41 - Anatomy of attacks aimed at financial sector by the Lazarus group
AREA41 - Anatomy of attacks aimed at financial sector by the Lazarus group
 
A XSSmas carol
A XSSmas carolA XSSmas carol
A XSSmas carol
 
Real world blockchains
Real world blockchainsReal world blockchains
Real world blockchains
 
New Methods in Automated XSS Detection & Dynamic Exploit Creation
New Methods in Automated XSS Detection & Dynamic Exploit CreationNew Methods in Automated XSS Detection & Dynamic Exploit Creation
New Methods in Automated XSS Detection & Dynamic Exploit Creation
 
How does cryptography work? by Jeroen Ooms
How does cryptography work?  by Jeroen OomsHow does cryptography work?  by Jeroen Ooms
How does cryptography work? by Jeroen Ooms
 
The innerHTML Apocalypse
The innerHTML ApocalypseThe innerHTML Apocalypse
The innerHTML Apocalypse
 
Hunting Security Bugs in Modern Web Applications
Hunting Security Bugs in Modern Web ApplicationsHunting Security Bugs in Modern Web Applications
Hunting Security Bugs in Modern Web Applications
 
Ruxmon feb 2013 what happened to rails
Ruxmon feb 2013   what happened to railsRuxmon feb 2013   what happened to rails
Ruxmon feb 2013 what happened to rails
 

Destaque (20)

The health of nigerians doctors
The health of nigerians   doctorsThe health of nigerians   doctors
The health of nigerians doctors
 
Matter and change
Matter and changeMatter and change
Matter and change
 
ACCT 402 Pinnacle Project
ACCT 402 Pinnacle ProjectACCT 402 Pinnacle Project
ACCT 402 Pinnacle Project
 
Jornal Cruzeiro do Sul
Jornal Cruzeiro do SulJornal Cruzeiro do Sul
Jornal Cruzeiro do Sul
 
Taller N10 DIEGO ARLEY GIRALDO
Taller N10 DIEGO ARLEY GIRALDOTaller N10 DIEGO ARLEY GIRALDO
Taller N10 DIEGO ARLEY GIRALDO
 
Electrolux Interim Report Q2 2016 - Report
Electrolux Interim Report Q2 2016 - ReportElectrolux Interim Report Q2 2016 - Report
Electrolux Interim Report Q2 2016 - Report
 
Comprehensive Plan 5-Year Report
Comprehensive Plan 5-Year ReportComprehensive Plan 5-Year Report
Comprehensive Plan 5-Year Report
 
Earnings Results 2Q09
Earnings Results 2Q09Earnings Results 2Q09
Earnings Results 2Q09
 
263 订味啦商业计划书
263 订味啦商业计划书263 订味啦商业计划书
263 订味啦商业计划书
 
Colombia y ODM
Colombia y ODMColombia y ODM
Colombia y ODM
 
España revision de la ue
España revision de la ueEspaña revision de la ue
España revision de la ue
 
Deaths in Alzheimers
Deaths in AlzheimersDeaths in Alzheimers
Deaths in Alzheimers
 
中国手机广告市场现状及发展趋势分析专题报告2009
中国手机广告市场现状及发展趋势分析专题报告2009中国手机广告市场现状及发展趋势分析专题报告2009
中国手机广告市场现状及发展趋势分析专题报告2009
 
9vos billetes cr
9vos billetes cr9vos billetes cr
9vos billetes cr
 
Quran in Hindi Part-25
Quran in Hindi Part-25Quran in Hindi Part-25
Quran in Hindi Part-25
 
Slide vn update q3.2014 website
Slide vn update q3.2014 websiteSlide vn update q3.2014 website
Slide vn update q3.2014 website
 
clearchannel 34
clearchannel 34clearchannel 34
clearchannel 34
 
安博士Asec 2011年1月安全报告
安博士Asec 2011年1月安全报告安博士Asec 2011年1月安全报告
安博士Asec 2011年1月安全报告
 
Sales in 2012_eng
Sales in 2012_engSales in 2012_eng
Sales in 2012_eng
 
4 q13 earnings presentation final
4 q13 earnings presentation final4 q13 earnings presentation final
4 q13 earnings presentation final
 

Semelhante a 25 Million Flows Later – Large-scale Detection of DOM-based XSS

Security Vulnerabilities: How to Defend Against Them
Security Vulnerabilities: How to Defend Against ThemSecurity Vulnerabilities: How to Defend Against Them
Security Vulnerabilities: How to Defend Against ThemMartin Vigo
 
Neoito — Secure coding practices
Neoito — Secure coding practicesNeoito — Secure coding practices
Neoito — Secure coding practicesNeoito
 
Script Fragmentation - Stephan Chenette - OWASP/RSA 2008
Script Fragmentation - Stephan Chenette - OWASP/RSA 2008Script Fragmentation - Stephan Chenette - OWASP/RSA 2008
Script Fragmentation - Stephan Chenette - OWASP/RSA 2008Stephan Chenette
 
04. xss and encoding
04.  xss and encoding04.  xss and encoding
04. xss and encodingEoin Keary
 
Масштабируемый и эффективный фаззинг Google Chrome
Масштабируемый и эффективный фаззинг Google ChromeМасштабируемый и эффективный фаззинг Google Chrome
Масштабируемый и эффективный фаззинг Google ChromePositive Hack Days
 
When third parties stop being polite... and start getting real
When third parties stop being polite... and start getting realWhen third parties stop being polite... and start getting real
When third parties stop being polite... and start getting realCharles Vazac
 
Protecting the Web at a scale using consul and Elk / Valentin Chernozemski (S...
Protecting the Web at a scale using consul and Elk / Valentin Chernozemski (S...Protecting the Web at a scale using consul and Elk / Valentin Chernozemski (S...
Protecting the Web at a scale using consul and Elk / Valentin Chernozemski (S...Ontico
 
Fluent 2018: When third parties stop being polite... and start getting real
Fluent 2018: When third parties stop being polite... and start getting realFluent 2018: When third parties stop being polite... and start getting real
Fluent 2018: When third parties stop being polite... and start getting realAkamai Developers & Admins
 
When Third Parties Stop Being Polite... and Start Getting Real
When Third Parties Stop Being Polite... and Start Getting RealWhen Third Parties Stop Being Polite... and Start Getting Real
When Third Parties Stop Being Polite... and Start Getting RealNicholas Jansma
 
DEFCON 23 - Jason Haddix - how do i shot web
DEFCON 23 - Jason Haddix - how do i shot webDEFCON 23 - Jason Haddix - how do i shot web
DEFCON 23 - Jason Haddix - how do i shot webFelipe Prado
 
Analysing NPM and JavaScript at scale
Analysing NPM and JavaScript at scaleAnalysing NPM and JavaScript at scale
Analysing NPM and JavaScript at scaleJakub Žitný
 
Efficient Context-sensitive Output Escaping for Javascript Template Engines
Efficient Context-sensitive Output Escaping for Javascript Template EnginesEfficient Context-sensitive Output Escaping for Javascript Template Engines
Efficient Context-sensitive Output Escaping for Javascript Template Enginesadonatwork
 
Waf.js: How to Protect Web Applications using JavaScript
Waf.js: How to Protect Web Applications using JavaScriptWaf.js: How to Protect Web Applications using JavaScript
Waf.js: How to Protect Web Applications using JavaScriptDenis Kolegov
 
How to Shot Web - Jason Haddix at DEFCON 23 - See it Live: Details in Descrip...
How to Shot Web - Jason Haddix at DEFCON 23 - See it Live: Details in Descrip...How to Shot Web - Jason Haddix at DEFCON 23 - See it Live: Details in Descrip...
How to Shot Web - Jason Haddix at DEFCON 23 - See it Live: Details in Descrip...bugcrowd
 
Content Security Policy - Lessons learned at Yahoo
Content Security Policy - Lessons learned at YahooContent Security Policy - Lessons learned at Yahoo
Content Security Policy - Lessons learned at YahooBinu Ramakrishnan
 
Monitoring at scale: Migrating to Prometheus at Fastly
Monitoring at scale: Migrating to Prometheus at FastlyMonitoring at scale: Migrating to Prometheus at Fastly
Monitoring at scale: Migrating to Prometheus at FastlyMarcus Barczak
 
OpenID Foundation RISC WG Update - 2018-04-02
OpenID Foundation RISC WG Update - 2018-04-02OpenID Foundation RISC WG Update - 2018-04-02
OpenID Foundation RISC WG Update - 2018-04-02MikeLeszcz
 
Securing TodoMVC Using the Web Cryptography API
Securing TodoMVC Using the Web Cryptography APISecuring TodoMVC Using the Web Cryptography API
Securing TodoMVC Using the Web Cryptography APIKevin Hakanson
 

Semelhante a 25 Million Flows Later – Large-scale Detection of DOM-based XSS (20)

Security Vulnerabilities: How to Defend Against Them
Security Vulnerabilities: How to Defend Against ThemSecurity Vulnerabilities: How to Defend Against Them
Security Vulnerabilities: How to Defend Against Them
 
Neoito — Secure coding practices
Neoito — Secure coding practicesNeoito — Secure coding practices
Neoito — Secure coding practices
 
Script Fragmentation - Stephan Chenette - OWASP/RSA 2008
Script Fragmentation - Stephan Chenette - OWASP/RSA 2008Script Fragmentation - Stephan Chenette - OWASP/RSA 2008
Script Fragmentation - Stephan Chenette - OWASP/RSA 2008
 
04. xss and encoding
04.  xss and encoding04.  xss and encoding
04. xss and encoding
 
Масштабируемый и эффективный фаззинг Google Chrome
Масштабируемый и эффективный фаззинг Google ChromeМасштабируемый и эффективный фаззинг Google Chrome
Масштабируемый и эффективный фаззинг Google Chrome
 
Cos 432 web_security
Cos 432 web_securityCos 432 web_security
Cos 432 web_security
 
When third parties stop being polite... and start getting real
When third parties stop being polite... and start getting realWhen third parties stop being polite... and start getting real
When third parties stop being polite... and start getting real
 
Protecting the Web at a scale using consul and Elk / Valentin Chernozemski (S...
Protecting the Web at a scale using consul and Elk / Valentin Chernozemski (S...Protecting the Web at a scale using consul and Elk / Valentin Chernozemski (S...
Protecting the Web at a scale using consul and Elk / Valentin Chernozemski (S...
 
Fluent 2018: When third parties stop being polite... and start getting real
Fluent 2018: When third parties stop being polite... and start getting realFluent 2018: When third parties stop being polite... and start getting real
Fluent 2018: When third parties stop being polite... and start getting real
 
When Third Parties Stop Being Polite... and Start Getting Real
When Third Parties Stop Being Polite... and Start Getting RealWhen Third Parties Stop Being Polite... and Start Getting Real
When Third Parties Stop Being Polite... and Start Getting Real
 
DEFCON 23 - Jason Haddix - how do i shot web
DEFCON 23 - Jason Haddix - how do i shot webDEFCON 23 - Jason Haddix - how do i shot web
DEFCON 23 - Jason Haddix - how do i shot web
 
Analysing NPM and JavaScript at scale
Analysing NPM and JavaScript at scaleAnalysing NPM and JavaScript at scale
Analysing NPM and JavaScript at scale
 
New web attacks-nethemba
New web attacks-nethembaNew web attacks-nethemba
New web attacks-nethemba
 
Efficient Context-sensitive Output Escaping for Javascript Template Engines
Efficient Context-sensitive Output Escaping for Javascript Template EnginesEfficient Context-sensitive Output Escaping for Javascript Template Engines
Efficient Context-sensitive Output Escaping for Javascript Template Engines
 
Waf.js: How to Protect Web Applications using JavaScript
Waf.js: How to Protect Web Applications using JavaScriptWaf.js: How to Protect Web Applications using JavaScript
Waf.js: How to Protect Web Applications using JavaScript
 
How to Shot Web - Jason Haddix at DEFCON 23 - See it Live: Details in Descrip...
How to Shot Web - Jason Haddix at DEFCON 23 - See it Live: Details in Descrip...How to Shot Web - Jason Haddix at DEFCON 23 - See it Live: Details in Descrip...
How to Shot Web - Jason Haddix at DEFCON 23 - See it Live: Details in Descrip...
 
Content Security Policy - Lessons learned at Yahoo
Content Security Policy - Lessons learned at YahooContent Security Policy - Lessons learned at Yahoo
Content Security Policy - Lessons learned at Yahoo
 
Monitoring at scale: Migrating to Prometheus at Fastly
Monitoring at scale: Migrating to Prometheus at FastlyMonitoring at scale: Migrating to Prometheus at Fastly
Monitoring at scale: Migrating to Prometheus at Fastly
 
OpenID Foundation RISC WG Update - 2018-04-02
OpenID Foundation RISC WG Update - 2018-04-02OpenID Foundation RISC WG Update - 2018-04-02
OpenID Foundation RISC WG Update - 2018-04-02
 
Securing TodoMVC Using the Web Cryptography API
Securing TodoMVC Using the Web Cryptography APISecuring TodoMVC Using the Web Cryptography API
Securing TodoMVC Using the Web Cryptography API
 

Último

data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfJiananWang21
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwaitjaanualu31
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesMayuraD1
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdfKamal Acharya
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxSCMS School of Architecture
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Call Girls Mumbai
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 
Wadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptxWadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptxNadaHaitham1
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...Amil baba
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.Kamal Acharya
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdfAldoGarca30
 
Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxchumtiyababu
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdfKamal Acharya
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxSCMS School of Architecture
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersMairaAshraf6
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Arindam Chakraborty, Ph.D., P.E. (CA, TX)
 

Último (20)

data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills KuwaitKuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
Kuwait City MTP kit ((+919101817206)) Buy Abortion Pills Kuwait
 
DeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakesDeepFakes presentation : brief idea of DeepFakes
DeepFakes presentation : brief idea of DeepFakes
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Wadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptxWadi Rum luxhotel lodge Analysis case study.pptx
Wadi Rum luxhotel lodge Analysis case study.pptx
 
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
NO1 Top No1 Amil Baba In Azad Kashmir, Kashmir Black Magic Specialist Expert ...
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
1_Introduction + EAM Vocabulary + how to navigate in EAM.pdf
 
Verification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptxVerification of thevenin's theorem for BEEE Lab (1).pptx
Verification of thevenin's theorem for BEEE Lab (1).pptx
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to Computers
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 

25 Million Flows Later – Large-scale Detection of DOM-based XSS

  • 1. 25 Million Flows Later – Large-scale Detection of DOM-based XSS CCS 2013, Berlin Sebastian Lekies, Ben Stock, Martin Johns
  • 2. Agenda ●  XSS & Attacker Scenario ●  WebSec guys: wake up once you see a cat ●  Motivation ●  Our contributions ●  Summary 2
  • 3. Cross-Site Scripting ●  Execution of attacker-controlled code on the client in the context of the vulnerable app ●  Three kinds: ●  Persistent XSS: guestbook, ... ●  Reflected XSS: search forms, ... ●  DOM-based XSS: also called local XSS ●  content dynamically added by JS (e.g. like button), .. 3 Server side Client side
  • 4. Cross-Site Scripting: attacker model ●  Attacker wants to inject own code into vuln. app ●  steal cookie ●  take abritrary action in the name of the user ●  pretend to be the server towards the user ●  ... 4 Source: http://blogs.sfweekly.com/thesnitch/ cookie_monster.jpg
  • 5. Cross-Site Scripting: problem statement ●  Main problem: attacker‘s content ends in document and is not properly filtered/encoded ●  common for server- and client-side flaws ●  Flow of data: from attacker-controllable source to security- sensitive sink ●  Our Focus: client side JavaScript code ●  Sources: e.g. the URL ●  Sinks: e.g. document.write 5
  • 6. Example of a DOMXSS vulnerability ●  Source: location.hash, Sink: document.write ●  Intended usage: ●  http://example.org/#mypage ●  <img src='//adve.rt/ise?hash=mypage'/>! ●  Exploiting the vuln: ●  http://example.org/#'/><script>alert(1)</script> ●  <img src='//adve.rt/ise?hash='/>
 <script>alert(1)</script>
 '/> 6 document.write("<img src='//adve.rt/ise?hash=" + location.hash.slice(1)+ "'/>");!
  • 7. How does the attacker exploit this? a.  Send a crafted link to the victim b.  Embed vulnerable page with payload into his own page 7 h"p://ki"enpics.org   Source: http://www.hd-gbpics.de/gbbilder/katzen/katzen2.jpg
  • 8. Our motivation and contribution ●  Perform Large-scale analysis of DOMXSS vulnerabilities ●  Automated, dynamic detection of suspicious flows ●  Automated validation of vulnerabilities ●  Our key components ●  Taint-aware browsing engine ●  Crawling infrastructure ●  Context-specific exploit generator ●  Exploit verification using the crawler 8
  • 9. Building a taint-aware browsing engine to find suspicious flows
  • 10. Our approach: use dynamic taint tracking ●  Taint tracking: Track the flow of marked data from source to sink ●  Implementation: into Chromium (Blink+V8) ●  Requirements for taint tracking ●  Taint all relevent values / propagate taints ●  Report all sinks accesses ●  be as precise as possible ●  taint details on EVERY character 10
  • 11. Representing sources ●  In terms of DOMXSS, we have 14 sources ●  additionally, three relevant, built-in encoding functions ●  escape, encodeURI and encodeURIComponent ●  .. may prevent XSS vulnerabilites if used properly ●  Goal: store source + bitmask of encoding functions for each character 11
  • 12. Representing sources (cntd) ●  14 sources è 4 bits sufficient ●  3 relevant built-in functions è 3 bits sufficient 7 bits < 1 byte ●  è 1 Byte sufficient to store source + encoding functions ●  encoding functions and counterparts set/unset bits ●  hard-coded characters have source 0 12 enconding functions Source
  • 13. Representing sources (cntd) ●  Each source API (e.g. URL or cookie) attaches taint bytes ●  identifing the source of a char ●  var x = location.hash.slice(1);! ●  x = escape(x);! 13 t   e   s   '   1   1   1   1   t   e   s   %   65   65   65   65  2   7   65   65   0   1   0   0   0   0   0   1  
  • 14. Detecting sink access ●  Taint propagated through all relevant functions ●  Security-sensitive sinks report flow and details ●  such as text, taint information, source code location ●  Chrome extension to handle reporting ●  keep core changes as small as possible ●  repack information in JavaScript ●  stub function directly inside V8 14 Extension V8 JS eval report WebKit document.write
  • 15. Empirical study on suspicious flows
  • 16. Crawling the Web (at University scale) ●  Crawler infrastructure constisting of ●  modified, taint-aware browsing engine ●  browser extension to direct the engine ●  Dispatching and reporting backend ●  In total, we ran 6 machines Control'backend' Background'script' Tab'1' content'' script' Web' page''' &'' user' script' Tab'n' content'' script' Web' page''' &'' user' script'…' Background'script' Tab'1' content'' script' Web' page''' &'' user' script' Tab'n' content'' script' Web' page''' &'' user' script'…'…' Browser'1' Browser'm' 16
  • 17. Empirical study ●  Shallow crawl of Alexa Top 5000 Web Sites ●  Main page + first level of links ●  504,275 URLs scanned in roughly 5 days ●  on average containing ~8,64 frames ●  total of 4,358,031 analyzed documents ●  Step 1: Flow detection ●  24,474,306 data flows from possibly attacker-controllable input to security-sensitive sinks 17
  • 18. Context-Sensitive Generation of Cross-Site Scripting Payloads
  • 19. Validating vulnerabilities ●  Current Situation: ●  Taint-tracking engine delivers suspicious flows ●  Suspicious flow != Vulnerability ●  Why may suspicious flows not be exploitable? ●  e.g. custom filter, validation or encoding function ●  Validation needed: working exploit <script>! if (/^[a-z][0-9]+$/.test(location.hash.slice(1)) {! document.write(location.hash.slice(1));! }! </script> 19
  • 20. Anatomy of an XSS Exploit ●  Cross-Site Scripting exploits are context-specific: ●  HTML Context ●  Vulnerability: ●  Exploit: ●  JavaScript Context ●  Vulnerability: ●  Exploit: eval("var x = '" + location.hash + "';"); '; alert(1); // document.write("<img src='pic.jpg?hash=" ! !+ location.hash.slice(1) + "'>"); '><script>alert(1)</script><textarea> 20
  • 21. Anatomy of an XSS Exploit ●  Context-Sensitivity ●  Breakout-Sequence: Highly context sensitive (generation is difficult) ●  Payload: Not context sensitive (arbitrary JavaScript code) ●  Comment Sequence: Very easy to generate (choose from a handful of options) Payload Break-in / Comment SequenceBreak-out Sequence '; alert(1); // '><script> alert(1); </script><textarea> 21
  • 22. Breaking out of JavaScript contexts ●  JavaScript Context ●  Visiting http://example.org/ in our engine <script>! var code = 'function test(){' ! ! + 'var x = "' + location.href + '";'! ! //inside function test! ! + 'doSomething(x);'! ! + '}'; ! //top level ! eval(code);! </script> eval('
 function test() {! var x = "http://example.org";! doSomething(x);! }
 '); 22
  • 23. Syntax tree to working exploit ●  Two options here: ●  break out of string ●  break out of function definition ●  Latter is more reliable ●  function test not necessarily called automatically on „normal“ execution 23 Tainted  value  aka   injecAon  point   function test() {! var x = "http://example.org";! doSomething(x);! }
  • 24. Generating a valid exploit ●  Traverse the AST upwards and “end” the branches ●  Breakout Sequence: “;} ●  Comment: // ●  Exploit: ";}alert(1);// ●  Visit: http://example.org/#";}alert(1);// } ; “ 24 function test() {! var x = "http://example.org";! }! alert(1);//“; doSomething(x); }
  • 25. Validating vulnerabilities ●  Our focus: directly controllable exploits ●  Sinks: direct execution sinks ●  HTML sinks (document.write, innerHTML ,...) ●  JavaScript sinks (eval, ...) ●  Sources: location and referrer ●  Only unencoded strings ●  Not in the focus (yet): second-order vulnerabilities ●  to cookie and from cookie to eval ●  ... 25
  • 26. Empirical study ●  Step 2: Flow reduction ●  Only JavaScript and HTML sinks: 24,474,306 è 4,948,264 ●  Only directly controllable sources: 4,948,264 è 1,825,598 ●  Only unencoded flows: 1,825,598 è 313,794 ●  Step 3: Precise exploit generation ●  Generated a total of 181,238 unique test cases ●  rest were duplicates (same URL and payload) ●  basically same vuln twice in same page 26
  • 27. Empirical study ●  Step 4: Exploit validation ●  69,987 out of 181,238 unique test cases triggered a vulnerability ●  Step 5: Further analysis ●  8,163 unique vulnerabilities affecting 701 domains ●  …of all loaded frames (i.e. also from outside Top 5000) ●  6,167 unique vulnerabilities affecting 480 Alexa top 5000 domains ●  At least, 9.6 % of the top 5000 Web pages contain one or more XSS problems ●  This number only represents the lower bound (!) 27
  • 28. Limitations ●  No assured code coverage ●  e.g. debug GET-param needed? ●  also, not all pages visited (esp. stateful applications) ●  Fuzzing might get better results ●  does not scale as well ●  Not yet looking at the „harder“ flows ●  found one URL è Cookie è eval „by accident“ 28
  • 29. Summary ●  We built a tool capable of detecting flows ●  taint-aware Chromium ●  Chrome extension for crawling and reporting ●  We built an automated exploit generator ●  taking into account the exact taint information ●  ... and specific contexts ●  We found that at least 480 of the top 5000 domains carry a DOM-XSS vuln 29
  • 30. Thank you very much for your attention! Ben Stock @kcotsneb ben.stock@fau.de
  • 31. 31 URL   Cookie   Referrer   window.name   postMessage   WebStorage   Total   HTML   1,356,796   1,535,299   240,341   35,446   35,103   16,387   3,219,392   JavaScript   22,962   359,962   511   617,743   448,311   279,383   1,728,872   URL   3,798,228   2,556,709   313,617   83,218   18,919   28,052   6,798,743   Cookie   220,300   10,227,050   25,062   1,328,634   2,554   5,618   11,809,218   post  Message   451,170   77,202   696   45,220   11,053   117,575   702,916   Web  Storage   41,739   65,772   1,586   434   194   105,440   215,165   Total   5,891,195   14,821,994   581,813   2,110,715   516,134   552,455   24,474,306   Encoded   64,78%   52,81%   83,99%   57,69%   1,57%   30,31%   Sinks Sources Outlook on future work
  • 32. 32 URL   Cookie   Referrer   window.name   postMessage   WebStorage   Total   HTML   1,356,796   1,535,299   240,341   35,446   35,103   16,387   3,219,392   JavaScript   22,962   359,962   511   617,743   448,311   279,383   1,728,872   URL   3,798,228   2,556,709   313,617   83,218   18,919   28,052   6,798,743   Cookie   220,300   10,227,050   25,062   1,328,634   2,554   5,618   11,809,218   post  Message   451,170   77,202   696   45,220   11,053   117,575   702,916   Web  Storage   41,739   65,772   1,586   434   194   105,440   215,165   Total   5,891,195   14,821,994   581,813   2,110,715   516,134   552,455   24,474,306   Encoded   64,78%   52,81%   83,99%   57,69%   1,57%   30,31%   Sinks Sources Outlook on future work
  • 33. 33 URL   Cookie   Referrer   window.name   postMessage   WebStorage   Total   HTML   1,356,796   1,535,299   240,341   35,446   35,103   16,387   3,219,392   JavaScript   22,962   359,962   511   617,743   448,311   279,383   1,728,872   URL   3,798,228   2,556,709   313,617   83,218   18,919   28,052   6,798,743   Cookie   220,300   10,227,050   25,062   1,328,634   2,554   5,618   11,809,218   post  Message   451,170   77,202   696   45,220   11,053   117,575   702,916   Web  Storage   41,739   65,772   1,586   434   194   105,440   215,165   Total   5,891,195   14,821,994   581,813   2,110,715   516,134   552,455   24,474,306   Encoded   64,78%   52,81%   83,99%   57,69%   1,57%   30,31%   Sinks Sources Outlook on future work
  • 34. 34 URL   Cookie   Referrer   window.name   postMessage   WebStorage   Total   HTML   1,356,796   1,535,299   240,341   35,446   35,103   16,387   3,219,392   JavaScript   22,962   359,962   511   617,743   448,311   279,383   1,728,872   URL   3,798,228   2,556,709   313,617   83,218   18,919   28,052   6,798,743   Cookie   220,300   10,227,050   25,062   1,328,634   2,554   5,618   11,809,218   post  Message   451,170   77,202   696   45,220   11,053   117,575   702,916   Web  Storage   41,739   65,772   1,586   434   194   105,440   215,165   Total   5,891,195   14,821,994   581,813   2,110,715   516,134   552,455   24,474,306   Encoded   64,78%   52,81%   83,99%   57,69%   1,57%   30,31%   Sinks Sources Outlook on future work