Skip to content

Commit 5ef1123

Browse files
s0cm0nkeygitbook-bot
authored andcommitted
GitBook: [#1312] No subject
1 parent 00b831f commit 5ef1123

1 file changed

Lines changed: 67 additions & 19 deletions

File tree

‎web-app-hacking/attacks-and-vulnerabilities/broken-authentication.md‎

Lines changed: 67 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@
77
* [https://cheatsheetseries.owasp.org/cheatsheets/Authentication\_Cheat\_Sheet.html](https://cheatsheetseries.owasp.org/cheatsheets/Authentication\_Cheat\_Sheet.html)
88
* [Fuzzhttpbypass](https://github.com/carlospolop/fuzzhttpbypass) - This tool use fuzzing to try to bypass unknown authentication methods, who knows...
99

10-
## **Session token Attacks**
10+
## **Session Token Attacks**
11+
12+
<details>
13+
14+
<summary>Session Token Attacks</summary>
1115

1216
* Session tokens should be randomized and not easily guessed.&#x20;
1317
* Session tokens should properly track a user.&#x20;
@@ -17,17 +21,25 @@
1721
* &#x20;Start live capture to start generating session tokens&#x20;
1822
* After a certain number of tokens it will give a summary of entropy, char level analysis and bit level analysis.
1923

24+
</details>
25+
2026
## **Password-Based Logins**
2127

22-
### Brute Force attacks
28+
<details>
29+
30+
<summary>Brute Force Attacks</summary>
2331

2432
* Brute-forcing usernames - Check for any accidental public disclosure, email addresses
2533
* Brute forcing passwords
2634
* Username Enumeration
2735
* Observe changes in the websites behavior depending on input
2836
* Notice changes in Status Codes, Error Messages, and [Response times](https://app.gitbook.com/s/-MQCNQTNhvnXD58Vo8Mf/web-app-hacking/Web\_Applications--Attack\_types--OWASP\_2\_-\_Broken\_Auth\_Attacks--Vuls\_in\_password-based\_login--Username\_enumeration\_via\_different\_responses.html)
2937

30-
### Flawed Brute force protection
38+
</details>
39+
40+
<details>
41+
42+
<summary>Flawed Brute Force Protection</summary>
3143

3244
* Two most common ways to protect: Locking the account and blocking the remote users IP
3345
* Ip blocking
@@ -49,20 +61,28 @@
4961
* Easy to decrypt
5062
* HTTP basic authentication is also particularly vulnerable to session-related exploits, notably [CSRF](https://portswigger.net/web-security/csrf), against which it offers no protection on its own.&#x20;
5163

64+
</details>
65+
5266
## **MultiFactor Authentication**
5367

5468
MFA -mandatory and optional two-factor authentication (2FA) based on something you know and something you have.
5569

5670
Two-Factor Tokens - Many high-security websites now provide users with a dedicated device for this purpose, such as the RSA token or keypad device that you might use to access your online banking or work laptop
5771

58-
### Bypassing 2FA
72+
### Bypassing 2fa
5973

6074
If the user is first prompted to enter a password, and then prompted to enter a verification code on a separate page, the user is effectively in a "logged in" state before they have entered the verification code. In this case, it is worth testing to see if you can directly skip to "logged-in only" pages after completing the first authentication step.
6175

6276
Mind Map: [https://www.mindmeister.com/1736437018?t=SEeZOmvt01](https://www.mindmeister.com/1736437018?t=SEeZOmvt01)
6377

64-
#### Response manipulation
78+
#### Resources
79+
80+
* [https://mrd0x.com/bypass-2fa-using-novnc/](https://mrd0x.com/bypass-2fa-using-novnc/) - Steal credentials and bypass 2FA by giving users remote access to your server via an HTML5 VNC client that has a browser running in kiosk mode.
81+
* [https://infosecwriteups.com/methods-to-bypass-two-factor-authentication-bc2bd35bd44e?source=rss----7b722bfd1b8d---4\&gi=d1d4b1015e30](https://infosecwriteups.com/methods-to-bypass-two-factor-authentication-bc2bd35bd44e?source=rss----7b722bfd1b8d---4\&gi=d1d4b1015e30)
82+
* [https://research.nccgroup.com/2021/06/10/testing-two-factor-authentication/](https://research.nccgroup.com/2021/06/10/testing-two-factor-authentication/)
6583

84+
{% tabs %}
85+
{% tab title="Response manipulation" %}
6686
* The response is
6787

6888
```
@@ -78,9 +98,9 @@ HTTP/1.1 404 Not Found
7898
...
7999
{"code": true}
80100
```
101+
{% endtab %}
81102

82-
#### Status code manipulation
83-
103+
{% tab title="Status code manipulation" %}
84104
The response is
85105

86106
```
@@ -96,9 +116,9 @@ HTTP/1.1 200 OK
96116
...
97117
{"code": false}
98118
```
119+
{% endtab %}
99120

100-
#### 2FA Code in Response
101-
121+
{% tab title="2FA Code in Response" %}
102122
Always check the response!
103123

104124
```
@@ -115,7 +135,9 @@ HTTP/1.1 200 OK
115135
...
116136
{"email": "victim@gmail.com", "code": "101010"}
117137
```
138+
{% endtab %}
118139

140+
{% tab title="Missing integrity validation" %}
119141
#### Missing 2FA Code integrity validation, code for any user account can be used
120142

121143
```
@@ -156,13 +178,15 @@ code=null
156178
```
157179

158180
Source: [Harsh Bothra](https://twitter.com/harshbothra\_) and [https://github.com/daffainfo/AllAboutBugBounty/blob/master/Bypass/Bypass%202FA.md](https://github.com/daffainfo/AllAboutBugBounty/blob/master/Bypass/Bypass%202FA.md)
159-
160-
* [https://mrd0x.com/bypass-2fa-using-novnc/](https://mrd0x.com/bypass-2fa-using-novnc/) - Steal credentials and bypass 2FA by giving users remote access to your server via an HTML5 VNC client that has a browser running in kiosk mode.
161-
* [https://infosecwriteups.com/methods-to-bypass-two-factor-authentication-bc2bd35bd44e?source=rss----7b722bfd1b8d---4\&gi=d1d4b1015e30](https://infosecwriteups.com/methods-to-bypass-two-factor-authentication-bc2bd35bd44e?source=rss----7b722bfd1b8d---4\&gi=d1d4b1015e30)
162-
* [https://research.nccgroup.com/2021/06/10/testing-two-factor-authentication/](https://research.nccgroup.com/2021/06/10/testing-two-factor-authentication/)
181+
{% endtab %}
182+
{% endtabs %}
163183

164184
### Flawed 2FA logic
165185

186+
<details>
187+
188+
<summary>Flawed 2FA logic</summary>
189+
166190
* Sometimes flawed logic in two-factor authentication means that after a user has completed the initial login step, the website doesn't adequately verify that the same user is completing the second step.
167191
* This is extremely dangerous if the attacker is then able to [brute-force](https://portswigger.net/web-security/authentication/password-based) the verification code as it would allow them to log in to arbitrary users' accounts based entirely on their username.
168192
* Brute forceing 2FA
@@ -173,30 +197,44 @@ Source: [Harsh Bothra](https://twitter.com/harshbothra\_) and [https://github.co
173197
* [https://cheatsheetseries.owasp.org/cheatsheets/Logging\_Vocabulary\_Cheat\_Sheet.html](https://cheatsheetseries.owasp.org/cheatsheets/Logging\_Vocabulary\_Cheat\_Sheet.html)
174198
* [https://research.nccgroup.com/2021/06/10/testing-two-factor-authentication/](https://research.nccgroup.com/2021/06/10/testing-two-factor-authentication/)
175199

200+
</details>
201+
176202
## Other Vulnerabilities
177203

178-
### The "Remember me" or "Keep me logged in" feature
204+
<details>
205+
206+
<summary>The "Remember me" or "Keep me logged in" feature</summary>
179207

180208
* This is usually set by a persistent cookie
181209
* If you can obtain or guess the cookie, the login process can be bypassed entirely
182210
* If the creation of this cookie is based off of simple rules, it cna be guessed or brute forced.
183211
* Even if the attacker is not able to create their own account, they may still be able to exploit this vulnerability. Using the usual techniques, such as [XSS](https://portswigger.net/web-security/cross-site-scripting), an attacker could steal another user's "remember me" cookie and deduce how the cookie is constructed from that. If the website was built using an open-source framework, the key details of the cookie construction may even be publicly documented.
184212

185-
### Resetting User passwords
213+
</details>
214+
215+
<details>
186216

217+
<summary>Resetting User passwords</summary>
218+
219+
* [https://github.com/daffainfo/AllAboutBugBounty/blob/master/Misc/Password%20Reset%20Flaws.md](https://github.com/daffainfo/AllAboutBugBounty/blob/master/Misc/Password%20Reset%20Flaws.md)
187220
* Sending passwords by email
188221
* It should go without saying that sending users their current password should never be possible if a website handles passwords securely in the first place. Instead, some websites generate a new password and send this to the user via email.\
189222
&#x20;Generally speaking, sending persistent passwords over insecure channels is to be avoided. In this case, the security relies on either the generated password expiring after a very short period, or the user changing their password again immediately. Otherwise, this approach is highly susceptible to man-in-the-middle attacks.\
190223
&#x20;Email is also generally not considered secure given that inboxes are both persistent and not really designed for secure storage of confidential information. Many users also automatically sync their inbox between multiple devices across insecure channels.
224+
225+
<!---->
226+
191227
* Resetting passwords using a URL
192228
* A more robust method of resetting passwords is to send a unique URL to users that takes them to a password reset page. Less secure implementations of this method use a URL with an easily guessable parameter to identify which account is being reset
193229
* An attacker could change the `user` parameter to refer to any username they have identified. They would then be taken straight to a page where they can potentially set a new password for this arbitrary user.
194230
* A better implementation of this process is to generate a high-entropy, hard-to-guess token and create the reset URL based on that. In the best case scenario, this URL should provide no hints about which user's password is being reset.
195231
* However, some websites fail to also validate the token again when the reset form is submitted. In this case, an attacker could simply visit the reset form from their own account, delete the token, and leverage this page to reset an arbitrary user's password.
196232

197-
[https://github.com/daffainfo/AllAboutBugBounty/blob/master/Misc/Password%20Reset%20Flaws.md](https://github.com/daffainfo/AllAboutBugBounty/blob/master/Misc/Password%20Reset%20Flaws.md)
233+
</details>
234+
235+
<details>
198236

199-
### Password reset poisoning
237+
<summary>Password reset poisoning</summary>
200238

201239
* The attacker first enters the victim's username and requests a password reset. They then intercept this request using Burp. If certain headers are supported, the attacker may be able to utilize them to override the hostname for the generated URL. They may even be able to simply change the value of the `Host` header directly.
202240
* If the attacker changes the `Host` to a domain that they control, such as `evil-user.net`, the victim would then receive an email similar to the following:\
@@ -205,11 +243,21 @@ Source: [Harsh Bothra](https://twitter.com/harshbothra\_) and [https://github.co
205243
&#x20;`http://evil-user.net/password-reset?token=a0ba0d1cb3b63d13822572fcff1a241895d893f659164d4cc550b421ebdd48a8`\
206244
&#x20;This would be a genuine email from the website and, importantly, would contain the valid token required to reset this user's password. However, as the URL points to the attacker's website, clicking this link would cause the user to expose their reset token to the attacker. By visiting the real URL with the user's leaked token, the attacker could subsequently reset the victim's password unimpeded.
207245

208-
### Changing user passwords
246+
</details>
247+
248+
<details>
249+
250+
<summary>Changing user passwords</summary>
209251

210252
* Typically, changing your password involves entering your current password and then the new password twice. These pages fundamentally rely on the same process for checking that usernames and current passwords match as a normal login page does. Therefore, these pages can be vulnerable to the same techniques.
211253
* Password change functionality can be particularly dangerous if it allows an attacker to access it directly without being logged in as the victim user. For example, if the username is provided in a hidden field, an attacker might be able to edit this value in the request to target arbitrary users. This can potentially be exploited to enumerate usernames and brute-force passwords.
212254

213-
### User registration sanitization
255+
</details>
256+
257+
<details>
258+
259+
<summary>User registration sanitization</summary>
214260

215261
* If you can discover a valid username, attempt to create a new user with the same name preceeded by a space
262+
263+
</details>

0 commit comments

Comments
 (0)