SlideShare ist ein Scribd-Unternehmen logo
1 von 46
Its All about CSRF
Nilesh Sapariya
Security Analyst | CEH v8 | Blogger
Who Am I ?
 Nilesh Sapariya
 Security Analyst
 3years of Experience in information security
 http://shield4you.blogspot.in/
 @nilesh_loganx
Agenda
What is CSRF ?
Problem
Basics
Validation
Defenses
 News
Demo
What is CSRF ?
• Wiki Says :-
http://en.wikipedia.org/wiki/Cross-site_request_forgery
CSRF | Other names of CSRF
• CSRF (Sea Surf)
• XSRF
• Session Riding
Problem
Problem | Overview
CSRF is an OWASP Top 10 vulnerability but it’s not as well understood
as many others
Many struggle with how to validate it
Customers have difficulty explaining to management why it’s
important to fix
We need to be well-versed in the main points to help the customer
with their narrative to management
Problem | Overview
 Undetectable by automated scanners
 The attack is silent
 Easily mountable
 Combines with XSS or HTML injection(stored)
Basics | OWASP
Basic | Description
“Cross-site Request Forgery is a vulnerability in a
website that allows attackers to force victims to
perform security-sensitive actions on that site
without their knowledge.”
What do we mean by “sensitive
actions”?
How do attackers “force” victims to
perform them?
And how do the victims not know it’s
happening?
Basic | Questions
Basic | Description
1. The target is a sensitive operation in the application, e.g.
UpdateSalary.aspx, that’s able to be tricked into executing.
2. Victims can be forced to execute this action through any method
that gets them to load a resource automatically, e.g. img tag, script
tag, onload form submit, etc. Note: credentials go with all requests!
3. These happen unknowingly because the actions are performed by
the victim’s browser, not by the victim explicitly.
Basic | Description
Basic | Description
Anatomy of CSRF Attack
• Step 1: Attacker hosts web pages with pre-populated HTML form data.
• Step 2: Victim browses to attacker’s HTML form.
• Step 3: Page automatically submits pre-populated form data to a site
where victim has access (No verification done by server as browser is
performing request by checking cookies)
• Step 4: Site Authenticates request (with attacker’s form data) as coming
from victim
Result : Attacker’s form data is accepted by server since it was sent from
legitimate user.
Validation
Validation | Criteria
• If you can’t change something using your CSRF vulnerability, then
you don’t have one.
• Examples of state changes:
- Updating an account (new password?)
- Transferring funds
- Changing the role of a user
- Ordering an item
- Adding an administrator to a system
Validation | Criteria
• The three components again…
1. Can you change state using it?
2. Is the function sensitive?
3. Is the request non-unique?
 This is the core of the validation process
 Any customer asking you to validate a CSRF vulnerability
should hear and learn these same concepts
Validation | Manual Validation
• How to manually verify CSRF:
1. Configure a proxy to observe traffic
2. Log in to the site with the issue in question
3. Perform the target functionality normally, through the browser
4. Observe the request, looking for state change, sensitivity, and uniqueness
5. Look for any additional controls that could stop CSRF, such as CAPTCHA or
additional authentication
6. Log out and log in with a different set of credentials
7. Submit the initial request from the new context, and see if it is successful
8. If the action is performed without issue, it is most likely CSRF
Misconception
Misconception | #1 CSRF = XSS ?
• CSRF = XSS ?
• Fact : CSRF and XSS are completely different attack vector
XSS
• Attacker insert text (for example JavaScript code) onto website by sending
the victim a specially prepared link
• <script>alert(‘nilesh’)</script>
CSRF
• Victim sends attacker’s request to the webserver without knowing about it
• http://www.example.com/admin/deleteuser.php?id=xxx
Misconception | #2 Preventing XSS stops CSRF ?
• Preventing XSS stops CSRF ?
• XSS makes CSRF easier, but it isn’t required
Basics | Trust Abuse
• Both XSS and CSRF are possible due to abused trust relationships:
In XSS the browser will run malicious JavaScript because it
was served from a site (origin) it trusts.
In CSRF the server will perform a sensitive action because it
was sent by a client that it trusts.
Defense
Defense | That Don’t Work
 Requiring multi-step transactions
- CSRF attack can perform each step in order
 CAPTCHAs
Protect forms against automated submission
Can by bypassed using automated tool
How to bypass captcha : http://shield4you.blogspot.in/2014/10/bypass-
captcha-verification-in-chrome.html
Provides security, but doesn't solve the problem
Defense | That Work
 Only use POST to initiate the request
Checking HTTP Referer Header (Accept requests only from trusted
sources by verifying the referer header)
Use random server generated user-specific token in all form
submission
Re-Authentication – Password based (Attacker must know victim
password)
Defense | TOKENS
• Approach #4 : Tokens
• Tokens are random string of character
• Insert a random string into hidden field in EVERY form
• Make sure tokens is random
• Make sure there are no XSS vulnerability on your page! This is utmost
importance! (If attacker find XSS in your page then he/she can easily
have access to your tokens)
Defense | Approach #4
 Session Tokens
• Attacker only need one token
and can access entire site while
user is logged in
• Easy to implement
 Session Tokens stored in database
• A bit more difficult to implement
• Stores unique id, random token,
current time, user id
• Attacker can only access the
form the token was assigned to
(higher security!)
• Definitely recommended
CSRF | Defenses
• Secret Validation Token
• Referer Validation
• Custom HTTP Header
<input type=hidden value=23a3af01b>
Referrer: http://www.facebook.com/home.php
X-Requested-By: XMLHttpRequest
CSRF | Defenses | Example : LinkedIn
Defense | Overview
• Beware of State-modifying GET Request
• The primary defense for Cross-site Request Forgery is creating unique
requests that cannot be easily generated by attackers.
• This is usually accomplished via a nonce (a number used once).
• CAPTCHAs can also be used, as well as authentication prompts
How To bypass | Defenses
 Clickjacking
Bypassing the captcha
Checking Token Validation
Checking header Validation
Converting POST based requests to GET based requests.
Obstacles for Attacker
Need to know victim’s server
• Knowing victim’s server is not hard in a targeted attack or a commonly used
server. Example: Famous banks, famous site etc.
Need to get victim to browser to attacker’s site (pre-populated form)
• Getting victim to load the attacker’s form isn’t hard. (Phishing is often successful.)
Needs victim to log into server
• Victim might already be logged into a site or might have automatic log-in
enabled.
• Examples: Windows Integrated authentication
• Windows integrated authentication is very popular on intranets.
Highlights |News
Latest | News
• Pay pal Defaced by CSRF
Latest | News
• Facebook Hacked #CSRF
Link: http://pyx.io/blog/facebook-csrf-leading-to-full-account-takeover
Latest | News Blogger haced # CSRF
• Blogger hacked # CSRF
Latest | News
• W3 Total Cache's W3TotalFail Vulnerability That Leads to Full Deface
by CSRF
Latest | News
• Google Account Recovery Vulnerability + CSRF
• http://www.orenh.com/2013/11/google-account-recovery-
vulnerability.html?showComment=1420318818311#c5894478871478
949015
Demo |Video
Demo | Setup
bWAPP – VM machine
Burp suite-pro
Download link:-
http://sourceforge.net/projects/bwapp/
Questions ?
Thank You 
Comments | Feedback | Suggestions
• @Twitter : @nilesh_loganx
• Email: nilesh.s.sapariya@gmail.com
• Blog: http://shield4you.blogspot.in/
• LinkedIn: https://www.linkedin.com/pub/nilesh-sapariya/39/33/735
• Slideshare: http://www.slideshare.net/Nilesh_logan

Weitere ähnliche Inhalte

Was ist angesagt?

Cross Site Request Forgery
Cross Site Request ForgeryCross Site Request Forgery
Cross Site Request ForgeryTony Bibbs
 
Cross site scripting attacks and defenses
Cross site scripting attacks and defensesCross site scripting attacks and defenses
Cross site scripting attacks and defensesMohammed A. Imran
 
Top 10 Web Security Vulnerabilities
Top 10 Web Security VulnerabilitiesTop 10 Web Security Vulnerabilities
Top 10 Web Security VulnerabilitiesCarol McDonald
 
XSS Magic tricks
XSS Magic tricksXSS Magic tricks
XSS Magic tricksGarethHeyes
 
Pentesting RESTful webservices
Pentesting RESTful webservicesPentesting RESTful webservices
Pentesting RESTful webservicesMohammed A. Imran
 
OWASP Top 10 API Security Risks
OWASP Top 10 API Security RisksOWASP Top 10 API Security Risks
OWASP Top 10 API Security RisksIndusfacePvtLtd
 
Cross Site Scripting Defense Presentation
Cross Site Scripting Defense Presentation Cross Site Scripting Defense Presentation
Cross Site Scripting Defense Presentation Ikhade Maro Igbape
 
Hacking Web 2.0 - Defending Ajax and Web Services [HITB 2007 Dubai]
Hacking Web 2.0 - Defending Ajax and Web Services [HITB 2007 Dubai]Hacking Web 2.0 - Defending Ajax and Web Services [HITB 2007 Dubai]
Hacking Web 2.0 - Defending Ajax and Web Services [HITB 2007 Dubai]Shreeraj Shah
 
Penetration testing web application web application (in) security
Penetration testing web application web application (in) securityPenetration testing web application web application (in) security
Penetration testing web application web application (in) securityNahidul Kibria
 
SSRF For Bug Bounties
SSRF For Bug BountiesSSRF For Bug Bounties
SSRF For Bug BountiesOWASP Nagpur
 
How to Test for The OWASP Top Ten
 How to Test for The OWASP Top Ten How to Test for The OWASP Top Ten
How to Test for The OWASP Top TenSecurity Innovation
 
Cross Site Request Forgery Vulnerabilities
Cross Site Request Forgery VulnerabilitiesCross Site Request Forgery Vulnerabilities
Cross Site Request Forgery VulnerabilitiesMarco Morana
 
Cross site scripting
Cross site scriptingCross site scripting
Cross site scriptingkinish kumar
 
SSRF vs. Business-critical applications. XXE tunneling in SAP
SSRF vs. Business-critical applications. XXE tunneling in SAPSSRF vs. Business-critical applications. XXE tunneling in SAP
SSRF vs. Business-critical applications. XXE tunneling in SAPERPScan
 
Secure Coding 101 - OWASP University of Ottawa Workshop
Secure Coding 101 - OWASP University of Ottawa WorkshopSecure Coding 101 - OWASP University of Ottawa Workshop
Secure Coding 101 - OWASP University of Ottawa WorkshopPaul Ionescu
 
Cross site scripting (xss)
Cross site scripting (xss)Cross site scripting (xss)
Cross site scripting (xss)Manish Kumar
 

Was ist angesagt? (20)

Cross Site Request Forgery
Cross Site Request ForgeryCross Site Request Forgery
Cross Site Request Forgery
 
Cross site scripting
Cross site scriptingCross site scripting
Cross site scripting
 
Cross site scripting attacks and defenses
Cross site scripting attacks and defensesCross site scripting attacks and defenses
Cross site scripting attacks and defenses
 
Top 10 Web Security Vulnerabilities
Top 10 Web Security VulnerabilitiesTop 10 Web Security Vulnerabilities
Top 10 Web Security Vulnerabilities
 
XSS Magic tricks
XSS Magic tricksXSS Magic tricks
XSS Magic tricks
 
Cross site scripting XSS
Cross site scripting XSSCross site scripting XSS
Cross site scripting XSS
 
Pentesting RESTful webservices
Pentesting RESTful webservicesPentesting RESTful webservices
Pentesting RESTful webservices
 
OWASP Top 10 API Security Risks
OWASP Top 10 API Security RisksOWASP Top 10 API Security Risks
OWASP Top 10 API Security Risks
 
Pentesting ReST API
Pentesting ReST APIPentesting ReST API
Pentesting ReST API
 
Cross Site Scripting Defense Presentation
Cross Site Scripting Defense Presentation Cross Site Scripting Defense Presentation
Cross Site Scripting Defense Presentation
 
Hacking Web 2.0 - Defending Ajax and Web Services [HITB 2007 Dubai]
Hacking Web 2.0 - Defending Ajax and Web Services [HITB 2007 Dubai]Hacking Web 2.0 - Defending Ajax and Web Services [HITB 2007 Dubai]
Hacking Web 2.0 - Defending Ajax and Web Services [HITB 2007 Dubai]
 
Penetration testing web application web application (in) security
Penetration testing web application web application (in) securityPenetration testing web application web application (in) security
Penetration testing web application web application (in) security
 
SSRF For Bug Bounties
SSRF For Bug BountiesSSRF For Bug Bounties
SSRF For Bug Bounties
 
How to Test for The OWASP Top Ten
 How to Test for The OWASP Top Ten How to Test for The OWASP Top Ten
How to Test for The OWASP Top Ten
 
Cross Site Request Forgery Vulnerabilities
Cross Site Request Forgery VulnerabilitiesCross Site Request Forgery Vulnerabilities
Cross Site Request Forgery Vulnerabilities
 
Cross site scripting
Cross site scriptingCross site scripting
Cross site scripting
 
Deep dive into ssrf
Deep dive into ssrfDeep dive into ssrf
Deep dive into ssrf
 
SSRF vs. Business-critical applications. XXE tunneling in SAP
SSRF vs. Business-critical applications. XXE tunneling in SAPSSRF vs. Business-critical applications. XXE tunneling in SAP
SSRF vs. Business-critical applications. XXE tunneling in SAP
 
Secure Coding 101 - OWASP University of Ottawa Workshop
Secure Coding 101 - OWASP University of Ottawa WorkshopSecure Coding 101 - OWASP University of Ottawa Workshop
Secure Coding 101 - OWASP University of Ottawa Workshop
 
Cross site scripting (xss)
Cross site scripting (xss)Cross site scripting (xss)
Cross site scripting (xss)
 

Andere mochten auch

Understanding Cross-site Request Forgery
Understanding Cross-site Request ForgeryUnderstanding Cross-site Request Forgery
Understanding Cross-site Request ForgeryDaniel Miessler
 
Be Afraid. Be Very Afraid. Javascript security, XSS & CSRF
Be Afraid. Be Very Afraid. Javascript security, XSS & CSRFBe Afraid. Be Very Afraid. Javascript security, XSS & CSRF
Be Afraid. Be Very Afraid. Javascript security, XSS & CSRFMark Stanton
 
[Infosecworld 08 Orlando] CSRF: The Biggest Little Vulnerability on the Web
[Infosecworld 08 Orlando] CSRF: The Biggest Little Vulnerability on the Web [Infosecworld 08 Orlando] CSRF: The Biggest Little Vulnerability on the Web
[Infosecworld 08 Orlando] CSRF: The Biggest Little Vulnerability on the Web Shreeraj Shah
 
DEFCON 17 Presentation: CSRF - Yeah, It Still Works
DEFCON 17 Presentation: CSRF - Yeah, It Still WorksDEFCON 17 Presentation: CSRF - Yeah, It Still Works
DEFCON 17 Presentation: CSRF - Yeah, It Still WorksRuss McRee
 
Introduction to CSRF Attacks & Defense
Introduction to CSRF Attacks & DefenseIntroduction to CSRF Attacks & Defense
Introduction to CSRF Attacks & DefenseSurya Subhash
 
CSRF Attack and Its Prevention technique in ASP.NET MVC
CSRF Attack and Its Prevention technique in ASP.NET MVCCSRF Attack and Its Prevention technique in ASP.NET MVC
CSRF Attack and Its Prevention technique in ASP.NET MVCSuvash Shah
 
Ppt on sql injection
Ppt on sql injectionPpt on sql injection
Ppt on sql injectionashish20012
 
XSS and CSRF with HTML5
XSS and CSRF with HTML5XSS and CSRF with HTML5
XSS and CSRF with HTML5Shreeraj Shah
 
SQL injection: Not Only AND 1=1 (updated)
SQL injection: Not Only AND 1=1 (updated)SQL injection: Not Only AND 1=1 (updated)
SQL injection: Not Only AND 1=1 (updated)Bernardo Damele A. G.
 
Understanding CSRF
Understanding CSRFUnderstanding CSRF
Understanding CSRFPotato
 
Cross Site Request Forgery (CSRF) Scripting Explained
Cross Site Request Forgery (CSRF) Scripting ExplainedCross Site Request Forgery (CSRF) Scripting Explained
Cross Site Request Forgery (CSRF) Scripting ExplainedValency Networks
 
SQL Injections - A Powerpoint Presentation
SQL Injections - A Powerpoint PresentationSQL Injections - A Powerpoint Presentation
SQL Injections - A Powerpoint PresentationRapid Purple
 

Andere mochten auch (16)

CSRF Basics
CSRF BasicsCSRF Basics
CSRF Basics
 
Understanding Cross-site Request Forgery
Understanding Cross-site Request ForgeryUnderstanding Cross-site Request Forgery
Understanding Cross-site Request Forgery
 
Be Afraid. Be Very Afraid. Javascript security, XSS & CSRF
Be Afraid. Be Very Afraid. Javascript security, XSS & CSRFBe Afraid. Be Very Afraid. Javascript security, XSS & CSRF
Be Afraid. Be Very Afraid. Javascript security, XSS & CSRF
 
[Infosecworld 08 Orlando] CSRF: The Biggest Little Vulnerability on the Web
[Infosecworld 08 Orlando] CSRF: The Biggest Little Vulnerability on the Web [Infosecworld 08 Orlando] CSRF: The Biggest Little Vulnerability on the Web
[Infosecworld 08 Orlando] CSRF: The Biggest Little Vulnerability on the Web
 
DEFCON 17 Presentation: CSRF - Yeah, It Still Works
DEFCON 17 Presentation: CSRF - Yeah, It Still WorksDEFCON 17 Presentation: CSRF - Yeah, It Still Works
DEFCON 17 Presentation: CSRF - Yeah, It Still Works
 
Introduction to CSRF Attacks & Defense
Introduction to CSRF Attacks & DefenseIntroduction to CSRF Attacks & Defense
Introduction to CSRF Attacks & Defense
 
CSRF Attack and Its Prevention technique in ASP.NET MVC
CSRF Attack and Its Prevention technique in ASP.NET MVCCSRF Attack and Its Prevention technique in ASP.NET MVC
CSRF Attack and Its Prevention technique in ASP.NET MVC
 
Sql injection
Sql injectionSql injection
Sql injection
 
SQL Injection
SQL InjectionSQL Injection
SQL Injection
 
Ppt on sql injection
Ppt on sql injectionPpt on sql injection
Ppt on sql injection
 
XSS and CSRF with HTML5
XSS and CSRF with HTML5XSS and CSRF with HTML5
XSS and CSRF with HTML5
 
SQL injection: Not Only AND 1=1 (updated)
SQL injection: Not Only AND 1=1 (updated)SQL injection: Not Only AND 1=1 (updated)
SQL injection: Not Only AND 1=1 (updated)
 
Sql Injection Myths and Fallacies
Sql Injection Myths and FallaciesSql Injection Myths and Fallacies
Sql Injection Myths and Fallacies
 
Understanding CSRF
Understanding CSRFUnderstanding CSRF
Understanding CSRF
 
Cross Site Request Forgery (CSRF) Scripting Explained
Cross Site Request Forgery (CSRF) Scripting ExplainedCross Site Request Forgery (CSRF) Scripting Explained
Cross Site Request Forgery (CSRF) Scripting Explained
 
SQL Injections - A Powerpoint Presentation
SQL Injections - A Powerpoint PresentationSQL Injections - A Powerpoint Presentation
SQL Injections - A Powerpoint Presentation
 

Ähnlich wie Its all about CSRF - null Mumbai Meet 10 January 2015 Null/OWASP Chapter

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
 
Web application security part 01
Web application security part 01Web application security part 01
Web application security part 01G Prachi
 
Secure Form Processing and Protection - Sunshine PHP 2015
Secure Form Processing and Protection - Sunshine PHP 2015Secure Form Processing and Protection - Sunshine PHP 2015
Secure Form Processing and Protection - Sunshine PHP 2015Joe Ferguson
 
Logical Attacks(Vulnerability Research)
Logical Attacks(Vulnerability Research)Logical Attacks(Vulnerability Research)
Logical Attacks(Vulnerability Research)Ajay Negi
 
OWASP TOP 10 by Team xbios
OWASP TOP 10  by Team xbiosOWASP TOP 10  by Team xbios
OWASP TOP 10 by Team xbiosVi Vek
 
Advanced Client Side Exploitation Using BeEF
Advanced Client Side Exploitation Using BeEFAdvanced Client Side Exploitation Using BeEF
Advanced Client Side Exploitation Using BeEF1N3
 
Secure Coding BSSN Semarang Material.pdf
Secure Coding BSSN Semarang Material.pdfSecure Coding BSSN Semarang Material.pdf
Secure Coding BSSN Semarang Material.pdfnanangAris1
 
Owasp top 10 vulnerabilities 2013
Owasp top 10 vulnerabilities   2013Owasp top 10 vulnerabilities   2013
Owasp top 10 vulnerabilities 2013Vishrut Sharma
 
Security testing presentation
Security testing presentationSecurity testing presentation
Security testing presentationConfiz
 
CNIT 129S: 13: Attacking Users: Other Techniques (Part 1 of 2)
CNIT 129S: 13: Attacking Users: Other Techniques (Part 1 of 2)CNIT 129S: 13: Attacking Users: Other Techniques (Part 1 of 2)
CNIT 129S: 13: Attacking Users: Other Techniques (Part 1 of 2)Sam Bowne
 
Lets Make our Web Applications Secure
Lets Make our Web Applications SecureLets Make our Web Applications Secure
Lets Make our Web Applications SecureAryashree Pritikrishna
 
Watch How the Giants Fall
Watch How the Giants FallWatch How the Giants Fall
Watch How the Giants Falljtmelton
 
Mitigating CSRF with two lines of codes
Mitigating CSRF with two lines of codesMitigating CSRF with two lines of codes
Mitigating CSRF with two lines of codesMinhaz A V
 
Andrews whitakrer lecture18-security.ppt
Andrews whitakrer lecture18-security.pptAndrews whitakrer lecture18-security.ppt
Andrews whitakrer lecture18-security.pptSilverGold16
 
A4 A K S H A Y B H A R D W A J
A4    A K S H A Y  B H A R D W A JA4    A K S H A Y  B H A R D W A J
A4 A K S H A Y B H A R D W A Jbhardwajakshay
 
Cyber security 2.pptx
Cyber security 2.pptxCyber security 2.pptx
Cyber security 2.pptxNotSure11
 
OWASPTop 10
OWASPTop 10OWASPTop 10
OWASPTop 10InnoTech
 
OWASP top 10-2013
OWASP top 10-2013OWASP top 10-2013
OWASP top 10-2013tmd800
 

Ähnlich wie Its all about CSRF - null Mumbai Meet 10 January 2015 Null/OWASP Chapter (20)

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
 
Web application security part 01
Web application security part 01Web application security part 01
Web application security part 01
 
Secure Form Processing and Protection - Sunshine PHP 2015
Secure Form Processing and Protection - Sunshine PHP 2015Secure Form Processing and Protection - Sunshine PHP 2015
Secure Form Processing and Protection - Sunshine PHP 2015
 
Vulnerabilities in Web Applications
Vulnerabilities in Web ApplicationsVulnerabilities in Web Applications
Vulnerabilities in Web Applications
 
Logical Attacks(Vulnerability Research)
Logical Attacks(Vulnerability Research)Logical Attacks(Vulnerability Research)
Logical Attacks(Vulnerability Research)
 
OWASP TOP 10 by Team xbios
OWASP TOP 10  by Team xbiosOWASP TOP 10  by Team xbios
OWASP TOP 10 by Team xbios
 
CSRF
CSRFCSRF
CSRF
 
Advanced Client Side Exploitation Using BeEF
Advanced Client Side Exploitation Using BeEFAdvanced Client Side Exploitation Using BeEF
Advanced Client Side Exploitation Using BeEF
 
Secure Coding BSSN Semarang Material.pdf
Secure Coding BSSN Semarang Material.pdfSecure Coding BSSN Semarang Material.pdf
Secure Coding BSSN Semarang Material.pdf
 
Owasp top 10 vulnerabilities 2013
Owasp top 10 vulnerabilities   2013Owasp top 10 vulnerabilities   2013
Owasp top 10 vulnerabilities 2013
 
Security testing presentation
Security testing presentationSecurity testing presentation
Security testing presentation
 
CNIT 129S: 13: Attacking Users: Other Techniques (Part 1 of 2)
CNIT 129S: 13: Attacking Users: Other Techniques (Part 1 of 2)CNIT 129S: 13: Attacking Users: Other Techniques (Part 1 of 2)
CNIT 129S: 13: Attacking Users: Other Techniques (Part 1 of 2)
 
Lets Make our Web Applications Secure
Lets Make our Web Applications SecureLets Make our Web Applications Secure
Lets Make our Web Applications Secure
 
Watch How the Giants Fall
Watch How the Giants FallWatch How the Giants Fall
Watch How the Giants Fall
 
Mitigating CSRF with two lines of codes
Mitigating CSRF with two lines of codesMitigating CSRF with two lines of codes
Mitigating CSRF with two lines of codes
 
Andrews whitakrer lecture18-security.ppt
Andrews whitakrer lecture18-security.pptAndrews whitakrer lecture18-security.ppt
Andrews whitakrer lecture18-security.ppt
 
A4 A K S H A Y B H A R D W A J
A4    A K S H A Y  B H A R D W A JA4    A K S H A Y  B H A R D W A J
A4 A K S H A Y B H A R D W A J
 
Cyber security 2.pptx
Cyber security 2.pptxCyber security 2.pptx
Cyber security 2.pptx
 
OWASPTop 10
OWASPTop 10OWASPTop 10
OWASPTop 10
 
OWASP top 10-2013
OWASP top 10-2013OWASP top 10-2013
OWASP top 10-2013
 

KĂźrzlich hochgeladen

Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century educationjfdjdjcjdnsjd
 

KĂźrzlich hochgeladen (20)

Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 

Its all about CSRF - null Mumbai Meet 10 January 2015 Null/OWASP Chapter

  • 1. Its All about CSRF Nilesh Sapariya Security Analyst | CEH v8 | Blogger
  • 2. Who Am I ?  Nilesh Sapariya  Security Analyst  3years of Experience in information security  http://shield4you.blogspot.in/  @nilesh_loganx
  • 3. Agenda What is CSRF ? Problem Basics Validation Defenses  News Demo
  • 4. What is CSRF ? • Wiki Says :- http://en.wikipedia.org/wiki/Cross-site_request_forgery
  • 5. CSRF | Other names of CSRF • CSRF (Sea Surf) • XSRF • Session Riding
  • 7. Problem | Overview CSRF is an OWASP Top 10 vulnerability but it’s not as well understood as many others Many struggle with how to validate it Customers have difficulty explaining to management why it’s important to fix We need to be well-versed in the main points to help the customer with their narrative to management
  • 8. Problem | Overview  Undetectable by automated scanners  The attack is silent  Easily mountable  Combines with XSS or HTML injection(stored)
  • 9.
  • 11. Basic | Description “Cross-site Request Forgery is a vulnerability in a website that allows attackers to force victims to perform security-sensitive actions on that site without their knowledge.”
  • 12. What do we mean by “sensitive actions”? How do attackers “force” victims to perform them? And how do the victims not know it’s happening? Basic | Questions
  • 13. Basic | Description 1. The target is a sensitive operation in the application, e.g. UpdateSalary.aspx, that’s able to be tricked into executing. 2. Victims can be forced to execute this action through any method that gets them to load a resource automatically, e.g. img tag, script tag, onload form submit, etc. Note: credentials go with all requests! 3. These happen unknowingly because the actions are performed by the victim’s browser, not by the victim explicitly.
  • 16. Anatomy of CSRF Attack • Step 1: Attacker hosts web pages with pre-populated HTML form data. • Step 2: Victim browses to attacker’s HTML form. • Step 3: Page automatically submits pre-populated form data to a site where victim has access (No verification done by server as browser is performing request by checking cookies) • Step 4: Site Authenticates request (with attacker’s form data) as coming from victim Result : Attacker’s form data is accepted by server since it was sent from legitimate user.
  • 18. Validation | Criteria • If you can’t change something using your CSRF vulnerability, then you don’t have one. • Examples of state changes: - Updating an account (new password?) - Transferring funds - Changing the role of a user - Ordering an item - Adding an administrator to a system
  • 19. Validation | Criteria • The three components again… 1. Can you change state using it? 2. Is the function sensitive? 3. Is the request non-unique?  This is the core of the validation process  Any customer asking you to validate a CSRF vulnerability should hear and learn these same concepts
  • 20. Validation | Manual Validation • How to manually verify CSRF: 1. Configure a proxy to observe traffic 2. Log in to the site with the issue in question 3. Perform the target functionality normally, through the browser 4. Observe the request, looking for state change, sensitivity, and uniqueness 5. Look for any additional controls that could stop CSRF, such as CAPTCHA or additional authentication 6. Log out and log in with a different set of credentials 7. Submit the initial request from the new context, and see if it is successful 8. If the action is performed without issue, it is most likely CSRF
  • 22. Misconception | #1 CSRF = XSS ? • CSRF = XSS ? • Fact : CSRF and XSS are completely different attack vector XSS • Attacker insert text (for example JavaScript code) onto website by sending the victim a specially prepared link • <script>alert(‘nilesh’)</script> CSRF • Victim sends attacker’s request to the webserver without knowing about it • http://www.example.com/admin/deleteuser.php?id=xxx
  • 23. Misconception | #2 Preventing XSS stops CSRF ? • Preventing XSS stops CSRF ? • XSS makes CSRF easier, but it isn’t required
  • 24. Basics | Trust Abuse • Both XSS and CSRF are possible due to abused trust relationships: In XSS the browser will run malicious JavaScript because it was served from a site (origin) it trusts. In CSRF the server will perform a sensitive action because it was sent by a client that it trusts.
  • 26. Defense | That Don’t Work  Requiring multi-step transactions - CSRF attack can perform each step in order  CAPTCHAs Protect forms against automated submission Can by bypassed using automated tool How to bypass captcha : http://shield4you.blogspot.in/2014/10/bypass- captcha-verification-in-chrome.html Provides security, but doesn't solve the problem
  • 27. Defense | That Work  Only use POST to initiate the request Checking HTTP Referer Header (Accept requests only from trusted sources by verifying the referer header) Use random server generated user-specific token in all form submission Re-Authentication – Password based (Attacker must know victim password)
  • 28. Defense | TOKENS • Approach #4 : Tokens • Tokens are random string of character • Insert a random string into hidden field in EVERY form • Make sure tokens is random • Make sure there are no XSS vulnerability on your page! This is utmost importance! (If attacker find XSS in your page then he/she can easily have access to your tokens)
  • 29. Defense | Approach #4  Session Tokens • Attacker only need one token and can access entire site while user is logged in • Easy to implement  Session Tokens stored in database • A bit more difficult to implement • Stores unique id, random token, current time, user id • Attacker can only access the form the token was assigned to (higher security!) • Definitely recommended
  • 30. CSRF | Defenses • Secret Validation Token • Referer Validation • Custom HTTP Header <input type=hidden value=23a3af01b> Referrer: http://www.facebook.com/home.php X-Requested-By: XMLHttpRequest
  • 31. CSRF | Defenses | Example : LinkedIn
  • 32. Defense | Overview • Beware of State-modifying GET Request • The primary defense for Cross-site Request Forgery is creating unique requests that cannot be easily generated by attackers. • This is usually accomplished via a nonce (a number used once). • CAPTCHAs can also be used, as well as authentication prompts
  • 33. How To bypass | Defenses  Clickjacking Bypassing the captcha Checking Token Validation Checking header Validation Converting POST based requests to GET based requests.
  • 34. Obstacles for Attacker Need to know victim’s server • Knowing victim’s server is not hard in a targeted attack or a commonly used server. Example: Famous banks, famous site etc. Need to get victim to browser to attacker’s site (pre-populated form) • Getting victim to load the attacker’s form isn’t hard. (Phishing is often successful.) Needs victim to log into server • Victim might already be logged into a site or might have automatic log-in enabled. • Examples: Windows Integrated authentication • Windows integrated authentication is very popular on intranets.
  • 36. Latest | News • Pay pal Defaced by CSRF
  • 37. Latest | News • Facebook Hacked #CSRF Link: http://pyx.io/blog/facebook-csrf-leading-to-full-account-takeover
  • 38. Latest | News Blogger haced # CSRF • Blogger hacked # CSRF
  • 39. Latest | News • W3 Total Cache's W3TotalFail Vulnerability That Leads to Full Deface by CSRF
  • 40. Latest | News • Google Account Recovery Vulnerability + CSRF • http://www.orenh.com/2013/11/google-account-recovery- vulnerability.html?showComment=1420318818311#c5894478871478 949015
  • 42.
  • 43. Demo | Setup bWAPP – VM machine Burp suite-pro Download link:- http://sourceforge.net/projects/bwapp/
  • 44.
  • 46. Thank You  Comments | Feedback | Suggestions • @Twitter : @nilesh_loganx • Email: nilesh.s.sapariya@gmail.com • Blog: http://shield4you.blogspot.in/ • LinkedIn: https://www.linkedin.com/pub/nilesh-sapariya/39/33/735 • Slideshare: http://www.slideshare.net/Nilesh_logan