-
Notifications
You must be signed in to change notification settings - Fork 52
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple bruteforce vulnerabilities in ezbookkeeping 0.7.0 #33
Comments
This is super thorough. Thank you for doing that. |
Thank you for your sharing! |
In my opinion, almost no personal user's data is worth brute-forcing. Especially after using a strong password and turing on 2fa, the security of ezBookkeeping for personal users is enough. |
You are welcome :) |
You are welcome, stay secure :) |
It's pretty common tactic we use in penetration testing, you can see an example here: 2FA itself can be bypassed because there is an exploit for that too. |
Without brute-forcing protection, 2fa can certainly be cracked. But what I said is |
I don't think strong password rules were implemented at the time I was testing this because I was able to set passwords like "1234567890" and get away with it. The application should encourage users to set strong passwords by asking for at least 12 characters, that would include special characters, numbers, letters, etc. |
Protecting login brute forcing is best done with a WAF (Web Application Firewall) in front of any application. It does not make much sense to include it in the application code. |
It makes every sense to include it at the core of your application because without that core security protection, you are expecting your users would protect themselves, not everyone has the technical know-how to do it. It's not as straight-forward for most developers. In my own website, I am using Flask-Limiter to limit number of logins, but that's not enough, I use account lockout functionality provided by Flask-Security to take it one step further and then there is Captcha. I think that if you take a look at hacking forums like BreachForums, you will notice that brute-force is used in most major campaigns. I have seen it myself in penetration testing (both internal & external). But to each their own, if your users are experts then you don't need security at all :) |
I would like to share that this vulnerability was reported to MITRE and it was published under CVE-2024-57603: |
Multiple bruteforce vulnerabilities affecting login and backup codes
I have discovered two critical vulnerabilities Ezbookkeeping that I wanted to share with the community. I must emphasize that this is being done after I had a conversation with [email protected] and they advised to publish my findings here.
These vulnerabilities are as follows:
To demonstrate the impact of these vulnerabilities, I have developed two proof-of-concept (PoC) exploits:
While changing the email address itself may not be a vulnerability, I included this step to illustrate the full impact of the attack and the risk of account takeover.
I conducted my testing by running your software locally using Docker. For your convenience, I have provided a detailed guide below to help you reproduce these issues.
Reproduce login bruteforce
Open the login page:
http://10.0.0.94/desktop#/login
Enter a username and password, intercept the request with a proxy such as BurpSuite and you will see the following HTTP request being sent:
If you send a request with a wrong password, you get the following response:
{"errorCode":201002,"errorMessage":"login name or password is wrong","path":"/api/authorize.json","success":false}
There is no rate limiting or account lockout mechanism so you we can exploit the vulnerability by trying a list of passwords to find the correct one.
The exploit code can be found here:
https://gist.github.com/0xHamy/edbf260d4ab6bb9628148bb376619292
Reproduce backup code bruteforce
The application allows users to setup Two-Factor Authentication through the following page:
http://10.0.0.94/desktop#/user/settings?tab=twoFactorSetting
Additionally, in case users can also use backup codes as an alternative to login when they don't have access to their Authenticator app:
![image](https://private-user-images.githubusercontent.com/192145022/398950729-5ca8313f-b1ab-41a7-809a-1913d26643ce.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1OTExNDEsIm5iZiI6MTczOTU5MDg0MSwicGF0aCI6Ii8xOTIxNDUwMjIvMzk4OTUwNzI5LTVjYTgzMTNmLWIxYWItNDFhNy04MDlhLTE5MTNkMjY2NDNjZS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNVQwMzQwNDFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT02OTlmZjIzZjQwNzA0YTlhNDkyNTc0MDRiNWFmYmUwZWRhNTY2ODViMTIxY2IwNWNkYTM5MTY5ZjEwODQ1YjkwJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.q8pR_3edpgy1uDmn_XZkIHQuAAU47edl4Aj3BhN6m0U)
Once enabled, you can enter these backup codes through the login page by clicking on question mark icon:
![image (1)](https://private-user-images.githubusercontent.com/192145022/398950854-29cca926-c45c-49dd-98cd-b7f7c88ce1f2.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk1OTExNDEsIm5iZiI6MTczOTU5MDg0MSwicGF0aCI6Ii8xOTIxNDUwMjIvMzk4OTUwODU0LTI5Y2NhOTI2LWM0NWMtNDlkZC05OGNkLWI3ZjdjODhjZTFmMi5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE1JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxNVQwMzQwNDFaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT00OTY3NmJiOTlhYTM3ZDAxYmM0ZWVjYWEzMmUyNGIzMmEwMjY0ZTdlNzkxNjQ5MmFiOGE0MTE0NWYzNWI5ZDJjJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.Phj2FlsuFvB8wgn7TdKO_FVTzd5EYV912FPLHdv30hM)
When submitting backup codes, the request is sent to the following path:
The interesting thing I have discovered is that you can't keep brute-forcing this endpoint repeatedly with a list of recovery codes, the token has a short lifespan & will expire, for this reason I have crafted an exploit that performs all of the following:
Here is the exploit code:
https://gist.github.com/0xHamy/908011130bc8ec05db3ac9bc54c7593a
Summary
Severity of the Vulnerability Chain
Overview of the Exploit Chain
Exploitable due to a lack of rate limiting or account lockout mechanisms on the login endpoint.
An attacker can brute force valid account credentials by trying different username-password combinations programmatically.
The application allows brute-forcing backup codes, which are meant to secure accounts as part of two-factor authentication (2FA).
Lack of rate limiting or monitoring on the backup code endpoint enables systematic guessing, bypassing 2FA entirely.
Once a valid backup code is brute-forced, the attacker gains full access to the account. This allows them to:
Change the email address associated with the account.
Lock out the legitimate user by taking ownership of the account.
Impact
Mitigation Steps
To address this exploit chain, the following measures should be implemented:
Login Brute Force Protection
Rate Limiting: Limit the number of login attempts allowed per user/IP to a reasonable threshold (e.g., 5 attempts per minute).
Account Lockout: Temporarily lock accounts after a defined number of failed login attempts (e.g., 3–5 attempts). Notify users of lockout events via email.
Captcha: Add CAPTCHA challenges after multiple failed attempts to deter automated attacks.
Password Policy: Enforce strong password requirements and recommend users enable 2FA.
Backup Code Security
Rate Limiting: Limit the number of backup code verification attempts per account to prevent brute-forcing.
One-Time Use Codes: Ensure backup codes are invalidated after one successful use.
Strong Backup Codes: Use longer, randomly generated alphanumeric codes to increase brute force resistance (e.g., 12–16 characters).
Monitoring and Alerts: Notify users of backup code usage and log all attempts for potential abuse detection.
Token Management
Short-Lived Tokens: Issue time-limited tokens that expire quickly after usage.
Scope Validation: Restrict tokens to specific actions (e.g., login vs. profile updates).
Immediate Revocation: Revoke all active tokens when critical account information (e.g., email or password) is changed.
Profile Update Endpoint
Re-Authentication: Require users to re-enter their password or a valid 2FA code before allowing changes to sensitive fields like email addresses.
Email Verification: Require verification of the new email address before making it the account’s primary email.
Why These Steps Are Necessary
The combination of vulnerabilities creates a critical risk where attackers can systematically bypass authentication and take over user accounts.
Addressing the root causes—lack of rate limiting, inadequate backup code security, and token mismanagement—will mitigate this risk and protect user data and account integrity.
Contact
Get in touch with me @ [email protected]
The text was updated successfully, but these errors were encountered: