Chapter 10. Cryptographic Attacks and Defenses

This chapter covers the following topics:

  • Functions of Cryptography: You should understand the functions of cryptography because it can be used to provide confidentiality, integrity, authenticity, and nonrepudiation. For example, symmetric encryption can provide confidentiality, hashing can provide integrity, and digital signatures can provide authenticity, integrity, and nonrepudiation.

  • History of Cryptography: Knowing the history of cryptographic solutions can help you understand its role in our world today. Throughout time, people have wanted to protect information. Systems such as Caesar’s cipher, Enigma, and One-Time Pads were developed to protect sensitive information.

  • Algorithms: You should understand the difference between symmetric, asymmetric, and hashing algorithms. Each has a unique role in the world of cryptography and can be used to protect information in transit or at rest.

  • Public Key Infrastructure: You should understand the purpose of public key infrastructure (PKI) and its role in communication and e-commerce. It can provide third-party trust and make e-commerce possible.

  • Protocols, Standards, and Applications: As a CEH, you should have a good basic understanding of common protocols and standards such as Secure Shell, IPsec, and PGP. Attackers are going to look for weaknesses in these systems to gain access to sensitive information.

This chapter introduces you to cryptography. You might find this topic interesting, or you might dread the thought of it. However, fear not. Cryptography is an exciting subject and something a CEH should fully understand. Understanding how it functions will go a long way toward helping you build a good security foundation. Cryptography is nothing new. It has been used throughout time to protect the confidentiality and integrity of information, and consequently there have always been individuals who are intent on breaking cryptosystems. This chapter examines both perspectives. As an ethical hacker, you might need to use cryptographic solutions to store reports and other sensitive client information. There is also a strong possibility that you will need to target cryptographic systems, such as when an attacker encrypts everything on your systems, your data during a ransomware attack, or when you need crack to hashed passwords.

The chapter starts with an overview of cryptography and discusses the two basic types. It then examines the history of cryptographic systems and the most popular types of cryptography used today: Data Encryption Standard (DES); Triple DES (3DES); Rivest, Shamir, and Adleman (RSA); Advanced Encryption Standard (AES), International Data Encryption Algorithm (IDEA), and others. So that you understand the many uses of encryption, this chapter also reviews hashing, digital signatures, and certificates. The public key infrastructure is also introduced. The chapter concludes with an overview of cryptographic applications, tools, and techniques.

“Do I Know This Already?” Quiz

The “Do I Know This Already?” quiz enables you to assess whether you should read this entire chapter thoroughly or jump to the “Exam Preparation Tasks” section. If you are in doubt about your answers to these questions or your own assessment of your knowledge of the topics, read the entire chapter. Table 10-1 lists the major headings in this chapter and their corresponding “Do I Know This Already?” quiz questions. You can find the answers in Appendix A, “Answers to the ‘Do I Know This Already?’ Quizzes and Review Questions.”

Table 10-1 “Do I Know This Already?” Section-to-Question Mapping

Foundation Topics Section

Questions

Functions of Cryptography

1

History of Cryptography

4

Algorithms

2, 3, 5, 7, 9

Public Key Infrastructure

6, 10

Protocols, Applications, and Attacks

8

Caution

The goal of self-assessment is to gauge your mastery of the topics in this chapter. If you do not know the answer to a question or are only partially sure of the answer, you should mark that question as wrong for purposes of the self-assessment. Giving yourself credit for an answer you correctly guess skews your self-assessment results and might provide you with a false sense of security.

1. Which of the following is usually discussed in addition to the concepts of AIC when dealing with cryptographic systems?

a. Privacy

b. Speed

c. Hacking

d. Nonrepudiation

2. Which of the following is an example of a symmetric encryption algorithm?

a. Diffie-Hellman

b. MD5

c. RC4

d. RSA

3. Which of the following is an example of a hashing algorithm?

a. Blowfish

b. MD5

c. RC4

d. RSA

4. Caesar’s cipher is also known as what?

a. ROT13

b. ATBASH

c. ROT3

d. A hashing algorithm

5. RSA is an example of which of the following?

a. Digital signature

b. Asymmetric algorithm

c. Symmetric algorithm

d. Hashing algorithm

6. Which of the following does a digital signature not provide?

a. Privacy

b. Integrity

c. Authentication

d. Nonrepudiation

7. Tiger is an example of what?

a. Digital signature

b. Asymmetric algorithm

c. Symmetric algorithm

d. Hashing algorithm

8. Which of the following is a serious vulnerability in the popular OpenSSL cryptographic software library?

a. FREAK

b. POODLE

c. Shellshock

d. Heartbleed

9. Which of the following does symmetric encryption provide?

a. Privacy

b. Integrity

c. Authentication

d. Nonrepudiation

10. When would a hashing algorithm be used in conjunction with a sender’s private key?

a. Hashing

b. Digital signatures

c. Symmetric encryption

d. PKI

Foundation Topics

Functions of Cryptography

Cryptography can be described as the process of concealing the contents of a message from all except those who know the key. Although protecting information has always been important, electronic communications and the Internet have made protecting information even more important, because systems are needed to protect email, corporate data, personal information, and electronic transactions. Cryptography can be used for many purposes; however, this chapter focuses primarily on encryption. Encryption is the process used in cryptography to convert plain text into cipher text to prevent any person or entity except the intended recipient from reading that data. Symmetric and asymmetric are the two primary types of encryption algorithms. Symmetric algorithms use a single key, and asymmetric uses a key pair.

What else is required to have a good understanding of cryptography? It is important to start with an understanding of what services cryptography offers. These include confidentiality, authenticity, integrity, and nonrepudiation.

Confidentiality means that what is private should stay private. Cryptography can provide confidentiality through the use of encryption. Encryption can protect the confidentiality of information in storage or in transit. Think about the CEO’s laptop. If it is lost or stolen, what is really worth more: the laptop or confidential information about next year’s hot new product line? Informational assets can be worth much more than the equipment that contains them. Encryption offers an easy way to protect that information if the equipment is lost, stolen, or accessed by unauthorized individuals.

Authentication has several roles. First, authentication can also be associated with message encryption. Authentication is something you use to prove your identity (such as something you have, you know, or you are). An example of something you know is a password, something you have might be a smart card, and something you are can include many forms of biometrics, such as a fingerprint.

Authentication is part of the identification and authentication process. The most common form of authentication is username and password. Most passwords are encrypted; they do not have to be, but without encryption, the authentication process would be weak. FTP and Telnet are two examples of protocols that do not use encryption; usernames and passwords are passed in clear text, and anyone with access to the wire can intercept and capture these credentials. Virtual private networks (VPNs) also use authentication, but instead of a clear-text username and password, they use digital certificates and digital signatures to more accurately identify the user and protect the authentication process from spoofing.

Integrity is another important piece of the cryptographic puzzle. Hashing can be used to establish integrity. Integrity is a means to ensure that information has remained unaltered from the point it was produced, while it was in transmission, and during storage. If you’re selling widgets on the Internet for $10 each, you will likely go broke if a hacker can change the price to $1 at checkout. Integrity is important for many individuals, including those who exchange information, perform e-commerce, are in charge of trade secrets, and are depending on accurate military communications.

Nonrepudiation and authenticity are used to ensure that a sender of data is provided with proof of delivery and that the recipient is assured of the sender’s identity. Neither party should be able to deny having sent or received the data at a later date if in fact the data was sent and received. In the days of face-to-face transactions, nonrepudiation was not as hard to prove. Today, the Internet makes many transactions faceless. You might buy a book from Amazon or purchase a computer from eBay. You need to be sure that when you pay for these items the funds actually go to the correct party. Therefore, nonrepudiation became even more critical. Nonrepudiation is achieved through digital signatures, digital certificates, and message authentication codes (MAC).

History of Cryptography

Cryptography, hiding information, has been used throughout the ages. The Spartans used a form of cryptography called Scytale to send information to their generals in the field. Ancient Hebrews used a basic cryptographic system called ATBASH. Even Julius Caesar used a form of encryption to send messages back to Rome in what is known as Caesar’s cipher. Although many might not consider it a true form of encryption, Caesar’s cipher worked by what we now call a simple substitution cipher. In Caesar’s cipher, there was a plain-text alphabet and a cipher-text alphabet. The alphabets were arranged as shown in Figure 10-1.

A table shows Caesar’s Cipher code. The first row shows the plain text alphabet written from A to Z and the second row shows the corresponding ciphertext alphabet written from D to C (in a reverse manner).

Figure 10-1 Caesar’s Cipher

When Caesar was ready to send a message, encryption required that he move forward three characters. Caesar’s cipher is also known as a ROT3 cipher because you are moving forward or back three characters to encrypt or decrypt. For example, using Caesar’s cipher to encrypt the word cat would result in fdw. You can try this yourself by referring to Figure 10-1; just look up each of the message’s letters in the top row and write down the corresponding letter from the bottom row.

Believe it or not, you have now been introduced to many of the elementary items used in all cryptosystems. First, there is the algorithm. In the case of Caesar’s cipher, the algorithm converts letter by letter each plain-text character with the corresponding cipher-text character. Next is the key. This was Caesar’s decision to move forward three characters for encryption and to move back three characters for decryption. Next, there is the plain text. In our example, the plain text is cat. Finally, there is the cipher text. Our cipher text is the value fdw. Before we get too far into our discussion of encryption, let’s spend a few minutes reviewing these basic and important terms:

  • Algorithm: A set of rules or a mathematical formula used to encrypt and decrypt data.

  • Plain text: Clear text that is readable.

  • Cipher text: Data that is scrambled and unreadable.

  • Cryptographic key: A key is a piece of information that controls how the cryptographic algorithm functions. It can be used to control the transformation of plain text to cipher text or cipher text to plain text. For example, the Caesar cipher uses a key that moves forward three characters to encrypt, and it moves back by three characters to decrypt.

  • Substitution cipher: A simple method of encryption in which units of plain text are substituted with cipher text according to a regular system. This could be achieved by advancing one or more letters in the alphabet. The receiver deciphers the text by performing an inverse substitution.

  • Symmetric encryption: Uses the same key to encode and decode data.

  • Asymmetric encryption: Uses two different keys, one for encryption and one decryption. In most asymmetric systems, each participant is assigned a pair of keys; what one key does, the other one undoes.

  • Encryption: To transform data into an unreadable format.

Around the beginning of the twentieth century, the United States became much more involved in encryption and cryptanalysis. Events such as WWI and WWII served to fuel the advances in cryptographic systems. Although some of these systems, such as the Japanese Purple Machine and the German Enigma, were rather complex mechanical devices, others were simply based on languages or unknown codes. Anyone who has ever seen the movie Windtalkers knows of one such story. In the movie, the U.S. military is faced with the need for securing against the Japanese, so they turned to the Navajo Indians. The unwritten Navajo language became the key used to create a code for the U.S. Marine Corps. Using their native tongue, Navajo code talkers transmitted top secret military messages that the Japanese were unable to decrypt. It worked because the language was so rare. This helped to turn the war against Japan and helped hasten its defeat. Entire government agencies were eventually created, such as the National Security Agency (NSA), to manage the task of coming up with new methods of keeping secret messages secure. These same agencies were also tasked with breaking the enemy’s secret messages. Today, encryption is no longer just a concern of the government; it can be found all around us and is used to perform transactions on the Internet, secure your email, maintain the privacy of your cell phone call, and protect intellectual property rights.

Algorithms

As introduced previously, an algorithm is a set of rules used to encrypt and decrypt data. It’s the set of instructions used along with the cryptographic key to encrypt plain-text data. Plain-text data encrypted with different keys or dissimilar algorithms will produce different cipher text. Not all cryptosystems are of the same strength. For example, Caesar might have thought his system of encryption was quite strong, but it would be relativity unsecure today. How strong should an encryption process be? The strength of a cryptosystem will rely on the strength of an algorithm itself, because a flawed algorithm can be reversed, and the cryptographic key recovered. The encryption mechanism’s strength also depends on the value of the data. High-value data requires more protection than data that has little value. More-valuable information needs longer key lengths and more frequent key exchange to protect against attacks. Another key factor is how long the data will be valid for. If the data is valid only for seconds, a weaker encryption algorithm could be used.

Modern cryptographic systems use two types of algorithms for encrypting and decrypting data. The main difference is that symmetric encryption uses the same key to encode and decode data. Asymmetric encryption uses different keys for encryption and decryption. Each participant is assigned a pair of keys. Before each type is examined in more detail, spend a minute to review Table 10-2, which highlights some of the key advantages and disadvantages of each method.

Table 10-2 Symmetric and Asymmetric Differences

Type of Encryption

Advantages

Disadvantages

Symmetric

Faster than asymmetric

Key distribution

Only provides confidentiality

Asymmetric

Easy key exchange

Slower than symmetric

Can provide confidentiality and authentication

Tip

You should know basic cryptographic concepts for the CEH exam.

Symmetric Encryption

Image

Symmetric encryption is the older of the two forms of encryption. It uses a single shared secret key for encryption and decryption. Symmetric algorithms include the following:

  • DES: Data Encryption Standard, FIPS 46-3, is the most common symmetric algorithm used (64 bits with an effective key length of 56 bits).

  • 3DES: Used as an extension to DES in that the algorithm is repeated three times instead of once. 3DES uses a 168-bit key.

  • Blowfish: A general-purpose symmetric algorithm intended as a replacement for DES.

  • Rijndael: A block cipher adopted as the Advanced Encryption Standard (AES) by the U.S. government to replace DES. It is detailed in FIPS 197.

  • RC4: Rivest Cipher 4 is a stream-based cipher.

  • RC5: Rivest Cipher 5 is a block-based cipher.

  • RC6: Revised from RC5 to use integer multiplication and uses four 4-bit working registers.

  • SAFER: Secure and Fast Encryption Routine is a block-based cipher.

All symmetric algorithms are based on the single shared key concept. Figure 10-2 shows an example of this concept.

A block diagram illustrates the symmetric encryption mechanism.

Figure 10-2 Symmetric Encryption

This simple diagram shows the process that symmetric encryption entails. Plain text is encrypted with the single shared key and is then transmitted to the message recipient, who goes through the same process to decrypt the message. The dual use of keys is what makes this system so simple, but it also causes its weakness. Symmetric encryption is fast and can encrypt and decrypt quickly; it is also considered strong. Symmetric encryption is hard to break if a longer key is used. Even though symmetric encryption has it strengths, it also has three disadvantages.

Note

For the exam, you should understand the advantages and disadvantages of symmetric encryption.

The first problem with symmetric encryption is key distribution. For symmetric encryption to be effective, there must be a secure method in which to transfer keys. In the modern world, there needs to be some type of out-of-band transmission. For example, if Bob wants to send Alice a secret message but is afraid that Black Hat Bill can monitor their communication, how can he send the message? If the key is sent in clear text, Black Hat Bill can intercept it. Bob could deliver the key in person, mail it, or even send a courier. All these methods are highly impractical in the world of e-commerce and electronic communication.

Even if the problems of key exchange are overcome, you still are faced with a second big problem when dealing with symmetric encryption: key management. If, for example, you needed to communicate with 10 people using symmetric encryption, you would need 45 keys. The following formula is used to calculate the number of keys needed:

N(N – 1) / 2 or [10(10 – 1) / 2 = 45 keys]

The third and final problem of symmetric encryption is that it provides confidentiality only, not authentication. If you’re looking for authentication, you will have to consider asymmetric encryption. But before asymmetric encryption is discussed, let’s take a look at DES, one of the most popular forms of symmetric encryption.

Data Encryption Standard (DES)

DES was adopted more than 20 years ago by the National Bureau of Standards (NBS). NBS is now known as the National Institute of Standards and Technology (NIST). This algorithm was modified to use a 56-bit key and was finally adopted as a national standard in 1976. The certification as a national standard is not a permanent thing; therefore, DES was required to be recertified every five years. Although initially passing without any problems, DES began to encounter problems during the 1987 recertification. By 1993, NIST stated that DES was beginning to outlive its usefulness, and NIST began looking for candidates to replace it. This new standard was to be referred to as the Advanced Encryption Standard (AES). What happened to DES? Well, DES had become the victim of increased computing power. Just as Moore’s law had predicted, processing power has doubled about every 18 to 24 months. The result is that each year it becomes easier to brute force existing encryption standards. A good example can be seen in the big encryption news of 1999 when it was announced that the Electronic Frontier Foundation (EFF) was able to guess a DES password in about 23 hours. The attack used distributed computing and required over 100,000 computers. That’s more processing power than most of us have at home, but it demonstrates the need for stronger algorithms.

Note

DES is considered weak and susceptible to a brute force (sequential guess) attack.

DES functions by what is known as a block cipher. The other type of cipher is a stream cipher. Block and stream ciphers can be defined as follows:

  • Block cipher: Functions by dividing the message into blocks for processing

  • Stream cipher: Functions by dividing the message into bits for processing

Because DES is a block cipher, it segments the input data into blocks. DES processes 64 bits of plain text at a time to output 64-bit blocks of cipher text. DES uses a 56-bit key, and the remaining 8 bits are used for parity. Because it is symmetric encryption, a block cipher uses the same key to encrypt and decrypt. DES works by means of a substitution cipher. It then performs a permutation on the input. This action is called a round, and DES performs these 16 times on every 64-bit block. DES actually has four modes or types, and not all of these are of equal strength. The four modes of DES are as follows:

  • Electronic Code Book mode (ECB): ECB is the native encryption mode of DES. It produces the highest throughput, although it is the easiest form of DES to break. The same plain text encrypted with the same key always produces the same cipher text.

  • Cipher Block Chaining mode (CBC): CBC is widely used and is similar to ECB. CBC takes data from one block to be used in the next; therefore, it chains the blocks together. However, it’s more secure than ECB and harder to crack. The disadvantage of CBC is that errors in one block will be propagated to others, which might make it impossible to decrypt that block and the following blocks as well.

  • Cipher Feedback mode (CFB): CFB emulates a stream cipher. CFB can be used to encrypt individual characters. Like CBC, errors and corruption can propagate through the encryption process.

  • Output Feedback mode (OFB): OFB also emulates a stream cipher. Unlike CFB, transmission errors do not propagate throughout the encryption process because OFB takes the plain text to feed back into a stream of cipher text.

To extend the usefulness of the DES encryption standard, 3DES was implemented. 3DES can use two or three keys to encrypt data and performs what is referred to as multiple encryption. It has a key length of up to 168 bits. It is much more secure, but it is up to three times as slow as 56-bit DES. Figure 10-3 shows an example of three-key 3DES.

A figure illustrates an example of triple DES technique.

Figure 10-3 3DES (Triple DES)

Note

Double DES is not used because it is no more secure than regular DES and is vulnerable to a meet-in-the-middle attack. This type of attack is used against encryption schemes that rely on performing multiple encryption operations in sequence.

Advanced Encryption Standard (AES)

In 2002, NIST decided on the replacement for DES. Rijndael (which sounds like rain doll) was the chosen replacement. Its name derives from its two developers, Vincent Rijmen and Joan Daemen. Rijndael is an iterated block cipher that supports variable key and block lengths of 128, 192, or 256 bits. It is considered a fast, simple, and robust encryption mechanism. Rijndael is also known to stand up well to various types of attacks. It uses a four-step, parallel series of rounds. Each of these steps is performed during each round, as follows:

  • SubBytes: Each byte is replaced by an S-box substation.

  • ShiftRows: Bytes are arranged in a rectangle and shifted.

  • MixColumns: Matrix multiplication is performed based on the arranged rectangle.

  • AddRoundKey: This round’s subkey is added in.

Rivest Cipher

Rivest Cipher (RC) is a general term for the family of ciphers designed by Ron Rivest. These include RC2, RC4, RC5, and RC6. RC2 is an early algorithm in the series. It features a variable key-size 64-bit block cipher that can be used as a drop-in substitute for DES. RC4 is a stream cipher and is faster than block mode ciphers. RC4 is useful for services such as voice communication. The 40-bit version was originally available in Wired Equivalent Privacy (WEP). RC4 is most commonly found in the 128-bit key version. RC5 is a block-based cipher in which the number of rounds can range from 0 to 255, and the key can range from 0 bits to 2,040 bits in size. Finally, there is RC6. It features variable key size and rounds and added two features not found in RC5: integer multiplication and four 4-bit working registers.

Asymmetric Encryption (Public Key Encryption)

Image

Asymmetric encryption is a rather new discovery. Public key cryptography is made possible by the use of one-way functions. It differs from symmetric encryption in that it requires two keys. What one key does, the second key undoes. These keys are referred to as public and private keys. The public key can be published and given to anyone, while the user keeps the private key a secret. Figure 10-4 shows an example of public key encryption.

A figure illustrates an example of public key encryption.

Figure 10-4 Asymmetric Encryption

Asymmetric encryption differs from symmetric encryption in other ways, too, because it uses difficult mathematical problems. Specifically, it is called a trapdoor function. Trapdoor functions get their name from the difficulty in factoring large prime numbers. For example, given the prime numbers of 387 and 283, it is easy to multiply them together and get 109,521. However, if you are given the number 109,521, it’s quite difficult to extract the two prime numbers of 387 and 283. As you can see, anyone who knows the trapdoor can perform the function easily in both directions, but anyone lacking the trapdoor can perform the function in only one direction. Trapdoor functions can be used in the forward direction for encryption and signature verification, and the inverse direction is used for decryption and signature generation. Although factoring large prime numbers is specific to RSA, it is not the only type; there are others, such as the discrete logarithm problem. RSA, Diffie-Hellman, ECC, and ElGamal are all popular asymmetric algorithms. All these functions are examined next.

It is essential to understand the following principle in public key encryption: What A encrypts, B decrypts; what B encrypts, A decrypts.

Note

For the exam, you should understand the advantages and disadvantages of asymmetric encryption.

RSA

RSA was developed in 1977 at MIT by Ron Rivest, Adi Shamir, and Leonard Adleman, and it is one of the first public key encryption systems ever invented. This is where the acronym for the well-known RSA originated from. Although RSA is not as fast as symmetric encryption, it is strong. It gets its strength by using two large prime numbers. It works on the principle of factoring these large prime numbers. RSA key sizes can grow quite large and are currently using a 4096-bit key length. Cracking a key of this size would require an extraordinary amount of computer processing power and time.

RSA is used for both encryption and digital signatures. Because asymmetric encryption is not as fast as symmetric encryption, the two are often used together. Therefore, it gains the strengths of both systems. The asymmetric protocol is used to exchange the private key, but the actual communication is performed with symmetric encryption. The RSA cryptosystem can be found in many products, such as Google Chrome and Mozilla Firefox.

Diffie-Hellman

Diffie-Hellman is another widely used asymmetric encryption protocol. It was developed for use as a key exchange protocol, and it is used as a component in Secure Sockets Layer (SSL) and Internet Protocol Security (IPsec). Diffie-Hellman is extremely valuable because it allows two individuals who have not communicated with each other before to exchange keys. However, like most systems, it isn’t perfect; it is vulnerable to man-in-the-middle attacks. This vulnerability exists because, by default, the key exchange process does not authenticate the participants. You can overcome this vulnerability if you use digital signatures or the Password Authentication Key Exchange (PAKE) form of Diffie-Hellman.

ElGamal

Developed in the early 1980s, ElGamal was designed for encryption and digital signatures. It is composed of three discrete components: a key generator, an encryption algorithm, and a decryption algorithm. It differs somewhat from the other asymmetric systems that have been discussed; it is based not on the factoring of prime numbers, but rather on the difficulty of solving discrete logarithm problems.

Elliptic Curve Cryptography (ECC)

ECC uses the discrete logarithm problem over the points on an elliptic curve in the encryption and decryption processes to provide security to messages. Because it requires less processing power than some of the previous algorithms discussed, it’s useful in hardware devices, such as cell phones and tablets.

Hashing

Image

Hashing algorithms take a variable amount of data and compress it into a fixed-length value, which is referred to as a hash value. Hashing provides a fingerprint of the message. The hash is not reversible, which means it cannot be used to re-create the original data. Strong hashing algorithms will not produce the same hash value for multiple different data sets. If two different data sets do produce the same hash, it is referred to as a collision. Hashing is used to provide integrity and is also used in authentication systems. It can help verify that information has remained unchanged. Figure 10-5 gives an overview of the hashing process.

An overview of the hashing process is shown.

Figure 10-5 The Hashing Process

Some common hashing algorithms include SHA (160/256/512), MD (128), Tiger (192) nontruncated, Whirlpool (256), bcrypt, and RIPEMD (160). Programs such as Tripwire, MD5Sum, and Windows System File Verification rely on hashing. The early examples of hashing algorithms are message digest algorithm version 5 (MD5) and Secure Hash Algorithm 1 (SHA-1). Both algorithms are explained next:

  • MD5: Creates a fixed-length 128-bit output. MD5 and the other MD hashing algorithm were created by Ron Rivest. It segments the data in blocks of 512 bits. MD5 digests are widely used for software verification and forensics, such as DiskProbe, to provide assurance that a downloaded file has not been altered. A user can compare a published MD5 value with one he calculates after downloading. The output of an MD5 is 32 characters long. However, because these MD5 values are subject to collision, most now use SHA-2 or SHA-3.

  • SHA-1: SHA is similar to MD5. It is considered the successor to MD5 and produces a 160-bit message digest. However, this large message digest is considered less prone to collisions. SHA-1 is part of a family of SHA algorithms, including SHA-0, SHA-1, SHA-2, and SHA-3.

Note

Hashing algorithms are closely associated with passwords because most password storage systems utilize hashing.

Digital Signature

Up to this point, this chapter has primarily focused on how encryption, both symmetric and asymmetric, is used for confidentiality. Now let’s focus on how asymmetric (but not symmetric) algorithms can be used for authentication. The application of asymmetric encryption for authentication is known as a digital signature. Digital signatures are much like a signature in real life, because the signature validates the integrity of the document and the sender. Let’s look at an example of how the five basic steps work in the digital signature process:

  1. Jay produces a message digest by passing a message through a hashing algorithm.

  2. The message digest is then encrypted using Jay’s private key.

  3. The message is forwarded, along with the encrypted message digest, to the recipient, Alice.

  4. Alice creates a message digest from the message with the same hashing algorithm that Jay used. Alice then decrypts Jay’s signature digest by using Jay’s public key.

  5. Alice compares the two message digests: the one originally created by Jay and the other that she created. If the two values match, Alice has proof that the message is unaltered and did come from Jay.

Figure 10-6 illustrates this process and demonstrates how asymmetric encryption can be used for confidentiality and integrity.

A figure illustrates the digital signature process.

Figure 10-6 The Digital Signature Process

Steganography

Steganography is the art of secret writing. As depicted in Figure 10-7, with steganography, messages can be hidden in images, sound files, videos, or even the whitespace of a document before it’s sent. Common steganographic techniques include substitution, cover generation, distortion, statistical, spread spectrum, and transform domain. This type of secret communication has been around for centuries. Books were written on this subject in the fifteenth and sixteenth centuries. The word steganography derives from a Greek word that means covered writing. One of the ways it was originally used was to tattoo messages onto someone’s shaved head; after the hair had grown out, that individual was sent to the message recipient. While this is certainly a way to hide information in plain sight, it is a far cry from how steganography is used today.

A figure shows the common steganographic types. The Common Stego Types Based on Cover Mediums are as follows: Image Stego, Document Stego, Folder Stego, White Space Stego, Email Stego, Video Stego, and Audio Stego.

Figure 10-7 Common Steganographic Types

Steganography took a big leap forward with the invention of computers. Today, steganography uses graphics, documents, and even MP3 sound files as carriers. The carrier is the nonsecret object that is used to transport the hidden message. Steganographic programs work in one of two ways. They can use the carrier file to hide the message, or the message can be scrambled or encrypted while being inserted into the carrier. Any encryption algorithm can be used. The dual level of protection vastly increases the security of the hidden object. Even if someone discovers the existence of the hidden message, the encryption method and key must be found to view the contents. With steganography, someone could be looking right at some type of covert message and never even realize it! Next, this section discusses how steganography works, and then it looks at some steganographic tools. These tools work well at allowing someone to hide or obscure information.

Note

Steganography offers the hacker a way to hide information that is hard to discover.

Steganography Operation

Image

One steganographic method works by hiding information in pictures or bitmaps. Steganography hides information in a bitmap by spreading the data across various bits within the file. Computer-based pictures or bitmaps are composed of many dots. Each one of the dots is called a pixel. Each pixel has its own color. These colors can range between no color (binary 0) and full color (binary 255).

Steganography in sound files works in a similar fashion because sound is also represented by a corresponding binary value. For example, let’s say that your Windows startup sound file has the following 4 bytes of information in it:

225               38           74         130
11100001    00100110     01001010    10000010

If you want to hide the decimal value 7 (binary 0111) here, you could simply make the following change:

224              39            75         131
11100000    0010011      01001011    10000011

Could you tell the difference? Most likely you could not because the actual file has changed just a little. In this example, the least significant bit was used to hide the data.

Other steganographic techniques include masking and filtering or transformation. Masking and filtering techniques are generally used on 24-bit images and are similar to watermarking. Transformation works by using mathematical functions so that the data is hidden in the cover image by changing the coefficients of the transformation of an image. Steganographic tools vary in how they work, but regardless of the technique, the idea is to make it difficult for someone attempting to brute force the algorithm. The actual amount of data that can be hidden within any one carrier depends on the carrier’s total size and the size of the hidden data. This means there is no way to hide a 10MB file in a 256KB bitmap. The container, or carrier, is simply too small.

Note

One of the reasons why videos make such useful carriers is that videos are generally much larger than image files and allow much more data to be hidden.

Steganographic Tools

Steganographic tools can be used to hide information in plain sight. Three basic types are discussed in this section. First, there are those tools that hide information in documents in an unseen manner. One such program is Snow. Snow hides messages in ASCII text by appending whitespace to the end of lines. A text message typically contains many items that you do not normally see, such as spaces and tabs. Snow uses these same techniques to place information in areas of the message that are usually not visible in document viewer programs. If encryption is used, the message cannot be read even if it is detected. If you would like to try the program, you can download it from http://www.darkside.com.au/snow.

The second type of steganographic program includes those that hide information in a sound file. Two tools that can hide information in sound files are Steghide and MP3Stego. One primary worry for the hacker might be that someone becomes suspicious of a large number of sound files being moved when no such activity occurred before. Although recovering the contents of the messages could prove difficult for the security administrator, she could always decompress and recompress the MP3 file, which would destroy the hidden contents.

The third type of steganographic tool discussed hides information in pictures or graphics. Here are some examples:

  • S-Tools: A steganography tool that hides files in BMP, GIF, and WAV files. To use it, simply open S-Tools and drag pictures and sounds across to it. To hide files, drag them over open sound/picture windows.

  • ImageHide: Another steganography tool that hides files in BMPs and GIFs. It can be downloaded from https://sourceforge.net/projects/hide-in-picture.

  • OpenPuff: A steganographic application that allows you to conceal a file or set of files within a standard computer image. As with the other software products listed previously, the new image looks like a human eye.

  • Steganography Studio: This steganographic tool hides any type of file in bitmap images, text files, HTML files, or Adobe PDF files. The file in which you hide the data is not visibly changed. It can be used to exchange sensitive data secretly.

Note

Spam Mimic is an example of a program that can be used to hide a message in spam. You can check it out at http://www.spammimic.com/.

Just as with many of the other tools that have been discussed in this book, the best way to increase your skill set is by using the tools. These programs are typically easy to use in that you open the program and drag the graphics file you would like to use onto the program’s screen. Then use Explorer to select the text file that you want to hide, drag the text file over the open picture file that you selected, and let go. It’s really that simple. You now have the option to encrypt the text inside the bitmap, as shown in Figure 10-8. These programs typically support multiple encryption methods that you can choose from.

A screenshot showing the s-tools (blue8 track) window. It displays the Panasonic 8 track player. It has a dialog box (revealing from blue8track) showing the text boxes for a passphrase, verify passphrase, and encryption algorithm.

Figure 10-8 S-Tools Encryption Method

After you choose the encryption method, a short pause occurs while the encryption proceeds. When the hiding process is complete, the steganographically altered image appears in a second window, as shown in Figure 10-9. See whether you can tell any difference between the two photos.

A screenshot presenting the S tools window. It displays the hidden data window and the tnt-8-track player window.

Figure 10-9 Original and Duplicate Graphic with Hidden Text

In this particular case, the image can hold a total of 60,952 bytes. If you save the image, you will see that both the original and the one with the hidden message are the same size.

Although it has been rumored that terrorists and other groups have used steganography, it’s not a mainstream product because only a limited amount of data can be stored in any one carrier file. The amount of data hidden is always less than the total size of the carrier. Another drawback to the use of steganography is that the possession or transmission of hundreds of carrier files could, in many cases, raise suspicion unless the sender is a photographer or artist.

Although images are one of the most common ways to hide information, other steganographic techniques enable you to hide text in videos, folders, and even spam.

Note

One of the more unique forms for steganography involves laser printers. Most color laser printers add to each page small dots that identify the printer and serial number of the device that printed the page. This technology was developed to help the U.S. government track down counterfeiters.

The art of discovering and extracting steganographic content is known as steganalysis. Tools such as Stegdetect, Stego Watch, and Stegalyzer AS can be used. These tools use a variety of techniques. Common steganalysis techniques include the following:

  • Stego-only: Only the steganographic content is available for analysis.

  • Known-stego: Both the original and the steganographic content are available for review.

  • Known-message: The hidden message and the corresponding steganographic image are known.

  • Disabling or active analysis: During the communication process, active attackers change the cover.

Digital Watermark

The commercial application of steganography lies mainly in the use of a digital watermark. A digital watermark acts as a type of digital fingerprint and can verify proof of source. It’s a way to identify the copyright owner, the creator of the work, authorized consumers, and so on. Steganography is perfectly suited for this purpose, as a digital watermark should be invisible and permanently embedded into digital data for copyright protection. The importance of digital watermarks cannot be overstated, because the Internet makes it so easy for someone to steal and reproduce protected assets at an alarming rate. Proprietary information can be copied, recopied, and duplicated with amazing speed. Digital watermarks can be used in cases of intellectual property theft to show proof of ownership. You can add a watermark using Adobe Photoshop. It is designed to help an artist determine whether his art was stolen. Other possible applications include marking music files that are pre-released. This would allow the identification of the individuals who released these onto peer-to-peer networks or spread them to other unauthorized sources.

Digital Certificates

Digital certificates play a vital role in the chain of trust. Public key encryption works well when you deal with people you know, as it’s easy to send each other a public key. However, what about communications with people you don’t know? What would stop someone from posting a public key and saying that instead of Mike his name is Ohmar? Not much, really. A hacker could post a phony key with the same name and identification of a potential recipient. If the data were encrypted with the phony key, it would be readable by the hacker.

The solution is digital certificates. They play a valuable role because they help you verify that a public key really belongs to a specific owner. Digital certificates are similar to a passport. If you want to leave the country, you must have a passport. If you’re at the airport, it’s the gold standard of identification, because it proves you are who you say you are. Digital certificates are backed by certificate authorities. A certificate authority is like the U.S. Department of State (the bureau that issues passports). In the real world, certificate authorities are private companies. Some of the most well-known are Verisign, Thawte, and Entrust.

Although you might want to use an external certificate authority, it is not mandatory. You could decide to have your own organization act as a certificate authority. Just keep in mind that digital certificates are only as trustworthy as the certificate authority that issues them. There have been cases where certificate authorities have been breached. In one case, a Dutch certificate authority was breached in 2011.

Regardless of whether you have a third party handle the duties or you perform them yourself, digital certificates usually contain the following critical pieces of information:

  • Identification information that includes username, serial number, and validity dates of the certificates.

  • The public key of the certificate holder.

  • The digital signature of the certificate authority. This piece is critical; it validates the entire package.

X.509 is the standard for digital signatures; it specifies information and attributes required for the identification of a person or a computer system. Version 3 is the most current version of X.509.

Tip

Digital signatures are a key concept you should understand because these certificates are what prove an entity’s validity. They operate in much the same way as a driver’s license proves a driver is authorized to operate a motor vehicle.

Public Key Infrastructure

Public key infrastructure (PKI) is a framework that consists of hardware, software, and policies that exist to manage, create, store, and distribute keys and digital certificates. Although PKI is not needed for small groups, exchanging keys becomes difficult as the groups become bigger. To respond to this need, PKI was developed. The components of the PKI framework include the following:

  • Certificate authority (CA): A person or group that issues signed certificates to authorized users. The CA creates and signs the certificate. The CA is the one that guarantees the authenticity of the signed certificate. When one public key infrastructure (PKI) CA trusts entities in another PKI, it is known as cross-certification.

  • Certificate revocation list (CRL): The CA maintains the CRL. The list is signed to verify its accuracy, and the list is used to report problems with certificates. When requesting a digital certificate, anyone can check the CRL to verify the certificate’s integrity. A compromised certificate or one that has been revoked before its expiration date will be reported by the CRL.

  • Registration authority (RA): Reduces the load on the CA. The RA cannot generate a certificate, but it can accept requests, verify an owner’s identity, and pass along the information to the CA for certificate generation.

  • Certificate server: Maintains the database of stored certificates.

  • X.509 standard: The accepted standard for digital certificates. An X.509 certificate includes the following elements:

    • Version

    • Serial number

    • Algorithm ID

    • Issuer

    • Validity

      • Not before

      • Not after

    • Subject

    • Subject public key info

      • Public key algorithm

      • Subject public key

    • Issuer unique identifier (optional)

    • Subject unique identifier (optional)

    • Extensions (optional)

Trust Models

Trust isn’t a problem in small organizations, but when you need to communicate within large organizations, with external clients, and with third parties, it’s important to develop a working trust model. Organizations typically follow one of several well-known trust models. The following are three of the most common:

  • Single-authority trust

  • Hierarchical trust

  • Web of trust

Single-Authority Trust

A single-authority trust model uses a single third-party central agency. This agency provides the trust, the authority, and any keys issued by that authority. Figure 10-10 shows an example of this trust model.

The arrangement of a single authority trust model is presented. This system has one certificate authority which issues certificate directly to two users.

Figure 10-10 Single-Authority Trust Model

Hierarchical Trust

The hierarchical trust is a rather common model. It is based on the principle that people know one common entity in which they truly trust. This top layer of trust is known as the root CA. The root CA can issue certificates to intermediate CAs. Intermediate CAs issue certificates to leaf CAs. Leaf CAs issue certificates to users. Figure 10-11 shows an example of this trust model.

A figure depicts the representation of the hierarchy of trust.

Figure 10-11 Hierarchical Trust Model

Web of Trust

A web of trust consists of many supporters that sign each other’s certificates. Users are validated on the knowledge of other users. Pretty Good Privacy (PGP) is an example of an application that uses the web of trust model. A vulnerability of the web of trust is that a malicious user can sign bad or bogus keys and endanger the entire group. Figure 10-12 shows an example of the web of trust model.

A schematic representation of the web of trust model consisting of three users connected in the form of a triangle.

Figure 10-12 Web of Trust Model

Note

One interesting fact about certificates is that there are two types: signed certificates and self-signed certificates. Signed certificates use a trustworthy certificate authority to purchase a digital certificate from. Self-signed certificates are used when users create their own pair of public/private keys. This can be accomplished with tools such as Adobe Reader, Apple’s Keychain, and Java’s Keytool. In this configuration, there is no central certificate authority.

Tip

For the exam, you should understand that PGP uses a web of trust.

Protocols, Applications, and Attacks

Many types of cryptographic solutions can be applied, from the application layer all the way down to the physical layer. Often, a pen test will uncover the use of protocols that are blatantly unsecure. Examples include File Transfer Protocol (FTP), Simple Mail Transfer Protocol (SMTP), Hypertext Transfer Protocol (HTTP), and Telnet. All these applications pass information in clear text. All the applications and protocols discussed here are solutions that the ethical hacker can recommend to clients to help them build a more secure infrastructure:

  • Secure/Multipurpose Internet Mail Extensions (S/MIME): S/MIME adds two valuable components to standard email: digital signatures and public key encryption. S/MIME supports X.509 digital certificates and RSA encryption.

  • Pretty Good Privacy (PGP): PGP is similar to PKI but does not have a CA. PGP builds a web of trust because the users must determine who they trust. Users sign and issue their own keys. PGP stores the public key in a file named pubring.pkr; keys located here can be shared with anyone. The user’s secret key is in the file named secring.skr. Loss of this file exposes the secret key and allows a hacker to gain access or spoof the user. PGP can be used to secure email and to encrypt data. It was developed to provide high-level encryption to the average user.

  • Secure Shell (SSH): A protocol that permits secure remote access over a network from one computer to another. SSH negotiates and establishes an encrypted connection between an SSH client and an SSH server on port 22 by default. The steps needed to set up an SSH session are shown in Figure 10-13.

    A figure demonstrates the working of SSH handshake by making use of a client-server model.

    Figure 10-13 SSH Handshake

  • Secure Sockets Layer (SSL): Netscape Communications Corp. initially developed SSL to provide security and privacy between clients and servers over the Internet. It’s considered application independent and can be used with HTTP, FTP, and Telnet to run on top of it transparently. SSL uses RSA public key cryptography. It is capable of client authentication, server authentication, and encrypted SSL connection. People sometimes confuse SSL and Transport Layer Security (TLS). Yet in reality, these two protocols accomplish that same task. SSL is the predecessor of TLS. TLS was initially released in 1999 as an updated version of SSLv3. Both TLS 1.0 and SSLv3 have been deprecated.

    Tip

    The exam will focus on your knowledge of current exploits, such as Heartbleed.

  • IPsec: The most widely used standard for protecting IP datagrams is IPsec. IPsec came about because the original Internet Protocol had no security mechanism built in. IPsec can be used by any or all applications and is transparent to end users. The two main protocols used by IPsec are Authentication Header (AH) and Encapsulating Security Payload (ESP). AH always provides authentication, and ESP does so optionally. IPsec can be used in tunnel mode or transport mode. Transport mode provides a secure connection between two endpoints by encapsulating IP’s payload, whereas tunnel mode provides an even more secure connection by encapsulating the entire IP packet. Transport mode is used to form a traditional VPN, whereas tunnel mode is typically used to create a secure tunnel across an untrusted Internet connection.

  • Point-to-Point Tunneling Protocol (PPTP): Developed by a group of vendors, including Microsoft, 3Com, and Ascend, PPTP is composed of two components: the transport, which maintains the virtual connection; and the encryption, which ensures confidentiality. It is widely used for VPNs.

  • Encrypting File System (EFS): Microsoft developed EFS as a built-in encryption system for files and folders.

  • BitLocker: Microsoft developed BitLocker to work with the Trusted Platform Module and provide encryption for an operating system, hard drive, or removable hard drive. You must be an administrator to turn on BitLocker or install it. However, even with BitLocker installed, an attacker may still be able to attempt a cold boot attack. This type of attack requires the attacker to have physical access to the systems and the ability to extract data remanence from RAM that may be available for a short period of time after the system has been powered off. You can read more about this older attack at http://citpsite.s3-website-us-east-1.amazonaws.com/oldsite-htdocs/pub/coldboot.pdf.

Encryption Cracking and Tools

Image

Attacks on cryptographic systems are nothing new. If a hacker believes that information has enough value, he will try to obtain it. Cryptographic attacks can use many methods to attempt to bypass the encryption someone is using. The attacker might focus on a weakness in the code, cipher, or protocol, or might even attack key management. Even if he cannot decrypt the data, he might be able to gain valuable information just from monitoring the flow of traffic. That’s why some organizations set up systems to maintain a steady flow of encrypted traffic. Military agencies do this to prevent third parties from performing an inference attack. Inference occurs anytime an attacker might notice a spike in activity and infer that some event is pending. For example, some news agencies monitor the White House for pizza deliveries. The belief is that a spike in pizza deliveries indicates that officials are working overtime, and therefore there is a pending event of importance. Other types of cryptographic attacks include known plain-text attacks, man-in-the-middle attacks, and chosen plain-text attacks. Some of these attacks are described in more detail in the following list:

  • Known plain-text attack: This attack requires the hacker to have both the plain text and cipher text of one or more messages. Together, these two items can be used to extract the cryptographic key and recover the remaining encrypted zipped files.

  • Cipher-text only attack: This attack requires a hacker to obtain encrypted messages that have been encrypted using the same encryption algorithm. For example, the original version of WEP used RC4 and, if sniffed for long enough, the repetitions would allow a hacker to extract the WEP key. Cipher-text attacks don’t require the hacker to have the plain text; statistical analysis might be enough.

  • Man-in-the-middle attack: This form of attack is based on the ability of the hackers to place themselves in the middle of the communications flow. There they could perform an inference or cipher-text-only attack, exchange bogus keys, or set up some type of replay attack.

  • Replay attack: This form of attack occurs when the attacker tries to repeat or delay a cryptographic transmission. These attacks can be prevented by using session tokens.

  • Side-channel attack: This form of attack occurs when the attacker can observe some issues about the system itself, such as timing, power consumption, size, and noise. This form of attack is not related to traditional attacks such as replay or brute force. The attacker analyzes this information to attempt to infer how the cryptosystem functions.

  • Chosen plain-text attack: The chosen plain-text attack occurs when the hacker can choose the information to be encrypted and the encrypted copy of the data. The idea is to find patterns in the cryptographic output that might uncover a vulnerability or reveal the cryptographic key.

  • Chosen cipher-text attack: The chosen cipher-text attack occurs when a hacker can choose the cipher text to be decrypted and can then analyze the plain-text output of the event. Early versions of RSA used in SSL were vulnerable to this attack.

Note

One way hackers can break encryption is to use the rubber hose attack. This means threatening someone with bodily harm if this person does not give the information or key to the attacker.

Before you run out and start trying to use these techniques to crack various encryption systems, it’s important to think about the strength of these systems. An ECC key was recovered using cracking techniques, but it took four months and thousands of computers. It took John Gilmore and Paul Kocher only 56 hours to brute force a DES key, but their personalized cracking system cost more than $125,000. Most cryptosystems use large cryptographic keys. It might be hard to realize how key size plays such a large role in the work factor of breaking an algorithm. Each time the key size increases by one, the work factor doubles. Although 24 is just 16, 25 jumps to 32, and by only incrementing up to 225, you increase to a number large enough to approximate the number of seconds in a year. If you make one final increase to 233, which is 8,589,934,592, you arrive at the probability you will win a state lottery. Although that might make some of us feel lucky, others should start to realize just how hard it is to brute force a modern cryptosystem, because many routinely use 256-bit encryption. This makes for a lot of possible key combinations. Other successful cracks and challenges include the following:

  • RSA Labs: RSA had a challenge to learn more about the difficulty in factoring the large numbers used for asymmetric keys.

  • Distributed.net: After 1,757 days and nearly 5,874,759,765 computers, Distributed.net cracked a 64-bit RC5 key.

  • Electronic Frontier Foundation: Developed the first unclassified DES cracking tool that cracked the 56-bit key version of DES in fewer than 3 days.

Not all forms of encryption are this strong. Some are no more than basic encoding schemes, which are discussed next. This chapter concludes by examining encryption-cracking tools.

Note

All cryptographic systems can be targeted via a brute-force attack. The success of such an attack comes down to how quickly the attacker can attempt each possible variable and how big the key space is. While cloud computing can help, this type of attack can take an extremely long period of time and a large number of systems you have at your disposal.

Weak Encryption

Sometimes, data is not protected by one of the more modern secure algorithms. Many programmers still practice security by obscurity. Instead of using strong encryption to secure data, they obscure information in the hope that if it is not plain text it will not be easily discovered. These methods include XOR, Base64, and Uuencode:

  • XOR: Also known as exclusive OR, XOR identifies a type of binary operation. This function requires that when two bits are combined, the results will only be a 0 if both bits are the same. XOR functions by first converting all letters, symbols, and numbers to ASCII text. These are represented by their binary equivalent. Next, each bit is compared to the XOR program’s password key. Finally, the resulting XOR value is saved. This is the encrypted text. An XOR truth table is shown in Table 10-3.

Table 10-3 XOR Truth Table

A

B

Output

0

0

0

0

1

1

1

0

1

1

1

0

Tip

You need to know the XOR truth table for the CEH exam.

Note

The exam might ask you what the binary output would be based on the XOR truth table.

  • Base64: This method of encoding is usually used to encode email attachments. Because email systems cannot directly handle binary attachments, email clients must convert binary attachments to their text equivalent. This printable string of characters is sent across the Internet. Upon arrival, the attachment is converted back into its original binary form. If someone can access the Base64-encoded passwords, they can easily be cracked. Base64 encoding is detectable by the occurrence of two equal signs that are typically placed at the end of the data string. Cisco is one vendor that uses this mode of encoding.

  • Uuencode: Uuencode is another relatively weak encryption method that was developed to aid in the transport of binary images via email. It is one of the most common binary coding methods used. The problem is that some vendors have decided to use the coding method to encode printable text. Uuencoded text requires nothing more than to be passed back through a Uudecode program to reveal the hidden text, which is a weak form of encryption.

A large number of tools can be used to decrypt these simple algorithms. Some can be run on Windows and Linux machines; others, such as the encrypter/decrypter at http://www.yellowpipe.com/yis/tools/encrypter/index.php, can be run online. Figure 10-14 shows an example.

A screenshot of yellow pipe is shown.

Figure 10-14 Online Decoders

Encryption-Cracking Tools

Let’s look at some real-life tools used by government and private individuals to break encryption schemes. There are many tools in this category, such as Cryptanalysis, CryptoBench, JCryptTool, AlphaPeeler, Ganzua, Crank, EverCrack, and Passcracking. Other examples of encryption-cracking tools include the following:

  • THC-Hydra: A fast network logon password cracker that supports many authentication schemes, such as Telnet, FTP, SMB, RSH, SNMP, LDAP, and Cisco.

  • John the Ripper: One of the more popular Linux password-cracking programs. Linux/UNIX passwords are usually kept in etc/passwd or etc/shadow. If you’d like to try your hand at cracking some, that’s the first place you should look. Just remember to do this on your own computer or have written permission if it isn’t yours.

  • Brutus: A Windows logon password cracker that supports a wide range of authentication schemes, such as Telnet, FTP, SMB, RSH, SNMP, LDAP, and Cisco.

  • Hashcat: Advertised as the world’s fastest CPU-based password-recovery tool, Hashcat can be installed on both Linux and Windows computers.

  • CryptoTool: CryptoTool provides examples of encryption and decryption activities. It is designed to help those interested in cryptography learn more.

Summary

In this chapter, you learned about cryptography and encryption. You were introduced to symmetric encryption and learned how it offers fast encryption with a small key length. Its primary disadvantage is that it is difficult to exchange private keys securely, and symmetric encryption only offers confidentiality. Next, asymmetric encryption was introduced. Its greatest advantages are that it can provide confidentiality and authentication, and it does not suffer from the key-exchange problem that symmetric encryption has. Asymmetric encryption features two keys—one public and one private. Distribution of the public key makes it possible for anyone to easily communicate with you in a secure manner. Yet, the problem with asymmetric encryption is it is not as fast as symmetric. Therefore, that’s why most modern encryption systems are of a hybrid nature and make use of both symmetric and asymmetric cryptography. However, you still must ensure that you get the correct key from the right person, which is where digital certificates come in. Digital certificates work as a type of digital driver’s license and help verify that someone is who he or she claims to be. Digital certificates are extremely useful for authentication.

Cryptography can help in other ways; if you need to verify that a file or data has remained unchanged, you can use a hash. A hash is nothing more than a fingerprint of a file, a way to verify message integrity. Finally, this chapter introduced some of the weaker forms of encryption, such as XOR encoding; discussed the file-hiding techniques offered by steganography; and reviewed some common password-cracking tools.

Exam Preparation Tasks

As mentioned in the section “How to Use This Book” in the Introduction, you have several choices for exam preparation: the exercises here, Chapter 12, “Final Preparation,” and the exam simulation questions in the Pearson Test Prep Software Online.

Review All Key Topics

Review the most important topics in this chapter, noted with the Key Topic icon in the outer margin of the page. Table 10-4 lists a reference of these key topics and the page numbers on which each is found.

Table 10-4 Key Topics for Chapter 10

Image

Key Topic Element

Description

Page Number

Section

Covers common symmetric algorithms

510

Section

Covers common asymmetric algorithms

514

Section

Explains the purpose of hashing algorithms

517

Section

Explains how steganography works

520

Section

Describes how cryptographic systems are attacked

531

Define Key Terms

Define the following key terms from this chapter and check your answers in the glossary:

algorithm

authentication

bcrypt

block cipher

Blowfish

cipher text

collisions

confidentiality

cryptographic key

Data Encryption Standard (DES)

digital certificate

digital signature

digital watermark

Electronic Code Book (ECB)

hash

inference attack

integrity

key exchange protocol

MD5

Moore’s law

nonrepudiation

public key infrastructure (PKI)

Rijndael

security by obscurity

SHA-1

spoofing

steganography

stream cipher

symmetric encryption

trapdoor function

Exercises

10.1 Examining an SSL Certificate

To get a better understanding of how SSL works, in this exercise you examine an SSL certificate.

Estimated Time: 10 minutes.

Step 1. Open your browser and navigate to http://mail2web.com. From there, choose the Secure Login option. To view a secured page, a warning will appear indicating that you are about to view pages over a secure connection.

Step 2. Click OK.

Step 3. Click the SSL icon (the padlock icon in the address bar).

Step 4. Review the certificate information.

Step 5. Click the Details tab, and then view the certificate in the Security Overview panel on the right to review the certificate information.

Step 6. Click each field to view the contents; the following information is provided:

  • Version: The version of X.509 used to create the certificate

  • Serial number: The unique serial number for the certificate

  • Signature algorithm: The encryption algorithm used to create the certificate’s signature

  • Issuer: The issuer of the certificate

  • Valid from: The date from which the certificate is valid

  • Valid to: The date after which the certificate expires

  • Subject: Used to establish the certificate holder, which typically includes the identification and geographic information

  • Public key: The certificate’s encrypted public key

  • Thumbprint algorithm: The encryption algorithm used to create the certificate’s thumbprint

  • Thumbprint: The encrypted thumbprint of the signature (for instance, message digest)

Step 7. Click the Certification Path tab.

Step 8. Click View Certificate to view the certificate of the CA.

Step 9. Return to the Details tab. When does the certificate expire? Is it valid? Hopefully so; otherwise, you should have seen an error message displayed.

Step 10. What algorithm was used to create the message digest? Was it MD5 or SHA 256?

Step 11. What is the algorithm used to sign the certificate?

Step 12. Close the certificate. How does the browser indicate whether an HTTPS page was displayed? It should show a closed-padlock icon and https in the address bar.

10.2 Using PGP

In this exercise, you install PGP.

Estimated Time: 10 minutes.

Step 1. Install the trial version of PGP desktop from https://pgp.en.softonic.com/.

Step 2. Notice that after PGP is installed and you have created a passphrase, the program creates two files: pubring.pkr and secring.skr. These are your public and private keys.

Step 3. Use PGP tools to encrypt a file on your hard drive. You can create a file such as test.txt if you do not want to use an existing file.

Step 4. Now that you have encrypted a file, how secure is it? It should be secure given that you used a strong passphrase.

Step 5. What is the most vulnerable part of PGP? What is the easiest way an attacker could gain access to your encrypted file? If an attacker can steal the secring.skr file, he has the passphrase, so there is no need for him to attempt to crack the file.

10.3 Using a Steganographic Tool to Hide a Message

In this exercise, you use a tool to hide information with a spam email. The tool is Spam Mimic.

Estimated Time: 5 minutes.

Step 1. Spam Mimic is a tool that enables you to hide a message inside a spam message. It can be found at http://www.spammimic.com.

Step 2. When you’re on the site, enter a short message into the Spam Mimic program.

Step 3. Within a few seconds, it will convert your message into an unrecognizable spam message. You could now send this message to the recipient.

Step 4. To decode the message, just load it back into the Spam Mimic decoder to see the results revealed.

Review Questions

1. Encryption routines can use a variety of cryptographic functions and logical operations. One such technique is the XOR. Using the XOR function, which of the following is correct?

10101100

00110101

a. 01100110

b. 10011001

c. 10101100

d. 10010011

2. Which of the following can be used to provide confidentiality and integrity?

a. Steganography

b. Asymmetric encryption

c. A hash

d. Symmetric encryption

3. Jake has just been given a new hacking tool by an old acquaintance. Before he installs it, he would like to make sure that it is legitimate. Which of the following is the best approach?

a. Ask his friend to provide him with the digital certificate of the tool’s creator.

b. Ask his friend to provide him with a digital certificate.

c. Load the tool and watch it closely to see if it behaves normally.

d. Compare the tool’s hash value to the one found on the vendor’s website.

4. Why are hashing algorithms like bcrypt used now instead of MD5 ?

a. It is harder to find collisions.

b. The algorithm is secret.

c. It uses 3 levels of symmetric encryption.

d. The MD5 hash algorithm was exposed and made public.

5. Which of the following is not correct about the registration authority?

a. The RA can accept requests.

b. The RA can take some of the load off the CA.

c. The RA can issue certificates.

d. The RA can verify identities.

6. Ginny has a co-worker’s WinZip file with several locked documents that are encrypted, and she would like to hack it. Ginny also has one of the locked files in its unencrypted state. What’s the best method to proceed?

a. Cipher-text only attack

b. Known plain-text attack

c. Chosen cipher-text attack

d. Replay attack

7. You have become worried that one of your co-workers accessed your computer and copied the secring.skr file while you were on break. What would that mean?

a. Your Windows logon passwords have been stolen.

b. Your Linux password has been stolen.

c. Your PGP secret key has been stolen.

d. Nothing. That is a bogus file.

8. During the exam, if you were asked to make two lists of symmetric and asymmetric algorithms, which of the following would you place in the symmetric algorithm category?

a. ElGamal

b. Diffie-Hillman

c. ECC

d. Rijndael

9. One of the reasons 3DES was adopted is because it is stronger than DES. What is the key length of 3DES?

a. 192 bits

b. 168 bits

c. 64 bits

d. 56 bits

10. Which of the following binds a user’s identity to a public key?

a. Digital signature

b. Hash value

c. Private key

d. Digital certificate

11. George has been sniffing the encrypted traffic between Bill and Al. He has noticed an increase in traffic and believes the two are planning a new venture. What is the name of this form of attack?

a. Inference attack

b. Cipher-text attack

c. Chosen cipher-text attack

d. Replay attack

12. How many bits of plain text can DES process at a time?

a. 192 bits

b. 168 bits

c. 64 bits

d. 56 bits

13. When discussing hashing algorithms, how would you best describe collisions?

a. When two clear-text inputs are fed into an asymmetric algorithm and produce the same encrypted output

b. When two messages produce the same digest or hash value

c. When two clear-text inputs are fed into a symmetric algorithm and produce the same encrypted output

d. When a steganographic program produces two images that look the same, except that one has text hidden in it

14. While shoulder surfing some co-workers, you notice one executing the following command: ./john /etc/shadow. What is the co-worker attempting to do?

a. Crack the user’s PGP public key

b. Crack the user’s PGP secret key

c. Crack the password file

d. Crack an EFS file

15. How long is the DES encryption key?

a. 32 bits

b. 56 bits

c. 64 bits

d. 128 bits

16. Which of the following properly describes the steps to create an encrypted message that contains a digital signature using PKI? Place the steps in the correct order.

1. Encrypt the message with the recipient’s public key.

2. Create a hash of the message.

3. Create the message to be sent.

4. Encrypt the hash with your private key.

a. 1, 2, 3, 4

b. 3, 2, 1, 4

c. 1, 3, 2, 4

d. 3, 2, 4, 1

17. Which of the following certification trust models can be described as allowing participants to trust other participants’ PKI?

a. Cross-certification

b. Web of trust

c. Hierarchy of trust

d. Shared trust

18. Which of the following would be best suited to streaming voice communication?

a. DES

b. RC4

c. MD5

d. Tiger

19. A small company that you consult for has asked your advice on how to set up an encrypted email service. The company does not want to pay a license fee or manage a server for these services. What should you recommend?

a. MIME

b. SSL

c. HTTPS

d. PGP

20. When using digital signatures, which of the following does the recipient utilize when verifying the validity of the message?

a. Secret key

b. Session key

c. Public key

d. Private key

Suggested Reading and Resources

https://blog.cloudflare.com/inside-shellshock/: Inside Shellshock

http://www.spammimic.com/: SPAM steganographic tool

https://www.troyhunt.com/everything-you-need-to-know-about/: How the POODLE SSL exploit works

https://www.team-cymru.com/malware-data.html: Malware hash database

http://heartbleed.com/: An overview of Heartbleed

http://www.cypherspace.org/adam/timeline/: The history of PGP

https://www.tutorialspoint.com/cryptography/attacks_on_cryptosystems.htm: Attacks on cryptosystems

https://learncryptography.com/: Cryptographic review

https://crackstation.net/: Free password hash cracker

http://www.pgpi.org/doc/pgpintro: https://users.ece.cmu.edu/~adrian/630-f04/PGP-intro.html

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset