Crypto Agility and Post Quantum Wed Aug 24 2022 What's Crypto Agility and Post Quantum? If you are writing an application, here's what you need to know. -------------------------------------------------------------------------------- Crypto Agility and Post Quantum =============================== Published Aug 24, 2022 - 13 min read /----- Table of contents -----\ | Table of contents | | * Cryptographic Agility | | * Post Quantum Cryptography | | * Side notes | \-----------------------------/ At DEF CON 30 "Crypto Agility" and "Post Quantum" buzz words were repeated in several villages. I heard it around the Privacy and Crypto village and Soatok heard about it at the Quantum village [L1]. If you are an application developer, keep reading, these words are for you! Note: A village in DEF CON is an organized area for a specific subdomain of the hacking community to gather and share ideas and experiences. Some villages receive sponsorships and those sponsors hold their own panels in the village space. Not all village panels are recorded or shared online. While Soatok wrote about his experience at the quantum village and then a follow up on cryptographic agility, I decided to commit my perspective too on these subjects. Cryptographic Agility --------------------- /[cendyne: anime-glasses]------------------------------------------------------\ | To start, let's review a definition of what cryptographic agility means or | | requires. | \------------------------------------------------------------------------------/ > Wikipedia > > A security system is considered crypto agile if its cryptographic algorithms > or parameters can be replaced with ease and is at least partly automated. > - Cryptographic agility [L2] /[cendyne: laptop-thinking]----------------------------------------------------\ | I believe there is a gradient of cryptographic agility: | | | | * You have no idea what crypto is in your system; | | * You have an idea of what crypto is in place but any changes require | | significant effort; | | * You have complete track of your crypto and you have reliable transition | | plans should any changes be required; | | * And any changes to your crypto can be managed with configuration to | | initiate and complete transitions between cryptographic algorithms. | | | | The inability to adjust your cryptography would be the opposite of agile. | \------------------------------------------------------------------------------/ /----------------------------------------------------------------[kyrmeso: wut]\ | What are the experts saying about crypto agility? | \------------------------------------------------------------------------------/ /[cendyne: music]--------------------------------------------------------------\ | Take a listen to Cryptographic Agility: Anticipating, Preparing for and | | Executing Change [L3] from RSA Conference 2020. From this I learned | | Microsoft found 50 distinct implementations of MD5 in the windows code base. | | Quite a few interesting recounts are described in this panel. | \------------------------------------------------------------------------------/ /------------------------------------------------------------------------------\ | RSA Conference | |------------------------------------------------------------------------------| | Youtube Video [L4] | | Cryptographic Agility: Anticipating, Preparing for and Executing Change [L3] | | 1/9/2023 | \------------------------------------------------------------------------------/ /---------------------------------------------------------------[kyrmeso: blep]\ | What do you have to say about crypto agility? | \------------------------------------------------------------------------------/ /[cendyne: public-speaking]----------------------------------------------------\ | I am only going to talk about what I have actually done. My recommendations | | come from my professional experience as a developer and now manager. None of | | this is armchair cryptography. | \------------------------------------------------------------------------------/ /[cendyne: proud]--------------------------------------------------------------\ | The application I am responsible for has ascended from crypto-ignorance to | | crypto-aware with interface points ready for any cryptographic migrations. | | Appropriate and correctly applied modern cryptography is deployed to | | production and I expect that no changes will be needed for a few years. | \------------------------------------------------------------------------------/ /[cendyne: i-dunno-man-im-just-a]----------------------------------------------\ | That said, I have not gotten application level cryptography to the point | | where migrations may be done through configuration. Unlike X.509, | | application cryptography has a wide set of use cases and solutions. I | | believe most changes require active human intervention to safely alter and | | to provide high availability of service during and after the change. | \------------------------------------------------------------------------------/ /-----------------------------------------------------------[kyrmeso: ych-boop]\ | What do I need to do to get as far as you have? | \------------------------------------------------------------------------------/ /[cendyne: i-am-looking]-------------------------------------------------------\ | The first step to being agile is to take an inventory of what you are using, | | for what purpose, and where. When you look, you might find out that the | | wrong technology is being applied in your code. For example, using RSA | | encryption for small messages that are encrypted and decrypted on the same | | server. A symmetric algorithm is more appropriate. | \------------------------------------------------------------------------------/ /[cendyne: the-more-you-know]--------------------------------------------------\ | The second step is to stay informed of what's going on in the field. Watch | | for updates to the tools available in your language of choice. Listen and | | watch for deprecated or broken algorithms just as you would with security | | vulnerabilities and see if you are using any of them. For example, JDK 16 | | added SHA3-256 support [L5] and JDK 18 disabled SHA-1 signed jars [L6]. | \------------------------------------------------------------------------------/ /[cendyne: press-f-to-pay-respects]--------------------------------------------\ | Oh and move away from the old dangerous stuff too! MD5 should not be touched | | with a 10 foot pole and SHA-1 is broken [L7]. Also Bleichenbacher's attack | | [L8] keeps coming back from the dead so stop using RSA. | \------------------------------------------------------------------------------/ /[cendyne: no-bad]-------------------------------------------------------------\ | Resist the urge to apply new algorithms for the sake of being new. You have | | limited resources and time. Focus on replacing what is broken and the | | threats you face. These migrations will consume you and your team's time and | | come with significant risk if done wrong. | \------------------------------------------------------------------------------/ /---------------------------------------------------------------[kyrmeso: math]\ | If I have to do it multiple times anyway, why don't I find a vendor that | | makes an extensible turnkey solution to handle every case I have? | \------------------------------------------------------------------------------/ /[cendyne: take-that-back]-----------------------------------------------------\ | You're likely falling for the most expensive snake oil out there. (No | | offense to snakes intended!) If you are not assessing what you are using | | cryptography for, then you will certainly fail to integrate a vendor's | | solution correctly. | \------------------------------------------------------------------------------/ /-------------------------------------------------------[kyrmeso: glassy-tears]\ | Okay, okay. I'll do it myself. | | | | I just added integrity checks to my encryption but someone says it looks | | wrong on the internet! | \------------------------------------------------------------------------------/ /------------------------------------------------------------------------------\ | Paul Moore @Paul_Reviews@twitter.com | |------------------------------------------------------------------------------| | Here's the latest #encryption [L9] code from #police [L10] #cyberAlarm [L11] | | It took me 5 seconds to spot the hilarious flaw. Now it's your turn. Welcome | | your thoughts @bascule [L12] @ProfWoodward [L13] @Sc00bzT [L14] | | @grittygrease [L15] @matthew_d_green [L16] @AlecMuffett [L17] @jedisct1 | | [L18] @CiPHPerCoder [L19] | | [I1: Photo included with tweet] | | | | [L20] [L21] 6/18/2022 | \------------------------------------------------------------------------------/ /[cendyne: ych-hug-sad]--------------------------------------------------------\ | Migrations are not easy. Here's some mistakes I see in this example: | | | | * The same function is being used for different versions; | | * It is subject to silent downgrade attacks because the signature can be | | removed; | | * The same key is used for both the old and new version; | | * AES-CBC is risky to implement in newer versions of anything; | | * And the data does not identify and is not bound to which version and | | key it is encrypted with. | \------------------------------------------------------------------------------/ /--------------------------------------------------------[kyrmeso: embarrassed]\ | If I did this over again, how should I approach it? | \------------------------------------------------------------------------------/ /[cendyne: ready]--------------------------------------------------------------\ | Modify your application in such a way that different versions are delivered | | and processed with different code paths and that the keys used are unique | | and not shared. Stop using OpenSSL directly and use a library like libsodium | | [L22] or Google Tink [L23]. Bind the fact that this is another version to | | the encrypted message with authenticated encryption with associated data | | [L24] (AEAD). Plan a timeline for when the old version is no longer accepted | | and add monitoring to find out how often the old and new code paths are | | used. And finally verify that the migration is taking place and that the new | | code path reaches expected levels of use before disabling the old code. For | | specific recommendations, see Cryptographic Agility Questions [L25]. | \------------------------------------------------------------------------------/ /--------------------------------------------------------------[soatok: typing]\ | If you're interested in another take about crypto agility, see: | | Cryptographic Agility and Superior Alternatives [L26]. | \------------------------------------------------------------------------------/ Post Quantum Cryptography ------------------------- /[cendyne: access-granted]-----------------------------------------------------\ | Today we rely primarily upon cryptography that is hard for classical | | computers to crack. The underlying strength relies on trapdoor functions | | [L27], which are easy to go one way and hard to go the other way. We | | consider something secure if the cryptography is so hard to crack with | | current methods that the time taken to intelligently explore all | | possibilities would surpass the heat death of the universe. | \------------------------------------------------------------------------------/ /[cendyne: looking-ych]--------------------------------------------------------\ | We expect the future will deliver quantum computers that can disrupt | | classical cryptography and undo the trapdoor functions in use today. We call | | that future "post-quantum". Post-quantum cryptography (PQC) is cryptography | | that is resistant to an adversary with a sufficiently advanced quantum | | computer. PQC is an active field of research and PQC solutions are still | | being investigated and analyzed. | \------------------------------------------------------------------------------/ /------------------------------------------------------------[kyrmeso: hopeful]\ | "Crypto Agile" has been a buzz word in the security space lately. Can I be | | agile and transition to PQC now? | \------------------------------------------------------------------------------/ /[cendyne: galaxy-brain2]------------------------------------------------------\ | Only as an experiment! By experimenting you will see where your existing | | system will break. However, PQC algorithms have not reached approved and | | recommended status! (2022) The keys and signatures (either or) are | | absolutely massive. If your system limits how large your key sizes and | | signatures may be then your system will break because of PQC. | \------------------------------------------------------------------------------/ /---------------------------------------------------------------[kyrmeso: blep]\ | I've heard about doing hybrids, what about that? | \------------------------------------------------------------------------------/ /[cendyne: bonked]-------------------------------------------------------------\ | Hybrids exist as a transitionary stage in case classical cryptography is | | broken. But the PQC side may also be broken like SIKE did [L28]. | \------------------------------------------------------------------------------/ /-----------------------------------------------------------[kyrmeso: ych-boop]\ | What about Hybrid TLS Certificates [L29] ? | \------------------------------------------------------------------------------/ /[cendyne: conspiracy]---------------------------------------------------------\ | X.509 [L30], the technology behind certificates, is an extensible | | specification for storing cryptographically bound assertions and | | establishing trust. While the technology is sound, paying money for these | | certificates is not. NIST and others have not settled on what our future | | holds. Browsers and other applications will not deploy PQC algorithms | | outside of limited experiments. | \------------------------------------------------------------------------------/ /---------------------------------------------------------------[kyrmeso: give]\ | My CISO thinks we should get these in production and he found a vendor ready | | to sell us some certificates at a discount! | \------------------------------------------------------------------------------/ /[cendyne: bullshit2]----------------------------------------------------------\ | Push back on that. Wait until Lets Encrypt deploys PQC hybrid certificates | | before hopping on the bandwagon with any certificate authority. History | | repeats itself as the PKI dot com bubble [L31] toots its horns again. | \------------------------------------------------------------------------------/ /---------------------------------------------------------------[kyrmeso: math]\ | How would I do a crypto agile hybrid algorithm for my application? | \------------------------------------------------------------------------------/ /[cendyne: objection]----------------------------------------------------------\ | That's dangerous! Do you really want to roll your own cryptography [L32] ? | | Without knowing these tools or options, you might invent a flexible | | cryptography engine. With that in place, can you protect yourself from | | downgrade attacks [L33] ? Will you have dedicated resources later to migrate | | away from whatever crypto you invented when it breaks? PQC is an active area | | of research. Unless you are experimenting, stay far away and do not bring | | cryptographic experiments into your product. | \------------------------------------------------------------------------------/ /--------------------------------------------------------------[kyrmeso: money]\ | Oh! So I should buy a product off the shelf instead! They've done the | | experiments already to know what's good! | \------------------------------------------------------------------------------/ /[cendyne: cupcake]------------------------------------------------------------\ | Don't waste your business's resources. PQC is still new and being evaluated | | by experts [L34]. Adding PQC to your application is likely premature [L35]. | | You can be crypto agile without PQC, for more see Cryptographic Agility | | [L36]. | \------------------------------------------------------------------------------/ Side notes ---------- I've added a new section to my website: Topics [L37] ! This post includes two topics, crypto agility and post quantum. For those interested in a specific topic without excess noise, check out those pages. -------------------------------------------------------------------------------- [L1]: https://soatok.blog/2022/08/18/burning-trust-at-the-quantum-village-at- defcon-30/ [L2]: https://en.wikipedia.org/wiki/Cryptographic_agility [L3]: https://www.youtube.com/watch?v=8pGJVTekDyM [L4]: https://youtu.be/8pGJVTekDyM [L5]: https://seanjmullan.org/blog/2021/03/18/jdk16 [L6]: https://seanjmullan.org/blog/2022/03/23/jdk18 [L7]: https://shattered.io/ [L8]: https://en.wikipedia.org/wiki/Adaptive_chosen-ciphertext_attack#Practical _attacks [L9]: https://twitter.com/hashtag/encryption [L10]: https://twitter.com/hashtag/police [L11]: https://twitter.com/hashtag/cyberAlarm [L12]: https://twitter.com/bascule [L13]: https://twitter.com/ProfWoodward [L14]: https://twitter.com/Sc00bzT [L15]: https://twitter.com/grittygrease [L16]: https://twitter.com/matthew_d_green [L17]: https://twitter.com/AlecMuffett [L18]: https://twitter.com/jedisct1 [L19]: https://twitter.com/CiPHPerCoder [L20]: https://twitter.com/Paul_Reviews/status/1538114752651710465 [L21]: https://archive.ph/QQsxl [L22]: https://doc.libsodium.org/ [L23]: https://github.com/google/tink [L24]: https://en.wikipedia.org/wiki/Authenticated_encryption [L25]: /topics/crypto-agility-questions.html [L26]: https://soatok.blog/2022/08/20/cryptographic-agility-and-superior- alternatives/ [L27]: https://en.wikipedia.org/wiki/Trapdoor_function [L28]: https://eprint.iacr.org/2022/975.pdf [L29]: https://archive.ph/3gsEj [L30]: https://www.itu.int/rec/T-REC-X.509-198811-S [L31]: https://en.wikipedia.org/wiki/Dot-com_bubble [L32]: https://archive.ph/M1YYw [L33]: https://en.wikipedia.org/wiki/Downgrade_attack [L34]: https://www.nist.gov/news-events/news/2022/07/nist-announces-first-four- quantum-resistant-cryptographic-algorithms [L35]: https://lwn.net/Articles/890788/ [L36]: /topics/crypto-agility.html [L37]: /topics/ [I1]: https://c.cdyn.dev/J2JHRp3U