Passwords Shouldn't Be Hard, Don't Cause Your Next Breach

10 Sep 2018 — Jeremy Buis

Originally published on the Software Secured blog. Mirrored here for posterity.

OWASP has identified authentication and poor session management as a critical issue as far back as 2004. To this day, it is still a major issue and looks to continue to be for the foreseeable future. The main benefactor of this are data breaches, as attackers have a growing pool of possible username/password combinations to use in brute force type attacks against user accounts.

Data breaches happen all the time — roughly 19,280 records are stolen every hour — and they should be considered the new normal. It is now a matter of when your company will be hit by a breach, rather than if at all.

The Problem: Insecure Password Storage

As more and more data breaches occur, we find that companies are still not implementing passwords in a secure manner. Insecure storage can be caused by a number of reasons including:

These, coupled with poor password policies, lead to user accounts being taken over by malicious users. A poor password policy would allow passwords to be less than 8 characters, have no symbols, numbers or special characters.

A strong password policy:

Two Factor Authentication

Companies have been adopting two factor authentication (2FA) as it provides another level of protection for users in the case of a user’s password being leaked via a data breach. 2FA consists of a one time code transmitted to the user via SMS, email, or by a piece of hardware or software.

Problems occur when the one time tokens are transmitted over insecure channels, like email and SMS.

SMS as a Channel

SMS messages are sent in clear text and attackers at times are able to recover a user’s text message, either by intercepting the message or gaining access through a different channel.

There are a number of ways an attacker can gain access to the user’s phone number:

Federated Authentication: OAuth2 and SAML

Companies are adding the ability for users to use their Google or Facebook accounts to authenticate. This helps users remember one less username/password combination. This is a move in the right direction, but comes with some problems. It’s hard to implement these federated identity protocols in a secure manner.

OAuth2 is probably the most popular protocol in use. The protocol is securely designed, but is often implemented poorly. For example, Facebook fell prone to poor implementation as an attacker was able to steal a user’s authorization tokens by breaking out of the OAuth2 redirect_uri parameter, thereby sending the user’s authorization token to a server they controlled.

Some common flaws in the protocol implementation include: allowing attackers to set any redirect_uri, improper error handling, and problems with the state parameter.

SAML is the popular protocol in use to authenticate and authorize users for a service. It passes messages using XML. Most attacks targeted towards SAML are XML based attacks. A SAML exploit was released earlier this year which allowed malicious users to bypass the authentication process completely. This happened as a result of XML libraries incorrectly parsing XML comments, allowing attackers to inject valid usernames into a SAML assertion.

Recommendations

References