Download pdf - CCNA Sec 7- Crypto

Transcript
  • Cryptography.The science or study of protecting information, whether in transit or at rest.Used to secure communication between two or more parties.Secure communications involves: Authentication, Integrity, Confidentiality.Plaintext refers to any thing you can read whether text or not.Ciphertext refers to something you cant read.More key length, more security.Cryptanalysis.The study and methods used to crack encrypted communications.Encryption by keys provides confidentiality, Encryption by hashes provides integrity.The stronger key gets stronger encryption and the longer the attack will take to be successful.Using a long key and changing it periodically ensures that encryption is uncrackable.Any key with a length over 256 bits is considered uncrackable.Non-Repudiation.The ability to ensure that data sender will not deny their signature on a document or the sending of a message that they originated.

    Guarantee that the sender of a message can't later deny having sent the message.Digital signatures & enryption are used to establish authenticity and non- repudiation.Forms of encryption of bits:Substitution.Bits are simply replaced by other bits.Examples.Scytale

    Atbash Cipher.Replaces each letter used with another letter the same distance away from the end of the alphabet.A would be sent as a Z and B would be sent as a Y.

    So test will be gvhgCaesar cipher.There was a specific key to shift letters for encryption and decryption.Ex. If the key is 3, so A will be shifted to be D.

    CCNA Sec 7- Crypto

    CCNA Sec Page 1

  • Vigenere Cipher.Created by Sixteenth-century French cryptographer Blaise de Vigener.Uses a table of raws and columes labled from A to Z to increase the available substitution values and make the substitution more complex.

    To get cipher text, first select the column of plain text and then select the row of the key.Sender and receiver have a shared secret key composed of letters.

    The intersection of row and column is called cipher text.To decode cipher text, select the row of the key & find the intersection that is equal to cipher text.Vernam Cipher.Created at 1917 by AT&T Bell Labs engineer Gilbert Vernam.The plain text is combined with a random key, or pad, that is the same length as the message.RC4 is an example of this type of cipher.

    Concealment Cipher.Creates a message that is concealed in some way.Ex. ' I have been trying to buy Sally some nice jewelry, like gold or silver earrings, but prices nowhave increased', The key is to look at every sixth word in a sentence. So the secret message is "buy gold now".

    CCNA Sec Page 2

  • gold now".

    Transposition.Doesnt replace bits at all; it changes their order altogether.FLANK EAST ATTACK AT DAWN will be NWAD TA KCATTA TSAE KNALFEncryption algorithm.Mathematical formula used with the keys to encrypt and decrypt data.Encryption algorithms methods to encrypt data.Stream ciphers.Bits of data are encrypted as a continuous stream.Readable bits in their regular pattern are fed into the cipher and are encrypted one at a time.This usually by an XOR operation.Suited for hardware usage.XOR operation (exclusive-or).Are at the very core of a lot of computing.Requires two inputs, with encryption algorithms, this would be the data bits and the key bits.Each bit is fed into the operation, one from the data, the next from the key.If the bits match, the output is a 0; if they dont, its a 10 XOR 0 = 0 , 1 XOR 1 = 0 , 0 XOR 1 = 1 , 1 XOR 0 = 1If the key chosen is actually smaller than the data, the cipher will be vulnerable to frequency attacks as it will be used repeatedly in the process.

    Block ciphers.Data bits are split up into blocks usually 64 bits at a time and fed into the cipher.Each block of data is then encrypted with the key and algorithm.Blocks are then put through one or more of the following scrambling methods:Considered simpler and slower than stream ciphers.If there is less input data than one full block, the algorithm complete with blanks until 64 bits.

    Cryptanalysis.

    CCNA Sec Page 3

  • Cryptanalysis.The study and methods used to crack encrypted communications.Keyspace.The number of possibilities that can be generated by a specific key length (2^n).DaR (Data At Rest) [Disk encryption].The data files and folders can be encrypted themselves or encrypt the entire drive.Protects confidentiality of the data stored on a disk even the OS is not active.Done using EFS, and other tools as TrueCrypt.To encrypt a file or folder.~ the file, Properties, Advanced, Encrypt contents to secure dataTo encrypt a folder.cipher /e pathTo encrypt a file.cipher /e /a pathTo decrypt.cipher /d pathFor encryption.TrueCrypt-----------------------------------------------------------------------------------------------------

    Encryption types.Symmetric encryption (single key encryption) (shared key encryption).Single key to encrypt & decrypt.Very fast.50 mb/s but asymmetric is 20-200 kb/sA great choice for bulk encryption, due to its speed.Used with EFS.Key distribution and management is difficult as there is no secure way to share the key.The delivery of the key for the secured channel must be done offline.Not practical in a large environment such as the Internet.Doesn't provide non-repudiation.Because everyone has to have a specific key from each partner they want to communicate with, the sheer number of keys needed presents a problem.

    Number of keys needed for a mix of users want to communicate together = N (N 1) / 2So 3 persons need 3 keys, but 4 persons need 6 keys to communicate together securelly.Symmetric algorithms.DES.A block cipher that uses a 56-bit key (+ 8 bits reserved for parity).The least significant bit of each byte is a parity bit.Should be set such that there is always an odd number of bits set (1s) in each key byte.Only the 7 most significant bits of each byte are effective for security purposes.Not considered a very secure encryption algorithm, due to the small key size.Describes the DEA (Data Encryption Algorithm).DEA is a symmetric cryptosystem originally designed for implementation in hardware.DEA is also used for single-user encryption, such as encrypting stored files on a hard disk.IDEA (International Data Encryption Algorithm).

    CCNA Sec Page 4

  • IDEA (International Data Encryption Algorithm).A block cipher that uses a 128-bit key.Originally used in PGP (Pretty Good Privacy) 2.0.Was patented and used mainly in Europe.3DES (Triple DES).A block cipher that uses a 168-bit key.Can use up to three 56-bit keys per 64-bit block in a multiple-encryption method.Much more effective than DES, but is much slower as it consumes more processing power.AES (Advanced Encryption Standard).A 128 bit block cipher that offers three different key lengths: 128 bits, 192 bits, and 256 bits.Much effective & faster than DES or 3DES.Considered an uncrackable encryption algorithm.SEAL (Software-Optimized Encryption Algorithm).A stream cipher uses a 160-bit key.Developed in 1993 by Phillip Rogaway and Don Coppersmith.Twofish.A block cipher with key size up to 256 bits.Blowfish.A fast block cipher, largely replaced by AES.Uses a key from 32 to 448 bits, and a 64-bit block size.Blowfish is considered public domain.RC (Rivest Cipher).A block cipher that uses a variable key length up to 2,040 bits.Has several versions from RC2 through RC6RC4.Was a stream cipher.Used frequently within SSL to secure web transactions.Key size 1 - 256RC5.Uses variable block sizes (32, 64, 128).Key size 0 - 2040, 128 suggestedRC6.Uses 128-256 bit blocks.Key size 128, 192, or 256MAC (Message Authentication Code).Requires the sender and receiver to share a secret key.HMAC (Hashed Message Authentication Code).Calculated using a specific algorithm with a secret key.A data integrity algorithm that guarantees the integrity of the message using a hash value.Functions by using a hashing algorithm, such as MD5 or SHA-1.Was designed to be immune to the multicollision attack.At the local device, the message and a shared-secret key are processed through a hash algorithm.The hash algorithm produces a hash value, that is appended to the message.The message is sent over the network.The hash value is recalculated and compared to the sent hash value by the remote host.

    CCNA Sec Page 5

  • The hash value is recalculated and compared to the sent hash value by the remote host.Common HMAC algorithms are HMAC MD5, HMAC SHA1.Asymmetric encryption.2 keys, one for encryption and the other for decryption.Can be used for data encryption, digital signatures.Provides: confidentiality, authentication, nonrepudiation.Slow, Consumes more processing power (the only real downside).Suitable for smaller amounts of data, mails,Asymmetric Encryption keys.Public key.Known and can be sent to anyone, so it's public.In general used for encryption.Private key.Used for digital signing & to decrypt data encrypted with the corresponding public key.A signature is authenticated by decrypting the signature with the sender's public key.Private and kept in a secure location.In general used for decryption.Each key can decrypt only data encrypted by it's corresponding key.Asymmetric algorithms.IPsec.A network layer tunneling protocol running in 2 modes.Tunnel mode.Used between two security gateways or between a host and a security gateway.The original IP packet is encrypted and then it is encapsulated in another IP packet.Transport mode.Protects the payload of the packet but leaves the original IP address in plaintext.The original IP address is used to route the packet through the Internet.Used between hosts.SSH (Secure Shell).A secured version of Telnet.Uses TCP port 22Relies on public key cryptography for its encryption.SSH2.The successor to SSH.More secure, efficient, and portable.Includes a built-in encrypted version of FTP (SFTP).SSL (Secure Sockets Layer).Encrypts data at the transport layer, and above, for secure communication across the Internet.Uses RSA encryption and digital certificates.Originally developed by Netscape, and has been universally accepted on the Web.SSL session establishment steps.The user makes an outbound connection to TCP port 443.The server responds with a digital certificate.The user's computer generates a shared secret key that both parties use.This key is encrypted with the public key of the server and transmitted to the server.

    CCNA Sec Page 6

  • This key is encrypted with the public key of the server and transmitted to the server.The router decrypts the packet to get the key with it's private key.This key will be used to encrypt the SSL session.It is being largely replaced by TLS.

    TLS (Transport Layer Security).The successor to SSL.Uses an RSA algorithm of 1024 and 2048 bits.PGP (Pretty Good Privacy).A computer program that provides cryptographic privacy and authentication and often used to increase the security of email communications.

    Encrypts data at the transport layer, and above for secure communication across the Internet.Uses RSA encryption and digital certificates.It is being largely replaced by TLS (Transport Layer Security).ECC (Elliptic Curve Cryptosystem).Uses points on an elliptical curve, in conjunction with logarithmic problems, for encryption and signatures.

    A good choice for mobile devices, as it uses less processing power than other methods.El Gamal.Not based on prime number factoring.Uses the solving of discrete logarithm problems for encryption and digital signatures.RSA.Achieves strong encryption through the use of two large prime numbers.Factoring these numbers creates key sizes up to 4,096 bits.Diffie-Hellman.Used as a key exchange protocol in SSL and IPSec encryption.Can be vulnerable to man-in-the-middle attacks, if the use of digital signatures is waived.

    CCNA Sec Page 7

  • Hash.One-way mathematical algorithm that generates a specific fixed-length number (hash value).Used to provide data integrity and verify authentication.Sent along with the message to the recipient.If even a single bit of the data is changed during the transmission, the hash value will change.The result will be either a retransmission of the data or a complete shutdown of the session.Changeable filelds are not included in the hash calculation as the TTL field.When you download a large file, it may contain another file called MD5SUM or something similar, that will contains the correct fingerprints.

    Hashing prevents the data from being changed accidentally, such as by a communication error.Data signing involves the creation of an MD5 message digest of the document.Then encrypted by the senders private key.Hash algorithms.MD5 (Message Digest algorithm).Created by Ronald Rivest.Produces a 128-bit hash value output, expressed as a 32-digit hexadecimal.Despite it's serious flaws, and the advancement of other hashes, MD5 is still used for file verification on downloads and, in many cases, to store passwords.

    SHA-1 (Secure Hash Algorithm).Developed by the NSA (National Security Agency).Produces a 160-bit value.Corrected a flaw in the original SHA-0 algorithm.SHA-0 was also a 160-bit value.

    CCNA Sec Page 8

  • In late 2005, a serious flaws became apparent to SHA-1 & so started to produce SHA-2.Although theoretically SHA-1 can be cracked, there havent been any proven cases of it.SHA-2.Holds four separate hash functions that produce outputs of 224, 256, 384, and 512 bits.Not widely used, although it was designed as a replacement for SHA-1.RIPEMD-160Collision attack. The attack against hashing algorithms.Collision occurs when 2 or more files create the same output, which is not supposed to happen.Tha hacker creates a second file that produces the same hash value output as the original, then he pass off the fake file as the original.

    There are only so many combinations the hash can create given an input.MD5 will generate 2^128 possible combinations.Given a hash value for an input, you can duplicate it over time using the same hash and applying it to different inputs.

    The hacker to get the password from a hash, he compares data inputs and the hash values they present until the hashes match.

    Some people sat down and started running every word, phrase, and compilation of characters they could think of into a hash algorithm, and results were stored in the rainbow table for use later.

    To protect against collision attacks and the use of rainbow tables, use salt.Salt.A collection of random bits that are used as a key in addition to the hashing algorithm.Used to protect against collision attacks and the use of rainbow tables.Coz the bits, and length are random, a good salt makes a collision attack very difficult to pull off.Every time a bit is added to the salt it adds a power of 2 to the complexity of the number of computation involved to derive the outcome.

    Windows password hashes are not salted.SAM DB can be protected using the syskey.Windows login hashing.LM (LAN Manager) hash storage.A win NT encryption method (but weak).LM Authentication (DES) was used with Windows 95/98 machines.Has 6 different levels, 0 is the Win XP default, and 2 is the Win 2003 default.NTLM (NT LAN Manager).A challenge/response authentication protocol.Encrypts users credentials in win NT domains.NTLM (DES and MD5) was used with Windows NT machines until SP3.NTLM v2 (MD5) was used after that. Windows 2000 uses NTLM hashing to secure passwords in transit on the network. Password hashing steps.Its first converted to all uppercase: for ex. 123456abcdef will be 123456ABCDEF.It's padded with null (blank) characters to make it 14 characters long: 123456ABCDEF__.The 14-character string is split in half: 123456A and BCDEF__.Each string is individually encrypted, and the results are concatenated:123456A = 6BF11E04AFAB197F , BCDEF__ = F1E9FFDCC75575B15*The hash is 6BF11E04AFAB197FF1E9FFDCC75575B15 .*

    CCNA Sec Page 9

  • The hash is 6BF11E04AFAB197FF1E9FFDCC75575B15 .*If a password is 7 characters or less, the 2nd half of the hash 'll always be AAD3B435B51404EE.Kerberos.Encrypts credentials for domain authentication.Came about with Windows 2000.Uses both symmetric and asymmetric encryption to send passwords & keys across a network.

    Ensures authenticity and integrity of messages.Digital signing.

    Provides assurance of the software codes.

    RSA (Rivest, Shamir, Adleman)

    CCNA Sec Page 10

  • RSA (Rivest, Shamir, Adleman)One of the most common asymmetric algorithms, based on a public key and a private key. The RSA keys are usually 512 to 2048 bits long.It is not possible to determine the private key from the public key.PKI.A structure designed to verify and authenticate the identity of individuals within the enterprise.A certificate management system for generation, distribution, storage, verification of certificates.The system starts at the top, with a CA that creates and issues digital certificates.Keeps track of all the certificates and maintains a CRL (Certificate Revocation List).Anyone wanting to send a message to a user will go to the CA to get a legitimate copy of its public key.

    Certificate (digital certificate) (x.509 certificate).An electronic credential used for authentication & securing data on open networks, as the Internet.Securely binds a public key to the entity that holds the corresponding private key.Ensures that a specific user or computer or service has a specific public key to prevent the intruder from distributing his public key as another user.

    Issued by a CA (Certificate Authority) or locally by the CSP service.Every CA also has a certificate containing its public key, signed by itself. X.509 standard defines what should and should not be in a digital certificate.Each user has a certificate store created in the user's profile when a user is added to the system.In the domain, a copy of each user & recovery agent certificate is sent to the CA server database.Certificate can be issued for a user, computer, service as IPSec.With certificates, hosts no longer have to maintain passwords to be authenticated.The digital certificate contents.Version.This identifies the certificate format. As each version has a format that has changed slightly.Serial Number.Used to uniquely identify the certificate itself.Subject.Whoever or whatever is being identified by the certificate.Algorithm ID (or Signature Algorithm).Shows the algorithm that was used to create the digital signature.Issuer.The entity that verifies the authenticity of the certificate (the one who created the certificates).Valid From and Valid To.These fields show the dates the certificate is good through.Key Usage.Shows for what purpose the certificate was created.Subjects Public Key.A copy of the subjects public key is included in the digital certificate, for obvious purposes.Optional fields.Issuer Unique Identifier, Subject Alternative Name, and Extensions.Certificate authority.A trusted third-party entity that issues certificates. Every CA also has a certificate containing its public key, signed by itself.

    CCNA Sec Page 11

  • Every CA also has a certificate containing its public key, signed by itself. This is called a CA certificate or, more properly, a self-signed CA certificate.

    Single-root PKI Topology.A single CA (root CA) issues all the certificates to the end users.

    Hierarchical CA Topology.

    CCNA Sec Page 12

  • One issue with hierarchical PKI topologies lies in finding the certification path for a certificate.Cross-certified CA.You could have a CA with a horizontal trust relationship over to a second CA sothat clients of either CA could trust the signatures of the other CA

    RA (Registration Authority).Accept requests for enrollment in the PKI.Employed to reduce the burden on Cas in larg environment or where the CA is offline.Can't issue certificates or publish CRLs.

    CCNA Sec Page 13

  • Certificate request.The client retrieves the CA certificate (self-signed certificate).The client forwards a certificate request that includes it's public key along with some identifying information.

    All of this information is encrypted using the public key of the CA.The CA administrator issues the certificate by adding some additional data to the certificate request and digitally signing it all.

    Either the end user manually retrieves the certificate or SCEP automatically retrieves the certificate, and the certificate is installed onto the system.

    Now users can authenticate each other by exchanging certificates signed by that CA.

    Cryptanalysis Methods.Brute-Force Method.The attacker tries every possible key with the decryption algorithm to decrypt the cipher.Preferred with short keys.Ciphertext-only attack.The hacker gains copies of several messages encrypted in the same way (the same algorithm).The attacker attempts to decode the cipher by looking for patterns and using statistical analysis.These kinds of attacks are no longer practical, because modern algorithms produce pseudorandom output that is resistant to statistical analysis.

    Known plaintext attack.The attacker has access to the ciphertext of several messages.Knowledge (underlying protocol, file type, or some characteristic strings) about the plaintext underlying that ciphertext.

    CCNA Sec Page 14

  • underlying that ciphertext.

    The attacker uses a brute-force attack to try keys until decryption with the correct key produces a meaningful result.

    Meet-in-the-Middle.A known plaintext attack.The attacker knows a portion of the plaintext and the corresponding ciphertext.The plaintext is encrypted with every possible key, and the results are stored.The ciphertext is then decrypted using every key, until one of the results matches one of the stored values.

    Choosen plaintext attack.The attacker encrypts multiple plaintext copies himself in order to gain the key.Ex. The hacker has the public key of a device then it can has a plaintext of data and cipher text encrypted by the public key of that device, this attack can help hacker to get the private key.

    Chosen cipher attack.The same process is followed (statistical analysis without a plaintext version for comparison), but its only for portions of gained ciphertext.

    CCNA Sec Page 15