Vulnerabilities

Severe Cal.com Vulnerability Lets Attackers Bypass Authentication with Fake TOTP Codes

Cal.com, a popular open-source scheduling platform, faces a critical authentication flaw that allows attackers to bypass password checks by using fake TOTP codes.

Security researcher Emrysal disclosed the issue last week via GitHub Advisory GHSA-9r3w-4j8q-pw98.

Rated critical, it affects versions up to 5.9.7. Users should update to 5.9.8 immediately to block unauthorized access to calendars and personal data.

The bug lies in the authorize() function of the login flow in packages/features/auth/lib/next-auth-options.ts (lines 179-187).

Flawed conditional logic skips password verification if a TOTP code is supplied, even a fake one. This creates two attack paths.

Vulnerability Mechanics and Exploit Scenarios

For users without 2FA enabled the majority a non-empty totpCode field tricks the system into bypassing password checks entirely.

Attackers need only the victim’s email; no valid password or TOTP is required. The code proceeds to authenticate without hurdles.

Here’s the vulnerable snippet:

if (!user.password?.hash && user.identityProvider == IdentityProvider.CAL) {
  throw new Error(ErrorCode.IncorrectEmailPassword);
}

if (user.password?.hash && !credentials.totpCode) {
  const isCorrectPassword = await verifyPassword(credentials.password, user.password.hash);
  if (!isCorrectPassword) {
    throw new Error(ErrorCode.IncorrectEmailPassword);
  }
}

if (user.twoFactorEnabled && credentials.backupCode) {
  ...
} else if (user.twoFactorEnabled) {
  if (!credentials.totpCode) {
    throw new Error(ErrorCode.SecondFactorRequired);
  }
  const isValidToken = totpAuthenticatorCheck(credentials.totpCode, secret);
  if (!isValidToken) {
    throw new Error(ErrorCode.IncorrectTwoFactorCode);
  }
}

For 2FA users, the same flaw drops password validation. A valid TOTP alone grants entry, gutting multi-factor security. Attackers could easily guess or phish TOTP codes.

AspectDetails
Affected Versions≤ 5.9.7
Patched Versions5.9.8
PackageNo specific package listed
CVSS ScoreCritical (no exact score; high impact)

Potential Impact and Mitigation Steps

Attackers with an email can impersonate users, steal meeting links, calendars, and sensitive info.

It enables account takeover, user enumeration, and supply chain risks for Cal.com’s enterprise users. Non-2FA accounts fall fastest; 2FA ones weaken to single-factor.

Fixes demand strict dual checks: always verify passwords before TOTP, regardless of input. Cal.com patched this in 5.9.8 by reordering logic.

Admins must upgrade, enforce 2FA, and audit logs for fake TOTP logins. Monitor for anomalies, such as rapid failed TOTP attempts tied to email addresses.

This underscores the pitfalls of TOTP in auth flows. Developers, audit conditionals to prevent bypasses. Check the complete advisory for patches.

Varshini

Varshini is a Cyber Security expert in Threat Analysis, Vulnerability Assessment, and Research. Passionate about staying ahead of emerging Threats and Technologies..

Recent Posts

Burp Suite Supercharges Its Scanning Capabilities With React2Shell Vulnerability Detection

PortSwigger has leveled up Burp Suite's scanning arsenal with the latest Active Scan++ extension, version…

4 months ago

Malicious MCP Servers Enable New Prompt Injection Attack To Drain Resources

Unit 42 researchers at Palo Alto Networks exposed serious flaws in the Model Context Protocol…

4 months ago

Law Enforcement Detains Hackers Equipped With Specialized Flipper Hacking Tools

Polish police have arrested three Ukrainian men traveling through Europe and seized a cache of…

4 months ago

Google Unveils 10 New Gemini-Powered AI Features For Chrome

Google has launched its most significant Chrome update ever, embedding Gemini AI across the browser…

4 months ago

CISA Alerts On Actively Exploited Buffer Overflow Flaw In D-Link Routers

Attackers exploit this vulnerability through the router's web interface components, specifically "cgibin" and "hnap_main," by…

4 months ago

Over 500 Apache Tika Toolkit Instances Exposed To Critical XXE Vulnerability

Security researchers have uncovered a severe flaw in Apache Tika, a popular open-source toolkit for…

4 months ago