SlideShare a Scribd company logo
1 of 32
Cross-Site Request Forgery



                     Vladimir Polumirac
                     e-mail: v.polumirac@sbb.rs
                     blog:   d0is.wordpress.com
                     FB:     facebook.com/vpolumirac
OWASP                Twitter twitter.com/d0is
23/07/2012

                Copyright © The OWASP Foundation
                Permission is granted to copy, distribute and/or modify this document
                under the terms of the OWASP License.




                The OWASP Foundation
                http://www.owasp.org
Content

1)   INTRODUCTION
2)   WEB APPLICATION SECURITY
3)   CSRF ATTACKS
4)   DEFENSES
5)   CONCLUSION




                                OWASP   2
1. INTRODUCTION

Cross-Site Request Forgery (CSRF)
- malicious use of user rights in which the
  unauthorized user to transmit commands over
  the locations which the user believes
- ranking in the OWASP top 10 and the
  CWE/SANS top 25

  Note: Common Weakness Enumeration (CWE)




                                            OWASP   3
1. INTRODUCTION

Exploits implicit authentication mechanisms
 Known since 2001
 XSRF a.k.a. CSRF a.k.a. “Session Riding”
   (a.k.a. “Sea Surf”)
 Unknown/underestimated attack vector
  (compared to XSS or SQL injection)
The Attack:
 The attacker creates a hidden http request inside the
  victim’s web browser
 This request is executed in the victim’s authentication
  context

                                                  OWASP     4
WEB APPLICATION SECURITY




                           OWASP   5
2.1 CSRF Demonstration




                         OWASP   6
2.1 CSRF Demonstration




                         OWASP   7
2.2 Attack characteristics

 Conditions:
I. page that the attack does not check the source of
    messages, or HTTP referrer header or
II. Web browser allows users faking the header
III.uses the HTTP request that such change is performed
    on the attacked site or user account
    (for example password change), 
IV.attacker has access authentication cookies and
    security badges by which accessing the site and 
V. the attacker is in able to specify the victim to open a
    malicious web links.
                                                 OWASP       8
2.3 Potential riscs

CSRF is not so easily done
But the problem with CSRF is that the scope of
    its consequences is practically unlimited
Any action that may be on the web to perform
    URL links, or by submitting a web form:
I. publishing content on blogs and forums on
    behalf of users,  sending different messages, 
II. on-line shopping, 
III.subscription to the virtual content etc.

                                           OWASP     9
2.4 Related attacks

 Distinguishing between CSRF and XSS
- Myth: CSRF is just a special case of XSS.
- Fact: CSRF is a separate vulnerability from XSS, with a
   different solution. XSS protections won’t stop CSRF
   attacks, although XSS are important to solve and should
   be prioritized
a. While XSS attacks using the trust that the user has a
   web site, CSRF attacks abusing the trust that has a web
   site to users.
b. CSRF attack and are much more dangerous, unpopular
   (which means less resources for developers) and much
   harder to defend against XSS attacks.
                                                 OWASP       10
3. CSFR ATTACKS

CSRF attacks can be carried out in various
    ways: 
I. use maliciously formed HTML objects 
II. using scripting code embedded in HTML
    (JavaScript, PHP, JScript, ...) and abuse
III.Automatic generation of application in a web
    browser (XMLHttpRequest).




                                           OWASP   11
3.1 Attacks HTML objects

 By HTTP GET methods

  <img src=”picture.gif" alt=”Picture" title=" Picture " />

  input fake code in attribute ”src” request to another web
  location
  <img src="http://server/false_request"/>

  input fake code in attribute ”src” in SCRIPT and FRAME
    object request to another web location
  <iframe src=" http://server/false_request"/>

  <script src=“http://server/false_request"/>


                                                              OWASP   12
3.2 Attacks scripting code
 Example abusing by object Image()
   <script>
   var picture = new Image();
   picture = http://server/false_request“;
   <script>

 By object ActiveXObject in Microsoft JScript
   <script>
   var xmlhttp=new
   ActiveXObject("Microsoft.XMLHTTP");
   xmlhttp.open("POST", 'http://server/fake_code', true);
   xmlhttp.onreadystatechange = function () {
   if (xmlhttp.readyState == 4)
   {alert(xmlhttp.responseText); }
    };
   xmlhttp.send(null);
   </script>

                                                            OWASP   13
3.3 Attacks XML HTTP Request

 an API available in web browser script languages such
  as JavaScript
  important role in the Ajax web development technique
   <script>
   xmlhttp=new XMLHttpRequest() ;
   xmlhttp.open(“GET”, “http://urlAdress”,true);
   xmlhttp.onreadystatechange = writeAnswer();
   xmlhttp.send(null);
   function writeAnswer(xmlhttp,element_id)
   {
   var element = document.getElementById(element_id);
   if (xmlhttp.readyState == 4)
   {
   var tekst = http.responseText;
   dokument.write.text;
   } }
   </script>

                                                        OWASP   14
3.4 CSRF with AJAX Attack
 AJAX calls can enable malicious web sites to:
i. Analyze the content returned and locate sensitive
     information.
ii. Locate anti-CSRF tokens in pages that precede a
     CSRF protected entry point.
iii. Dynamically locate the CSRF target entry points,
     instead of constructing the CSRF payload in advance.
iv.Overcome custom header requirements, and bypass
     incomplete CSRF prevention mechanisms.
v. Perform CSRF on entry points that require JSON,
     XML or different content delivery methods.

                                                  OWASP     15
3.4 CSRF with AJAX Attack

 following conditions must be met:
a. Same Port – the malicious website and the vulnerable
   website reside on the same port.
b. Same Protocol – the malicious website and the
   vulnerable website must use the same protocol.
c. The victim must use a “permissive browser”, meaning a
   browser that supports permissive intranet settings (a
   concept which will be described in the following section).
d. The malicious web site must be perceived as "Internal"
   by the browser – the user should access the attacking
   web site while using an Intranet address.

                                                  OWASP         16
3.4.1 Demonstrating CSRF with AJAX

By creating the malicious website (abstract)
   Step 1 - The user authenticates in front of the
 vulnerable website, which populates the session
 memory associated with the browser' cookie
 with the user identity and permissions.
  Step 2 – The authenticated user uses a second
 tab to surf to the malicious website
  http://absractSite/Ajax-CSRF.html



                                         OWASP       17
3.4.1 Demonstrating CSRF with AJAX
function csrfAjax()
{
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("myDiv").innerHTML=xmlhttp.responseText;
}
 }
xmlhttp.open("GET","http://edition.cnn.com/search/?
query=123hacked123&primaryType=mixed&sortBy=date&intl=true",true);
xmlhttp.send("");
}

                                                              OWASP   18
3.4.1 Demonstrating CSRF with AJAX
                                                              innocent looking popup




Step 3 – The user clicks "yes" and the following request is
generated (intercepted with a proxy)                                OWASP          19
3.4.1 Demonstrating CSRF with AJAX

The browser sends the request to the target
 while automatically adding the users`cookie, and
 thus, causes the victim to perform the action that
 the attacker intended.
Now, the malicious website is able to analyze
 the response, and presents it under the
 malicious domain.




                                          OWASP       20
4. DEFENSES

 Defenses against CSRF and other attacks on web
    applications consists of: 
I. the application of appropriate principles and safeguards
    when designing programs 
II. the responsible handling of the program, 
    code and test
III.test the program.

    OWASP is helping by publishing application and
  documentation related to web protection, discovering
  vunerability and security maintaince.

                                                  OWASP       21
4. DEFENSES

 Secret Validation Token

                         <input type=hidden value=23a3af01b>


 Referer Validation

                   Referer: http://www.facebook.com/home.php

 Custom HTTP Header


                             X-Requested-By: XMLHttpRequest



                                                  OWASP        22
4.1 Client-side defenses
Can browsers help with CSRF?
Does not break existing sites
Easy to use
Hard to misuse
Allows legitimate cross-site requests
Reveals minimum amount of information
Can be standardized




                                         OWASP   23
4.1 Client-side defenses

Can browsers help with CSRF?
Does not break existing sites
Easy to use
Hard to misuse
Allows legitimate cross-site requests
Reveals minimum amount of information
Can be standardized



                                     OWASP   24
4.1 Client-side defenses




private searching history in FireFox   secure possibilities in FireFox


                                                                   OWASP   25
4.1 Client-side defenses

 The Firefox add-on CsFire protects the Internet user against
  malicious cross-domain requests. The add-on basically
  nullifies them by removing authentication information like
  cookies and authentication headers to eliminate the
  possibility that these requests can be harmful to the user.




                                                  OWASP      26
4.2 Web-browser defenses

a) re-apply each time users log critical GET and POST
   requests, 
b) limit the validity of the authentication cookie time, 
c) checking the source message (HTTP Referer header) 
d) introduction of additional secret security badges, which
   joins the identifiers and the session request 
e) the use of cookies in the new each new legend form,
   even within the same session 
f) reject cookies and outdated 
g) avoid displaying attributes in the URL link. 
   It is recommended to send them in hidden fields of web
   forms.
                                                 OWASP        27
4.3 Protection Approaches

 Approach 1: Use cryptographic tokens to prove the
  action formulator knows a session‐ and action‐specific
  secret.
 Level of protection: Very High Recommended by iSEC

 Advantages: Very strong protection, no additional
  memory requirements per user session.
 Disadvantages: Requires the dynamic generation of all
  actions. This widespread change can be eased through
  integration with a thin client framework. The approach
  also requires a small amount of computation when
  actions are formulated and verified.
                                                OWASP      28
4.3 Protection Approaches

 Approach 2: Use secret tokens to prove the action
  formulator knew an action‐ and session‐specific secret.
 Level of protection: Very High Recommended by iSEC

 Advantages: Very strong protection, minimal
  computational overhead.
 Disadvantages: Requires the dynamic generation of all
  actions. This widespread change can be eased through
  integration with a thin client framework. Requires
  additional memory on the order of 128 bits times the
  number of actions per session.

                                                 OWASP      29
5. CONCLUSIONS AND ADVICE
• Login CSRF. Strict Referer validation to protect against login
CSRF because login forms typically submit over HTTPS, where the
Referer header is reliably present for legitimate requests. If a login
request lacks a Referer header, the site should reject the request
to defend against malicious suppression.
• HTTPS. For sites exclusively served over HTTPS, such as
banking sites, we recommend strict Referer validation to protect
against CSRF. Sites should whitelist specific “landing” pages, such
as the home page, that accept cross-site requests.
• Third-party Content. Sites that incorporate thirdparty content,
such as images and hyperlinks, should use a framework, such as
Ruby-on-Rails, that implements secret token validation correctly. If
such a framework is unavailable, sites should spend the
engineering effort to implement secret token validation and use
HMAC to bind the token to the user’s session.
                                                        OWASP       30
Resources
1.   OWASP        http://www.owasp.org/
2.   CSRF - An introduction to a common web application weakness -
     Jesse Burns https://www.isecpartners.com/
3.   Jason Lam,Johannes B. Ullrich: CSRF: What Attackers Don’t
     Want You to Know A Study of Browser Implementations and
     Security Mechanisms for XMLHttpRequest and XDomainRequest,
     http://www.sans.org/reading_room/application_security/protecting_web_ap
     ps2.pdf
4.   Robert Auger - CSRF/XSRF FAQ
     http://www.cgisecurity.com/articles/csrf-faq.shtml
5.   Cross-Site Request Forgery Explained
     http://www.threadstrong.com/courses/csrf/
6.   CsFire, Protects Against Malicious Cross-Domain Requests In
     Firefox                      http://www.ghacks.net/2010/10/22/csfire-
     protects-against-malicious-cross-domain-requests-in-firefox/

                                                                    OWASP      31
Diskusija




            OWASP   32

More Related Content

What's hot

10 things I’ve learnt about web application security
10 things I’ve learnt about web application security10 things I’ve learnt about web application security
10 things I’ve learnt about web application securityJames Crowley
 
OWASP TOP TEN 2017 RC1
OWASP TOP TEN 2017 RC1OWASP TOP TEN 2017 RC1
OWASP TOP TEN 2017 RC1Telefónica
 
Top 10 Web Security Vulnerabilities (OWASP Top 10)
Top 10 Web Security Vulnerabilities (OWASP Top 10)Top 10 Web Security Vulnerabilities (OWASP Top 10)
Top 10 Web Security Vulnerabilities (OWASP Top 10)Brian Huff
 
OWASP App Sec US - 2010
OWASP App Sec US - 2010OWASP App Sec US - 2010
OWASP App Sec US - 2010Aditya K Sood
 
A5-Security misconfiguration-OWASP 2013
A5-Security misconfiguration-OWASP 2013   A5-Security misconfiguration-OWASP 2013
A5-Security misconfiguration-OWASP 2013 Sorina Chirilă
 
Owasp top 10 vulnerabilities
Owasp top 10 vulnerabilitiesOwasp top 10 vulnerabilities
Owasp top 10 vulnerabilitiesOWASP Delhi
 
Security misconfiguration
Security misconfigurationSecurity misconfiguration
Security misconfigurationMicho Hayek
 
Sergey Kochergan - OWASP Top 10 Web Application Vulnerabilities
Sergey Kochergan - OWASP Top 10 Web Application Vulnerabilities Sergey Kochergan - OWASP Top 10 Web Application Vulnerabilities
Sergey Kochergan - OWASP Top 10 Web Application Vulnerabilities Braindev Kyiv
 
Web application Security tools
Web application Security toolsWeb application Security tools
Web application Security toolsNico Penaredondo
 
OWASP Top 10 And Insecure Software Root Causes
OWASP Top 10 And Insecure Software Root CausesOWASP Top 10 And Insecure Software Root Causes
OWASP Top 10 And Insecure Software Root CausesMarco Morana
 
Secure coding guidelines
Secure coding guidelinesSecure coding guidelines
Secure coding guidelinesZakaria SMAHI
 
PCI Security Requirements - secure coding
PCI Security Requirements - secure codingPCI Security Requirements - secure coding
PCI Security Requirements - secure codingHaitham Raik
 
Pci compliance writing secure code
Pci compliance   writing secure codePci compliance   writing secure code
Pci compliance writing secure codeMiva
 
RSA Europe 2013 OWASP Training
RSA Europe 2013 OWASP TrainingRSA Europe 2013 OWASP Training
RSA Europe 2013 OWASP TrainingJim Manico
 
Avoiding Cross Site Scripting - Not as easy as you might think
Avoiding Cross Site Scripting - Not as easy as you might thinkAvoiding Cross Site Scripting - Not as easy as you might think
Avoiding Cross Site Scripting - Not as easy as you might thinkErlend Oftedal
 

What's hot (20)

OWASP Top10 2010
OWASP Top10 2010OWASP Top10 2010
OWASP Top10 2010
 
10 things I’ve learnt about web application security
10 things I’ve learnt about web application security10 things I’ve learnt about web application security
10 things I’ve learnt about web application security
 
OWASP TOP TEN 2017 RC1
OWASP TOP TEN 2017 RC1OWASP TOP TEN 2017 RC1
OWASP TOP TEN 2017 RC1
 
Cyber ppt
Cyber pptCyber ppt
Cyber ppt
 
Top 10 Web Security Vulnerabilities (OWASP Top 10)
Top 10 Web Security Vulnerabilities (OWASP Top 10)Top 10 Web Security Vulnerabilities (OWASP Top 10)
Top 10 Web Security Vulnerabilities (OWASP Top 10)
 
OWASP App Sec US - 2010
OWASP App Sec US - 2010OWASP App Sec US - 2010
OWASP App Sec US - 2010
 
A5-Security misconfiguration-OWASP 2013
A5-Security misconfiguration-OWASP 2013   A5-Security misconfiguration-OWASP 2013
A5-Security misconfiguration-OWASP 2013
 
Attques web
Attques webAttques web
Attques web
 
Owasp top 10 vulnerabilities
Owasp top 10 vulnerabilitiesOwasp top 10 vulnerabilities
Owasp top 10 vulnerabilities
 
Security misconfiguration
Security misconfigurationSecurity misconfiguration
Security misconfiguration
 
Sergey Kochergan - OWASP Top 10 Web Application Vulnerabilities
Sergey Kochergan - OWASP Top 10 Web Application Vulnerabilities Sergey Kochergan - OWASP Top 10 Web Application Vulnerabilities
Sergey Kochergan - OWASP Top 10 Web Application Vulnerabilities
 
Web application Security tools
Web application Security toolsWeb application Security tools
Web application Security tools
 
OWASP Top 10 And Insecure Software Root Causes
OWASP Top 10 And Insecure Software Root CausesOWASP Top 10 And Insecure Software Root Causes
OWASP Top 10 And Insecure Software Root Causes
 
Secure coding guidelines
Secure coding guidelinesSecure coding guidelines
Secure coding guidelines
 
PCI Security Requirements - secure coding
PCI Security Requirements - secure codingPCI Security Requirements - secure coding
PCI Security Requirements - secure coding
 
Owasp webgoat
Owasp webgoatOwasp webgoat
Owasp webgoat
 
Pci compliance writing secure code
Pci compliance   writing secure codePci compliance   writing secure code
Pci compliance writing secure code
 
Atelier Technique - F5 - #ACSS2019
Atelier Technique - F5 - #ACSS2019Atelier Technique - F5 - #ACSS2019
Atelier Technique - F5 - #ACSS2019
 
RSA Europe 2013 OWASP Training
RSA Europe 2013 OWASP TrainingRSA Europe 2013 OWASP Training
RSA Europe 2013 OWASP Training
 
Avoiding Cross Site Scripting - Not as easy as you might think
Avoiding Cross Site Scripting - Not as easy as you might thinkAvoiding Cross Site Scripting - Not as easy as you might think
Avoiding Cross Site Scripting - Not as easy as you might think
 

Similar to OWASP Serbia - A5 cross-site request forgery

Mutillidae and the OWASP Top 10 by Adrian Crenshaw aka Irongeek
Mutillidae and the OWASP Top 10 by Adrian Crenshaw aka IrongeekMutillidae and the OWASP Top 10 by Adrian Crenshaw aka Irongeek
Mutillidae and the OWASP Top 10 by Adrian Crenshaw aka IrongeekMagno Logan
 
Securing your AngularJS Application
Securing your AngularJS ApplicationSecuring your AngularJS Application
Securing your AngularJS ApplicationPhilippe De Ryck
 
OWASP_Top_10_Introduction_and_Remedies_2017.ppt
OWASP_Top_10_Introduction_and_Remedies_2017.pptOWASP_Top_10_Introduction_and_Remedies_2017.ppt
OWASP_Top_10_Introduction_and_Remedies_2017.pptjangomanso
 
Top Ten Web Hacking Techniques (2010)
Top Ten Web Hacking Techniques (2010)Top Ten Web Hacking Techniques (2010)
Top Ten Web Hacking Techniques (2010)Jeremiah Grossman
 
OWASP Khartoum - Top 10 A5 - 7th meeting - Cross Site Request Forgery
OWASP Khartoum - Top 10 A5 - 7th meeting - Cross Site Request ForgeryOWASP Khartoum - Top 10 A5 - 7th meeting - Cross Site Request Forgery
OWASP Khartoum - Top 10 A5 - 7th meeting - Cross Site Request ForgeryOWASP Khartoum
 
A8 cross site request forgery (csrf) it 6873 presentation
A8 cross site request forgery (csrf)   it 6873 presentationA8 cross site request forgery (csrf)   it 6873 presentation
A8 cross site request forgery (csrf) it 6873 presentationAlbena Asenova-Belal
 
Report on xss and do s
Report on xss and do sReport on xss and do s
Report on xss and do smehr77
 
Hacking 101 (Henallux, Owasp Top 10, WebGoat, Live Demo)
Hacking 101 (Henallux, Owasp Top 10, WebGoat, Live Demo) Hacking 101 (Henallux, Owasp Top 10, WebGoat, Live Demo)
Hacking 101 (Henallux, Owasp Top 10, WebGoat, Live Demo) Nitroxis Sprl
 
Owasp Top 10 - Owasp Pune Chapter - January 2008
Owasp Top 10 - Owasp Pune Chapter - January 2008Owasp Top 10 - Owasp Pune Chapter - January 2008
Owasp Top 10 - Owasp Pune Chapter - January 2008abhijitapatil
 
Deep understanding on Cross-Site Scripting and SQL Injection
Deep understanding on Cross-Site Scripting and SQL InjectionDeep understanding on Cross-Site Scripting and SQL Injection
Deep understanding on Cross-Site Scripting and SQL InjectionVishal Kumar
 
Automatically detecting security vulnerabilities in WordPress
Automatically detecting security vulnerabilities in WordPressAutomatically detecting security vulnerabilities in WordPress
Automatically detecting security vulnerabilities in WordPressFresh Consulting
 
Continuing in your role as a human service provider for your local.docx
Continuing in your role as a human service provider for your local.docxContinuing in your role as a human service provider for your local.docx
Continuing in your role as a human service provider for your local.docxrichardnorman90310
 
Securing your EmberJS Application
Securing your EmberJS ApplicationSecuring your EmberJS Application
Securing your EmberJS ApplicationPhilippe De Ryck
 
Hacking The World With Flash
Hacking The World With FlashHacking The World With Flash
Hacking The World With Flashjoepangus
 

Similar to OWASP Serbia - A5 cross-site request forgery (20)

Mutillidae and the OWASP Top 10 by Adrian Crenshaw aka Irongeek
Mutillidae and the OWASP Top 10 by Adrian Crenshaw aka IrongeekMutillidae and the OWASP Top 10 by Adrian Crenshaw aka Irongeek
Mutillidae and the OWASP Top 10 by Adrian Crenshaw aka Irongeek
 
Xss frame work
Xss frame workXss frame work
Xss frame work
 
WebApps_Lecture_15.ppt
WebApps_Lecture_15.pptWebApps_Lecture_15.ppt
WebApps_Lecture_15.ppt
 
Securing your AngularJS Application
Securing your AngularJS ApplicationSecuring your AngularJS Application
Securing your AngularJS Application
 
OWASP_Top_10_Introduction_and_Remedies_2017.ppt
OWASP_Top_10_Introduction_and_Remedies_2017.pptOWASP_Top_10_Introduction_and_Remedies_2017.ppt
OWASP_Top_10_Introduction_and_Remedies_2017.ppt
 
Top Ten Web Hacking Techniques (2010)
Top Ten Web Hacking Techniques (2010)Top Ten Web Hacking Techniques (2010)
Top Ten Web Hacking Techniques (2010)
 
OWASP Khartoum - Top 10 A5 - 7th meeting - Cross Site Request Forgery
OWASP Khartoum - Top 10 A5 - 7th meeting - Cross Site Request ForgeryOWASP Khartoum - Top 10 A5 - 7th meeting - Cross Site Request Forgery
OWASP Khartoum - Top 10 A5 - 7th meeting - Cross Site Request Forgery
 
A8 cross site request forgery (csrf) it 6873 presentation
A8 cross site request forgery (csrf)   it 6873 presentationA8 cross site request forgery (csrf)   it 6873 presentation
A8 cross site request forgery (csrf) it 6873 presentation
 
Cross site scripting
Cross site scriptingCross site scripting
Cross site scripting
 
4.Xss
4.Xss4.Xss
4.Xss
 
Report on xss and do s
Report on xss and do sReport on xss and do s
Report on xss and do s
 
Hacking 101 (Henallux, Owasp Top 10, WebGoat, Live Demo)
Hacking 101 (Henallux, Owasp Top 10, WebGoat, Live Demo) Hacking 101 (Henallux, Owasp Top 10, WebGoat, Live Demo)
Hacking 101 (Henallux, Owasp Top 10, WebGoat, Live Demo)
 
Owasp Top 10 - Owasp Pune Chapter - January 2008
Owasp Top 10 - Owasp Pune Chapter - January 2008Owasp Top 10 - Owasp Pune Chapter - January 2008
Owasp Top 10 - Owasp Pune Chapter - January 2008
 
Deep understanding on Cross-Site Scripting and SQL Injection
Deep understanding on Cross-Site Scripting and SQL InjectionDeep understanding on Cross-Site Scripting and SQL Injection
Deep understanding on Cross-Site Scripting and SQL Injection
 
Automatically detecting security vulnerabilities in WordPress
Automatically detecting security vulnerabilities in WordPressAutomatically detecting security vulnerabilities in WordPress
Automatically detecting security vulnerabilities in WordPress
 
Continuing in your role as a human service provider for your local.docx
Continuing in your role as a human service provider for your local.docxContinuing in your role as a human service provider for your local.docx
Continuing in your role as a human service provider for your local.docx
 
Securing your EmberJS Application
Securing your EmberJS ApplicationSecuring your EmberJS Application
Securing your EmberJS Application
 
Web Application Security
Web Application SecurityWeb Application Security
Web Application Security
 
Attack with-html5
Attack with-html5Attack with-html5
Attack with-html5
 
Hacking The World With Flash
Hacking The World With FlashHacking The World With Flash
Hacking The World With Flash
 

More from Nikola Milosevic

Classifying intangible social innovation concepts using machine learning and ...
Classifying intangible social innovation concepts using machine learning and ...Classifying intangible social innovation concepts using machine learning and ...
Classifying intangible social innovation concepts using machine learning and ...Nikola Milosevic
 
Machine learning (ML) and natural language processing (NLP)
Machine learning (ML) and natural language processing (NLP)Machine learning (ML) and natural language processing (NLP)
Machine learning (ML) and natural language processing (NLP)Nikola Milosevic
 
AI an the future of society
AI an the future of societyAI an the future of society
AI an the future of societyNikola Milosevic
 
Machine learning prediction of stock markets
Machine learning prediction of stock marketsMachine learning prediction of stock markets
Machine learning prediction of stock marketsNikola Milosevic
 
Equity forecast: Predicting long term stock market prices using machine learning
Equity forecast: Predicting long term stock market prices using machine learningEquity forecast: Predicting long term stock market prices using machine learning
Equity forecast: Predicting long term stock market prices using machine learningNikola Milosevic
 
BelBi2016 presentation: Hybrid methodology for information extraction from ta...
BelBi2016 presentation: Hybrid methodology for information extraction from ta...BelBi2016 presentation: Hybrid methodology for information extraction from ta...
BelBi2016 presentation: Hybrid methodology for information extraction from ta...Nikola Milosevic
 
Extracting patient data from tables in clinical literature
Extracting patient data from tables in clinical literatureExtracting patient data from tables in clinical literature
Extracting patient data from tables in clinical literatureNikola Milosevic
 
Supporting clinical trial data curation and integration with table mining
Supporting clinical trial data curation and integration with table miningSupporting clinical trial data curation and integration with table mining
Supporting clinical trial data curation and integration with table miningNikola Milosevic
 
Mobile security, OWASP Mobile Top 10, OWASP Seraphimdroid
Mobile security, OWASP Mobile Top 10, OWASP SeraphimdroidMobile security, OWASP Mobile Top 10, OWASP Seraphimdroid
Mobile security, OWASP Mobile Top 10, OWASP SeraphimdroidNikola Milosevic
 
Table mining and data curation from biomedical literature
Table mining and data curation from biomedical literatureTable mining and data curation from biomedical literature
Table mining and data curation from biomedical literatureNikola Milosevic
 
Sentiment analysis for Serbian language
Sentiment analysis for Serbian languageSentiment analysis for Serbian language
Sentiment analysis for Serbian languageNikola Milosevic
 
Sigurnosne prijetnje i mjere zaštite IT infrastrukture
Sigurnosne prijetnje i mjere zaštite IT infrastrukture Sigurnosne prijetnje i mjere zaštite IT infrastrukture
Sigurnosne prijetnje i mjere zaštite IT infrastrukture Nikola Milosevic
 
Mašinska analiza sentimenta rečenica na srpskom jeziku
Mašinska analiza sentimenta rečenica na srpskom jezikuMašinska analiza sentimenta rečenica na srpskom jeziku
Mašinska analiza sentimenta rečenica na srpskom jezikuNikola Milosevic
 

More from Nikola Milosevic (20)

Classifying intangible social innovation concepts using machine learning and ...
Classifying intangible social innovation concepts using machine learning and ...Classifying intangible social innovation concepts using machine learning and ...
Classifying intangible social innovation concepts using machine learning and ...
 
Machine learning (ML) and natural language processing (NLP)
Machine learning (ML) and natural language processing (NLP)Machine learning (ML) and natural language processing (NLP)
Machine learning (ML) and natural language processing (NLP)
 
Veštačka inteligencija
Veštačka inteligencijaVeštačka inteligencija
Veštačka inteligencija
 
AI an the future of society
AI an the future of societyAI an the future of society
AI an the future of society
 
Machine learning prediction of stock markets
Machine learning prediction of stock marketsMachine learning prediction of stock markets
Machine learning prediction of stock markets
 
Equity forecast: Predicting long term stock market prices using machine learning
Equity forecast: Predicting long term stock market prices using machine learningEquity forecast: Predicting long term stock market prices using machine learning
Equity forecast: Predicting long term stock market prices using machine learning
 
BelBi2016 presentation: Hybrid methodology for information extraction from ta...
BelBi2016 presentation: Hybrid methodology for information extraction from ta...BelBi2016 presentation: Hybrid methodology for information extraction from ta...
BelBi2016 presentation: Hybrid methodology for information extraction from ta...
 
Extracting patient data from tables in clinical literature
Extracting patient data from tables in clinical literatureExtracting patient data from tables in clinical literature
Extracting patient data from tables in clinical literature
 
Supporting clinical trial data curation and integration with table mining
Supporting clinical trial data curation and integration with table miningSupporting clinical trial data curation and integration with table mining
Supporting clinical trial data curation and integration with table mining
 
Mobile security, OWASP Mobile Top 10, OWASP Seraphimdroid
Mobile security, OWASP Mobile Top 10, OWASP SeraphimdroidMobile security, OWASP Mobile Top 10, OWASP Seraphimdroid
Mobile security, OWASP Mobile Top 10, OWASP Seraphimdroid
 
Serbia2
Serbia2Serbia2
Serbia2
 
Table mining and data curation from biomedical literature
Table mining and data curation from biomedical literatureTable mining and data curation from biomedical literature
Table mining and data curation from biomedical literature
 
Malware
MalwareMalware
Malware
 
Sentiment analysis for Serbian language
Sentiment analysis for Serbian languageSentiment analysis for Serbian language
Sentiment analysis for Serbian language
 
Http and security
Http and securityHttp and security
Http and security
 
Android business models
Android business modelsAndroid business models
Android business models
 
Android(1)
Android(1)Android(1)
Android(1)
 
Sigurnosne prijetnje i mjere zaštite IT infrastrukture
Sigurnosne prijetnje i mjere zaštite IT infrastrukture Sigurnosne prijetnje i mjere zaštite IT infrastrukture
Sigurnosne prijetnje i mjere zaštite IT infrastrukture
 
Mašinska analiza sentimenta rečenica na srpskom jeziku
Mašinska analiza sentimenta rečenica na srpskom jezikuMašinska analiza sentimenta rečenica na srpskom jeziku
Mašinska analiza sentimenta rečenica na srpskom jeziku
 
Malware
MalwareMalware
Malware
 

Recently uploaded

Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxsqpmdrvczh
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayMakMakNepo
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Planning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxPlanning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxLigayaBacuel1
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........LeaCamillePacle
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 

Recently uploaded (20)

Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptx
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
Quarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up FridayQuarter 4 Peace-education.pptx Catch Up Friday
Quarter 4 Peace-education.pptx Catch Up Friday
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Planning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxPlanning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptx
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 

OWASP Serbia - A5 cross-site request forgery

  • 1. Cross-Site Request Forgery Vladimir Polumirac e-mail: v.polumirac@sbb.rs blog: d0is.wordpress.com FB: facebook.com/vpolumirac OWASP Twitter twitter.com/d0is 23/07/2012 Copyright © The OWASP Foundation Permission is granted to copy, distribute and/or modify this document under the terms of the OWASP License. The OWASP Foundation http://www.owasp.org
  • 2. Content 1) INTRODUCTION 2) WEB APPLICATION SECURITY 3) CSRF ATTACKS 4) DEFENSES 5) CONCLUSION OWASP 2
  • 3. 1. INTRODUCTION Cross-Site Request Forgery (CSRF) - malicious use of user rights in which the unauthorized user to transmit commands over the locations which the user believes - ranking in the OWASP top 10 and the CWE/SANS top 25 Note: Common Weakness Enumeration (CWE) OWASP 3
  • 4. 1. INTRODUCTION Exploits implicit authentication mechanisms  Known since 2001  XSRF a.k.a. CSRF a.k.a. “Session Riding” (a.k.a. “Sea Surf”)  Unknown/underestimated attack vector (compared to XSS or SQL injection) The Attack:  The attacker creates a hidden http request inside the victim’s web browser  This request is executed in the victim’s authentication context OWASP 4
  • 8. 2.2 Attack characteristics  Conditions: I. page that the attack does not check the source of messages, or HTTP referrer header or II. Web browser allows users faking the header III.uses the HTTP request that such change is performed on the attacked site or user account (for example password change),  IV.attacker has access authentication cookies and security badges by which accessing the site and  V. the attacker is in able to specify the victim to open a malicious web links. OWASP 8
  • 9. 2.3 Potential riscs CSRF is not so easily done But the problem with CSRF is that the scope of its consequences is practically unlimited Any action that may be on the web to perform URL links, or by submitting a web form: I. publishing content on blogs and forums on behalf of users,  sending different messages,  II. on-line shopping,  III.subscription to the virtual content etc. OWASP 9
  • 10. 2.4 Related attacks  Distinguishing between CSRF and XSS - Myth: CSRF is just a special case of XSS. - Fact: CSRF is a separate vulnerability from XSS, with a different solution. XSS protections won’t stop CSRF attacks, although XSS are important to solve and should be prioritized a. While XSS attacks using the trust that the user has a web site, CSRF attacks abusing the trust that has a web site to users. b. CSRF attack and are much more dangerous, unpopular (which means less resources for developers) and much harder to defend against XSS attacks. OWASP 10
  • 11. 3. CSFR ATTACKS CSRF attacks can be carried out in various ways:  I. use maliciously formed HTML objects  II. using scripting code embedded in HTML (JavaScript, PHP, JScript, ...) and abuse III.Automatic generation of application in a web browser (XMLHttpRequest). OWASP 11
  • 12. 3.1 Attacks HTML objects  By HTTP GET methods <img src=”picture.gif" alt=”Picture" title=" Picture " /> input fake code in attribute ”src” request to another web location <img src="http://server/false_request"/> input fake code in attribute ”src” in SCRIPT and FRAME object request to another web location <iframe src=" http://server/false_request"/> <script src=“http://server/false_request"/> OWASP 12
  • 13. 3.2 Attacks scripting code  Example abusing by object Image() <script> var picture = new Image(); picture = http://server/false_request“; <script>  By object ActiveXObject in Microsoft JScript <script> var xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); xmlhttp.open("POST", 'http://server/fake_code', true); xmlhttp.onreadystatechange = function () { if (xmlhttp.readyState == 4) {alert(xmlhttp.responseText); } }; xmlhttp.send(null); </script> OWASP 13
  • 14. 3.3 Attacks XML HTTP Request  an API available in web browser script languages such as JavaScript   important role in the Ajax web development technique <script> xmlhttp=new XMLHttpRequest() ; xmlhttp.open(“GET”, “http://urlAdress”,true); xmlhttp.onreadystatechange = writeAnswer(); xmlhttp.send(null); function writeAnswer(xmlhttp,element_id) { var element = document.getElementById(element_id); if (xmlhttp.readyState == 4) { var tekst = http.responseText; dokument.write.text; } } </script> OWASP 14
  • 15. 3.4 CSRF with AJAX Attack  AJAX calls can enable malicious web sites to: i. Analyze the content returned and locate sensitive information. ii. Locate anti-CSRF tokens in pages that precede a CSRF protected entry point. iii. Dynamically locate the CSRF target entry points, instead of constructing the CSRF payload in advance. iv.Overcome custom header requirements, and bypass incomplete CSRF prevention mechanisms. v. Perform CSRF on entry points that require JSON, XML or different content delivery methods. OWASP 15
  • 16. 3.4 CSRF with AJAX Attack  following conditions must be met: a. Same Port – the malicious website and the vulnerable website reside on the same port. b. Same Protocol – the malicious website and the vulnerable website must use the same protocol. c. The victim must use a “permissive browser”, meaning a browser that supports permissive intranet settings (a concept which will be described in the following section). d. The malicious web site must be perceived as "Internal" by the browser – the user should access the attacking web site while using an Intranet address. OWASP 16
  • 17. 3.4.1 Demonstrating CSRF with AJAX By creating the malicious website (abstract) Step 1 - The user authenticates in front of the vulnerable website, which populates the session memory associated with the browser' cookie with the user identity and permissions. Step 2 – The authenticated user uses a second tab to surf to the malicious website http://absractSite/Ajax-CSRF.html OWASP 17
  • 18. 3.4.1 Demonstrating CSRF with AJAX function csrfAjax() { if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); } else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("myDiv").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","http://edition.cnn.com/search/? query=123hacked123&primaryType=mixed&sortBy=date&intl=true",true); xmlhttp.send(""); } OWASP 18
  • 19. 3.4.1 Demonstrating CSRF with AJAX innocent looking popup Step 3 – The user clicks "yes" and the following request is generated (intercepted with a proxy) OWASP 19
  • 20. 3.4.1 Demonstrating CSRF with AJAX The browser sends the request to the target while automatically adding the users`cookie, and thus, causes the victim to perform the action that the attacker intended. Now, the malicious website is able to analyze the response, and presents it under the malicious domain. OWASP 20
  • 21. 4. DEFENSES  Defenses against CSRF and other attacks on web applications consists of:  I. the application of appropriate principles and safeguards when designing programs  II. the responsible handling of the program,  code and test III.test the program. OWASP is helping by publishing application and documentation related to web protection, discovering vunerability and security maintaince. OWASP 21
  • 22. 4. DEFENSES  Secret Validation Token <input type=hidden value=23a3af01b>  Referer Validation Referer: http://www.facebook.com/home.php  Custom HTTP Header X-Requested-By: XMLHttpRequest OWASP 22
  • 23. 4.1 Client-side defenses Can browsers help with CSRF? Does not break existing sites Easy to use Hard to misuse Allows legitimate cross-site requests Reveals minimum amount of information Can be standardized OWASP 23
  • 24. 4.1 Client-side defenses Can browsers help with CSRF? Does not break existing sites Easy to use Hard to misuse Allows legitimate cross-site requests Reveals minimum amount of information Can be standardized OWASP 24
  • 25. 4.1 Client-side defenses private searching history in FireFox secure possibilities in FireFox OWASP 25
  • 26. 4.1 Client-side defenses  The Firefox add-on CsFire protects the Internet user against malicious cross-domain requests. The add-on basically nullifies them by removing authentication information like cookies and authentication headers to eliminate the possibility that these requests can be harmful to the user. OWASP 26
  • 27. 4.2 Web-browser defenses a) re-apply each time users log critical GET and POST requests,  b) limit the validity of the authentication cookie time,  c) checking the source message (HTTP Referer header)  d) introduction of additional secret security badges, which joins the identifiers and the session request  e) the use of cookies in the new each new legend form, even within the same session  f) reject cookies and outdated  g) avoid displaying attributes in the URL link.  It is recommended to send them in hidden fields of web forms. OWASP 27
  • 28. 4.3 Protection Approaches  Approach 1: Use cryptographic tokens to prove the action formulator knows a session‐ and action‐specific secret.  Level of protection: Very High Recommended by iSEC  Advantages: Very strong protection, no additional memory requirements per user session.  Disadvantages: Requires the dynamic generation of all actions. This widespread change can be eased through integration with a thin client framework. The approach also requires a small amount of computation when actions are formulated and verified. OWASP 28
  • 29. 4.3 Protection Approaches  Approach 2: Use secret tokens to prove the action formulator knew an action‐ and session‐specific secret.  Level of protection: Very High Recommended by iSEC  Advantages: Very strong protection, minimal computational overhead.  Disadvantages: Requires the dynamic generation of all actions. This widespread change can be eased through integration with a thin client framework. Requires additional memory on the order of 128 bits times the number of actions per session. OWASP 29
  • 30. 5. CONCLUSIONS AND ADVICE • Login CSRF. Strict Referer validation to protect against login CSRF because login forms typically submit over HTTPS, where the Referer header is reliably present for legitimate requests. If a login request lacks a Referer header, the site should reject the request to defend against malicious suppression. • HTTPS. For sites exclusively served over HTTPS, such as banking sites, we recommend strict Referer validation to protect against CSRF. Sites should whitelist specific “landing” pages, such as the home page, that accept cross-site requests. • Third-party Content. Sites that incorporate thirdparty content, such as images and hyperlinks, should use a framework, such as Ruby-on-Rails, that implements secret token validation correctly. If such a framework is unavailable, sites should spend the engineering effort to implement secret token validation and use HMAC to bind the token to the user’s session. OWASP 30
  • 31. Resources 1. OWASP http://www.owasp.org/ 2. CSRF - An introduction to a common web application weakness - Jesse Burns https://www.isecpartners.com/ 3. Jason Lam,Johannes B. Ullrich: CSRF: What Attackers Don’t Want You to Know A Study of Browser Implementations and Security Mechanisms for XMLHttpRequest and XDomainRequest, http://www.sans.org/reading_room/application_security/protecting_web_ap ps2.pdf 4. Robert Auger - CSRF/XSRF FAQ http://www.cgisecurity.com/articles/csrf-faq.shtml 5. Cross-Site Request Forgery Explained http://www.threadstrong.com/courses/csrf/ 6. CsFire, Protects Against Malicious Cross-Domain Requests In Firefox http://www.ghacks.net/2010/10/22/csfire- protects-against-malicious-cross-domain-requests-in-firefox/ OWASP 31
  • 32. Diskusija OWASP 32