Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of SignatureBits for ECDSA issuers (#14943) #14994

Merged

Conversation

cipherboy
Copy link
Contributor

Backport of #14943:

When adding SignatureBits control logic, we incorrectly allowed
specification of SignatureBits in the case of an ECDSA issuer. As noted
in the original request, NIST and Mozilla (and others) are fairly
prescriptive in the choice of signatures (matching the size of the
NIST P-curve), and we shouldn't usually use a smaller (or worse, larger
and truncate!) hash.

Ignore the configuration of signature bits and always use autodetection
for ECDSA like ed25519.

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>


This definitely warrants a changelog entry, but not sure if we need anything else? This was added in 1.10.0, we'll backport this to 1.10.1, fixing the issue. It only presently works on roles (it should probably be added to the other endpoints later?).

Ticket: VAULT-5707

When adding SignatureBits control logic, we incorrectly allowed
specification of SignatureBits in the case of an ECDSA issuer. As noted
in the original request, NIST and Mozilla (and others) are fairly
prescriptive in the choice of signatures (matching the size of the
NIST P-curve), and we shouldn't usually use a smaller (or worse, larger
and truncate!) hash.

Ignore the configuration of signature bits and always use autodetection
for ECDSA like ed25519.

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
@cipherboy cipherboy added bug Used to indicate a potential bug secret/pki cryptosec labels Apr 11, 2022
@cipherboy cipherboy added this to the 1.10.1 milestone Apr 11, 2022
@cipherboy cipherboy requested review from stevendpclark and a team April 11, 2022 19:22
@cipherboy cipherboy merged commit dda23ae into release/1.10.x Apr 11, 2022
@cipherboy
Copy link
Contributor Author

Thanks @stevendpclark!

@cipherboy cipherboy deleted the cipherboy-backport-fix-pki-ecdsa-signatures branch May 17, 2022 14:34
@martin31821
Copy link

Hi @cipherboy.

We're using Vault to manage Certificates in an embedded-secureboot scenario and unfortunately, this PR broke our workflow.
The actual hardware only supports SHA256 signatures on any EC curve (we're using secp521).

Is there any way, the possibility to override the default behavior could be reintroduced?
I agree that for the overwhelming majority of the people this behavior is totally fine, but I would still like to see the possibility to override the setting.

Maybe there should be an enforcement in place that rejects the SHA512/256 downsampling problem?

cipherboy added a commit that referenced this pull request Jul 18, 2022
In #14994, it was noticed that larger hashes than curve sizes could be
used for the majority of algorithms that it shouldn't be allowed for.
E.g., with P-256, a 512-bit SHA-2 invocation could be used, resulting in
an incorrect prefix truncation (different from the standardized
SHA-2-512/256 by NIST). This is non-standard and non-desirable.

However, in attempting to fix it, we broke users who were specifying
smaller hash functions than curve sizes. While this makes a little less
sense in general (why not use a smaller curve?) since support seems to
be fairly widespread for this, we attempt the following behavior:

 - If signature_bits is not specified, size based off the curve size.
 - If signature_bits is too large, size based off the curve size.
 - If signature_bits is the right size or smaller, use it.

This should allow for a reasonable rolling default with the value of
key_bits=0, while allowing undersized hashes when necessary.

Signed-off-by: Alexander Scheel <alex.scheel@hashicorp.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Used to indicate a potential bug cryptosec secret/pki
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants