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

Susceptible to timing attacks #1

Closed
jceipek opened this issue Feb 8, 2019 · 1 comment
Closed

Susceptible to timing attacks #1

jceipek opened this issue Feb 8, 2019 · 1 comment
Assignees

Comments

@jceipek
Copy link

jceipek commented Feb 8, 2019

I ended up using "golang.org/x/crypto" directly in my own project, but just as a heads up, this implementation currently uses a time-insecure hash comparison because it early outs when it finds a mismatching byte here: https://github.com/dwin/goArgonPass/blob/master/password.go#L142

You can read about timing attacks here: https://codahale.com/a-lesson-in-timing-attacks/ but the core issue is that a determined attacker could measure the difference in execution time between a comparisonHash that has more vs fewer initial bytes in common with decodedHash.

Go's crypto library provides a time-secure comparison function you can use instead: https://golang.org/pkg/crypto/subtle/#ConstantTimeCompare

Full disclosure: I am not a cryptographer, nor do I know the specifics of how Argon2 works.

@dwin dwin closed this as completed in 408dbc2 Feb 8, 2019
@dwin
Copy link
Owner

dwin commented Feb 8, 2019

Thanks!

@dwin dwin self-assigned this Feb 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants