-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Consistently use constant-time comparison of password hashes instead of bare password strings #7455
Conversation
2a52bbf
to
0848136
Compare
As per golang/go#47001 even subtle.ConstantTimeCompare should never be used with variable-length inputs, as it will return 0 if the lengths do not match. Switch to consistently using constant-time comparisons of hashes for password checks to avoid any possible side-channel leaks that could be combined with other vectors to discover password lengths. Signed-off-by: Brad Davidson <[email protected]>
0848136
to
840ddeb
Compare
@@ -60,14 +60,6 @@ func Read(file string) (*Passwd, error) { | |||
return result, nil | |||
} | |||
|
|||
func (p *Passwd) Check(name, pass string) (matches bool, exists bool) { |
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.
Note: this function was not used anywhere in the codebase.
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## master #7455 +/- ##
===========================================
+ Coverage 19.48% 47.53% +28.04%
===========================================
Files 81 139 +58
Lines 5497 14254 +8757
===========================================
+ Hits 1071 6775 +5704
- Misses 4204 6403 +2199
- Partials 222 1076 +854
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
Proposed Changes
Consistently use constant-time comparison of password hashes
As per golang/go#47001 even subtle.ConstantTimeCompare should never be used with variable-length inputs, as it will return 0 if the lengths do not match. Switch to consistently using constant-time comparisons of hashes for password checks to avoid any possible side-channel leaks that could be combined with other vectors to discover password lengths.
The
passwordfile
misuse ofsubtle.ConstantTimeCompare
comes from upstream Kubernetes:https://github.com/kubernetes/kubernetes/blob/release-1.18/staging/src/k8s.io/apiserver/plugin/pkg/authenticator/password/passwordfile/passwordfile.go
Types of Changes
bugfix
Verification
Normal CI and release testing (no visible user impact)
Testing
Linked Issues
User-Facing Change
Further Comments