Skip to content

Issue warning to folks using old sha256 hashed password #3560

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

Closed
jsjoeio opened this issue Jun 7, 2021 · 11 comments
Closed

Issue warning to folks using old sha256 hashed password #3560

jsjoeio opened this issue Jun 7, 2021 · 11 comments
Assignees
Labels
enhancement Some improvement that isn't a feature security Security related
Milestone

Comments

@jsjoeio
Copy link
Contributor

jsjoeio commented Jun 7, 2021

@jawnsy had a great idea:

I'm not sure where in the code to put it, but it would be nice to issue a warning if someone is using the plain text/cookie/sha256 methods to tell them that their authentication method is insecure, and to consider upgrading to argon2.

See: #3422 (comment)

Will look at after: #3422

@jsjoeio jsjoeio added enhancement Some improvement that isn't a feature security Security related labels Jun 7, 2021
@jsjoeio jsjoeio added this to the On Deck milestone Jun 7, 2021
@jsjoeio jsjoeio self-assigned this Jun 7, 2021
@finzzz
Copy link

finzzz commented Aug 10, 2021

I've tried to use argon2 but apparently it needs salt. But when I use salt, code-server cannot verify it.

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Aug 10, 2021

Hmm...that doesn't seem right. Can you provide steps to reproduce?

@finzzz
Copy link

finzzz commented Aug 10, 2021

Sorry my bad, I tried to use

echo "password" | argon2 passphrase -e

instead of

echo -n "password" | argon2 passphrase -e

But probably will help if someone encounters similar issue.

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Aug 10, 2021

You have to use argon2-cli because that's what code-server uses under the hood. I don't think argon2 will work because it uses a different hashing algorithm compared to argon2 the npm package (unless it changed and it does work, but that would be new to me).

Video

Here's how you can do it:

Screen.Recording.2021-08-10.at.1.55.39.PM.mov

@finzzz
Copy link

finzzz commented Aug 10, 2021

I don't know what's under the hood, but it works with argon2.

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Aug 10, 2021

Ah, interesting! Maybe I was using it wrong before but hey, glad that works then 🙌

@antofthy
Copy link

antofthy commented Dec 20, 2021

I for one would love to be able to figure out (or retrieve) the session token! Either from the password, or from the code-server configuration files. So far no luck getting anything to match up to the cookie! Code-Server v3.12.0

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Jan 3, 2022

So the user declares the password in the code-server config file. The password is then hashed and sent back in the response to the client and stored as a cookie. Here is the logic: https://github.com/coder/code-server/blob/main/src/node/routes/login.ts#L87

@antofthy
Copy link

antofthy commented Jan 4, 2022

Though I declare the password in an environment variable ($PASSWORD) in a docker instance.
But after some experiments I validated the URL encoded value of the 'key' cookie, to the given password.
As such if the cookie can be preset set for that website, I should be able to auto-initialise the login for a already authenticated user.

One small step... leading to another.
Of course if the hashing method changes that all gets broken!

@jsjoeio
Copy link
Contributor Author

jsjoeio commented Jan 4, 2022

@antofthy well keep an eye on any argon2 issues. If it does change, we should be able to add backwards-compatibility. You'll know though from the release notes

@code-asher
Copy link
Member

Merging with #3546

@code-asher code-asher closed this as not planned Won't fix, can't repro, duplicate, stale Jul 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Some improvement that isn't a feature security Security related
Projects
None yet
Development

No branches or pull requests

4 participants