Cryptography Foundations and TLS Lecture
Course Administration and Project Logistics
Departmental Coordination and Media: Recording of sessions, such as Monday's Slack show, is typically an automated process that does not require manual intervention from laboratory or teaching staff. General publication timelines for course materials are approximately to days.
Enrollment and Auditing Policy: When a course reaches maximum capacity, further enrollment is not possible, even if a concession is applied for and subsequently declined. However, students who are not formally enrolled are permitted to sit in on lectures as auditors; they will not be expelled from the room, but they cannot be officially added to the class roster.
Team Sign-Ups and Collaboration:
Group establishment is a priority, especially for students currently in a group of size who need to coordinate paper presentations.
There are approximately students currently unassigned to groups.
Groups generally consist of or members, determined by the length and complexity of the assigned paper.
Canvas does not explicitly show group sizes to students. If a group associated with a specific paper is full, students must select a different paper topic.
Communication between group members on Canvas can be initiated via the group home page, announcements, or discussion boards, as Canvas hides individual group member emails for privacy.
Project Milestones:
The Elevator Pitch: The initial presentation focusing on the intended "dream" architecture or goal of the build.
The Final Presentation: An overview of the actual finished product, which may differ from the initial pitch.
Introduction to Cryptographic Primitives
Foundational Role: Cryptography is the final foundation topic for course . Most high-level defense tools are assemblies of lower-level building blocks known as cryptographic primitives.
Vulnerability Context: Cryptographic failures were ranked number in the previous year's OS Hot (OWASP Top ) vulnerabilities for web applications. These failures often stem from misconfiguration or developer-induced vulnerabilities during the coding process.
Core Offerings:
Confidentiality: Ensuring data is scrambled so only those with a specific secret can reverse the transformation.
Integrity: Guaranteeing that data has not been modified in transit.
Authentication: Verifying the identity of the parties involved in a communication.
Key Establishment: Methodologies for two parties to agree upon a shared secret.
Hashing and Data Integrity
Definition: A hash function is a one-way operation that takes an arbitrary amount of data and produces a fixed-length output, acting as a digital fingerprint. This output is designed to be unique to the input data.
Sensitivity: Extremely small changes in the original message result in radical changes in the hash output (digest).
Example: A hash of the word "hello" might start with the string . Changing the message to "hi" results in a completely different digest string.
Primary Use Cases:
Software Distribution: Publishers provide a hash of a binary. Users download the file and compute its hash locally to verify that the software has not been altered by a malicious third party or redirected through a compromised site.
Digital Signatures: Signatures are typically performed on the hash of a message rather than the message itself.
Secure Password Storage: Passwords must never be stored in plain text. At a minimum, they must be converted into a hash.
Security Limitations: Hashing does not encrypt data; there are no secrets involved in the hashing process. Fast hashes (general purpose) are unsuitable for passwords because they allow for the possibility of recovery via brute force. Specialized, deliberately slow algorithms should be utilized for password storage to make brute-forcing computationally infeasible.
Message Authentication Codes (MAC) and AEAD
MAC (Message Authentication Code): Addresses the limitations of simple hashes by incorporating a secret key. This provides a guarantee that the message was created by someone who shares the same secret key, effectively stopping "adversaries in the middle" from tampering with or forging messages.
Process: The sender uses a MAC algorithm and a secret key to produce a unique digest (code). This code is sent with the (often unencrypted) message. The receiver uses their copy of the secret key to re-compute the MAC and verify it matches the one received.
Limitation: A standard MAC provides integrity and authenticity but does not provide confidentiality (encryption) or public proof of identity for wide-scale distribution (e.g., users).
AEAD (Authenticated Encryption with Associated Data): A protocol used in TLS that combines encryption and MACs into a single packaged solution. This reduces the risk of configuration errors that occur when developers attempt to combine separate encryption and MAC algorithms manually.
Nonce: A bit of non-private extra data added to the cryptographic process. Its purpose is to ensure that even if the same message is encrypted multiple times, the encrypted output is always different. This prevents attackers from inferring the contents of messages by looking for patterns in similar encrypted strings (e.g., distinguishing between a transfer of and ).
Symmetric vs. Asymmetric Cryptography
Symmetric Cryptography: Uses a single shared key for both encryption and decryption.
Advantage: It is extremely fast and efficient for large volumes of data (used in WiFi, SSH, and TLS application data).
Disadvantage: It requires a secure method to exchange the shared secret over an untrusted network.
Asymmetric (Public Key) Cryptography: Utilizes a pair of mathematically related keys: a public key (published for everyone) and a private key (kept secret).
Confidentiality: Anyone can use a user's public key to encrypt a message, but only the owner of the private key can decrypt it.
Authenticity: The owner of a private key can sign a hash of a message, and anyone with the public key can verify that only the private key owner could have produced that signature.
Diffie Hellman Key Exchange: A method where two parties use each other's public keys and their own private keys to independently derive the same shared symmetric secret without actually transmitting the key itself. This allows for "fresh" session keys to be generated for every encounter.
Transport Layer Security (TLS) and Certificates
Guarantees provided by TLS:
Authentication: Ensuring communication is with the intended entity (e.g., the real bank and not a phishing site).
Integrity: Preventing the "monkeying" or editing of messages (e.g., changing the recipient of a transaction).
Confidentiality: Only the two intended parties can read the data.
Non-Replayability: Ensuring a transaction cannot be captured and re-sent multiple times by an attacker.
Forward Secrecy: Using rotating session keys so that if a key is compromised in the future, it cannot be used to decrypt past communications.
Protocol Negotiation: During the initial handshake, the parties agree on which cryptographic primitives to use. Both parties sign their understanding of the negotiation to prevent a "downgrade attack," where an adversary forces the use of a weaker, exploited algorithm.
Certificates and Trust Chains: A centralized, top-down system where Certificate Authorities (CAs) are responsible for vetting organizations and domain ownership.
Modern browsers provide warnings for sites using only HTTP rather than HTTPS (TLS).
Phishing remains a significant problem because many users cannot accurately parse hierarchical domain structures (e.g., accepting
facebook.mydomain.comas a legitimate Facebook domain).
Questions & Discussion
Questions regarding Password Cracking:
Question: What are rainbow tables?
Response: Rainbow tables are large, pre-calculated tables of passwords and their corresponding hashes used for instantaneous lookups if a database is leaked. Salts are a primary defense against this, as they ensure that identical passwords result in unique hashes, forcing an attacker to use brute force instead of a lookup table.
Questions regarding Network Security:
Question: Can a malicious WiFi or captive portal cause you to think you are connected to a real bank when you are not?
Response: This is an "adversary in the middle" scenario. While tools like
wgetcan be used to easily clone the visual appearance of a bank website, hosting verification and TLS certificates serve as countermeasures. If a user tries to access a specific domain (e.g.,bnzed.co), the certificate must match that host name. If an attacker tries to pass off a fake certificate or a different domain, the verification should fail. However, attackers often use subdomains that look reasonable to untrained users (e.g., incorporating the word "search" or "verification" in the name) to bypass human scrutiny.
General Demonstration of OpenSSL:
Key Generation: Using OpenSSL to create a private key file (
private.pem) and deriving a public key from it.Signing and Verifying: Demonstrating how a signature created with a private key is successfully validated by a public key, and how changing even one character in the original message leads to a verification failure.