Skip to content
OAuth / SSO Disclosed report Intermediate CVE-2024-22403

OAuth2 "authorization_code" is valid indefinetly

The OAuth2 authorisation endpoint stored issued authorisation codes without any expiry, contrary to the recommended ten-minute lifetime. An attacker who obtained a code could redeem it much later, or could keep guessing codes indefinitely.

mikaelgundersen Follow

Originally disclosed on HackerOne

Bounty$100 Low 3.0 View original
  • Triaged in under an hour
  • Fixed in 12 months
  • Paid in 12 months
  • Disclosed after 15 months

Summary by the program

Security advisory at https://github.com/nextcloud/security-advisories/security/advisories/GHSA-wppc-f5g8-vx36

The report

Your OAuth2 endpoint is not at all following best practices. When the authorization_code is generated it is stored without a timeout. Now according to https://www.rfc-editor.org/rfc/rfc6749#section-4.1.2 10 minutes is recommended. As the goal is that is gets used almost directly or not at all.

Now there is a debate maybe to have on the 10 minutes. But there is kind of a big difference between 10 minutes and no timeout at all.

Impact

An attacker that obtains this code could possibly easily redeem it in the future. Or an attacker could just keep trying codes.

The original report as published on HackerOne, by mikaelgundersen. Images and videos are our own copies; raw HTML is shown as text. View it on HackerOne.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely the authorisation codes were persisted without an expiry timestamp or cleanup, so they remained valid until redeemed.

Impact

An attacker holding a code could possibly redeem it later, and could keep trying codes.

What the attacker needed

Attacker obtains a valid authorisation code

The fix

Authorisation codes should be given a short lifetime, such as the recommended ten minutes, and rejected once expired.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

When you log in to a site using another service, the service hands back a short-lived ticket called an authorisation code that the site swaps for access. These tickets are meant to expire quickly so a stolen one is useless. Here they never expired, so a leaked ticket stayed usable.

What is OAuth / SSO?

Mistakes in OAuth, OpenID Connect, SAML or token handling that leak codes and tokens or link an attacker's identity to a victim's account.

More by mikaelgundersen

View all

6 more disclosed reports, best first.

More from Nextcloud

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

OAuth and single sign-on flaws

The lesson behind this report.

Mistakes in OAuth, OpenID Connect, SAML or token handling that leak codes and tokens or link an attacker's identity to a victim's account.