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

Change Traffic Ops password hashing to scrypt #602

Closed
wants to merge 1 commit into from

Conversation

rob05c
Copy link
Member

@rob05c rob05c commented May 23, 2017

Note this is not a security vulnerability or mitigation in itself. In the event the database is compromised, it prevents an attacker from learning the users' passwords.

Which is the intention of hashing the passwords in the first place; but sha1 doesn't accomplish that. Nor does sha512, the problem isn't sha1's brokenness, it's that fast hashes aren't designed to solve this problem. The hash must be computationally slow ("slow" here means several milliseconds). Scrypt is a stretching hash, and solves the problem.

@mitchell852
Copy link
Member

I'll try to look at this tomorrow. thanks @rob05c

@mitchell852
Copy link
Member

sorry, i merged another PR that created a conflict for you...

@rob05c
Copy link
Member Author

rob05c commented Jun 5, 2017

Fixed.

@mitchell852
Copy link
Member

i'm seeing this when i try to login

[2017-06-07 10:59:36,931] [DEBUG] POST "/api/1.2/user/login".
[2017-06-07 10:59:37,072] [DEBUG] Routing to controller "API::User" and action "login".
[2017-06-07 10:59:37,077] [ERROR] Undefined subroutine &Utils::Helper::sha1_hex called at /code/src/github.com/apache/incubator-trafficcontrol/traffic_ops/app/lib/Utils/Helper.pm line 147.

@rob05c
Copy link
Member Author

rob05c commented Jun 7, 2017

Ah, Helper.pm didn't already use SHA1. Not sure how it worked for me; should be fixed.

return scrypt_hash($pass, \64, 16384, 8, 1, 64);
}

sub verify_pass {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how about a comment here describing what's going on? I assume it's for a gradual upgrade -- trying both crypt and sha1 for passwords that haven't been upgraded yet..

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -28,7 +28,7 @@ use DBI;
use POSIX;
use File::Basename qw{dirname};
use File::Path qw{make_path};
use Digest::SHA1 qw(sha1_hex);
use Crypt::ScryptKDF qw(scrypt_hash);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

was this added to the cpanfile?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't appear to be in there.. please add to that module to traffic_ops/app/cpanfile

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure how I missed that.. thanks..

@asfgit asfgit closed this in acd48b6 Jun 8, 2017
@rob05c rob05c deleted the to-scryptpasses branch November 13, 2017 18:20
@zrhoffman zrhoffman added the authentication Relating to login, registration, passwords, tokens, etc. label Jan 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
authentication Relating to login, registration, passwords, tokens, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants