SlideShare una empresa de Scribd logo
1 de 21
Broken Authentication and
             Session Management



                     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
INTRODUCTION

Proper authentication and session management
 is critical to web application security.
Flaws in this area most frequently involve the
 failure to protect credentials and session tokens
 through their lifecycle. These flaws can lead to
 the hijacking of user or administrative accounts,
 undermine authorization and accountability
 controls, and cause privacy violations. 



                                         OWASP       2
Account credentials and sessions tokens are often not
  properly protected
 A third can access to one's account
 Attacker compromise password, keys or authentication token
  Risks
 Undermine authorization and accountability controls
 Cause privacy violation
 Identity Theft
  Method of attack: use weaknesses in authentication
  mechanism
 Logout
 Password Management
 Timeout
 Remember me
 Secret question and account update
                                                  OWASP        3
WEB APPLICATION SECURITY




                           OWASP   4
Authentication
 User authentication on the web typically involves the use
  of a : UserID and Password.
 Stronger methods of authentication (commercially)
   Software and hardware based cryptographic tokens or
  biometrics, but such mechanisms are cost prohibitive for
  most web applications.
 A wide array of account and session management flaws
  can result in the compromise of user or system
  administration accounts.
 Development teams frequently underestimate the
  complexity of designing an authentication and session
  management scheme that adequately protects
  credentials in all aspects of the site.
                                                 OWASP        5
What are sessions?

Part of the art of session management.
Storing of data on the server for later.
Need a session ID – Where to store it?
  Cookies
  Query Strings




                                            OWASP   6
Example Scenario

Login page with UserID/Password.
Another page with “Welcome, user”
How does 2nd page know user is logged in?
On login.aspx, we write a session object.
 Session["Username"] = txtUsername.Text;


And on Page2.aspx, we read the session object.
  username = (Session["Username"] ??
  "Guest").ToString();


                                           OWASP   7
Cookies

The cookie will have

 ASP.NET_SessionId:33irkjdmslkjeior9324jkdkj2039


And if we go cookieless, the url will look like:

 http://tic.com/(S(33irkjdmslkjeior932))/Page2.aspx



If the attacker can get the cookie or cookieless
 URL, he can impersonate a logged-in browser.

                                            OWASP     8
Environments Affected

All known
 web servers,
 application servers and
 web application environments


- are susceptible to broken authentication and
  session management issues.




                                      OWASP      9
How attackers do it

Hackers will intercept the session ID, either from
 the cookie or the request URL.
They then replicate that session ID themselves.
URLs are easy; they simply type it into their own
 browser.
Cookies are tougher, but if they can write a
 cookie or inject the cookie into the HTTP
 Request header, they can trick the server.



                                          OWASP       10
How to Determine If You Are Vulnerable
 Both code review and penetration testing can be used to
  diagnose authentication and session management
  problems.
 Carefully review each aspect of your authentication
  mechanisms to ensure that user's credentials are
  protected at all times, while they are at rest (e.g., on
  disk) and while they are in transit (e.g., during login).
 Review every available mechanism for changing a user's
  credentials to ensure that only an authorized user can
  change them.
 Review your session management mechanism to ensure
  that session identifiers are always protected and are
  used in such a way as to minimize the likelihood of
  accidental or hostile exposure.
                                                 OWASP        11
Protection

Avoid cookieless sessions
Avoid homegrown authentication schemes
Look into IP checking
Double-check passwords on certain activities
Use SSL (Security Socket Layer)
Expire sessions early and often




                                        OWASP   12
Avoiding cookieless sessions


In web.config, set cookieless=“False”
This doesn’t completely solve the problem
  but it makes it a whole lot tougher to crack.

   <sessionState cookieless=“false" />




                                           OWASP   13
Add IP checking

Store the original IP add in session.
Add subsequent checks; if the IP from the HTTP
 header is different, decline to show anything.
 You can even delete the session itself.
If the attacker is behind the same firewall, the
 public IP may be the same.
Similarly, the legitimate surfer’s ISP may
 dynamically change the IP address during the
 session.

                                        OWASP       14
Use SSL with sessions

When using SSL, all communications (including
 cookies) are encrypted.
Makes it nearly impossible to directly lift the
 cookies.
Still can be stolen via:
  Physical access to cookie store.
So other methods are still needed




                                        OWASP      15
Expire sessions early and often

You can’t hijack what isn’t there!
 Get rid of sessions quickly.
  Set the timeout as small as possible.

   <system.web>
     <sessionState timeout= "8" />
   </system.web>

  Have a logout button.

   Session.Abandon()




                                           OWASP   16
Preventing authentication flaws

- careful planning so important considerations are
   (conclusion):

  • Implementing a decent audit logging for
  authentication and authorization controls.
  Questions?: 
 Who logged on? 
 When? 
 From where? 
 What transactions did the user start? 
 What data was accessed? 
                                               OWASP   17
Solution
 • Only use the inbuilt session management mechanism.
 • Do not accept new, preset or invalid session identifiers from
 the URL or in the request.
 • Limit or rid your code of custom cookies for authentication or
 session management purposes, such as “remember me” Use
 the session management of the application server. 
 • Use a single authentication mechanism with appropriate
 strength and number of factors.
 • Implement a strong password policy when allowing
 passwords.
 • Don not allow the login process to start from an unencrypted
 page.
 • Ensure that every page has a logout link. Logout should
 destroy all server side session state and client side cookies.

                                                     OWASP      18
• Use a timeout period that automatically logs out an
inactive session as per the value of the data being
protected (shorter is always better)
• Use only strong ancillary authentication functions
(questions and answers, password reset)
• Require the user to enter the old password when the user
changes to a new password 
• Do not rely upon spoofable credentials as the sole form of
authentication, such as IP addresses or address range
masks, DNS or reverse DNS lookups, referrer headers or
similar…
• Be careful of sending secrets to registered e-mail
addresses as a mechanism for password resets.



                                                 OWASP         19
Resources

1. OWASP
   http://www.owasp.org/


2. Top 10 Web Application Security Vunerabilities
   http://www.upenn.edu/computing/security/swat/SWAT_Top_Ten_A3.php


3. CodeIdol
   http://codeidol.com/community/security/a3-broken-authentication-and-
   session-management/22604/




                                                              OWASP       20
Diskusija




            OWASP   21

Más contenido relacionado

La actualidad más candente

Owasp Top 10 And Security Flaw Root Causes
Owasp Top 10 And Security Flaw Root CausesOwasp Top 10 And Security Flaw Root Causes
Owasp Top 10 And Security Flaw Root Causes
Marco Morana
 
PCI security requirements secure coding and code review 2014
PCI security requirements   secure coding and code review 2014PCI security requirements   secure coding and code review 2014
PCI security requirements secure coding and code review 2014
Haitham Raik
 

La actualidad más candente (20)

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 Top 10 And Security Flaw Root Causes
Owasp Top 10 And Security Flaw Root CausesOwasp Top 10 And Security Flaw Root Causes
Owasp Top 10 And Security Flaw Root Causes
 
t r
t rt r
t r
 
OWASP Top 10 - 2017 Top 10 web application security risks
OWASP Top 10 - 2017 Top 10 web application security risksOWASP Top 10 - 2017 Top 10 web application security risks
OWASP Top 10 - 2017 Top 10 web application security risks
 
A5-Security misconfiguration-OWASP 2013
A5-Security misconfiguration-OWASP 2013   A5-Security misconfiguration-OWASP 2013
A5-Security misconfiguration-OWASP 2013
 
Owasp top 10 2017
Owasp top 10 2017Owasp top 10 2017
Owasp top 10 2017
 
PCI security requirements secure coding and code review 2014
PCI security requirements   secure coding and code review 2014PCI security requirements   secure coding and code review 2014
PCI security requirements secure coding and code review 2014
 
Introduction to Web Application Penetration Testing
Introduction to Web Application Penetration TestingIntroduction to Web Application Penetration Testing
Introduction to Web Application Penetration Testing
 
Security misconfiguration
Security misconfigurationSecurity misconfiguration
Security misconfiguration
 
OWASP TOP TEN 2017 RC1
OWASP TOP TEN 2017 RC1OWASP TOP TEN 2017 RC1
OWASP TOP TEN 2017 RC1
 
Oh, WASP! Security Essentials for Web Apps
Oh, WASP! Security Essentials for Web AppsOh, WASP! Security Essentials for Web Apps
Oh, WASP! Security Essentials for Web Apps
 
OWASP Top10 2010
OWASP Top10 2010OWASP Top10 2010
OWASP Top10 2010
 
OWASP Top 10 - The Ten Most Critical Web Application Security Risks
OWASP Top 10 - The Ten Most Critical Web Application Security RisksOWASP Top 10 - The Ten Most Critical Web Application Security Risks
OWASP Top 10 - The Ten Most Critical Web Application Security Risks
 
Web Application Vulnerabilities
Web Application VulnerabilitiesWeb Application Vulnerabilities
Web Application Vulnerabilities
 
OWASP Top Ten 2017
OWASP Top Ten 2017OWASP Top Ten 2017
OWASP Top Ten 2017
 
The New OWASP Top Ten: Let's Cut to the Chase
The New OWASP Top Ten: Let's Cut to the ChaseThe New OWASP Top Ten: Let's Cut to the Chase
The New OWASP Top Ten: Let's Cut to the Chase
 
Introduction to security testing
Introduction to security testingIntroduction to security testing
Introduction to security testing
 
Attques web
Attques webAttques web
Attques web
 
Web application Security tools
Web application Security toolsWeb application Security tools
Web application Security tools
 
Web application security
Web application securityWeb application security
Web application security
 

Similar a OWASP Serbia - A3 broken authentication and session management

Anti (anti crawling) techniques
Anti (anti crawling) techniquesAnti (anti crawling) techniques
Anti (anti crawling) techniques
Ayman Hussein
 
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
OWASP Khartoum
 
Security Ninjas: An Open Source Application Security Training Program
Security Ninjas: An Open Source Application Security Training ProgramSecurity Ninjas: An Open Source Application Security Training Program
Security Ninjas: An Open Source Application Security Training Program
OpenDNS
 
OWASP Top 10 Security Vulnerabilities, and Securing them with Oracle ADF
OWASP Top 10 Security Vulnerabilities, and Securing them with Oracle ADFOWASP Top 10 Security Vulnerabilities, and Securing them with Oracle ADF
OWASP Top 10 Security Vulnerabilities, and Securing them with Oracle ADF
Brian Huff
 

Similar a OWASP Serbia - A3 broken authentication and session management (20)

Proxy Caches and Web Application Security
Proxy Caches and Web Application SecurityProxy Caches and Web Application Security
Proxy Caches and Web Application Security
 
Owasp top 10 2013
Owasp top 10 2013Owasp top 10 2013
Owasp top 10 2013
 
Owasp first5 presentation
Owasp first5 presentationOwasp first5 presentation
Owasp first5 presentation
 
Owasp first5 presentation
Owasp first5 presentationOwasp first5 presentation
Owasp first5 presentation
 
Shields up - improving web application security
Shields up - improving web application securityShields up - improving web application security
Shields up - improving web application security
 
2013 OWASP Top 10
2013 OWASP Top 102013 OWASP Top 10
2013 OWASP Top 10
 
The OWASP Top 10 Most Critical Web App Security Risks - TdT@Cluj #20
The OWASP Top 10 Most Critical Web App Security Risks - TdT@Cluj #20The OWASP Top 10 Most Critical Web App Security Risks - TdT@Cluj #20
The OWASP Top 10 Most Critical Web App Security Risks - TdT@Cluj #20
 
Anti (anti crawling) techniques
Anti (anti crawling) techniquesAnti (anti crawling) techniques
Anti (anti crawling) techniques
 
Owasp top 10_openwest_2019
Owasp top 10_openwest_2019Owasp top 10_openwest_2019
Owasp top 10_openwest_2019
 
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
 
Owasp Top 10 2017
Owasp Top 10 2017Owasp Top 10 2017
Owasp Top 10 2017
 
Sql server security in an insecure world
Sql server security in an insecure worldSql server security in an insecure world
Sql server security in an insecure world
 
OWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptxOWASP_Top_Ten_Proactive_Controls_v2.pptx
OWASP_Top_Ten_Proactive_Controls_v2.pptx
 
Security Ninjas: An Open Source Application Security Training Program
Security Ninjas: An Open Source Application Security Training ProgramSecurity Ninjas: An Open Source Application Security Training Program
Security Ninjas: An Open Source Application Security Training Program
 
Don't get stung - an introduction to the OWASP Top 10
Don't get stung - an introduction to the OWASP Top 10Don't get stung - an introduction to the OWASP Top 10
Don't get stung - an introduction to the OWASP Top 10
 
Presentation on Top 10 Vulnerabilities in Web Application
Presentation on Top 10 Vulnerabilities in Web ApplicationPresentation on Top 10 Vulnerabilities in Web Application
Presentation on Top 10 Vulnerabilities in Web Application
 
Secure Code Warrior - Authentication
Secure Code Warrior - AuthenticationSecure Code Warrior - Authentication
Secure Code Warrior - Authentication
 
Web application security (eng)
Web application security (eng)Web application security (eng)
Web application security (eng)
 
OWASP Top 10 Security Vulnerabilities, and Securing them with Oracle ADF
OWASP Top 10 Security Vulnerabilities, and Securing them with Oracle ADFOWASP Top 10 Security Vulnerabilities, and Securing them with Oracle ADF
OWASP Top 10 Security Vulnerabilities, and Securing them with Oracle ADF
 
Become a Security Ninja
Become a Security NinjaBecome a Security Ninja
Become a Security Ninja
 

Más de Nikola Milosevic

Más de 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
 

Último

1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 

Último (20)

2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
Role Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptxRole Of Transgenic Animal In Target Validation-1.pptx
Role Of Transgenic Animal In Target Validation-1.pptx
 
Unit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptxUnit-V; Pricing (Pharma Marketing Management).pptx
Unit-V; Pricing (Pharma Marketing Management).pptx
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
Ecological Succession. ( ECOSYSTEM, B. Pharmacy, 1st Year, Sem-II, Environmen...
 
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-IIFood Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
Food Chain and Food Web (Ecosystem) EVS, B. Pharmacy 1st Year, Sem-II
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 

OWASP Serbia - A3 broken authentication and session management

  • 1. Broken Authentication and Session Management 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. INTRODUCTION Proper authentication and session management is critical to web application security. Flaws in this area most frequently involve the failure to protect credentials and session tokens through their lifecycle. These flaws can lead to the hijacking of user or administrative accounts, undermine authorization and accountability controls, and cause privacy violations.  OWASP 2
  • 3. Account credentials and sessions tokens are often not properly protected  A third can access to one's account  Attacker compromise password, keys or authentication token Risks  Undermine authorization and accountability controls  Cause privacy violation  Identity Theft Method of attack: use weaknesses in authentication mechanism  Logout  Password Management  Timeout  Remember me  Secret question and account update OWASP 3
  • 5. Authentication  User authentication on the web typically involves the use of a : UserID and Password.  Stronger methods of authentication (commercially) Software and hardware based cryptographic tokens or biometrics, but such mechanisms are cost prohibitive for most web applications.  A wide array of account and session management flaws can result in the compromise of user or system administration accounts.  Development teams frequently underestimate the complexity of designing an authentication and session management scheme that adequately protects credentials in all aspects of the site. OWASP 5
  • 6. What are sessions? Part of the art of session management. Storing of data on the server for later. Need a session ID – Where to store it? Cookies Query Strings OWASP 6
  • 7. Example Scenario Login page with UserID/Password. Another page with “Welcome, user” How does 2nd page know user is logged in? On login.aspx, we write a session object. Session["Username"] = txtUsername.Text; And on Page2.aspx, we read the session object. username = (Session["Username"] ?? "Guest").ToString(); OWASP 7
  • 8. Cookies The cookie will have ASP.NET_SessionId:33irkjdmslkjeior9324jkdkj2039 And if we go cookieless, the url will look like: http://tic.com/(S(33irkjdmslkjeior932))/Page2.aspx If the attacker can get the cookie or cookieless URL, he can impersonate a logged-in browser. OWASP 8
  • 9. Environments Affected All known  web servers,  application servers and  web application environments - are susceptible to broken authentication and session management issues. OWASP 9
  • 10. How attackers do it Hackers will intercept the session ID, either from the cookie or the request URL. They then replicate that session ID themselves. URLs are easy; they simply type it into their own browser. Cookies are tougher, but if they can write a cookie or inject the cookie into the HTTP Request header, they can trick the server. OWASP 10
  • 11. How to Determine If You Are Vulnerable  Both code review and penetration testing can be used to diagnose authentication and session management problems.  Carefully review each aspect of your authentication mechanisms to ensure that user's credentials are protected at all times, while they are at rest (e.g., on disk) and while they are in transit (e.g., during login).  Review every available mechanism for changing a user's credentials to ensure that only an authorized user can change them.  Review your session management mechanism to ensure that session identifiers are always protected and are used in such a way as to minimize the likelihood of accidental or hostile exposure. OWASP 11
  • 12. Protection Avoid cookieless sessions Avoid homegrown authentication schemes Look into IP checking Double-check passwords on certain activities Use SSL (Security Socket Layer) Expire sessions early and often OWASP 12
  • 13. Avoiding cookieless sessions In web.config, set cookieless=“False” This doesn’t completely solve the problem but it makes it a whole lot tougher to crack. <sessionState cookieless=“false" /> OWASP 13
  • 14. Add IP checking Store the original IP add in session. Add subsequent checks; if the IP from the HTTP header is different, decline to show anything.  You can even delete the session itself. If the attacker is behind the same firewall, the public IP may be the same. Similarly, the legitimate surfer’s ISP may dynamically change the IP address during the session. OWASP 14
  • 15. Use SSL with sessions When using SSL, all communications (including cookies) are encrypted. Makes it nearly impossible to directly lift the cookies. Still can be stolen via: Physical access to cookie store. So other methods are still needed OWASP 15
  • 16. Expire sessions early and often You can’t hijack what isn’t there! Get rid of sessions quickly. Set the timeout as small as possible. <system.web> <sessionState timeout= "8" /> </system.web> Have a logout button. Session.Abandon() OWASP 16
  • 17. Preventing authentication flaws - careful planning so important considerations are (conclusion): • Implementing a decent audit logging for authentication and authorization controls. Questions?:   Who logged on?   When?   From where?   What transactions did the user start?   What data was accessed?  OWASP 17
  • 18. Solution • Only use the inbuilt session management mechanism. • Do not accept new, preset or invalid session identifiers from the URL or in the request. • Limit or rid your code of custom cookies for authentication or session management purposes, such as “remember me” Use the session management of the application server.  • Use a single authentication mechanism with appropriate strength and number of factors. • Implement a strong password policy when allowing passwords. • Don not allow the login process to start from an unencrypted page. • Ensure that every page has a logout link. Logout should destroy all server side session state and client side cookies. OWASP 18
  • 19. • Use a timeout period that automatically logs out an inactive session as per the value of the data being protected (shorter is always better) • Use only strong ancillary authentication functions (questions and answers, password reset) • Require the user to enter the old password when the user changes to a new password  • Do not rely upon spoofable credentials as the sole form of authentication, such as IP addresses or address range masks, DNS or reverse DNS lookups, referrer headers or similar… • Be careful of sending secrets to registered e-mail addresses as a mechanism for password resets. OWASP 19
  • 20. Resources 1. OWASP http://www.owasp.org/ 2. Top 10 Web Application Security Vunerabilities http://www.upenn.edu/computing/security/swat/SWAT_Top_Ten_A3.php 3. CodeIdol http://codeidol.com/community/security/a3-broken-authentication-and- session-management/22604/ OWASP 20
  • 21. Diskusija OWASP 21