\documentclass[10pt,a4paper]{article} % Packages \usepackage{fancyhdr} % For header and footer \usepackage{multicol} % Allows multicols in tables \usepackage{tabularx} % Intelligent column widths \usepackage{tabulary} % Used in header and footer \usepackage{hhline} % Border under tables \usepackage{graphicx} % For images \usepackage{xcolor} % For hex colours %\usepackage[utf8x]{inputenc} % For unicode character support \usepackage[T1]{fontenc} % Without this we get weird character replacements \usepackage{colortbl} % For coloured tables \usepackage{setspace} % For line height \usepackage{lastpage} % Needed for total page number \usepackage{seqsplit} % Splits long words. %\usepackage{opensans} % Can't make this work so far. Shame. Would be lovely. \usepackage[normalem]{ulem} % For underlining links % Most of the following are not required for the majority % of cheat sheets but are needed for some symbol support. \usepackage{amsmath} % Symbols \usepackage{MnSymbol} % Symbols \usepackage{wasysym} % Symbols %\usepackage[english,german,french,spanish,italian]{babel} % Languages % Document Info \author{csthrowaway} \pdfinfo{ /Title (cs440-intro-to-cyber-security-part-i.pdf) /Creator (Cheatography) /Author (csthrowaway) /Subject (CS440: Intro to cyber security Part I Cheat Sheet) } % Lengths and widths \addtolength{\textwidth}{6cm} \addtolength{\textheight}{-1cm} \addtolength{\hoffset}{-3cm} \addtolength{\voffset}{-2cm} \setlength{\tabcolsep}{0.2cm} % Space between columns \setlength{\headsep}{-12pt} % Reduce space between header and content \setlength{\headheight}{85pt} % If less, LaTeX automatically increases it \renewcommand{\footrulewidth}{0pt} % Remove footer line \renewcommand{\headrulewidth}{0pt} % Remove header line \renewcommand{\seqinsert}{\ifmmode\allowbreak\else\-\fi} % Hyphens in seqsplit % This two commands together give roughly % the right line height in the tables \renewcommand{\arraystretch}{1.3} \onehalfspacing % Commands \newcommand{\SetRowColor}[1]{\noalign{\gdef\RowColorName{#1}}\rowcolor{\RowColorName}} % Shortcut for row colour \newcommand{\mymulticolumn}[3]{\multicolumn{#1}{>{\columncolor{\RowColorName}}#2}{#3}} % For coloured multi-cols \newcolumntype{x}[1]{>{\raggedright}p{#1}} % New column types for ragged-right paragraph columns \newcommand{\tn}{\tabularnewline} % Required as custom column type in use % Font and Colours \definecolor{HeadBackground}{HTML}{333333} \definecolor{FootBackground}{HTML}{666666} \definecolor{TextColor}{HTML}{333333} \definecolor{DarkBackground}{HTML}{A3A3A3} \definecolor{LightBackground}{HTML}{F3F3F3} \renewcommand{\familydefault}{\sfdefault} \color{TextColor} % Header and Footer \pagestyle{fancy} \fancyhead{} % Set header to blank \fancyfoot{} % Set footer to blank \fancyhead[L]{ \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{C} \SetRowColor{DarkBackground} \vspace{-7pt} {\parbox{\dimexpr\textwidth-2\fboxsep\relax}{\noindent \hspace*{-6pt}\includegraphics[width=5.8cm]{/web/www.cheatography.com/public/images/cheatography_logo.pdf}} } \end{tabulary} \columnbreak \begin{tabulary}{11cm}{L} \vspace{-2pt}\large{\bf{\textcolor{DarkBackground}{\textrm{CS440: Intro to cyber security Part I Cheat Sheet}}}} \\ \normalsize{by \textcolor{DarkBackground}{csthrowaway} via \textcolor{DarkBackground}{\uline{cheatography.com/201525/cs/43099/}}} \end{tabulary} \end{multicols}} \fancyfoot[L]{ \footnotesize \noindent \begin{multicols}{3} \begin{tabulary}{5.8cm}{LL} \SetRowColor{FootBackground} \mymulticolumn{2}{p{5.377cm}}{\bf\textcolor{white}{Cheatographer}} \\ \vspace{-2pt}csthrowaway \\ \uline{cheatography.com/csthrowaway} \\ \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Cheat Sheet}} \\ \vspace{-2pt}Not Yet Published.\\ Updated 18th April, 2024.\\ Page {\thepage} of \pageref{LastPage}. \end{tabulary} \vfill \columnbreak \begin{tabulary}{5.8cm}{L} \SetRowColor{FootBackground} \mymulticolumn{1}{p{5.377cm}}{\bf\textcolor{white}{Sponsor}} \\ \SetRowColor{white} \vspace{-5pt} %\includegraphics[width=48px,height=48px]{dave.jpeg} Measure your website readability!\\ www.readability-score.com \end{tabulary} \end{multicols}} \begin{document} \raggedright \raggedcolumns % Set font size to small. Switch to any value % from this page to resize cheat sheet text: % www.emerson.emory.edu/services/latex/latex_169.html \footnotesize % Small font. \begin{multicols*}{3} \begin{tabularx}{5.377cm}{x{1.04425 cm} x{1.04425 cm} x{1.04425 cm} x{1.04425 cm} } \SetRowColor{DarkBackground} \mymulticolumn{4}{x{5.377cm}}{\bf\textcolor{white}{Week 1: Basics}} \tn % Row 0 \SetRowColor{LightBackground} 3 Types of security threats: At home (Client), On the move, On the guest house (Server) & CPU \seqsplit{Protection} rings (The more outer the rings, the less access to sensitive \seqsplit{information)} & TCP/IP Internet suite: ATNLP & Defining security: \seqsplit{Confidentiality}, Integrity, \seqsplit{Availability} \tn % Row Count 9 (+ 9) % Row 1 \SetRowColor{white} \seqsplit{Confidentiality:} Only intended \seqsplit{participants} can gain access to \seqsplit{information}. & \seqsplit{Integrity:} \seqsplit{Information} not modified by \seqsplit{authorised} parties. & \seqsplit{Availability:} You can gain access to \seqsplit{information} at any time you want. & Kerckoffs \seqsplit{Principle:} Security of a system lies in its keys only. \seqsplit{Everything} else should be public \seqsplit{knowledge.} \tn % Row Count 20 (+ 11) % Row 2 \SetRowColor{LightBackground} Tradeoffs for achieving security: High \seqsplit{functionality} + Low cost -\textgreater{} Low security & High security -\textgreater{} High cost + Low \seqsplit{functionality} & Best to have a good enough balance & High security -\textgreater{} Low \seqsplit{performance} + Low \seqsplit{compatibility} \tn % Row Count 28 (+ 8) \hhline{>{\arrayrulecolor{DarkBackground}}----} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.04425 cm} x{1.04425 cm} x{1.04425 cm} x{1.04425 cm} } \SetRowColor{DarkBackground} \mymulticolumn{4}{x{5.377cm}}{\bf\textcolor{white}{Week 2: Symmetric Encryption}} \tn % Row 0 \SetRowColor{LightBackground} \seqsplit{Plaintext:} Original \seqsplit{message/data} & \seqsplit{Ciphertext:} Encoded \seqsplit{message/data} after \seqsplit{encryption} & Key: \seqsplit{Information} used in \seqsplit{encryption} \& \seqsplit{decryption} & \seqsplit{Encryption:} Turn plaintext to \seqsplit{ciphertext} \tn % Row Count 5 (+ 5) % Row 1 \SetRowColor{white} \seqsplit{Decryption:} Turn \seqsplit{ciphertext} back to plaintext & Symmetric \seqsplit{Encryption:} Shared key is used in \seqsplit{encrypting} and \seqsplit{decrypting} data. & \seqsplit{Motivation} for \seqsplit{encryption:} Protect \seqsplit{confidentiality} between two parties. (Only \seqsplit{authorised} parties can gain access to data) & How does \seqsplit{encryption} achieve this? Plaintext is turned into \seqsplit{ciphertext} using \seqsplit{substitution} and \seqsplit{permutation}. Adversary cannot find patterns and cannot interpret the meaning of \seqsplit{ciphertext}. \tn % Row Count 24 (+ 19) % Row 2 \SetRowColor{LightBackground} Classical ciphers: Caesar cipher, Move plaintext by X number (Enc), Move \seqsplit{ciphertext} back by x number (Dec) & One-time pad ciphers: \seqsplit{Ciphertext} = Plaintext XOR key. Key must be a random bitstring of same length as plaintext, every enc uses a newly chosen key. Plaintext = \seqsplit{Ciphertext} XOR key (same key), \seqsplit{Limitation:} Need to store an unlimited \# Keys and key generated must be truly random. & Block ciphers: Message is broken down into blocks. Each block is a fixed number of bits of the message & Symmetric \seqsplit{Encryption} Enc process: Plaintext -\textgreater{} \seqsplit{(Encryption} algorithm + secret key) -\textgreater{} \seqsplit{Ciphertext} \tn % Row Count 52 (+ 28) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{1.04425 cm} x{1.04425 cm} x{1.04425 cm} x{1.04425 cm} } \SetRowColor{DarkBackground} \mymulticolumn{4}{x{5.377cm}}{\bf\textcolor{white}{Week 2: Symmetric Encryption (cont)}} \tn % Row 3 \SetRowColor{LightBackground} Symmetric \seqsplit{Encryption} Dec process: \seqsplit{Ciphertext} -\textgreater{} \seqsplit{(Decryption} algorithm + secret key) -\textgreater{} Plaintext & \seqsplit{Encryption} \& \seqsplit{Decryption} algorithm is public but secret key is private. & Security relies on the secret key only. & Chicken \& egg problem: To exchange secret data, you must have a shared secret. \tn % Row Count 10 (+ 10) % Row 4 \SetRowColor{white} AES \seqsplit{algorithm:} AES is a symmetric key algorithm, uses fixed size blocks of data (128 bits), If the blocks of data (message) not exactly divisible by 128 bits need to add padding, No specific key sizes (larger key size means more rounds of \seqsplit{transformation)} & Modes of \seqsplit{Encryption:} ECB \& CBC & ECB Enc Process: Plaintext split into blocks of equal size -\textgreater{} Each block is encrypted using the same secret key -\textgreater{} Encrypted blocks are joined together to form final \seqsplit{ciphertext}. & ECB Dec Process: Reverse of Enc process. Each block can be decrypted \seqsplit{independently} using shared secret key. \tn % Row Count 36 (+ 26) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{1.04425 cm} x{1.04425 cm} x{1.04425 cm} x{1.04425 cm} } \SetRowColor{DarkBackground} \mymulticolumn{4}{x{5.377cm}}{\bf\textcolor{white}{Week 2: Symmetric Encryption (cont)}} \tn % Row 5 \SetRowColor{LightBackground} \seqsplit{Characteristics} of ECB: Both Enc \& Dec can be performed in parallel since each block is \seqsplit{independent}, ECB is \seqsplit{deterministic} as same plaintext block will always enc to same \seqsplit{ciphertext} block with same secret key. & \seqsplit{Limitation} of ECB: Larger size messages are \seqsplit{vulnerable} to pattern analysis since they can contain \seqsplit{repetitive} patterns that could be seen in \seqsplit{ciphertext}. & Use cases of ECB: Suitable for small amounts of data / Messages that do not contain \seqsplit{repetitive} patterns. & CBC Enc Process: Message is broken down into blocks -\textgreater{} Block 1 XOR IV -\textgreater{} \seqsplit{Ciphertext} is Enc with K -\textgreater{} Cipher block 1 -\textgreater{} Block 2 XOR Cipher block 1 -\textgreater{} \seqsplit{Ciphertext} is Enc with K -\textgreater{} Cipher block 2 -\textgreater{} Block 3 XOR Cipher block 2 -\textgreater{} ... till the last block. \seqsplit{Ciphertext} will be the result of all the \seqsplit{cipherblocks} chained together. \tn % Row Count 33 (+ 33) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{1.04425 cm} x{1.04425 cm} x{1.04425 cm} x{1.04425 cm} } \SetRowColor{DarkBackground} \mymulticolumn{4}{x{5.377cm}}{\bf\textcolor{white}{Week 2: Symmetric Encryption (cont)}} \tn % Row 6 \SetRowColor{LightBackground} CBC Dec Process: Decrypt each block followed by XOR operation with previous \seqsplit{cipherblock/} IV for first block. & \seqsplit{Characteristics:} Chaining (Enc of each block depends on all previous blocks, each erroneous block will lead to wrong Dec in the one block after. (Block 2 is wrong, then Block 3 will be wrongly Dec) & Enc occurs \seqsplit{sequentially} but Dec can be done in parallel & IV introduce \seqsplit{randomness} to Enc process. Length of IV is same as block size (128 bits), IV is the first block, IV is freshly chosen for every process Enc, IV is not kept a secret since what attacker needs is the secret key. \tn % Row Count 23 (+ 23) % Row 7 \SetRowColor{white} Use cases: Larger \seqsplit{data/messages}, Data where security is a high priority. & \seqsplit{Comparison} between ECB \& CBC: ECB has identical \seqsplit{ciphertext} blocks while CBC has different \seqsplit{ciphertext} blocks & For ECB, each block is Enc/Dec \seqsplit{independently} while for CBC proper Enc/Dec requires correct previous \seqsplit{ciphertext} blocks, For ECB no error \seqsplit{propagation} while for CBC \seqsplit{ciphertext} block error affects the \seqsplit{decryption} of itself and next block. & \seqsplit{Cryptanalysis:} Methods for gaining access to encrypted \seqsplit{contents/information}. \tn % Row Count 47 (+ 24) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{1.04425 cm} x{1.04425 cm} x{1.04425 cm} x{1.04425 cm} } \SetRowColor{DarkBackground} \mymulticolumn{4}{x{5.377cm}}{\bf\textcolor{white}{Week 2: Symmetric Encryption (cont)}} \tn % Row 8 \SetRowColor{LightBackground} \seqsplit{Ciphertext} only attack: Only know \seqsplit{ciphertext}, need to deduce \seqsplit{plaintext.} & Known plaintext attack: Knows both plaintext and its \seqsplit{corresponding} \seqsplit{ciphertext}, goal is to find secret key to decrypt other \seqsplit{ciphertexts}. (Note you just know the mapping of plaintext \& \seqsplit{ciphertext}, but you don't choose the pair) & Chosen Plaintext attacks: Obtain the \seqsplit{ciphertexts} \seqsplit{corresponding} to \seqsplit{plaintexts} chosen by you. (Note I chose the \seqsplit{plaintext)} & Chosen \seqsplit{ciphertext} attack: Obtain the \seqsplit{plaintexts} \seqsplit{corresponding} to \seqsplit{ciphertexts} chosen by you. \tn % Row Count 23 (+ 23) % Row 9 \SetRowColor{white} Frequency analysis: Analyse the frequency of letters in \seqsplit{ciphertext}, compare them with expected frequency in the English Lang, Start guessing the potential mapping of \seqsplit{ciphertext} to \seqsplit{plaintext.} & Brute force: \# \seqsplit{combinations} for a 256 bit key is (2 to power of 256). Attacker will need to try all possible keys which is \seqsplit{computationally} \seqsplit{infeasible.} & Moore's law: Computing power doubles every 1.5 year (18 months) & \tn % Row Count 42 (+ 19) \hhline{>{\arrayrulecolor{DarkBackground}}----} \end{tabularx} \par\addvspace{1.3em} \begin{tabularx}{5.377cm}{x{1.04425 cm} x{1.04425 cm} x{1.04425 cm} x{1.04425 cm} } \SetRowColor{DarkBackground} \mymulticolumn{4}{x{5.377cm}}{\bf\textcolor{white}{Week 3: Public Key Encryption}} \tn % Row 0 \SetRowColor{LightBackground} Why we need Public Key Enc? For symmetric Enc, to exchange secret data, you must have a shared secret. \seqsplit{(Chicken-egg} problem) & \# of different secret keys in total = n(n-1)/2, where n is the number of people & \# of secret key stored by each user: n-1, where n is the number of people & Public Key Enc Process (Alice wants to send message to Bob ): Alice Plaintext (message) -\textgreater{} \seqsplit{Encryption} algorithm (RSA) + Bob public key -\textgreater{} \seqsplit{Ciphertext} -\textgreater{} \seqsplit{Decryption} algorithm (RSA) + Bob private key -\textgreater{} Bob receive back Alice plaintext (message) \tn % Row Count 25 (+ 25) % Row 1 \SetRowColor{white} Bob public key is \seqsplit{accessible} to everyone & Bob private key is only known to Bob & It is \seqsplit{computationally} \seqsplit{infeasible} to compute Bob private key from public key. & RSA \seqsplit{encryption:} Performed only on message sizes smaller than the RSA modulus (n) , M \textless{}=n \tn % Row Count 34 (+ 9) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{1.04425 cm} x{1.04425 cm} x{1.04425 cm} x{1.04425 cm} } \SetRowColor{DarkBackground} \mymulticolumn{4}{x{5.377cm}}{\bf\textcolor{white}{Week 3: Public Key Encryption (cont)}} \tn % Row 2 \SetRowColor{LightBackground} Public Key = (n, e), Private Key = d & Enc Formula: C = M\textasciicircum{}(e) \% n & Dec Formula: M = C\textasciicircum{}(d) \% n & Security does not depend on e, e is a random value so there can be many co primes. \tn % Row Count 9 (+ 9) % Row 3 \SetRowColor{white} If n is small, easy to factor n to obtain p and q -\textgreater{} lambda = LCM (p-1, q-1) -\textgreater{} 1\textless{}e\textless{}lambda, gcd(e, lamda) = 1 -\textgreater{} d = e\textasciicircum{}(-1) \% lambda & But when n is large enough (\textgreater{}2048 bits), it is \seqsplit{infeasible} to factor n to obtain p and q and from there d. & RSA \seqsplit{deterministic} problem: Attacker has the public key and can encrypt chosen \seqsplit{plaintexts} (Chosen plaintext attack) -\textgreater{} Attacker can test if they are equal to \seqsplit{stolen/intercepted} \seqsplit{ciphertext.} If a match is found, \seqsplit{corresponding} plaintext to the stolen cipher text is \seqsplit{discovered}. & Solution to \seqsplit{deterministic} problem: Before \seqsplit{encryption}, RSA choose a random padding R -\textgreater{} Encrypt (P||R) -\textgreater{} Different \seqsplit{ciphertexts} for even same messages. \tn % Row Count 37 (+ 28) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{1.04425 cm} x{1.04425 cm} x{1.04425 cm} x{1.04425 cm} } \SetRowColor{DarkBackground} \mymulticolumn{4}{x{5.377cm}}{\bf\textcolor{white}{Week 3: Public Key Encryption (cont)}} \tn % Row 4 \SetRowColor{LightBackground} Enc formula: C = (R||P)\textasciicircum{}(e) \% n & Dec formula: (R||P) = C\textasciicircum{}(d) \% n & If padding is 34 bytes and n is 256 bytes, P = 222 bytes. What if P \textgreater{} 222 bytes? When M \textgreater{} n, then it cannot be Enc using RSA as Enc \& Dec would yield different results. Solution to this is to use Hybrid Enc & \seqsplit{Limitations} of RSA: Toruble Enc Large files, Textbook RSA is subjected to chosen plaintext attack as it is \seqsplit{deterministic}. \tn % Row Count 21 (+ 21) % Row 5 \SetRowColor{white} \seqsplit{Comparison} between Public Key Enc \& Symmetric Key Enc: For public key \seqsplit{encryption}, public key can be sent over public channel while for symmetric key Enc, secret key must be sent over a secured channel. & Public key Enc is scalable for multi party \seqsplit{communications} but for symmetric Enc it is not scalable for multi party \seqsplit{communications}. & Public key Enc has long keys (2048 bits) while symmetric Enc has \seqsplit{relatively} shorter keys. & Public Key Enc has a slow Enc speed while symmetric Enc has a fast Enc speed. \tn % Row Count 42 (+ 21) \end{tabularx} \par\addvspace{1.3em} \vfill \columnbreak \begin{tabularx}{5.377cm}{x{1.04425 cm} x{1.04425 cm} x{1.04425 cm} x{1.04425 cm} } \SetRowColor{DarkBackground} \mymulticolumn{4}{x{5.377cm}}{\bf\textcolor{white}{Week 3: Public Key Encryption (cont)}} \tn % Row 6 \SetRowColor{LightBackground} \mymulticolumn{4}{x{5.377cm}}{Hybrid Enc (Alice to Bob): Alice selects a AES key K and then Enc message P to get C1 -\textgreater{} Alice use Bob's Public Key to Enc AES key K to get C2 -\textgreater{} Alice share C1 and C2 over public channel to Bob -\textgreater{} Bob use his private key to Dec C2 to get AES key K -\textgreater{} Bob use AES key K to Dec C1 to get message P.} \tn % Row Count 6 (+ 6) \hhline{>{\arrayrulecolor{DarkBackground}}----} \end{tabularx} \par\addvspace{1.3em} % That's all folks \end{multicols*} \end{document}