01 Authentication
Introduction¶
- Authentication is the process of verifying the identity of the user or client.
- There are three types of Authentication
- Something you know (Passwords, Security questions, etc). Also called knowledge factors.
- Something you have (Mobile phone, security token, etc). Also called possession factors.
- Something you are (Biometrics). Also called inherence factors.
Authentication vs Authorization¶
- Authentication is the process of verifying that a user is who they claim to be.
- Authorization involves verifying whether a user is allowed to do something.
Why Authentication Vulnerabilities Arise¶
- Most authentication vulnerabilities arise due to one of the following two ways
- Authentication mechanisms are weak and doesn't provide protection against brute forcing.
- Logic flaws or poor coding due to which authentication can be bypassed entirely.
Impact of Authentication Vulnerabilities¶
- Impact is often high or critical due to the fact that the account can be took over by the attacker.
- If the account is high privileged then the whole application can be compromised.
Vulnerabilities in Password-Based login¶
Bruteforce Attacks¶
- Usernames can be bruteforced on the following conditions.
- If they conform to a specific pattern such as
firstname.lastname@companyname.com. - If the usernames are predictable such as
adminoradministrator. - Passwords can similarly be brute-forced, with the difficulty varying based on the strength of the password.
- Users often take a password that they can remember and try to crowbar it into fitting the password policy.
- For example, if
mypasswordis not allowed, users may try something likeMypassword1!orMyp4$$w0rdinstead.
Username Enumeration¶
- Username enumeration is when an attacker is able to observe changes in the website's behavior in order to identify whether a given username is valid.
- Username enumeration typically occurs either on the login page.
- For example, when you enter a valid username but an incorrect password, or on registration forms when you enter a username that is already taken.
- Look for changes in the following areas to identify the usernames.
- Status codes
- Response text
- Error messages
- Response time
- Enumerate usernames with ffuf using the below command.
Enumerate Passwords¶
-
Enumerate passwords with ffuf using the below command.
-
Support website: http://10.10.129.12/customers/signup/
Bruteforce Password¶
- Use the identified usernames and attempt to find the passwords.
- If you created your valid_usernames file by piping the output from ffuf directly you may have difficulty with this task. Clean your data, or copy just the names into a new file.
- Bruteforce individual usernames.
Logic Flaws¶
- Password reset request looks like below.
- Create an account with email id
attacker@hacker.comand update the curl request like below.
Cookie Tampering¶
- Cookies are set by the web server during your online session can have multiple outcomes, such as unauthenticated access, access to another user's account, or elevated privileges.
- Some of the examples of cookies set after successful login are
Set-Cookie: logged_in=true; Max-Age=3600; Path=/Set-Cookie: admin=false; Max-Age=3600; Path=/Set-Cookie: session=eyJpZCI6MSwiYWRtaW4iOmZhbHNlfQ==; Max-Age=3600; Path=/eyJpZCI6MSwiYWRtaW4iOmZhbHNlfQ==- base64 decoded has the value of{"id":1,"admin": false}