Disclaimer: everything that follows is a personal opinion - not an assertion of fact.
NIST has created Federal Information Processing Standard (FIPS) 140-2: Security Requirements for Cryptographic Modules. FIPS requirements are mandatory for Federal Government agencies, as prescribed by FISMA law. FIPS-140-2 Annex D covers Approved Key Establishment Techniques. The only FIPS-approved password-based key derivation algorithm is PBKDF2 (NIST SP800-132). Login.gov uses scrypt, which is not FIPS-approved. The FIPS-approved key-derivation algorithms are mostly covered by NIST SP800-108. Login.gov uses several custom approaches for key derivation, none of which are FIPS-approved.
Login.gov likely violates FISMA law. US-Government Agencies which operate IT systems/applications which rely on Login.gov (as presently designed) likely violate FISMA law.
My analysis is based on Login.gov encryption overview available here and here. The following problematic design choices are noted:
scrypt
is used as password-based KDF, which violates NIST 140-2.- Two subkeys
Z1
andZ2
are derived via a non-approved KDF. - The purpose of
Z1
is to act as a 2nd layer of encryption over the KMS-encrypted server-secretR
. This violates FIPS, since the only FIPS-approved encryption isAES
(in various approved encryption modes). - PII encryption key
E
is derived ashash (Z2 + Random)
. This is not a FIPS-approved KDF. hash(E)
is stored right next to the ciphertext from (4). Who thought that storing a hash of the encryption key right next to PII ciphertext encrypted with that key was a good idea?
(3) might also indicate an inadequate familiarity/understanding of AWS KMS. Z1
should have been passed as EncryptionContext
to KMS_GCM_Encrypt
, instead of the xor-masking silliness.
It is my opinion that Login.gov cryptography was put together by amateurs, and was never reviewed by professionals. If NIST has truly consulted on and approved the current design, NIST has a lot of explaining to do.
Login.gov encryption design is flawed and exhibits serious "rookie" mistakes. If I were an auditor reviewing their Assessment & Authorization, I would revoke their ATO (Authorization to Operate). There is no place for home-made cryptography in USG systems - so says the law.
P.S. For those who do not know what an audit is - this is clearly not an audit.
@tarcieri No one is arguing superiority or inferiority of
scrypt
overPBKDF2
. You don't get to choose what is/isn't superior when designing and accrediting USG systems: you follow NIST requirements (FIPS) and FISMA law. Those who try to argue that everything that precedesPBKDF2
inscrypt
should be considered as "key extraction", should read NIST SP800-56c, also referenced by FIPS-140-2 Annex-D (tldr: scrypt does not fly). Welcome to USG infosec compliance.scrypt
is one of the problems in Login.gov, but not the only problem - let's not make this about improper use ofscrypt
alone.