HomePhorge

Don't use "phutil_hashes_are_identical()" to compare public keys

Description

Don't use "phutil_hashes_are_identical()" to compare public keys

Summary:
Ref T13436. There's no real security value to doing this comparison, it just wards off evil "security researchers" who get upset if you ever compare two strings with a non-constant-time algorithm.

In practice, SSH public keys are pretty long, pretty public, and have pretty similar lengths. This leads to a relatively large amount of work to do constant-time comparisons on them (we frequently can't abort early after identifying differing string length).

Test Plan: Ran bin/ssh-auth --sshd-key ... on secure with ~1K keys, saw runtime drop by ~50% (~400ms to ~200ms) with ===.

Maniphest Tasks: T13436

Differential Revision: https://secure.phabricator.com/D20875

Details

Provenance
epriestleyAuthored on Oct 28 2019, 6:28 PM
themackabuPushed on Tue, Mar 25, 8:07 PM
Parents
rP24f771c1bc07: Add an optional "--sshd-key" argument to "bin/ssh-auth" for reading "%k" from…
Branches
Unknown
Tags
Unknown

Event Timeline