Skip to main content
Menu
Advisories

Login CSRF: OAuth callback accepted when no login was started

GHSA-H6VP-4QR8-GVH5Published Updated GitHub

Description

validateNonce() in decap-cms-lib-auth compared the state nonce of an OAuth callback with the nonce stored in sessionStorage without checking that a nonce had been stored. When no login was started in the tab, the stored side is null, so a callback carrying state={"nonce":null} passed the check. The OAuth state check, which protects against login CSRF, was bypassed.

Example attack URL for the implicit flow:

/admin/#access_token=ATTACKER_TOKEN&token_type=bearer&state={"nonce":null}

The CMS stores the attacker's token as the signed-in user and sends it to the Git provider's API.

Impact

Login CSRF. An editor who opens a crafted link is signed into the CMS with the attacker's Git provider account. Content the editor then saves (entries, drafts, media, editorial workflow pull requests) is written with the attacker's token wherever that account has access, and is attributed to the attacker.

Affected: backends that use the implicit flow (Azure, and GitLab or Bitbucket with auth_type: implicit). PKCE flows also passed the nonce check, but the code exchange then fails without the matching code_verifier.

Patches

Fixed in decap-cms-lib-auth 3.5.0, shipped in decap-cms and decap-cms-app 3.19.0. A callback is now accepted only when a non-empty nonce was stored by this tab and matches.

Workarounds

None besides upgrading.

Credit

Reported by Zachariah Mithani (AploSec).

Affected versions

References

GitHub · decaporg/decap-cms