December 4, 2026
Okta Authentication Bypass: The 52-Character Username
A cache key built with bcrypt quietly ignored the password for very long usernames, so a past login could vouch for any future one

By Muhammad Asim Shahzad
2 min read
A cache key built with bcrypt quietly ignored the password for very long usernames, so a past login could vouch for any future one
AI-assisted: drafted with AI help from public sources, then reviewed and edited. This is an analytical case study of a public disclosure, not my own discovery.
For about three months, some Okta users with long usernames could be signed in without the right password. This Okta authentication bypass hit AD/LDAP delegated authentication when the username was 52 characters or longer and a cached login was checked instead of the directory. Okta found it internally and fixed it the same day.
Disclaimer:_ Educational and defensive use only. The bug existed from 23 July to 30 October 2024 and was fixed in Okta's production environment on 30 October 2024. This case was found internally by Okta, not through a bug bounty._
Vulnerability Overview
- Type: Authentication bypass through a truncating hash used as a credential cache key
- CWE (analytical mapping): CWE-287 (Improper Authentication), CWE-305 (Authentication Bypass by Primary Weakness)
- CVE / CVSS: Not reported
- Bounty: None; discovered internally by Okta
How the Okta Authentication Bypass Worked (high level)
With delegated authentication, Okta checks passwords against a customer's Active Directory or LDAP through an on-premises agent. When that agent is down or unreachable, a cache of earlier successful logins can be used instead.
Okta's advisory says the cache key was a bcrypt hash of the user ID, username and password joined into one string, and that under the right conditions someone could authenticate by supplying the username alone against the cached key of an earlier successful login.
The advisory does not explain why 52 characters is the threshold. My reading: bcrypt only uses the first 72 bytes of its input, and many libraries silently drop the rest. Put the user ID and username first, and once they fill those 72 bytes the password never reaches the hash. If the user ID takes 20 bytes, a 52-character username does exactly that. After that, any password produces the same key as the real one.
Every condition had to line up: delegated authentication, no MFA, a long username, an existing cache entry, the cache checked first, and a login inside the affected window.
Okta fixed it by moving the cache key from bcrypt to PBKDF2 and asked affected customers to search their System Logs for unexpected logins by long usernames.
Business Impact
An identity provider's job is to say no to the wrong password. Here that answer depended on string length, and it failed exactly when the directory was unreachable, which is when nobody is watching logins closely. Customers without MFA had no second check behind it.
Preventing Okta Authentication Bypass-Style Bugs (my own analysis)
1. Know your primitive's input limits. bcrypt truncates at 72 bytes. Never feed it concatenated fields.
2. Pre-hash and frame inputs. Length-prefix each field, HMAC the result to a fixed size, then apply the slow KDF.
3. Fail closed on the fallback path. A cache used during an outage should require MFA, and it should be tested with long, Unicode and boundary-length usernames.
# Pseudocode: cache key that commits to every byte of every field
def frame(*fields):
return b"".join(len(f).to_bytes(4, "big") + f for f in fields) # no ambiguity
def cache_key(user_id, username, password, salt):
pre = hmac_sha256(CACHE_PEPPER, frame(user_id, username, password))
return slow_kdf(b64encode(pre), salt) # 44 bytes, well under any limit
def verify_offline(entry, user_id, username, password, mfa_ok):
if not mfa_ok:
return deny("directory unreachable: MFA required") # fallback fails closed
return constant_time_equal(entry.key, cache_key(user_id, username, password, entry.salt))
# Test: 60-char username + wrong password -> key differs; no MFA during outage -> deny# Pseudocode: cache key that commits to every byte of every field
def frame(*fields):
return b"".join(len(f).to_bytes(4, "big") + f for f in fields) # no ambiguity
def cache_key(user_id, username, password, salt):
pre = hmac_sha256(CACHE_PEPPER, frame(user_id, username, password))
return slow_kdf(b64encode(pre), salt) # 44 bytes, well under any limit
def verify_offline(entry, user_id, username, password, mfa_ok):
if not mfa_ok:
return deny("directory unreachable: MFA required") # fallback fails closed
return constant_time_equal(entry.key, cache_key(user_id, username, password, entry.salt))
# Test: 60-char username + wrong password -> key differs; no MFA during outage -> denyKey Takeaways
- Hash functions with input limits turn length into a security boundary. Test at and beyond it.
- Outage fallbacks are authentication paths too. Give them the same rigor as the main path.
- MFA is what made this bug irrelevant for most customers.
Credit & Sources
Discovered internally by Okta. Primary source: Okta AD/LDAP Delegated Authentication โ Username Above 52 Characters, security advisory dated 1 November 2024 and updated 4 November 2024. bcrypt's 72-byte limit: pyca/bcrypt documentation. Facts come from those pages; analysis and code are original.
Next breakdown: how OAuth "dirty dancing" tricks leaked sign-in tokens from major login flows. Follow @masimshahzad for daily bug bounty breakdowns.