-
Notifications
You must be signed in to change notification settings - Fork 161
Conversation
a.AttData.AAGUID = rawAuthData[37:53] | ||
idLength := binary.BigEndian.Uint16(rawAuthData[53:55]) | ||
if len(rawAuthData) < int(55+idLength) { | ||
return ErrBadRequest.WithDetails("Authenticator attestation data length too short") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can add a testcase for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, the test is probably a good idea. Also see my suggestion. Per the spec the credentialIdLength must be less than or equal to 1023.
Also maybe we want to include it with minAuthDataLength/minAttestedAuthLength as something like maxCredentialIDLength. Also shouldn't these be consts?
idLength := binary.BigEndian.Uint16(rawAuthData[53:55]) | ||
if len(rawAuthData) < int(55+idLength) { | ||
return ErrBadRequest.WithDetails("Authenticator attestation data length too short") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
idLength := binary.BigEndian.Uint16(rawAuthData[53:55]) | |
if len(rawAuthData) < int(55+idLength) { | |
return ErrBadRequest.WithDetails("Authenticator attestation data length too short") | |
} | |
idLength := binary.BigEndian.Uint16(rawAuthData[53:55]) | |
if len(rawAuthData) < int(55+idLength) { | |
return ErrBadRequest.WithDetails("Authenticator attestation data length too short") | |
} | |
if idLength > 1023 { | |
return ErrBadRequest.WithDetails("Authenticator attestation data credential id length too long") | |
} |
See https://w3c.github.io/webauthn/#attested-credential-data
I've encountered this a couple times too. Unfortunately I don't have the raw request data that caused it, but here's a stack trace:
This is using go1.17.8 linux/amd64 and 4d1cf2d of this package. The PR looks like it'd resolve it to me! |
Yep that's precisely what this PR is looking to fix: webauthn/protocol/authenticator.go Line 210 in 4d1cf2d
|
Firefox 98.0 is causing this error when Attestation=NONE in my case, can provide information about the test case if needed. |
Would a new PR make sense at this point? I could give it a shot if so. Info for the test case would be good probably in that case! |
well i guess so |
I made #137, incorporating the comments here! |
Invalid data from the client will cause the server to panic from unchecked lengths