Repository navigation
Description
Preface
To issue, manage and validate authentication tokens (bearer tokens), Keystone currently offers two backends1 (called providers):
- Fernet
- was introduced in Kilo and made the default in the Pike release, deprecating UUID tokens
- all tokens are encrypted
- shared symmetric key repository between Keystone instances that needs to be rotated in sync
- JWS
- was introduced in the Stein release als an alternative to Fernet
- tokens are only signed, not encrypted
- each Keystone server has its own signing key pair, which can be rotated individually
Motivation
The current default token provider in Keystone is based on Fernet.
By now, Fernet is a pretty old standard with no visible maintainership over the last decade:
- The Fernet spec has not received updates since 2014 and is still limited to AES1282.
- Updating Fernet to support AES192 and AES256 was attempted 8 years ago but was not implemented due to the lack of maintainership3.
- Concerns raised about the spec failing to meet current security recommendations were left unanswered4.
Although python-cryptography actively maintains the implementation of Fernet, it is limited to the design choices of the Fernet spec, e.g. limited to AES128.
Keystone actually shares some of these concerns, which was the main motivation behind introducing the alternative JWS token provider backend5. In contrast to Fernet, JSON Web Signature (JWS) is a widely adopted and more recent IETF standard.
Since there was no activity in recent years, it does not seem like Fernet will receive updates any time soon. As a result, its design choices will become more and more outdated as security recommendations will shift towards stronger algorithms over time due to the technical progress.
Request
SCS should evaluate whether the shortcomings of the Fernet token provider are a concern that should be adressed now or in the foreseeable future.
Resulting actions could be implementing a guideline or standard for SCS clouds to favor the JWS token provider in case Fernet is deemed insufficient.
Footnotes
-
https://docs.openstack.org/keystone/latest//admin/tokens-overview.html#token-providers ↩
-
https://github.com/fernet/spec/blob/20dead475f53f11d20592baf29ad697163afc0cd/Spec.md ↩
-
https://github.com/fernet/spec/pull/17 ↩
-
https://github.com/fernet/spec/issues/8 ↩
-
https://specs.openstack.org/openstack/keystone-specs/specs/keystone/stein/json-web-tokens.html#problem-description ↩
Activity
markus-hentsch commentedon Mar 13, 2024
We discussed this in today's IaaS and IAM calls. Key points:
markus-hentsch commentedon Mar 13, 2024
Cross-referencing the Barbican plugins discussion here since it is related: SovereignCloudStack/standards#509 (comment)
markus-hentsch commentedon Mar 14, 2024
Thoughts on security implications
Disclaimer: The following is not a professional audit of token security but just my thoughts about the matter based on the information I have gathered so far. It is meant to provide a rough picture of what the implications of Fernet's design choices could be at the time of writing. It might not cover all resulting attack vectors or threats.
Preface
The Fernet spec1 states the following about the key structure:
Scenario A: Decryption
An adversary is able to decrypt existing auth tokens originally issued by the Fernet token provider of Keystone.
Implications:
Requirements:
Assessment:
Scenario B: Encryption
An Adversary is able to encrypt auth tokens with a Fernet key reconstructed from one or multiple collected auth tokens.
Implications:
Requirements:
Assessment:
Bottom line
The only real threat seems to be scenario B. Since Fernet tokens are both encrypted and signed, the AES-128 encryption key (128 bit) is most likely not sufficient to craft valid tokens that will be accepted by Keystone because they also need to be signed using the signing key, which consists of another 128 bits. Thus, successfully crafting a valid auth token requires 256 bit of key material in total.
Having a lower-grade algorithm for the encryption part (AES-128 as opposed to AES-192 or AES-256) does not seem to be problematic here as the encrypted portion of an auth token does not carry highly sensitive information which could be used to compromise things on their own.
For comparison, the JWS token provider does not encrypt this information at all.
Footnotes
https://github.com/fernet/spec/blob/master/Spec.md#key-format ↩
https://files.openstack.org/docs/keystone/2023.2/_modules/keystone/token/providers/fernet/core.html#Provider.generate_id_and_issued_at ↩
markus-hentsch commentedon Mar 14, 2024
Based on the thoughts I collected above, I think there is no pressing need currently for SCS to strictly push JWS as long as there is no known vulnerability or weakness for Fernet specifically. Going away from Fernet would be more about future-proofness than concrete security concerns at the time of writing.
josephineSei commentedon Mar 14, 2024
I read through the security implications and I share Markus opinion.
markus-hentsch commentedon Mar 27, 2024
We discussed this in the SCS IaaS community call on 2024-03-20 and concluded that there currently is no need to establish any restrictions or guidelines as both provider backends currently offered by OpenStack (Fernet and JWS) are valid choices based on the evaluation above.