REST API: Keycloak OAuth 2.0 still allows grant_type=password disallowed by OAuth 2.0 Security BCP (and other BCP MUST violations)

  • I am able to generate perpetual refresh tokens using legacy username/password authentication and without use of any 2FA:

    OAuth 2.1 does not have this grant type, and OAuth 2.0 Security BCP (Best Current Practice) disallows password grants:

    2.4. Resource Owner Password Credentials Grant

    The resource owner password credentials grant [RFC6749] MUST NOT be used. This grant type insecurely exposes the credentials of the resource owner to the client. Even if the client is benign, usage of this grant results in an increased attack surface (i.e., credentials can leak in more places than just the authorization server) and in training users to enter their credentials in places other than the authorization server.

    Furthermore, the resource owner password credentials grant is not designed to work with two-factor authentication and authentication processes that require multiple user interaction steps. Authentication with cryptographic credentials (cf. WebCrypto [W3C.WebCrypto], WebAuthn [W3C.WebAuthn]) may be impossible to implement with this grant type, as it is usually bound to a specific web origin.

    In addition, while reviewing the OIDC configuration, there were several other "MUST" violations as well as some other settings that should follow the "SHOULD" recommendations. It may be worth performing a compliance review of your configuration against the security BCP. Issues that I immediately see:

    • PKCE `plain` method exposes verifier, PKCE is optional and not mandatory
    • `implicit` grants

    2 Mal editiert, zuletzt von leee (29. November 2025 um 15:23)

  • leee 29. November 2025 um 15:16

    Hat den Titel des Themas von „REST API: Keycloak OAuth 2.0 still allows grant_type=password disallowed by OAuth 2.0 Security BCP“ zu „REST API: Keycloak OAuth 2.0 still allows grant_type=password disallowed by OAuth 2.0 Security BCP (and other BCP MUST violations)“ geändert.