Skip to content

UID2-7641: Remove support for V2 refresh tokens - #2718

Open
samin-ttd wants to merge 4 commits into
mainfrom
sra-UID2-7641-fix-refresh-padding-oracle-vulnerability
Open

UID2-7641: Remove support for V2 refresh tokens#2718
samin-ttd wants to merge 4 commits into
mainfrom
sra-UID2-7641-fix-refresh-padding-oracle-vulnerability

Conversation

@samin-ttd

@samin-ttd samin-ttd commented Sep 2, 2026

Copy link
Copy Markdown

Summary

Fixes a padding-oracle-style information leak in the /token/refresh endpoint. Previously, only ClientInputValidationException during refresh token decoding was caught and mapped to RefreshResponse.Invalid — any other exception (notably BadPaddingException / IllegalBlockSizeException from the underlying cipher on malformed ciphertext) propagated up and resulted in a different response (500) than the standard invalid-token response (400). This discrepancy let an attacker distinguish "malformed padding" from "well-formed but invalid token" purely from the HTTP status code — a classic padding oracle.

Change

  • Added a catch-all Exception handler around refresh token decoding.
  • BadPaddingException / IllegalBlockSizeException (and any other exception) are now logged and mapped to RefreshResponse.Invalid, so the response is indistinguishable from other invalid-token cases — always 400, no signal leaked to the caller.
  • Distinguishes expected padding/block-size failures (WARN) from truly unexpected errors (ERROR) in logging, to preserve operational visibility without changing the response behavior.

Testing

  • Send requests crafted to trigger padding against the endpoint both before and after the change: ensure the response is 500 before and 400 after

@samin-ttd
samin-ttd force-pushed the sra-UID2-7641-fix-refresh-padding-oracle-vulnerability branch from 0690322 to b220bdf Compare September 2, 2026 05:50
@samin-ttd
samin-ttd force-pushed the sra-UID2-7641-fix-refresh-padding-oracle-vulnerability branch from c82fcee to 7cfb5b1 Compare September 2, 2026 23:01
@samin-ttd samin-ttd changed the title UID2-7641: Fix padding oracle vulnerability in token/refresh UID2-7641: Remove support for V2 refresh tokens Sep 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant