From 8a4bf386552f976b0f16907b309d6c3119f85f01 Mon Sep 17 00:00:00 2001 From: epriestley Date: Wed, 7 Nov 2018 09:07:02 -0800 Subject: [PATCH] Use 160-bit TOTP keys rather than 80-bit TOTP keys Summary: See . 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 --- src/applications/auth/factor/PhabricatorTOTPAuthFactor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/applications/auth/factor/PhabricatorTOTPAuthFactor.php b/src/applications/auth/factor/PhabricatorTOTPAuthFactor.php index 373adfbb54..7d7aec921f 100644 --- a/src/applications/auth/factor/PhabricatorTOTPAuthFactor.php +++ b/src/applications/auth/factor/PhabricatorTOTPAuthFactor.php @@ -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(