-
Use Strong Passwords
- Enforce strong password policies. Use a password strength checker like zxcvbn to guide users in creating secure passwords.
- Example: If a user tries "password123," the system should suggest using "MyStr0ng#Pass2025" instead.
-
Prevent Username Enumeration
- Return the same error message and HTTP status code for invalid usernames and passwords to avoid revealing whether a username exists.
- Example: Show "Invalid credentials" for both wrong usernames and passwords, without confirming which part was incorrect.
-
Implement Account Locking
- Temporarily lock accounts after a certain number of failed login attempts.
- Example: Lock an account for 10 minutes after 5 wrong attempts to prevent targeted brute-forcing.
-
Limit Login Attempts (Rate Limiting)
- Limit login attempts per IP address and block suspicious behavior.
- Example: Allow 5 attempts per minute per IP. Block further attempts for 15 minutes if the limit is exceeded.
-
Add CAPTCHA for Extra Protection
- Require users to complete a CAPTCHA after several failed login attempts.
- Example: After 3 failed logins, show a CAPTCHA like "Click all the images with traffic lights."
-
Implement Multi-Factor Authentication (MFA)
- Use app-based or hardware-based MFA instead of SMS.
- Example: After entering a password, require a 6-digit code from Google Authenticator or a similar app.
-
Secure Password Reset
- Use a time-limited, unique token for password reset links.
- Example: Send an email with a link that expires in 15 minutes. Ensure the link can only be used once.
-
Avoid SMS-Based MFA
- SMS 2FA can be bypassed via SIM-swapping attacks. Use app-based authentication instead.
- Example: Encourage users to set up an authenticator app for 2FA instead of relying on SMS codes.
-
Protect Additional Authentication Functions
- Secure features like account registration, password recovery, and password changes.
- Example: Require users to verify their email before changing their password.
-
Prevent Brute-Force Attacks on Multiple Accounts
- Limit the number of login attempts across all usernames using shortlists of passwords.
- Example: If an attacker tries common passwords like "123456" or "qwerty" across accounts, block them after 5 attempts.
-
Triple-Check Verification Logic
- Regularly audit login and authentication logic to prevent bypass vulnerabilities.
- Example: Ensure the system verifies both the username and password properly and doesn't skip steps due to flawed code.
-
Donβt Rely on Users for Security
- Enforce secure practices like strong passwords and MFA automatically.
- Example: Block weak passwords like "Password123" and require a unique, strong password.
-
Implement Robust Brute-Force Protections
- Require CAPTCHA or other verification methods after multiple failed attempts.
- Example: After 5 failed attempts from the same IP, show a CAPTCHA and notify the account owner.
Please feel free to add more :).
Acknowledgment: This document references information from PortSwigger Web Security