Skip to content

How To Fix Broken Auth

Alexis edited this page Apr 20, 2020 · 3 revisions

Fixing Broken Auth

Fixing a broken authentication is probably one of the easiest tasks in securing your website in this document I will show you simple yet clever ways to secure your app and fix your authentication so that no bad guys tries to hack your website, exploiting your authentication.

Password Length

Everything starts with the password length, force your users to use a password that has a minimum of 8 Characters, that contains at least one alphanumeric character (0 to 9), and a unicode symbol such as a dot or a comma. By having your user entering stronger passwords, you eliminate the risks of a simple bruteforce login software that uses a email:password key value system to login into other people's account. believe it or not, some people still use Pikachu123 as their password...

This is why in my rails application, I changed the minimum amount of characters to 8 for the password requirement.

Username/Password Enumeration

NEVER Tell the user if either the username or the password was incorrect, in the case that the user mispelled his login information. If the person trying to login is trying to bruteforce the password of the specific account, and the website tells him that the password is bad but not the email, the hacker now knows that Atleast the email works, and that he only needs to focus on the password, thus motivating him. You should always tell your users that the Email/Password is wrong, both infos at the same time, will discourage a portion of the people trying to hack into your website

Use a captcha

One of the most important things about forms and login pages, is the captcha. Without a captcha, a nefarious user could spam your website with bots, adding a captcha does not solve that problem completely, but is still crucial ! I invite you to watch these 2 videos on how I managed to add Captchas to my Rails application

Clone this wiki locally