Page MenuHomePhabricator

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

Authored by epriestley on Nov 7 2018, 5:13 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Nov 4, 5:03 AM
Unknown Object (File)
Oct 15 2024, 1:03 PM
Unknown Object (File)
Oct 14 2024, 3:19 AM
Unknown Object (File)
Oct 13 2024, 12:52 PM
Unknown Object (File)
Oct 13 2024, 12:47 PM
Unknown Object (File)
Oct 9 2024, 10:33 AM
Unknown Object (File)
Sep 11 2024, 5:41 PM
Unknown Object (File)
Sep 9 2024, 12:55 PM
Subscribers
None

Details

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.

Diff Detail

Repository
rP Phabricator
Branch
totplen
Lint
Lint Passed
Unit
Tests Passed
Build Status
Buildable 21108
Build 28694: Run Core Tests
Build 28693: arc lint + arc unit

Event Timeline

amckinley added inline comments.
src/applications/auth/factor/PhabricatorTOTPAuthFactor.php
188

Just for giggles, I checked that auth_factorconfig.factorSecret was compatible with this change, and yeah, it's a LONGTEXT. I also don't think it's worth migrating existing secrets or throwing a setup warning for installs with the old "less secure" TOTP secrets, but maybe we should call out this change in particular in the changelog?

This revision is now accepted and ready to land.Nov 7 2018, 7:02 PM

Yeah, I'll note this in the changelog. I think migrating is probably not worth the effort since even 80 bit secrets are not really within reach of any practical attacker today, but might add a UI hint when MFA next gets a round of updates.

This revision was automatically updated to reflect the committed changes.