1
0
Fork 0
mirror of https://we.phorge.it/source/phorge.git synced 2024-11-22 14:52:41 +01:00

Use 160-bit TOTP keys rather than 80-bit TOTP keys

Summary:
See <https://hackerone.com/reports/435648>. We currently use 80-bit TOTP keys. The RFC suggests 128 as a minimum and recommends 160.

The math suggests that doing the hashing for an 80-bit key is hard (slightly beyond the reach of a highly motivated state actor, today) but there's no reason not to use 160 bits instead to put this completely out of reach.

See some additional discussion on the HackerOne report about enormous key sizes, number of required observations, etc.

Test Plan: Added a new 160-bit TOTP factor to Google Authenticator without issue.

Reviewers: amckinley

Reviewed By: amckinley

Differential Revision: https://secure.phabricator.com/D19792
This commit is contained in:
epriestley 2018-11-07 09:07:02 -08:00
parent 1f6a4cfffe
commit 8a4bf38655

View file

@ -185,7 +185,7 @@ final class PhabricatorTOTPAuthFactor extends PhabricatorAuthFactor {
public static function generateNewTOTPKey() {
return strtoupper(Filesystem::readRandomCharacters(16));
return strtoupper(Filesystem::readRandomCharacters(32));
}
public static function verifyTOTPCode(