Applied Cryptography (Pt. 2) Engineering Secure Software Last Revised: October 16, 2020 SWEN-331: Engineering Secure Software Benjamin S Meyers 1
Recap Symmetric keys ● Benefit: fastest, mathematically the strongest ○ Drawback: distributing the keys ○ Public keys ● Benefit: easier to distribute the keys ○ Drawback: trusting public keys is tricky ○ How to establish trust? ● SSH, SSL, PGP approach this differently ○ SWEN-331: Engineering Secure Software Benjamin S Meyers 2
SSL: Secure Sockets Layer SSL/TLS are the modern public-key encryption standards ● Protocols suffixed with “s”: https, ftps, etc. ○ Another algorithm implementation best left to the experts ○ Untrusted public keys? ● For ~$30/year, you can get your public key signed! ○ Seriously, this is how it works ■ e.g. VeriSign and GoDaddy are Certificate Authorities (CA’s) ■ Thus, trust the public key != trust the website ■ Ray of hope: letsencrypt.org ■ Self-signed certificate? ○ Not usually a good idea to accept them, but… ■ If the key changes, you will be alerted ■ You only need to trust the server once ■ SWEN-331: Engineering Secure Software Benjamin S Meyers 3
PGP: Pretty Good Privacy Open protocol created in 1991 ● Primarily used for email encryption today ○ Very popular in open source culture ○ Combines symmetric-key and public-key cryptography ● Symmetric is much faster and harder to crack than public-key ○ Uses public-key to distribute the symmetric-key ○ Untrusted recipient now has your symmetric-key? ○ One-time symmetric-key only ■ Use a secure PRNG to generate symmetric-keys ■ SWEN-331: Engineering Secure Software Benjamin S Meyers 4
PGP: Web of Trust How do you trust PGP public-keys? ● There are no PGP certificate authorities ○ Public-key databases are open ○ How do you know that the food you’re eating is disease-free? ● You trust the grocery store, who trusts the distributors, who trust the ○ farmers FDA is also a trusted third party ○ But when you trust the farmers directly, you trust their food more ○ In the same way, PGP incentivizes short trust chains ● Each person can “sign” someone else’s key, connecting you to them in a ○ web of trust Each “hop” diminishes the trust of a given public-key ○ SWEN-331: Engineering Secure Software Benjamin S Meyers 5
PGP: Web of Trust Direct Trust Andy Paul t s u r T t c e r i d n I Me Sid Jen Bryan Emilio SWEN-331: Engineering Secure Software Benjamin S Meyers 6
PGP: Mean Shortest Distance How trusted should this key be? ● Geodesic paths (shortest paths) ○ Compare the mean geodesic distance to entire network mean ○ “Closeness” in social network analysis ○ Relatively trusted by the community? ● Many will trust you (direct connections) ○ If you are trusted by people who are trusts (indirect connections) ○ SWEN-331: Engineering Secure Software Benjamin S Meyers 7
Example: PGP Web of Trust Compute shortest distances for every pair in your community ● MSD Paul : (2+ ○ Paul → Karen: 2 ■ Paul Andy Jen Sid Emilio Karen Bryan SWEN-331: Engineering Secure Software Benjamin S Meyers 8
Example: PGP Web of Trust Compute shortest distances for every pair in your community ● MSD Paul : (2+2+ ○ Paul → Karen: 2 ■ Paul Paul → Sid: 2 ■ Andy Jen Sid Emilio Karen Bryan SWEN-331: Engineering Secure Software Benjamin S Meyers 9
Example: PGP Web of Trust Compute shortest distances for every pair in your community ● MSD Paul : (2+2+1+ ○ Paul → Karen: 2 ■ Paul Paul → Sid: 2 ■ Paul → Jen: 1 ■ Andy Jen Sid Emilio Karen Bryan SWEN-331: Engineering Secure Software Benjamin S Meyers 10 10
Example: PGP Web of Trust Compute shortest distances for every pair in your community ● MSD Paul : (2+2+1+1+ ○ Paul → Karen: 2 ■ Paul Paul → Sid: 2 ■ Paul → Jen: 1 ■ Andy Jen Paul → Andy: 1 ■ Sid Emilio Karen Bryan SWEN-331: Engineering Secure Software Benjamin S Meyers 11 11
Example: PGP Web of Trust Compute shortest distances for every pair in your community ● MSD Paul : (2+2+1+1+1)/5 = 1.4 ○ Paul → Karen: 2 ■ Paul Paul → Sid: 2 ■ Paul → Jen: 1 ■ Andy Jen Paul → Andy: 1 ■ Paul → Emilio: 1 ■ Sid Emilio Karen Bryan SWEN-331: Engineering Secure Software Benjamin S Meyers 12 12
Example: PGP Web of Trust Compute shortest distances for every pair in your community ● MSD Paul : (2+2+1+1+1)/5 = 1.4 ○ MSD Andy : (2+2+1+1+1)/5 = 1.4 ○ Paul MSD Jen : (3+2+1+1+1)/5 = 1.6 ○ MSD Emilio : (3+2+1+1+1)/5 = 1.6 ○ Andy Jen MSD Karen : (4+3+2+2+1)/5 = 2.4 ○ MSD Sid : (4+3+2+2+1)/5 = 2.4 ○ Sid Emilio Nobody trusts Bryan ● Disconnected → Untrusted ○ Karen Bryan SWEN-331: Engineering Secure Software Benjamin S Meyers 13 13
Source: https://xkcd.com/1181/ SWEN-331: Engineering Secure Software Benjamin S Meyers 14 14
Cryptanalysis Definition: “the analytic investigation of an information ● system with the goal of illuminating hidden aspects of that system” [nsa.gov] In other words: breaking cryptography ● Comes in many forms ● Brute force attacks ○ Theoretical/algorithmic weaknesses ○ Side-channel attacks ○ SWEN-331: Engineering Secure Software Benjamin S Meyers 15 15
Side Channel Attacks Side channel: ● Information emitted from a physical implementation of a ○ cryptosystem Side channel vulnerabilities are mutually exclusive from ● algorithmic vulnerabilities Although coding vulnerabilities can lead to side channel attacks ○ e.g. password fields obscure the text to prevent someone ● from looking over your shoulder e.g. keeping the sticky note with your password on your ● monitor SWEN-331: Engineering Secure Software Benjamin S Meyers 16 16
Timing Attacks Using the timing of an operation to gain information ● e.g. computing large prime numbers for SSL ● Constant concern for OpenSSL: CVE-2013-0169 ○ “Square and multiply” algorithm ○ Dependent on how many times you go through a for loop ○ e.g. timing for password lookups ● Does a user exist in MySQL → padding lookup time ○ e.g. cache-hit vs. cache-miss on a sensitive record ● SWEN-331: Engineering Secure Software Benjamin S Meyers 17 17
Data Remanence Deleted data is not always deleted ● Hard drives release the memory, but it’s not necessarily ○ overwritten Magnetic fields can remain even after it’s been overwritten ○ e.g. rebooting a router ○ Many, many creative ways to do this ● Cold Boot Attack: Freezing RAM with liquid nitrogen ○ Hibernation files store RAM ○ Core dumps reveal sensitive information ○ SWEN-331: Engineering Secure Software Benjamin S Meyers 18 18
So many more... Power monitoring attacks ● Can predict which branch of an if-statement was taken by ○ monitoring power consumption Particularly nasty on embedded devices ○ Even AES encryption can be broken with way ○ Van Eck Phreaking (Radiation) → TEMPEST ● Acoustic analysis of hard drive/keyboard sounds ● Accelerometers in phones reveal what you type ● “Chatter” -- even the known existence of encrypted ● communication can be useful information SWEN-331: Engineering Secure Software Benjamin S Meyers 19 19
Lessons from Side Channel Attacks Okay, so what? ● Can we do anything about this? ○ What must software engineers do? ○ Lesson 1: Identify your side channels ● Network chatter, timing, power, etc. ○ SWEN-331: Engineering Secure Software Benjamin S Meyers 20 20
Lessons from Side Channel Attacks Okay, so what? ● Can we do anything about this? ○ What must software engineers do? ○ Lesson 1: Identify your side channels ● Network chatter, timing, power, etc. ○ Lesson 2: You have not identified all of your side channels ● SWEN-331: Engineering Secure Software Benjamin S Meyers 21 21
Lessons from Side Channel Attacks Okay, so what? ● Can we do anything about this? ○ What must software engineers do? ○ Lesson 1: Identify your side channels ● Network chatter, timing, power, etc. ○ Lesson 2: You have not identified all of your side channels ● Lesson 3: Better testing ● Realistic production environments ○ Third-party testers with security experience ○ SWEN-331: Engineering Secure Software Benjamin S Meyers 22 22
Keeping Up Networking and cryptographic algorithms are constantly ● changing New networking protocols, new models ○ Broken cryptographic algorithms ○ You will need to keep up with the news on algorithms ● Organizations: ○ CWE ■ OWASP: Open Web Application Security Project ■ Bloggers & Researchers: ○ Bruce Schneier: https://www.schneier.com/ ■ Steve Gibson: https://www.grc.com/news.htm ■ Gary McGraw: https://www.synopsys.com/ ■ SWEN-331: Engineering Secure Software Benjamin S Meyers 23 23
Recommend
More recommend