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

local my_make_scrambled_password() != mysqlclient's my_make_scrambled_password() #29

Closed
panlinux opened this issue May 15, 2017 · 2 comments

Comments

@panlinux
Copy link
Contributor

panlinux commented May 15, 2017

I think there is some confusion going on, even upstream, regarding these functions that unfortunately have very similar (long) names:
make_scrambled_password()
my_make_scrambled_password()
my_make_scrambled_password_sha1()

This is the current status:
make_scrambled_password(): wrapper for my_make_scrambled_password_sha1(). Produces hex text output.
my_make_scrambled_password(): something entirely different. Produces a non-hexified hash
pam_mysql's my_make_scrambled_password(): seems to mimick upstream's my_make_scrambled_password_sha1()

Bottom line, using upstream's my_make_scrambled_password() with a 42 byte buffer will lead to buffer overflows since it is not the same as my_make_scrambled_password_sha1() or the one reimplemented in pam_mysql.c. Upstream's my_make_scrambled_password() takes a CRYPT_MAX_PASSWORD_SIZE len buffer and does not produce the same type of value that is stored in the table when the PASSWORD() SQL function is used.

I think upstream is nowadays just not exporting the correct function. They should probably export make_scrambled_password() which maps to my_make_scrambled_password_sha1(), but it's messy now. I added a comment to #80974

For pam_mysql, I suggest to use make_scrambled_password() from mysqlclient if it exists, and if not reimplement it as you are doing now, but with the name make_scrambled_password.

Last but not least, even if it weren't for the overflow problem, the authentication will never work because the output of my_make_scrambled_password() will never match the hexified hash stored on the server.

NigelCunningham added a commit that referenced this issue May 24, 2017
…unction

Use correct scrambled password function (issue #29)
@panlinux
Copy link
Contributor Author

panlinux commented Jun 28, 2017

I believe this can be closed now? Or is it missing a merge against a particular branch? Or a new 0.8 release perhaps?

@NigelCunningham
Copy link
Owner

New 0.8 release coming :) Thanks.

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