October 24th, 2023

Why is there a hash of a weak password in the Windows cryptographic libraries?

A customer found the byte sequence ba7816bf8f01cfea­414140de5dae2223­b00361a396177a9c­b410ff61f20015ad in the Windows cryptographic libraries. This is the SHA256 hash of the notoriously insecure password abc. (See pages 14 through 16 of the NIST Computer Security Resource Center, Cryptographic Standards and Guidelines, SHA examples document.) Why does the Windows cryptographic library use such a ridiculously weak password, and what is this password used for?

While it’s true that abc is a horrible password, it’s also the case that the Windows cryptographic libraries aren’t using it as a password. The value is part of a self-test that the libraries perform to verify that nothing obvious has gone wrong with the standard providers.

You can find this hard-coded “well-known SHA256” in the sha256.c module, with the “plaintext” in selftest.c. The values are used by the function Sym­Crypt­Sha256­Self­Test to verify that the algorithm produces the expected answer.

The fact that an insecure password appears in the cryptography libraries doesn’t mean that the library is using them as passwords. In this case, they are just test data.

Bonus chatter: I bet you can find insecure passwords in a lot of binaries if you set your mind to it. Just scan for the bytes 61 62 63 in any binary, and if you find it, you can get all excited: “Hey, your binary contains the insecure password abc!”

Topics
Other

Author

Raymond has been involved in the evolution of Windows for more than 30 years. In 2003, he began a Web site known as The Old New Thing which has grown in popularity far beyond his wildest imagination, a development which still gives him the heebie-jeebies. The Web site spawned a book, coincidentally also titled The Old New Thing (Addison Wesley 2007). He occasionally appears on the Windows Dev Docs Twitter account to tell stories which convey no useful information.

2 comments

Discussion is closed. Login to edit/delete existing comments.

  • Dave Gzorple

    It’s not just a particular artefact of the Windows cryptographic library, “abc” is a standard test string used for hash functions going back to at least MD5 in 1991. Other standard hash-function test strings are “a”, “message digest”, “abcdefghijklmnopqrstuvwxyz”, and “abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq”. If you look for MD5, SHA-1, and SHA-2 hashes of those in other crypto libraries you’ll find those as well.

  • Son Le

    nice post