Crypto for CTFs RPISEC 2013 Ben Kaiser. Terminology plaintext - the original message ciphertext - the coded message cipher - algorithm for transforming.

Slides:



Advertisements
Similar presentations
CLASSICAL ENCRYPTION TECHNIQUES
Advertisements

Using Cryptography to Secure Information. Overview Introduction to Cryptography Using Symmetric Encryption Using Hash Functions Using Public Key Encryption.
Cryptography and Network Security Chapter 2
Cryptography and Network Security Chapter 2. Chapter 2 – Classical Encryption Techniques Many savages at the present day regard their names as vital parts.
CSCE 790G: Computer Network Security
Cryptography and Network Security Third Edition by William Stallings Lecture slides by Lawrie Brown.
Chapter 2 – Classical Encryption Techniques. Classical Encryption Techniques Symmetric Encryption Or conventional / private-key / single-key sender and.
Classical Encryption Techniques
CPSC CPSC 3730 Cryptography Chapter 2 Classical Encryption Techniques.
Classical Encryption Techniques
Overview of Cryptographic Techniques Hector M Lugo-Cordero CIS 4361 Secure Operating System Administration 1.
Chapter 2 – Classical Encryption Techniques
Cryptography and Network Security Third Edition by William Stallings Lecture slides by Lawrie Brown.
Chapter 2 Basic Encryption and Decryption. csci5233 computer security & integrity 2 Encryption / Decryption encrypted transmission AB plaintext ciphertext.
Cryptography. Secret (crypto) Writing (graphy) –[Greek word] Practice and study of hiding information Concerned with developing algorithms for: –Conceal.
Cryptography and Network Security Chapter 2. Chapter 2 – Classical Encryption Techniques Many savages at the present day regard their names as vital parts.
Dr. Lo’ai Tawalbeh 2007 Chapter 2: Classical Encryption Techniques Dr. Lo’ai Tawalbeh New York Institute of Technology (NYIT) Jordan’s Campus INCS.
1 University of Palestine Information Security Principles ITGD 2202 Ms. Eman Alajrami 2 nd Semester
Chapter 2 Classical Encryption Techniques. Symmetric Encryption n conventional / private-key / single-key n sender and recipient share a common key n.
Chapter 2 – Elementary Cryptography  Concepts of encryption  Cryptanalysis  Symmetric (secret key) Encryption (DES & AES)(DES & AES)  Asymmetric (public.
Cryptography and Network Security Third Edition by William Stallings Lecture slides by Lawrie Brown.
Computer Science&Technology School of Shandong University Instructor: Hou Mengbo houmb AT sdu.edu.cn Office: Information Security Research Group.
Cryptography and Network Security Chapter 2. Symmetric Encryption  or conventional / private-key / single-key  sender and recipient share a common key.
Cryptography and Network Security (CS435) Part Two (Classic Encryption Techniques)
Cryptography and Network Security Chapter 2 Fourth Edition by William Stallings Lecture slides by Lawrie Brown.
Symmetric Encryption or conventional / private-key / single-key sender and recipient share a common key all classical encryption algorithms are private-key.
Network Security Lecture 12 Presented by: Dr. Munam Ali Shah.
Introduction to Cryptography
Classical Encryption Techniques CSE 651: Introduction to Network Security.
 Classic Crypto  Slides based on those developed by Dr. Lawrie Brown at the Australian Defence Force Academy, University College, UNSW  See
1 Chapter 2-1 Conventional Encryption Message Confidentiality.
Rather than just shifting the alphabet Could shuffle (jumble) the letters arbitrarily Each plaintext letter maps to a different random cipher text letter.
Symmetric-Key Cryptography
Module :MA3036NI Cryptography and Number Theory Lecture Week 3 Symmetric Encryption-2.
Classic Cryptography History. Some Basic Terminology plaintext - original message ciphertext - coded message cipher - algorithm for transforming plaintext.
1 University of Palestine Information Security Principles ITGD 2202 Ms. Eman Alajrami.
Computer and Network Security Rabie A. Ramadan Lecture 2.
Elementary Cryptography  Concepts of encryption  Symmetric (secret key) Encryption (DES & AES)(DES & AES)  Asymmetric (public key) Encryption (RSA)(RSA)
Cryptography (Traditional Ciphers)
Data Security and Encryption (CSE348) 1. Lecture # 4 2.
Traditional Symmetric-Key Ciphers
1 Cryptography and Network Security Third Edition by William Stallings Lecture slides by Lawrie Brown [Changed by Somesh Jha]
1 Cryptography and Network Security Fourth Edition by William Stallings Lecture slides by Lawrie Brown [Changed by Somesh Jha]
Cryptography. Introduction Cryptography is the art of achieving security by encoding messages to make them non- readable. Some cryptography algorithms.
Information Systems Security 3. Chapter 2 – Classical Encryption Techniques Many savages at the present day regard their names as vital parts of themselves,
Symmetric Cipher Model Plaintext input 1- encryption algorithm 2- secret key Encryption Cipher text output Cipher text input 1- Decryption algorithm 2-
Chapter 2 – Classical Encryption Techniques. Symmetric Encryption or conventional / private-key / single-key sender and recipient share a common key all.
Cryptography and Network Security Chapter 2
Chapter 2 – Classical Encryption Techniques Many savages at the present day regard their names as vital parts of themselves, and therefore take great pains.
Instructor: Dania Alomar
Network Security Lecture 13 Presented by: Dr. Munam Ali Shah.
1 Cryptography and Network Security Fourth Edition by William Stallings Lecture slides by Lawrie Brown [Changed by Somesh Jha]
1 Classical Encryption Techniques. 2 Symmetric cipher model –Cryptography –Cryptanalysis Substitution techniques –Caesar cipher –Monoalphabetic cipher.
Cryptography and Network Security Third Edition by William Stallings Lecture slides by Lawrie Brown.
Cryptography and Network Security Third Edition by William Stallings Lecture slides by Lawrie Brown.
By Marwan Al-Namari & Hafezah Ben Othman Author: William Stallings College of Computer Science at Al-Qunfudah Umm Al-Qura University, KSA, Makkah 1.
Cryptography and Network Security Third Edition by William Stallings Lecture slides by Lawrie Brown.
Prof. Wenguo Wang Network Information Security Prof. Wenguo Wang Tel College of Computer Science QUFU NORMAL UNIVERSITY.
@Yuan Xue CS 285 Network Security Cryptography Overview and Classical Encryption Algorithms Fall 2012 Yuan Xue.
CS480 Cryptography and Information Security Huiping Guo Department of Computer Science California State University, Los Angeles 4. Traditional and Modern.
3.1 Chapter 3 Traditional Symmetric-Key Ciphers Part2.
@Yuan Xue Quick Review.
CRYPTOGRAPHY G REEK WORD MEANING “ SECRET WRITING ”
Substitution Ciphers.
Classical Techniques: Substitution
Communication Security
Cryptography and Network Security
CS4780 Cryptography and Information Security
Outline Some Basic Terminology Symmetric Encryption
Cryptographic Algorithms and Protocols
Presentation transcript:

Crypto for CTFs RPISEC 2013 Ben Kaiser

Terminology plaintext - the original message ciphertext - the coded message cipher - algorithm for transforming plaintext to ciphertext key - info used in cipher known only to sender/receiver encipher (encrypt) - converting plaintext to ciphertext decipher (decrypt) - recovering ciphertext from plaintext cryptography - study of encryption principles/methods cryptanalysis (codebreaking) - the study of principles/methods of deciphering ciphertext without knowing key

Classification Characterize by: Type of encryption operations used substitution transposition product Number of keys used single-key (private) two-key (public) Way in which plaintext is processed Block – processes a block of element at a time Stream – processes continuous stream of elements

Classical Ciphers - Substitution Letters of plaintext are replaced by other letters or by numbers or symbols. Monoalphabetic ciphers: For every letter, one and only one letter (or symbol) is substituted. Polyalphabetic ciphers: Throughout the cipher text, different symbols can stand for the same letter, and the same symbols can stand for different letters

Monoalphabetic Ciphers The “key” for substitution ciphers is a mapping from plaintext alphabet to ciphertext alphabet. It must be known to both parties. Caesar cipher: Each character is converted to a numeric value (0-25), then summed with a constant value (the key) and modded by 25. rpisecisfun becomes uslvhflvixq if the key is 3.

Monoalphabetic Ciphers The Caesar Cipher is easy to break by brute force since there are only 25 possible keys. Let’s look at a more complex monoalphabetic cipher. What if we had a 26-character key that maps each plaintext character to a ciphertext character at random? That gives 26! = 403 septillion possible keys.

Frequency Analysis You’d think this would be incredibly difficult to break, but it’s not thanks to frequency analysis In English, “E” is the most common letter, followed by T,R,N,I,O,A, and S. Z,J,K,Q, and X are quite rare.

Frequency Analysis Calculate the letter frequencies for your ciphertext, then compare counts against known values. Use known tricks: The most common letter at the end of a word is E The most common beginning letter of a word is T A single-letter word is A or I, and on rare occasions, O. The most frequent two-letter word is OF, followed by TO and IN The most used three-letter word is THE, next common is AND The most frequent four-letter word is THAT Q is always followed by U The most common double letters are: LL, EE, SS, OO, TT, FF, RR, NN, PP and CC

Practice: Cracking a Monoalphabetic Cipher UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZV UEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSXEPYEPOPD ZSZUFPOMBZWPFUPZHMDJUDTMOHMQ Hints:

Practice: Cracking a Monoalphabetic Cipher UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZV UEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSXEPYEPOPD ZSZUFPOMBZWPFUPZHMDJUDTMOHMQ Hints: Count the letter frequencies and compare to the chart. Make educated guesses and work from there (guess & check).

Practice: Cracking a Monoalphabetic Cipher UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZV UEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSXEPYEPOPD ZSZUFPOMBZWPFUPZHMDJUDTMOHMQ Hints: Count the letter frequencies and compare to the chart. Make educated guesses and work from there (guess & check). P & Z are very frequent in the ciphertext – let’s guess those are E and T, the two most common letters in English.

Practice: Cracking a Monoalphabetic Cipher UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZV UEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSXEPYEPOPD ZSZUFPOMBZWPFUPZHMDJUDTMOHMQ Hints: Count the letter frequencies and compare to the chart. Make educated guesses and work from there (guess & check). P & Z are very frequent in the ciphertext – let’s guess those are E and T, the two most common letters in English. ZW is a common letter combination. If Z = T then maybe TH? What does that make ZWP likely to be?

Practice: Cracking a Monoalphabetic Cipher UZQSOVUOHXMOPVGPOZPEVSGZWSZOPFPESXUDBMETSXAIZV UEPHZHMDZSHZOWSFPAPPDTSVPQUZWYMXUZUHSXEPYEPOPD ZSZUFPOMBZWPFUPZHMDJUDTMOHMQ Hints: Count the letter frequencies and compare to the chart. Make educated guesses and work from there (guess & check). P & Z are very frequent in the ciphertext – let’s guess those are E and T, the two most common letters in English. ZW is a common letter combination. If Z = T then maybe TH? What does that make ZWP likely to be? “It was disclosed yesterday that several informal but direct contacts have been made with political representatives of the vietcong in moscow.”

CSAW 2011 Crypto5: 200 Pts JR UNIR QVFPBIRERQ GUNG BHE YNFG GUERR GENAFZVFFVBAF JR'ER RNFVYL QRPVCURERQ. JR UNIR GNXRA PNER BS GUR CNEGL ERFCBAFVOYR SBE GURVE RAPBQVAT NAQ NER ABJ HFVAT N ARJ ZRGUBQ. HFR GUR VASBEZNGVBA CEBIVQRQ NG YNFG JRRX.F ZRRGVAT GB QRPVCURE NYY ARJ ZRFFNTRF. NAQ ERZRZORE, GUVF JRRX.F XRL VF BOSHFPNGRQ. No hint was provided, but I’ve only showed you one cipher so far so connect the dots.

CSAW 2011 Crypto5: 200 Pts JR UNIR QVFPBIRERQ GUNG BHE YNFG GUERR GENAFZVFFVBAF JR'ER RNFVYL QRPVCURERQ. JR UNIR GNXRA PNER BS GUR CNEGL ERFCBAFVOYR SBE GURVE RAPBQVAT NAQ NER ABJ HFVAT N ARJ ZRGUBQ. HFR GUR VASBEZNGVBA CEBIVQRQ NG YNFG JRRX.F ZRRGVAT GB QRPVCURE NYY ARJ ZRFFNTRF. NAQ ERZRZORE, GUVF JRRX.F XRL VF BOSHFPNGRQ. Answer: The key is 13. WE HAVE DISCOVERED THAT OUR LAST THREE TRANSMISSIONS WERE EASILY DECIPHERED. …

PHDays CTF 2013: Crypto 100 Decrypt the message: 7y9rr177sluqv1r4pw Hint: at $

PHDays CTF 2013: Crypto 100 Decrypt the message: 7y9rr177sluqv1r4pw Hint: at $ The cipher used is the Atbash Cipher. Each letter is assigned to the letter at the opposite end of the alphabet – A=Z, B=Y, C=X, etc. In this case, the numbers 0-9 were added onto the end of the key so A=9, B=8, … J=1, K=Z, L=Y, etc.

PHDays CTF 2013: Crypto 100 Decrypt the message: 7y9rr177sluqv1r4pw Hint: at $ The cipher used is the Atbash Cipher. Each letter is assigned to the letter at the opposite end of the alphabet – A=Z, B=Y, C=X, etc. In this case, the numbers 0-9 were added onto the end of the key so A=9, B=8, … J=1, K=Z, L=Y, etc. classiccryptoisfun

CSAW 2011 Crypto1 – 100 pts This is a simple monoalphabetic cipher. Do these numbers look like anything you recognize? If not, try frequency analysis.

More Advanced Monoalphabetic Ciphers The Playfair Cipher is a famous advanced Monoalphabetic Cipher that uses single word as a key. That word is used to generate a 5x5 character matrix: If “MONARCHY” is the key, our matrix looks like this: MONAR CHYBD EFGIK LPQST UVWXZ

Playfair Cipher plaintext encrypted two letters at a time: if a pair is a repeated letter, insert a filler like 'X', eg. "balloon" encrypts as "ba lx lo on" if both letters fall in the same row, replace each with letter to right (wrapping back to start from end), eg. “ar" encrypts as "RM" if both letters fall in the same column, replace each with the letter below it (again wrapping to top from bottom), eg. “mu" encrypts to "CM" otherwise each letter is replaced by the one in its row in the column of the other letter of the pair, eg. “hs" encrypts to "BP", and “ea" to "IM" or "JM" (as desired) Decrypt ONANMSVFBIKLEBUBFSCFAT using “MONARCHY” as a key.

Polyalphabetic Ciphers In a polyalphabetic ciphers, each letter of a ciphertext does not always decrypt to the same plaintext letter. The Vigenère Cipher is essentially multiple Caesar Ciphers: key is multiple letters long K = k 1 k 2... k d i th letter specifies i th alphabet to use use each alphabet in turn repeat from start after d letters in message

Vigenère Cipher write the plaintext out write the keyword repeated above it use each key letter as a caesar cipher key encrypt the corresponding plaintext letter eg using keyword deceptive key: deceptivedeceptivedeceptive plaintext: wearediscoveredsaveyourself ciphertext:ZICVTWQNGRZGVTWAVZHCQYGLMGJ

Kasiski Method of Breaking Vigenère Guess the key length Find a number of duplicated sequences Collect all their distances apart Look for common factors Thus obtain a set of monoalphabetic ciphers (each is subject to letter fq. Char.) repetitions in ciphertext give clues to period so find same plaintext an exact period apart which results in the same ciphertext of course, could also be random fluke eg repeated “VTW” in previous example suggests size of 3 or 9 then attack each monoalphabetic cipher individually using same techniques as before

Transposition Ciphers Transposition (or permutation) ciphers hide the message by rearranging the letter order in the message without altering the actual letters used. The classic example is the Rail Fence cipher, in which you write message letters out diagonally over a number of rows, then read off the cipher row by row. Plain Text: Meet me tonight + padding(qxz) M E M T N G T X E T E O I H Q Z Cipher Text: MEMTNGTXETEOIHQZ