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

crypto/x509: check the Key Usage extension #40100

Open
FiloSottile opened this issue Jul 7, 2020 · 6 comments
Open

crypto/x509: check the Key Usage extension #40100

FiloSottile opened this issue Jul 7, 2020 · 6 comments
Labels
NeedsFix
Milestone

Comments

@FiloSottile
Copy link
Contributor

@FiloSottile FiloSottile commented Jul 7, 2020

We currently ignore the Key Usage extension because some old roots had gotten it wrong. Things probably improved by now and we can take a stab at following the spec again. AFAIK other verifiers do check them.

@FiloSottile FiloSottile added the NeedsFix label Jul 7, 2020
@FiloSottile FiloSottile added this to the Go1.16 milestone Jul 7, 2020
@gopherbot
Copy link

@gopherbot gopherbot commented Aug 5, 2020

Change https://golang.org/cl/246877 mentions this issue: crypto: check the Key Usage extension

@SparrowLii
Copy link
Contributor

@SparrowLii SparrowLii commented Aug 5, 2020

I searched the crypto pkg and found there are two functions in crypto which relate to KU extension checking:
CheckSignature(x509.go 823) and verifyHandshakeSignature(auth.go 22). But it seems hard to check the KU inside the func body. I think maybe we can check KU before use one PublicKey.

@ottosulin
Copy link

@ottosulin ottosulin commented Jan 23, 2021

KU extensions can also be checked with the Verify method available for certificates. If you are considering rewriting KU extension checking I suggest you also take a look at this:
https://go.googlesource.com/go/+/go1.15.6/src/crypto/x509/verify.go#803

I think the method makes a bit too straightforward assumption about KUs if the opts.KeyUsages is left empty. I'm not sure if it would be better to then assume that no usage is ok or to get the acceptable KUs from the cert chain.

@odeke-em
Copy link
Member

@odeke-em odeke-em commented Feb 5, 2021

Thanks everyone for the interaction. Not much action during Go1.16, thus I'll punt to Go1.17, and I'll kindly tag you @FiloSottile @katiehockman @rolandshoemaker to help review @SparrowLii's CL from #40100 (comment)

@odeke-em odeke-em removed this from the Go1.16 milestone Feb 5, 2021
@odeke-em odeke-em added this to the Go1.17 milestone Feb 5, 2021
@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Apr 28, 2021

Is anything going to happen here for 1.17? Thanks.

@dmitshur
Copy link
Contributor

@dmitshur dmitshur commented May 21, 2021

Moving to Backlog since it doesn't appear someone is actively working on getting this into 1.17, and it can wait. Please update this issue if needed.

@dmitshur dmitshur removed this from the Go1.17 milestone May 21, 2021
@dmitshur dmitshur added this to the Backlog milestone May 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsFix
Projects
None yet
Development

No branches or pull requests

7 participants