Difference between revisions of "Top 10 2010-A3-Broken Authentication and Session Management"

From OWASP
Jump to: navigation, search
 
(19 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Top_10_2010:TopTemplate|usenext=NextLink|next=-Broken Authentication and Session Management|useprev=PrevLink|prev=-Cross Site Request Forgery|usemain=MainLink|main=}}  
+
{{Top_10_2010:TopTemplate|useprev=2010PrevLink|prev=A2-Cross-Site Scripting (XSS)|usenext=2010NextLink|next=A4-Insecure Direct Object References}}
  
<center>
+
{{Top_10_2010:SummaryTableHeaderBeginTemplate}}
{| style="align:center; text-align:center; border:2px solid #4F81BD; background-color:#F2F2F2;"
+
{{Top_10_2010:SummaryTableValue-2-Template|Exploitability|AVERAGE}}
|- style="background-color: #4F81Bd; color: #000000;"
+
{{Top_10_2010:SummaryTableValue-2-Template|Prevalence|COMMON}}
! Threat Agents !! Attack Vectors !! Security Weakness !! Weakness Detectability !! Technical Impact !! Business Impacts
+
{{Top_10_2010:SummaryTableValue-2-Template|Detectability|AVERAGE}}
|-
+
{{Top_10_2010:SummaryTableValue-1-Template|Impact|SEVERE}}
| style="background-color: #D9D9D9; color: #000000;" | ______
+
{{Top_10_2010:SummaryTableHeaderEndTemplate}}
| style="background-color: #FF0000; color: #000000;" | Exploitability<br>EASY
+
    <td {{Template:Top 10 2010:SummaryTableRowStyleTemplate}}>Consider anonymous external attackers, as well as users with their own accounts, who may attempt to steal accounts from others. Also consider insiders wanting to disguise their actions.</td>
| style="background-color: #FFB200; color: #000000;" | Prevalence<br>COMMON
+
    <td {{Template:Top 10 2010:SummaryTableRowStyleTemplate}}>Attacker uses leaks or flaws in the authentication or session management functions (e.g., exposed accounts, passwords, session IDs) to impersonate users.</td>
| style="background-color: #FFB200; color: #000000;" | Detectability<br>AVERAGE
+
    <td colspan=2  {{Template:Top 10 2010:SummaryTableRowStyleTemplate}}>Developers frequently build custom authentication and session management schemes, but building these correctly is hard. As a result, these custom schemes frequently have flaws in areas such as logout, password management, timeouts, remember me, secret question, account update, etc. Finding such flaws can sometimes be difficult, as each implementation is unique.</td>
| style="background-color: #FF0000; color: #000000;" | Impact<br>SIMPLE
+
    <td {{Template:Top 10 2010:SummaryTableRowStyleTemplate}}>Such flaws may allow some or even all accounts to be attacked. Once successful, the attacker can do anything the victim could do. Privileged accounts are frequently targeted.</td>
| style="background-color: #D9D9D9; color: #000000;" | ______
+
    <td {{Template:Top 10 2010:SummaryTableRowStyleTemplate}}>Consider the business value of the affected data or application functions.<br/><br/>Also consider the business impact of public exposure of the vulnerability.</td>
|-
+
{{Top_10_2010:SummaryTableEndTemplate}}
|
+
|
+
|
+
|
+
|
+
|
+
|}
+
</center>
+
  
{{Top_10_2010:SubsectionVulnerableTemplate|Injection|a}}
+
{{Top_10_2010:SubsectionAdvancedTemplate|type={{Top_10_2010:StyleTemplate}}|number=1|risk=3}}
{{Top_10_2010:SubsectionPreventionTemplate|Injection|b}}
+
The primary assets to protect are credentials and session IDs.
{{Top_10_2010:SubsectionExampleTemplate|Injection|c}}
+
# Are credentials always protected when stored using hashing or encryption? [[Top_10_2010-A7 | See A7]].
{{Top_10_2010:SubsectionReferencesTemplate|Injection|d|e}}
+
# Can credentials be guessed or overwritten through weak account management functions (e.g., account creation, change password, recover password, weak session IDs)?
 +
# Are session IDs exposed in the URL (e.g., URL rewriting)?
 +
# Are session IDs vulnerable to session fixation attacks?
 +
# Do session IDs timeout and can users log out?
 +
# Are session IDs rotated after successful login?
 +
# Are passwords, session IDs, and other credentials sent only over TLS connections? [[Top_10_2010-A9 | See A9]].
 +
See the [http://www.owasp.org/index.php/ASVS#tab=Downloads ASVS] requirement areas V2 and V3 for more details.
 +
{{Top_10_2010:SubsectionAdvancedTemplate|type={{Top_10_2010:StyleTemplate}}|number=2|risk=3}}
 +
The primary recommendation for an organization is to make available to developers:
 +
# A single set of strong authentication and session management controls. Such controls should strive to:
 +
## meet all the authentication and session management requirements defined in OWASP’s [http://www.owasp.org/index.php/ASVS#tab=Downloads Application Security Verification Standard] (ASVS) areas V2 (Authentication) and V3 (Session Management).
 +
## have a simple interface for developers. Consider the [http://owasp-esapi-java.googlecode.com/svn/trunk_doc/latest/org/owasp/esapi/Authenticator.html ESAPI Authenticator and User APIs] as good examples to emulate, use, or build upon.
 +
# Strong efforts should also be made to avoid XSS flaws which can be used to steal session IDs. [[Top_10_2010-A2 | See A2]].
 +
{{Top_10_2010:SubsectionAdvancedTemplate|type={{Top_10_2010:StyleTemplate}}|number=3|risk=3}}
 +
<u>Scenario #1</u>: Airline reservations application supports URL rewriting, putting session IDs in the URL:
 +
{{Top_10_2010:ExampleBeginTemplate}}<nowiki>http://example.com/sale/saleitems</nowiki>;<span style="color:red;"><br/>jsessionid=2P0OC2JDPXM0OQSNDLPSKHCJUN2JV</span><br/>?dest=Hawaii{{Top_10_2010:ExampleEndTemplate}}
 +
An authenticated user of the site wants to let his friends know about the sale. He e-mails the above link without knowing he is also giving away his session ID. When his friends use the link they will use his session and credit card.
  
 +
<u>Scenario #2</u>: Application’s timeouts aren’t set properly. User uses a public computer to access site. Instead of selecting “logout” the user simply closes the browser tab and walks away. Attacker uses the same browser an hour later, and that browser is still authenticated.
  
{{Top_10_2010:BottomTemplate|usenext=NextLink|next=-Broken Authentication and Session Management|useprev=PrevLink|prev=-Cross Site Request Forgery|usemain=MainLink|main=}}
+
<u>Scenario #3</u>: Insider or external attacker gains access to the system’s password database. User passwords are not encrypted, exposing every users’ password to the attacker.
 +
 
 +
{{Top_10_2010:SubsectionAdvancedTemplate|type={{Top_10_2010:StyleTemplate}}|number=4|risk=3}}
 +
{{Top_10_2010:SubSubsectionOWASPReferencesTemplate}}
 +
For a more complete set of requirements and problems to avoid in this area, see the [http://www.owasp.org/index.php/ASVS#tab=Downloads ASVS requirements areas for Authentication (V2) and Session Management (V3)]
 +
* [[Authentication_Cheat_Sheet | OWASP Authentication Cheat Sheet]]
 +
* [http://owasp-esapi-java.googlecode.com/svn/trunk_doc/latest/org/owasp/esapi/Authenticator.html ESAPI Authenticator API]
 +
* [http://owasp-esapi-java.googlecode.com/svn/trunk_doc/latest/org/owasp/esapi/User.html ESAPI User API]
 +
* [[Guide_to_Authentication | OWASP Development Guide: Chapter on Authentication]]
 +
* [[Testing_for_authentication | OWASP Testing Guide: Chapter on Authentication]]
 +
{{Top_10_2010:SubSubsectionExternalReferencesTemplate}}
 +
* [http://cwe.mitre.org/data/definitions/287.html CWE Entry 287 on Improper Authentication]
 +
{{Top_10_2010:BottomAdvancedTemplate|type={{Top_10_2010:StyleTemplate}}|useprev=2010PrevLink|prev=A2-Cross-Site Scripting (XSS)|usenext=2010NextLink|next=A4-Insecure Direct Object References}}
 +
 
 +
[[Category:OWASP Top Ten Project]]

Latest revision as of 00:26, 2 May 2010

← A2-Cross-Site Scripting (XSS)
Top 10 Introduction
Top 10 Risks
A4-Insecure Direct Object References →
Threat Agents Attack Vectors Security Weakness Technical Impacts Business Impacts
Application Specific Exploitability
AVERAGE
Prevalence
COMMON
Detectability
AVERAGE
Impact
SEVERE
Application / Business Specific
Consider anonymous external attackers, as well as users with their own accounts, who may attempt to steal accounts from others. Also consider insiders wanting to disguise their actions. Attacker uses leaks or flaws in the authentication or session management functions (e.g., exposed accounts, passwords, session IDs) to impersonate users. Developers frequently build custom authentication and session management schemes, but building these correctly is hard. As a result, these custom schemes frequently have flaws in areas such as logout, password management, timeouts, remember me, secret question, account update, etc. Finding such flaws can sometimes be difficult, as each implementation is unique. Such flaws may allow some or even all accounts to be attacked. Once successful, the attacker can do anything the victim could do. Privileged accounts are frequently targeted. Consider the business value of the affected data or application functions.

Also consider the business impact of public exposure of the vulnerability.
Am I Vulnerable To 'Broken Authentication and Session Management'?

The primary assets to protect are credentials and session IDs.

  1. Are credentials always protected when stored using hashing or encryption? See A7.
  2. Can credentials be guessed or overwritten through weak account management functions (e.g., account creation, change password, recover password, weak session IDs)?
  3. Are session IDs exposed in the URL (e.g., URL rewriting)?
  4. Are session IDs vulnerable to session fixation attacks?
  5. Do session IDs timeout and can users log out?
  6. Are session IDs rotated after successful login?
  7. Are passwords, session IDs, and other credentials sent only over TLS connections? See A9.

See the ASVS requirement areas V2 and V3 for more details.

How Do I Prevent 'Broken Authentication and Session Management'?

The primary recommendation for an organization is to make available to developers:

  1. A single set of strong authentication and session management controls. Such controls should strive to:
    1. meet all the authentication and session management requirements defined in OWASP’s Application Security Verification Standard (ASVS) areas V2 (Authentication) and V3 (Session Management).
    2. have a simple interface for developers. Consider the ESAPI Authenticator and User APIs as good examples to emulate, use, or build upon.
  2. Strong efforts should also be made to avoid XSS flaws which can be used to steal session IDs. See A2.
Example Attack Scenarios

Scenario #1: Airline reservations application supports URL rewriting, putting session IDs in the URL:

http://example.com/sale/saleitems;
jsessionid=2P0OC2JDPXM0OQSNDLPSKHCJUN2JV

?dest=Hawaii

An authenticated user of the site wants to let his friends know about the sale. He e-mails the above link without knowing he is also giving away his session ID. When his friends use the link they will use his session and credit card.

Scenario #2: Application’s timeouts aren’t set properly. User uses a public computer to access site. Instead of selecting “logout” the user simply closes the browser tab and walks away. Attacker uses the same browser an hour later, and that browser is still authenticated.

Scenario #3: Insider or external attacker gains access to the system’s password database. User passwords are not encrypted, exposing every users’ password to the attacker.

References

OWASP For a more complete set of requirements and problems to avoid in this area, see the ASVS requirements areas for Authentication (V2) and Session Management (V3)

External

← A2-Cross-Site Scripting (XSS)
Top 10 Introduction
Top 10 Risks
A4-Insecure Direct Object References →

© 2002-2010 OWASP Foundation This document is licensed under the Creative Commons Attribution-ShareAlike 3.0 license. Some rights reserved. CC-by-sa-3 0-88x31.png