# Top 10 2017-A2-Broken Authentication and Session Management

From OWASP

==The Top 10-2017 Wiki is under Construction. The Content is Not Finished yet.==
==Edits to this page will be lost. If you wish a change, please file an issue on GitHub. ==

← A1-Injection | 2017 Table of Contents 2017 Top 10 List | A3-Cross-Site Scripting (XSS) →

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 authorized users, who may attempt to steal accounts from others. Also consider insiders wanting to disguise their actions. | Attackers use leaks or flaws in the authentication or session management functions (e.g., exposed accounts, passwords, session IDs) to temporarily or permanently 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, create account, change password, forgot password, 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'? Are session management assets like user credentials and session IDs properly protected? You may be vulnerable if: User authentication credentials aren’t properly protected when stored using hashing or encryption. See 2017-A6. Credentials can be guessed or overwritten through weak account management functions (e.g., account creation, change password, recover password, weak session IDs). Session IDs are exposed in the URL (e.g., URL rewriting). Session IDs are vulnerable to session fixation attacks. Session IDs don’t timeout, or user sessions or authentication tokens (particularly single sign-on (SSO) tokens) aren’t properly invalidated during logout. Session IDs aren’t rotated after successful login. Passwords, session IDs, and other credentials are sent over unencrypted connections. See 2017-A6. 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: 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 Application Security Verification Standard (ASVS) areas V2 (Authentication) and V3 (Session Management). have a simple interface for developers. Consider the 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. See 2017-A3.
Example Attack Scenarios Scenario #1: Airline reservations application supports URL rewriting, putting session IDs in the URL: http://example.com/sale/saleitems; sessionid=268544541&dest=Hawaii An authenticated user of the site wants to let their friends know about the sale. User e-mails the above link without knowing they are also giving away their session ID. When the friends use the link they use user’s 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. An attacker uses the same browser an hour later, and that browser is still authenticated. Scenario #3: An insider or external attacker gains access to the system’s password database. User passwords are not properly hashed and salted, exposing every users’ password. | 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). OWASP Authentication Cheat Sheet OWASP Forgot Password Cheat Sheet OWASP Password Storage Cheat Sheet OWASP Session Management Cheat Sheet OWASP Testing Guide: Chapter on Authentication External CWE Entry 287 on Improper Authentication CWE Entry 384 on Session Fixation

← A1-Injection | 2017 Table of Contents 2017 Top 10 List | A3-Cross-Site Scripting (XSS) →

© 2002-2017 OWASP Foundation This document is licensed under the Creative Commons Attribution-ShareAlike 3.0 license. Some rights reserved.
Retrieved from "https://www.owasp.org/index.php?title=Top_10_2017-A2-Broken_Authentication_and_Session_Management&oldid=229066"
Categories:

- OWASP Top Ten Project
- OWASP Top Ten 2017 Project