Page MenuHomePhabricator

Switch WMF production to Argon2 password hashes
Closed, ResolvedPublic

Description

Argon2 is a new-generation key derivation algorithm that was designed to resist side-channel (i variants) and GPU brute force (d variants), unlike our current PBKDF2. Now that we have Argon2 support in core, we should talk about protecting our users with it.

  • Argon2i requires PHP 7.2
  • Argon2id requires PHP 7.3

We need to determine whether we want to wait for PHP 7.3 to get Argon2id, and determine algorithm parameters (memory cost, time cost and thread count).


Blocked on completion of T176370: Migrate to PHP 7 in WMF production.

Event Timeline

Argon2 is a new-generation key derivation algorithm that was designed to resist side-channel (i variants) and GPU brute force (d variants), unlike our current PBKDF2. Now that we have Argon2 support in core, we should talk about protecting our users with it.

Its been a while since I read up on these, but I thought Argon2i is meant to resist side-channel leaks relative to other variants of Argon2, not necessarily in comparison to SHA512-PBKDF.

Memory hardness/GPU-resistence would be the big win here. The i variant is still a very significant improvement over SHA512-PBKDF in that category.

FYI: The argon2 paper suggests parameters of 0.5 seconds, 1 GB ram, and 2 threads for password hashing with argon2i. We should probably make our own determinations, and I'm not sure how old the recommendation in the paper is, but at least that's a starting point.

Krinkle subscribed.

De'refing the sub tree for now as it's really its own project. Hopefully makes the graph a bit easier to follow and makes space for other sub tasks that are more directly related to this initiative.

This issue is blocked on PHP 7.2 deployment being completed but is not itself a problem to be solved before PHP 7.2+ can be considered adopted/supported.

Meanwhile, PBKDF2 is now considered a "last resort" algorithm (and we're doing only 30K iterations compared to 85K recommended).

Unfortunately, Argon2 will most likely be broken in a backwards-incompatible way in PHP 7.4: https://wiki.php.net/rfc/sodium.argon.hash

Can't trust it right now.

Unfortunately, Argon2 will most likely be broken in a backwards-incompatible way in PHP 7.4: https://wiki.php.net/rfc/sodium.argon.hash

Can't trust it right now.

I just skimmed the rfc - at first glance it looks like its backwards compatible as long as we specify a non-default cost of at least 3

Perryprog reopened this task as Open.EditedNov 8 2021, 4:37 PM
Perryprog subscribed.

We're on PHP 7.2 now and the part mentioned earlier has been struck in the standard, so this may be worth a second look.

Change #1029183 had a related patch set uploaded (by Zabe; author: Zabe):

[operations/mediawiki-config@master] Use encrypted Argon2 Hashes to store user passwords

https://gerrit.wikimedia.org/r/1029183

Change #1029225 had a related patch set uploaded (by Zabe; author: Zabe):

[mediawiki/core@master] Make EncryptedPassword work with Argon2Password

https://gerrit.wikimedia.org/r/1029225

Change #1029225 merged by jenkins-bot:

[mediawiki/core@master] Make EncryptedPassword work with Argon2Password

https://gerrit.wikimedia.org/r/1029225

Change #1029252 had a related patch set uploaded (by Zabe; author: Zabe):

[mediawiki/core@REL1_39] Make EncryptedPassword work with Argon2Password

https://gerrit.wikimedia.org/r/1029252

Change #1029253 had a related patch set uploaded (by Zabe; author: Zabe):

[mediawiki/core@REL1_40] Make EncryptedPassword work with Argon2Password

https://gerrit.wikimedia.org/r/1029253

Change #1029254 had a related patch set uploaded (by Zabe; author: Zabe):

[mediawiki/core@REL1_41] Make EncryptedPassword work with Argon2Password

https://gerrit.wikimedia.org/r/1029254

Change #1029255 had a related patch set uploaded (by Zabe; author: Zabe):

[mediawiki/core@REL1_42] Make EncryptedPassword work with Argon2Password

https://gerrit.wikimedia.org/r/1029255

Change #1029255 merged by jenkins-bot:

[mediawiki/core@REL1_42] Make EncryptedPassword work with Argon2Password

https://gerrit.wikimedia.org/r/1029255

Change #1029252 merged by jenkins-bot:

[mediawiki/core@REL1_39] Make EncryptedPassword work with Argon2Password

https://gerrit.wikimedia.org/r/1029252

Change #1029254 merged by jenkins-bot:

[mediawiki/core@REL1_41] Make EncryptedPassword work with Argon2Password

https://gerrit.wikimedia.org/r/1029254

Change #1029253 merged by jenkins-bot:

[mediawiki/core@REL1_40] Make EncryptedPassword work with Argon2Password

https://gerrit.wikimedia.org/r/1029253

Change #1029183 merged by jenkins-bot:

[operations/mediawiki-config@master] Use encrypted Argon2 Hashes to store user passwords

https://gerrit.wikimedia.org/r/1029183

Mentioned in SAL (#wikimedia-operations) [2024-05-21T22:56:51Z] <zabe@deploy1002> Started scap: Backport for [[gerrit:1029183|Use encrypted Argon2 Hashes to store user passwords (T150647 T216682)]]

Mentioned in SAL (#wikimedia-operations) [2024-05-21T22:59:31Z] <zabe@deploy1002> zabe: Backport for [[gerrit:1029183|Use encrypted Argon2 Hashes to store user passwords (T150647 T216682)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2024-05-21T23:23:43Z] <zabe@deploy1002> Finished scap: Backport for [[gerrit:1029183|Use encrypted Argon2 Hashes to store user passwords (T150647 T216682)]] (duration: 26m 51s)