Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part...

56
Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying secure communication. We cover cryptographic techniques for coding and decoding data, including both symmetric key cryptography and public key cryptography. We examine DES as a case study for symmetric key cryptography and RSA as a case study for public key cryptography. We examine authentication, and develop a series of increasingly sophisticated authentication protocols to ensure that a conversant is indeed who he/she claims to be. We find that symmetric and public key cryptography play an important role in authentication as well as in secrecy. We examine digital signatures and message digests--a shorthand way for signing digital documents. We then look at a series of security applications that make use of these cryptographic techniques. We discuss how these techniques can provide sender authentication and secrecy in e-mail. We examine the PGP protocol as a case study for secure e-mail. We then look at two popular electronic commerce security protocols, SSL and SET. We conclude this chapter by discussing an emerging network-layer security protocol, IPsec. Online Book 7.1: What is Network Security? Let us introduce Alice and Bob, two people who want to communicate "securely." This being a networking text, we should remark that Alice and Bob may be two routers that want to securely exchange routing tables, two hosts that want to establish a secure transport connection, or two e-mail applications that want to exchange secure e-mail--all case studies that we will consider later in this chapter. Alice and Bob are well-known fixtures in the security community, perhaps because their names are more fun than a generic entity named "A" that wants to securely communicate with a generic entity named "B." Illicit love affairs, wartime communication, and business transactions are the commonly cited human needs for secure communications; preferring the first to the latter two, we’re happy to use Alice and Bob as our sender and receiver, and imagine them in this first scenario. 7.1.1: Secure Communication We said that Alice and Bob want to communicate "securely," but what precisely does this mean? Certainly, Alice wants only Bob to be able to understand a message that she has sent, even though they are

Transcript of Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part...

Page 1: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

Chapter 7: Security in Computer Networks

The first part of this chapter presents various principles underlying securecommunication. We cover cryptographic techniques for coding and decodingdata, including both symmetric key cryptography and public key cryptography.We examine DES as a case study for symmetric key cryptography and RSA asa case study for public key cryptography. We examine authentication, anddevelop a series of increasingly sophisticated authentication protocols toensure that a conversant is indeed who he/she claims to be. We find thatsymmetric and public key cryptography play an important role in authenticationas well as in secrecy. We examine digital signatures and message digests--ashorthand way for signing digital documents. We then look at a series ofsecurity applications that make use of these cryptographic techniques. Wediscuss how these techniques can provide sender authentication and secrecyin e-mail. We examine the PGP protocol as a case study for secure e-mail. Wethen look at two popular electronic commerce security protocols, SSL andSET. We conclude this chapter by discussing an emerging network-layersecurity protocol, IPsec.

Online Book

7.1: What is Network Security?Let us introduce Alice and Bob, two people who want to communicate"securely." This being a networking text, we should remark that Alice andBob may be two routers that want to securely exchange routing tables, twohosts that want to establish a secure transport connection, or two e-mailapplications that want to exchange secure e-mail--all case studies that wewill consider later in this chapter. Alice and Bob are well-known fixtures inthe security community, perhaps because their names are more fun than ageneric entity named "A" that wants to securely communicate with a genericentity named "B." Illicit love affairs, wartime communication, and businesstransactions are the commonly cited human needs for securecommunications; preferring the first to the latter two, we’re happy to useAlice and Bob as our sender and receiver, and imagine them in this firstscenario.

7.1.1: Secure CommunicationWe said that Alice and Bob want to communicate "securely," but whatprecisely does this mean? Certainly, Alice wants only Bob to be able tounderstand a message that she has sent, even though they are

Page 2: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

communicating over an "insecure" medium where an intruder (Trudy, theintruder) may intercept, read, and perform computations on whatever istransmitted from Alice to Bob. Bob also wants to be sure that the messagethat he receives from Alice was indeed sent by Alice, and Alice wants tomake sure that the person with whom she is communicating is indeed Bob.Alice and Bob also want to make sure that the contents of Alice’s messagehave not been altered in transit. Given these considerations, we can identifythe following desirable properties of secure communication:

• Secrecy. Only the sender and intended receiver should be able tounderstand the contents of the transmitted message. Becauseeavesdroppers may intercept the message, this necessarily requiresthat the message be somehow encrypted (its data disguised) sothat an intercepted message cannot be decrypted (understood) byan interceptor. This aspect of secrecy is probably the mostcommonly perceived meaning of the term "secure communication."Note, however, that this is not only a restricted definition of securecommunication (we list additional aspects of secure communicationbelow), but a rather restricted definition of secrecy as well. Forexample, Alice might also want the mere fact that she iscommunicating with Bob (or the timing or frequency of hercommunications) to be a secret! We will study cryptographictechniques for encrypting and decrypting data in Section 7.2.

• Authentication. Both the sender and receiver need to confirm theidentity of other party involved in the communication--to confirm thatthe other party is indeed who or what they claim to be. Face-to-facehuman communication solves this problem easily by visualrecognition. When communicating entities exchange messages overa medium where they cannot "see" the other party, authentication isnot so simple. Why, for instance, should you believe that a receivede-mail containing a text string saying that the e-mail came from afriend of yours indeed came from that friend? If someone calls youon the phone claiming to be your bank and asking for your accountnumber, secret Personal Identification Number (PIN), and accountbalances for verification purposes, would you give that informationout over the phone? Hopefully not. We will examine authenticationtechniques in Section 7.3, including several that, perhapssurprisingly, also rely on the cryptographic techniques we study inSection 7.2.

• Message integrity. Even if the sender and receiver are able toauthenticate each other, they also want to ensure that the content oftheir communication is not altered, either maliciously or by accident,in transmission. Extensions to the checksumming techniques that weencountered in reliable transport and data link protocols will also bestudied in Section 7.4; these techniques also rely on cryptographic

Page 3: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

concepts from Section 7.2.

Having established what we mean by secure communication, let us nextconsider exactly what is meant by an "insecure channel." What informationdoes an intruder have access to, and what actions can be taken on thetransmitted data? Figure 7.1 illustrates the scenario.

Figure 7.1: Sender, receiver, and intruder (Alice, Bob, and Trudy)Alice, the sender, wants to send data to Bob, the receiver. In order tosecurely exchange data, while meeting the requirements of secrecy,authentication, and message integrity, Alice and Bob will exchange bothcontrol messages and data messages (in much the same way that TCPsenders and receivers exchange both control segments and datasegments). All or some of these messages will typically be encrypted. Apassive intruder can listen to and record the control and data messageson the channel; an active intruder can remove messages from the channeland/or add messages into the channel.

7.1.2: Network Security Considerations in the InternetBefore delving into the technical aspects of network security in the followingsections, let’s conclude our introduction by relating our fictitious characters--Alice, Bob, and Trudy--to "real-world" scenarios in today’s Internet.Let’s begin with Trudy, the network intruder. Can a "real world" networkintruder really listen to and record network messages? Is it easy to do so?Can an intruder actively inject or remove messages from the network? Theanswer to all of these questions is an emphatic yes. A packet sniffer is aprogram running in a network-attached device that passively receives alldata-link layer frames passing by the device’s network interface. In abroadcast environment such as an Ethernet LAN, this means that thepacket sniffer receives all frames being transmitted from or to all hosts onthe LAN. Any host with an Ethernet card can easily serve as a packetsniffer, as the Ethernet NIC needs only be set to promiscuous mode toreceive all passing Ethernet frames. These frames can then be passed onto application programs that extract application-level data. For example, inthe Telnet scenario shown in Figure 7.2, the login password prompt sentfrom A to B, as well as the password entered at B are "sniffed" at host C.Packet sniffing is a double-edged sword--it can be invaluable to a network

Page 4: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

administrator for network monitoring and management (see Chapter 8) butalso used by the unethical hacker. Packet-sniffing software is freelyavailable at various WWW sites, and as commercial products. Professorsteaching a networking course have been known to assign lab exercises thatinvolve writing a packet-sniffing and application-level data reconstructionprogram.

Figure 7.2: Packet sniffingAny Internet-connected device necessarily sends IP datagrams into thenetwork. Recall from Chapter 4 that these datagrams carry the sender’s IPaddress, as well as upper-layer data. A user with complete control over thatdevice’s software (in particular its operating system) can easily modify thedevice’s protocols to place an arbitrary IP address into a datagram’s SourceAddress field. This is known as IP spoofing. A user can thus craft an IPpacket containing any payload (upper-layer) data it desires and make itappear as if that data was sent from an arbitrary IP host. Packet sniffingand IP spoofing are just two of the more common forms of security "attacks"on the Internet.A third broad class of security threats are denial-of-service (DoS) attacks.As the name suggests, a DoS attack renders a network, host, or otherpiece of network infrastructure unusable by legitimate users. Typically, aDoS attack works by creating so much work for the infrastructure underattack that legitimate work cannot be performed. In a so-called SYNflooding attack [CERT SYN 1996], the attacker deluges a server with TCPSYN packets, each having a spoofed IP source address. The server, notbeing able to differentiate between a legitimate SYN and a spoofed SYN,completes the second step of the TCP handshake (see Section 3.5.7) for aspoofed SYN, allocating data structures and state. The third step of thethree way-handshake is never completed by the attacker, leaving an ever-increasing number of partially open connections. The load of SYN packetsto be processed and depletion of free memory eventually brings the serverto its knees. A "smurf" DoS attack [CERT Smurf 1998] operates by having alarge number of innocent hosts respond to ICMP echo-request packets(see Section 4.4.5) that contain a spoofed source IP address. This resultsin a large number of ICMP echo-reply packets being sent to the host whoseIP address is being spoofed. RFC 2267 and RFC 2644 outline severalsimple steps that can be taken to help prevent these and other DoSattacks.Various network attacks and security threats are discussed in the collection

Page 5: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

of essays [Denning 1997]. A summary of reported attacks is maintained atthe CERT Coordination Center [CERT 2000]. See also [Cisco Security1997; Voydock 1983; Bhimani 1996].Having established that there are indeed real bogeymen (a.k.a. "Trudy")loose in the Internet, what are the Internet equivalents of Alice and Bob, ourtwo friends who need to communicate securely? Certainly, "Bob" and"Alice" might be human users at two end systems, for example, a real Aliceand a real Bob who really do want to exchange secure e-mail. They mightalso be participants in an electronic commerce transaction. For example, areal Alice might want to securely transfer her credit card number to a WWWserver to purchase an item online. Similarly, a real Alice might want tointeract with her bank online. As noted in RFC 1636, however, the partiesneeding secure communication might also themselves be part of thenetwork infrastructure. Recall that the Domain Name System (DNS, seeSection 2.5), or routing daemons that exchange routing tables (see Section4.5) require secure communication between two parties. The same is truefor network management applications, a topic we examine in Chapter 8. Anintruder that could actively interfere with, control, or corrupt DNS lookupsand updates, routing computations, or network management functionscould wreak havoc in the Internet.Having now established the framework, a few of the most importantdefinitions, and the need for network security, let us next delve intocryptography, a topic of central importance to many aspects of networksecurity.

Online Book

7.2: Principles of CryptographyAlthough cryptography has a long history dating back at least as far asJulius Caesar (we will look at the so-called Caesar cipher shortly), moderncryptographic techniques, including many of those used in today’s Internet,are based on advances made in the past thirty years. Kahn’s book, "TheCodebreakers," [Kahn 1967] provides a fascinating look at this long history.A detailed (but entertaining and readable) technical discussion ofcryptography, particularly from a network standpoint, is [Kaufman 1995].[Diffie 1998] provides a compelling and up-to-date examination of thepolitical and social (for example, privacy) issues that are now inextricablyintertwined with cryptography. A complete discussion of cryptography itselfrequires a complete book [Kaufman 1995; Schneier 1995] and so we onlytouch on the essential aspects of cryptography, particularly as they arepracticed in today’s Internet. Two excellent on-line sites are [Kessler 1998]

Page 6: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

and the RSA Labs FAQ page [RSA FAQ 1999].

Cryptographic techniques allow a sender to disguise data so that anintruder can gain no information from the intercepted data. The receiver, ofcourse, must be able to recover the original data from the disguised data.Figure 7.3 illustrates some of the important terminology.

Figure 7.3: Cryptographic components

Suppose now that Alice wants to send a message to Bob. Alice’s messagein its original form (for example, "%RE��,�ORYH�\RX��$OLFH") is known asplaintext, or cleartext. Alice encrypts her plaintext message using anencryption algorithm so that the encrypted message, known asciphertext, looks unintelligible to any intruder. Interestingly, in manymodern cryptographic systems, including those used in the Internet, theencryption technique itself is known--published, standardized, and availableto everyone (for example, [RFC 1321, RFC 2437, RFC 2420]), even apotential intruder! Clearly, if everyone knows the method for encoding data,then there must be some bit of secret information that prevents an intruderfrom decrypting the transmitted data. This is where keys come in.

In Figure 7.3, Alice provides a key, KA, a string of numbers or characters,as input to the encryption algorithm. The encryption algorithm takes the keyand the plaintext as input and produces ciphertext as output. Similarly, Bobwill provide a key, KB, to the decryption algorithm, that takes theciphertext and Bob’s key as input and produces the original plaintext asoutput. In so-called symmetric key systems, Alice and Bob’s keys areidentical and are secret. In public key systems, a pair of keys is used.One of the keys is known to both Bob and Alice (indeed, it is known to thewhole world). The other key is known only by either Bob or Alice (but notboth). In the following two subsections, we consider symmetric key andpublic key systems in more detail.

Code-Breaking Contests

Page 7: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

First adopted by the U.S. government in 1977, the Data Encryption Standard (DES) 56-bitalgorithm is still widely used by financial services and other industries worldwide to protectsensitive information. The company RSA has been sponsoring a series of DES-crackingcontests to emphasize the need for encryption stronger than the current 56-bit standardwidely used to secure both U.S. and international commerce. Each challenge is to decrypta message that has been encoded with 56-bit DES within a specified amount of time. Codebreakers meet the challenge by exhaustively searching over all of the possible secret keys.As part of the contest, RSA awards a $10,000 prize to the winners.

The company RSA launched a challenge in January 1997, aiming to show that the U.S. government’s Data EncryptionStandard, with its 56-bit key, offers only limited protection against a devoted adversary. The first contest was won by ateam from Colorado that recovered the secret key in less than four months, winning DES Challenge I. Since that time,improved technology has made much faster exhaustive search efforts possible. In February 1998, Distributed.Net wonRSA’s DES Challenge II-1 with a 41-day effort, and in July, the Electronic Frontier Foundation (EFF) won RSA’s DESChallenge II-2 when it cracked the DES message in 56 hours.

In January 1999, Distributed.Net, a worldwide coalition of computer enthusiasts, worked with the Electronic FrontierFoundation’s (EFF) "Deep Crack," a specially designed supercomputer, and a worldwide network of nearly 100,000 PCson the Internet, to win RSA Data Security’s DES Challenge III in a record-breaking 22 hours and 15 minutes. EFF’s"Deep Crack" and the Distributed.Net computers were testing 245 billion keys per second when the key was found!

7.2.1: Symmetric Key CryptographyAll cryptographic algorithms involve substituting one thing for another, forexample, taking a piece of plaintext and then computing and substitutingthe appropriate ciphertext to create the encrypted message. Beforestudying a modern key-based cryptographic system, let us first "get our feetwet" by studying a very old simple symmetric key algorithm attributed toJulius Caesar, known as the Caesar cipher (a cipher is a method forencrypting data).For English text, the Caesar cipher would work by taking each letter in theplaintext message and substituting the letter that is k letters later (allowingwraparound; i.e., having the letter "z" followed by the letter "a") in thealphabet. For example if k = 3, then the letter "a" in plaintext becomes "d" inciphertext; "b" in plaintext becomes "e" in ciphertext, and so on. Here, thevalue of k serves as the key. As an example, the plaintext message "ERE��,ORYH�\RX��DOLFH�" becomes "HUH��O�RU\K�EU[��GROIK�" in ciphertext. While theciphertext does indeed look like gibberish, it wouldn’t take long to break thecode if you knew that the Caesar cipher was being used, as there are only25 possible key values.An improvement to the Caesar cipher is the so-called monoalphabeticcipher that also substitutes one letter in the alphabet with another letter inthe alphabet. However, rather than substituting according to a regularpattern (for example, substitution with an offset of k for all letters), any lettercan be substituted for any other letter, as long as each letter has a uniquesubstitute letter, and vice versa. The substitution rule in Figure 7.4 showsone possible rule for encoding plaintext.PlaintextLetter:CiphertextLetter:

D�E�F�G�H�I�J�K�L�M�N�O�P�Q�R�S�T�U�V�W�X�Y�Z�[�\�]

Page 8: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

P�Q�E�Y�F�[�]�D�V�G�I�J�K�M�N�O�S�R�L�X�\�W�U�H�Z�T

Figure 7.4: A monoalphabetic cipher

The plaintext message "ERE��,�ORYH�\RX��DOLFH�" becomes "QNQ��V�JNWF�ZN\�PJVEF�" Thus, as in the case of the Caesar cipher, this looks like gibberish.A monoalphabetic cipher would also appear to be better than the Caesarcipher in that there are 26! (on the order of 1026) possible pairings of lettersrather than 25 possible pairings. A brute force approach of trying all 1026

possible pairings would require far too much work to be a feasible way ofbreaking the encryption algorithm and decoding the message. However, bystatistical analysis of the plaintext language, for example, knowing that theletters "e" and "t" are the most frequently occurring letters in typical Englishtext (accounting for 13% and 9% of letter occurrences), and knowing thatparticular two- and three-letter occurrences of letters appear quite oftentogether (for example, "in," "it," "the," "ion," "ing," and so forth) make itrelatively easy to break this code. If the intruder has some knowledge aboutthe possible contents of the message, then it is even easier to break thecode. For example, if Trudy the intruder is Bob’s wife and suspects Bob ofhaving an affair with Alice, then she might suspect that the names "bob"and "alice" appear in the text. If Trudy knew for certain that those twonames appeared in the ciphertext and had a copy of the example ciphertextmessage above, then she could immediately determine seven of thetwenty-six letter pairings, requiring 109 fewer possibilities to be checked bya brute-force method. Indeed, if Trudy suspected Bob of having an affair,she might well expect to find some other choice words in the message aswell.When considering how easy it might be for Trudy to break Bob and Alice’sencryption scheme, one can distinguish three different scenarios,depending on what information the intruder has:

• Ciphertext-only attack. In some cases, the intruder may only haveaccess to the intercepted ciphertext, with no certain informationabout the contents of the plaintext message. We have seen howstatistical analysis can help in a ciphertext-only attack on anencryption scheme.

• Known-plaintext attack. We saw above that if Trudy somehow knewfor sure that "ERE" and "DOLFH" appeared in the ciphertext message,then she could have determined the (plaintext, ciphertext) pairingsfor the letters D, O, L, F, H, E, and R. Trudy might also have beenfortunate enough to have recorded all of the ciphertext transmissionsand then found Bob’s own decrypted version of one of thetransmissions scribbled on a piece of paper. When an intruderknows some of the (plaintext, ciphertext) pairings, we refer to this asa known plaintext attack on the encryption scheme.

Page 9: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

• Chosen-plaintext attack. In a chosen-plaintext attack, the intruder isable to choose the plaintext message and obtain its correspondingciphertext form. For the simple encryption algorithms we’ve seen sofar, if Trudy could get Alice to send the message, "7KH�TXLFN�IR[MXPSV�RYHU�WKH�OD]\�EURZQ�GRJ," she can completely break theencryption scheme. We’ll see shortly that for more sophisticatedencryption techniques, a chosen-plaintext attack does notnecessarily mean that the encryption technique can be broken.

Five hundred years ago, techniques improving on monoalphabeticencryption, known as polyalphabetic encryption were invented. Thesetechniques, incorrectly attributed to Blaise de Vigenere [Kahn 1967], havecome to be known as Vigenere ciphers. The idea behind Vigenere ciphersis to use multiple monoalphabetic ciphers, with a specific monoalphabeticcipher to encode a letter in a specific position in the plaintext message.Thus, the same letter, appearing in different positions in the plaintextmessage might be encoded differently. The Vigenere cipher shown inFigure 7.5 has two different Caesar ciphers (with k = 5 and k = 19), shownas rows in Figure 7.5. One might choose to use these two Caesar ciphers,C1 and C2, in the repeating pattern C1, C2, C2, C1, C2. That is, the first letterof plaintext is to be encoded using C1, the second and third using C2, thefourth using C1, and the fifth using C2. The pattern then repeats, with thesixth letter being encoded using C1, the seventh with C2, and so on. Theplaintext message "ERE��,�ORYH�\RX�" is thus encrypted "JKX��Q�HWR[�GK]�" Notethat the first "E" in the plaintext message is encrypted using C1, while thesecond "b" is encrypted using C2. In this example, the encryption anddecryption "key" is the knowledge of the two Caesar keys (k = 5, k = 19)and the pattern C1, C2, C2, C1, C2.PlaintextLetter:C1(k=5):

C2(k=19):

D�E�F�G�H�I�J�K�L�M�N�O�P�Q�R�S�T�U�V�W�X�Y�Z�[�\�]

I�J�K�L�M�N�O�P�Q�R�S�T�U�V�W�X�Y�Z�[�\�]�D�E�F�G�H

W�X�Y�Z�[�\�]�D�E�F�G�H�I�J�K�L�M�N�O�P�Q�R�S�T�U�V

Figure 7.5: A Vigenere cipher using two Caesar ciphersData Encryption Standard (DES)Let us now fast-forward to modern time and examine the Data EncryptionStandard (DES) [NIST 1993], a symmetric-key encryption standardpublished in 1977 and updated most recently in 1993 by the U.S. NationalBureau of Standards for commercial and nonclassified U.S. governmentuse. DES encodes plaintext in 64-bit chunks using a 64-bit key. Actually, 8of these 64 bits of the key are odd parity bits (there is one parity bit for each

Page 10: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

of the eight bytes), so the DES key is effectively 56 bits long. The NationalInstitute of Standards (the successor to the National Bureau of Standards)states the goal of DES as follows: "The goal is to completely scramble thedata and key so that every bit of the ciphertext depends on every bit of thedata and every bit of the key . . . with a good algorithm, there should be nocorrelation between the ciphertext and either the original data or key."[NIST 1999].The basic operation of DES is illustrated in Figure 7.6. In our discussion wewill overview DES operation, leaving the nitty-gritty, bit-level details (thereare many) to other sources [Kaufman 1995; Schneier 1995]. [Schneier1995] includes a C implementation as well. The DES consists of twopermutation steps (the first and last steps of the algorithm), in which all 64bits are permuted and there are 16 identical "rounds" of operation inbetween. The operation of each round is identical, taking the output of theprevious round as input. During each round, the rightmost 32 bits of theinput are moved to the left 32 bits of the output. The entire 64-bit input tothe ith round and the 48-bit key for the ith round (derived from the largerDES 56-bit key) are taken as input to a function that involves expansion of4-bit input chunks into 6-bit chunks, exclusive 25-ing with the expanded 6-bit chunks of the 48-bit key Ki, a substitution operation and further exclusive25-ing with the leftmost 32 bits of the input; see [Kaufman 1995 andSchneier 1995] for details. The resulting 32-bit output of the function is thenused as the rightmost 32 bits of the round’s 64-bit output, as shown inFigure 7.6. Decryption works by reversing the algorithm’s operations.

Page 11: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

Figure 7.6: Basic operation of DESHow well does DES work? How secure is it? No one can tell for sure.[Kaufman 1995]. In 1997, a network security company, RSA Data SecurityInc., launched a DES Challenge contest to "crack" (decode) a short phraseit had encrypted using 56-bit DES. The unencoded phrase ("6WURQJFU\SWRJUDSK\�PDNHV�WKH�ZRUOG�D�VDIHU�SODFH.") was determined in less than fourmonths by a team that used volunteers throughout the Internet tosystematically explore the key space. The team claimed the $10,000 prizeafter testing only a quarter of the key space--about 18 quadrillion keys [RSA1997]. The most recent 1999 DES Challenge III was won in a record time ofa little over 22 hours, with a network of volunteers and a special purposecomputer that was built for less than $250,000 (nick-named "Deep Crack")and is documented online [EFF 1999].If 56-bit DES is considered too insecure, one can simply run the 56-bitalgorithm multiple times, taking the 64-bit output from one iteration of DESas the input to the next DES iteration, using a different encryption key eachtime. For example, so-called triple-DES (3DES), is a proposed U.S.government standard [NIST 1999b] and has been proposed as theencryption standard for the Point-to-Point (PPP) protocol [RFC 2420] for thedata-link layer (see Section 5.8). A detailed discussion of key lengths andthe estimated time and budget needed to crack DES can be found in [Blaze1996].

Page 12: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

We should also note that our description above has considered only theencryption of a 64-bit quantity. When longer messages are encrypted,which is typically the case, DES is often used with a technique known ascipher-block chaining, in which the encrypted version of the jth 64-bitquantity of data is ;25’ed with the (j + 1)st unit of data before the (j + 1)stunit of data is encrypted.

7.2.2: Public Key EncryptionFor more than 2000 years (since the time of the Caesar cipher and up tothe 1970s), encrypted communication required that the two communicatingparties share a common secret--the symmetric key used for encryption anddecryption. One difficulty with this approach is that the two parties mustsomehow agree on the shared key; but to do so requires (presumablysecure) communication! Perhaps the parties could first meet and agree onthe key in person (for example, two of Caesar’s centurions might meet atthe Roman baths) and thereafter communicate with encryption. In anetworked world, however, communicating parties may never meet andmay never converse except over the network. Is it possible for two partiesto communicate with encryption without having a shared secret key that isknown in advance? In 1976, Diffie and Hellman [Diffie 1976] demonstratedan algorithm (known now as Diffie-Hellman Key Exchange) to do just that--a radically different and marvelously elegant approach toward securecommunication that has led to the development of today’s public keycryptography systems. We will see shortly that public key cryptographysystems also have several wonderful properties that make them useful notonly for encryption, but for authentication and digital signatures as well. Theideas begun earlier ([Diffie 1976] and [RSA 1978]) are a cornerstone ofcurrent e-commerce activity (see Section 7.7). Interestingly, it has recentlycome to light that ideas similar to those in [Diffie 1976] and [RSA 1978] hadbeen independently developed in the early 1970s in a series of secretreports by researchers at the Communications-Electronics Security Groupin the United Kingdom [CESG 2000]. As is often the case, great ideas canspring up independently in many places; fortunately, public key advancestook place not only in private, but also in the public view, as well.The use of public key cryptography is quite simple. Suppose Alice wants tocommunicate with Bob. As shown in Figure 7.7, rather than Bob and Alicesharing a single secret key (as in the case of symmetric key systems), Bob(the recipient of Alice’s messages) instead has two keys--a public key thatis available to everyone in the world (including Trudy the intruder) and aprivate key that is known only to Bob. In order to communicate with Bob,Alice first fetches Bob’s public key. Alice then encrypts her message to Bobusing Bob’s public key and a known (for example, standardized) encryptionalgorithm. Bob receives Alice’s encrypted message and uses his privatekey and a known (for example, standardized) decryption algorithm todecrypt Alice’s message. In this manner, Alice can send a secret messageto Bob without either of them having to have to distribute any secret keys!

Page 13: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

Figure 7.7: Public key cryptographyUsing the notation of Figure 7.7, for any message m, dB(eB(m)) = m, that is,applying Bob’s public key, eB, then Bob’s private key, dB, to the message mgives back m. We will see shortly that we can interchange the public keyand private key encryption and get the same result, that is, eB(dB(m)) =dB(eB(m)) = m.The use of public key cryptography is thus conceptually simple. But twoimmediate worries may spring to mind. A first concern is that although anintruder intercepting Alice’s encrypted message will only see gibberish, theintruder knows both the key (Bob’s public key, which is available for all theworld to see) and the algorithm that Alice used for encryption. Trudy canthus mount a chosen plaintext attack, using the known standardizedencryption algorithm and Bob’s publicly available encryption key to encodeany message she chooses! Trudy might well try, for example, to encodemessages, or parts of messages, that she suspects that Alice might send.Clearly, if public key cryptography is to work, key selection andencryption/decryption must be done in such a way that it is impossible (or atleast so hard as to be nearly impossible) for an intruder to either determineBob’s private key or somehow otherwise decrypt or guess Alice’s messageto Bob. A second concern is that since Bob’s encryption key is public,anyone can send an encrypted message to Bob, including Alice orsomeone claiming to be Alice. In the case of a single shared secret key, thefact that the sender knows the secret key implicitly identifies the sender tothe receiver. In the case of public key cryptography, however, this is nolonger the case since anyone can send an encrypted message to Bobusing Bob’s publicly available key. A digital signature, a topic we will studyin Section 7.4 is needed to bind a sender to a message.While there may be many algorithms and keys that address theseconcerns, the RSA algorithm (named after its founders, Ron Rivest, AdiShamir, and Leonard Adleman) has become almost synonymous withpublic key cryptography. Let’s first see how RSA works and then examinewhy it works. Suppose that Bob wants to receive encrypted messages, asshown in Figure 7.7. There are two interrelated components of RSA:

Page 14: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

• Choice of the public key and the private key

• The encryption and decryption algorithm

In order to choose the public and private keys, Bob must do the following:

1. Choose two large prime numbers, p and q. How large should p and qbe? The larger the values, the more difficult it is to break RSA, butthe longer it takes to perform the encoding and decoding. RSALaboratories recommends that the product of p and q be on theorder of 768 bits for personal use and 1024 bits for corporate use[RSA Key 1999]. (Which leads one to wonder why corporate use isdeemed so much more important than personal use!)

2. Compute n = pq and z = (p - 1)(q - 1).

3. Choose a number, e, less than n, which has no common factors(other than 1) with z. (In this case, e and z are said to be relativelyprime). The letter "e" is used since this value will be used inencryption.

4. Find a number, d, such that ed - 1 is exactly divisible (that is, with noremainder) by z. The letter "d" is used because this value will beused in decryption. Put another way, given e, we choose d such thatthe integer remainder when ed is divided by z is 1. (The integerremainder when an integer x is divided by the integer n, is denoted xmod n).

5. The public key that Bob makes available to the world is the pair ofnumbers (n,e); his private key is the pair of numbers (n,d).

The encryption by Alice, and the decryption by Bob is done as follows:

1. Suppose Alice wants to send Bob a bit pattern, or number, m, suchthat m < n. To encode, Alice performs the exponentiation, me, andthen computes the integer remainder when me is divided by n. Thus,the encrypted value, c, of the plaintext message, m, that Alice sendsis:

c = me mod n

2. To decrypt the received ciphertext message, c, Bob computes

m = cd mod n

which requires the use of his secret key (n,d).

As a simple example of RSA, suppose Bob chooses p = 5 and q = 7.(Admittedly, these values are far too small to be secure.) Then n = 35 and z= 24. Bob chooses e = 5, since 5 and 24 have no common factors. Finally,Bob chooses d = 29, since 5 * 29 - 1 (that is, ed - 1) is exactly divisible by24. Bob makes the two values, n = 35 and e = 5, public and keeps the

Page 15: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

value d = 29 secret. Observing these two public values, suppose Alice nowwants to send the letters "l" "o" "v" and "e" to Bob. Interpreting each letteras a number between 1 and 26 (with "a" being 1, and "z" being 26), Aliceand Bob perform the encryption and decryption shown in Tables 7.1 and7.2, respectively:Table 7.1: Alice’s RSA encryption, e = 5, n = 35

Plaintext letterm: numeric representation

me

ciphertext c = me mod n

l12

24883217

o15

75937515

v22

515363222

e5

312510

Table 7.2: Bob’s RSA decryption, d = 29, n = 35Ciphertext c

cd

m = cd mod nPlaintext Letter

17481968572106750915091411825223072000

12l

1512783403948858939111232757568359400

15o

228.5164331908653770195619449972111e+38

22v

1010000000000000000000000000000

5

Page 16: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

e

Given that the "toy" example in Tables 7.1 and 7.2 has already producedsome extremely large numbers, and given that we know that we saw earlierthat p and q should each be several hundred bits long, several practicalissues regarding RSA come to mind. How does one choose large primenumbers? How does one then choose e and d? How does one performexponentiation with large numbers? A discussion of these important issuesis beyond the scope of this book; see [Kaufman 1995] and the referencestherein for details.We do note here that the exponentiation required by RSA is a rather time-consuming process. RSA Data Security [RSA Fast 1999] says its softwaretoolkit can encrypt/decrypt at a throughput of 21.6 Kbits per second with a512-bit value for n and 7.4 Kbits per second with a 1024-bit value. DES is atleast 100 times faster in software and between 1,000 and 10,000 timesfaster in hardware. As a result, RSA is often used in practice in combinationwith DES. For example, if Alice wants to send Bob a large amount ofencrypted data at high speed, she could do the following. First Alicechooses a DES key that will be used to encode the data itself; this key issometimes referred to as a session key, KS. Alice must inform Bob of thesession key, since this is the shared secret key they will use for DES. Alicethus encrypts the session key value using Bob’s public RSA key, that is,computes c = (KS)e mod n. Bob receives the RSA-encrypted session key, c,and decrypts to obtain the session key, KS. Bob now knows the session keythat Alice will use for her DES-encrypted data transfer.Why Does RSA Work?The RSA encryption/decryption above appears rather magical. Why shouldit be that by applying the encryption algorithm and then the decryptionalgorithm, one recovers the original message? In order to understand whyRSA works, we’ll need to perform arithmetic operations using so-calledmodulo-n arithmetic. In modular arithmetic, one performs the usualoperations of addition, multiplication, and exponentiation. However, theresult of each operation is replaced by the integer remainder that is leftwhen the result is divided by n. We will take n = pq, where p and q are thelarge prime numbers used in the RSA algorithm.Recall that under RSA encryption, a message (represented by an integer),m, is first exponentiated to the power e using modulo-n arithmetic toencrypt. Decryption is performed by raising this value to the power d, againusing modulo-n arithmetic. The result of an encryption step, followed by adecryption step is thus (me)d. Let’s now see what we can say about thisquantity. We have:

(me)d mod n = med mod nAlthough we’re trying to remove some of the "magic" about why RSA works,we’ll need to use a rather magical result from number theory here.Specifically, we’ll need the result that says if p and q are prime, and n = pq,then xy mod n is the same as x(y mod (p-1)(q-1)) mod n [Kaufman 1995].Applying this result, we have

Page 17: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

(me)d mod n = m(ed mod (p-1)(q-1)) mod nBut remember that we chose e and d such that ed - 1 is exactly divisible(that is, with no remainder) by (p - 1)(q - 1), or equivalently that ed isdivisible by (p - 1)(q - 1) with a remainder of 1, and thus ed mod (p - 1)(q -1) = 1. This gives us

(me)d mod n = m1 mod n = mthat is, that

(me)d mod n = mThis is the result we were hoping for! By first exponentiating to the power ofe (that is, encrypting) and then exponentiating to the power of d (that is,decrypting), we obtain the original value, m. Even more remarkable is thefact that if we first exponentiate to the power of d and then exponentiate tothe power of e, that is, we reverse the order of encryption and decryption,performing the decryption operation first and then applying the encryptionoperation, we also obtain the original value, m! (The proof for this resultfollows the exact same reasoning as above.) We will see shortly that thiswonderful property of the RSA algorithm,

(me)d mod n = m = (md)e mod nwill be of great use.The security of RSA relies on the fact that there are no known algorithmsfor quickly factoring a number, in this case the public value n, into theprimes p and q. If one knew p and q, then given the public value e, onecould then easily compute the secret key, d. On the other hand, it is notknown whether or not there exist fast algorithms for factoring a number, andin this sense the security of RSA is not "guaranteed."

© 2000-2001 by Addison Wesley LongmanA division of Pearson Education

Online Book

7.3: Authentication: Who are You?Authentication is the process of proving one’s identity tosomeone else. As humans, we authenticate each other in manyways: we recognize each other’s faces when we meet, werecognize each other’s voices on the telephone, we areauthenticated by the customs official who checks us against thepicture on our passport.

In this section we consider how one party can authenticate anotherparty when the two are communicating over a network. We focushere on authenticating a "live" party, at the point in time whencommunication is actually occurring. We will see that this is a

Page 18: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

subtly different problem from proving that a message received atsome point in the past (for example, that may have been archived)did indeed come from that claimed sender. This latter problem isreferred to as the digital signature problem, which we explore inSection 7.4.

When performing authentication over the network, thecommunicating parties cannot rely on biometric information, suchas a visual appearance or a voiceprint. Indeed, we will see in ourlater case studies that it is often network elements such as routersand client/server processes that must authenticate each other.Here, authentication must be done solely on the basis ofmessages and data exchanged as part of an authenticationprotocol. Typically, an authentication protocol would run beforethe two communicating parties run some other protocol (forexample, a reliable data-transfer protocol, a routing tableexchange protocol, or an e-mail protocol). The authenticationprotocol first establishes the identities of the parties to each others’satisfaction; only after authentication do the parties get down to thework at hand.

As in the case of our development of a reliable data-transfer (rdt)protocol, in Chapter 3, we will find it instructive here to developvarious versions of an authentication protocol, which we will call ap("authentication protocol"), and poke holes (that is, find securityflaws) in each version as we proceed. Let’s begin by assuming thatAlice needs to authenticate herself to Bob.

7.3.1: Authentication Protocol ap1.0Perhaps the simplest authentication protocol we can imagine isone where Alice simply sends a message to Bob saying she isAlice. This protocol is shown in Figure 7.8. The flaw here isobvious--there is no way for Bob to actually know that the personsending the message, "I am Alice" is indeed Alice. For example,Trudy (the intruder) could just as well send such a message.

Figure 7.8: Protocol ap1.0 and a failure scenario

Page 19: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

7.3.2: Authentication Protocol ap2.0In the case that Alice has a well-known network address (forexample, IP address) from which she always communicates, Bobcould attempt to authenticate Alice by verifying that the sourceaddress on the IP datagram carrying the authentication messagematches Alice’s well-known address. If so, then Alice would beauthenticated. This might stop a very network-naive intruder fromimpersonating Alice. But it wouldn’t stop the determined studentstudying this book, or many others! See Figure 7.9.

Figure 7.9: Protocol ap2.0 and a failure scenarioGiven that we have now studied both the network and data-linklayers, we know that it is not that hard (for example, if one hadaccess to the operating system code and could build one’s ownoperating system kernel, as is the case with Linux and severalother freely available operating systems) to create an IP datagram,put whatever IP source address we want (for example, includingAlice’s well-known IP address) into the IP datagram, and send thedatagram over the link layer protocol to the first hop router. Fromthen on, the incorrectly source-addressed datagram would bedutifully forwarded to Bob. This approach is a form of IP spoofing,a well-known security attack technique [CERT SYN 1996]. IPspoofing can be avoided if a router is configured to refuse IPdatagrams that do not have a given source IP address [RFC2267]. For example, Trudy’s first hop router could be configured toforward only datagrams containing Trudy’s IP source address.However, this capability is not universally deployed or enforced.Bob would thus be foolish to assume that Trudy’s networkmanager (who might be Trudy herself) had configured Trudy’s firsthop router to forward only appropriately addressed datagrams.

7.3.3: Authentication Protocol ap3.0One classic approach to authentication is to use a secretpassword. We have PIN numbers to identify ourselves toautomatic teller machines and login passwords for operatingsystems. The password is a shared secret between theauthenticator and the person being authenticated. We saw in

Page 20: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

Section 2.2.4 that HTTP uses a password-based authenticationscheme. Telnet and FTP use password authentication as well. Inprotocol ap3.0, Alice thus sends her secret password to Bob, asshown in Figure 7.10.

Figure 7.10: Protocol ap3.0 and a failure scenarioThe security flaw here is clear. If Trudy eavesdrops on Alice’scommunication, then she can learn Alice’s password. Lest youthink this is unlikely, consider the fact that when one Telnets toanother machine and logs in, the login password is sentunencrypted to the Telnet server. Someone connected to theTelnet client or server’s LAN can possibly "sniff" (read and store)all packets transmitted on the LAN and thus steal the loginpassword. In fact, this is a well-known approach for stealingpasswords (see, for example, [Jimenez 1997]). Such a threat isobviously very real, so ap3.0 clearly won’t do.

7.3.4: Authentication Protocol ap3.1Having just studied the previous section on cryptography, our nextidea for fixing ap3.0 is naturally to use encryption. By encryptingthe password, Trudy will not be able to learn Alice’s password! Ifwe assume that Alice and Bob share a symmetric secret key, KA-B,then Alice can encrypt the password, send her identificationmessage, ",�DP�$OLFH," and her encrypted password to Bob. Bobthen decrypts the password and, assuming the password iscorrect, authenticates Alice. Bob feels comfortable inauthenticating Alice since not only does Alice know the password,but she also knows the shared secret key value needed to encryptthe password. Let’s call this protocol ap3.1.While it is true that ap3.1 prevents Trudy from learning Alice’spassword, the use of cryptography here does not solve theauthentication problem! Bob is again subject to a so-calledplayback attack: Trudy needs only eavesdrop on Alice’scommunication, record the encrypted version of the password, andthen later play back the encrypted version of the password to Bobto pretend that she is Alice. The use of an encrypted passworddoesn’t make the situation manifestly different from that in Figure

Page 21: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

7.10.

7.3.5: Authentication Protocol ap4.0The problem with ap3.1 is that the same password is used overand over again. One way to solve this problem would be to use adifferent password each time. Alice and Bob could agree on asequence of passwords (or on an algorithm for generatingpasswords) and use each password only once, in sequence. Thisidea is used in the S/KEY system [RFC 1760], adopting anapproach due to Lamport [Lamport 1981] for generating asequence of passwords.Rather than just stop here with this solution, however, let usconsider a more general approach for combating the playbackattack. The failure scenario in Figure 7.10 resulted from the factthat Bob could not distinguish between the original authenticationof Alice and the later playback of Alice’s original authentication.That is, Bob could not tell if Alice was "live" (i.e., was currentlyreally on the other end of the connection) or whether themessages he was receiving were a recorded playback of aprevious authentication of Alice. The very (very) observant readerwill recall that the three-way TCP handshake protocol needed toaddress the same problem--the server side of a TCP connectiondid not want to accept a connection if the received SYN segmentwas an old copy (retransmission) of a SYN segment from anearlier connection. How did the TCP server side solve the problemof determining if the client was really "live"? It chose an initialsequence number that had not been used in a very long time, sentthat number to the client, and then waited for the client to respondback with an ACK segment containing that number. We can adoptthe same idea here for authentication purposes.A nonce is a number that a protocol will use only once in alifetime. That is, once a protocol uses a nonce, it will never usethat number again. Our ap4.0 protocol uses a nonce as follows:

1. Alice sends the message, ",�DP�$OLFH," to Bob.

2. Bob chooses a nonce, R, and sends it to Alice.

3. Alice encrypts the nonce using Alice and Bob’s symmetricsecret key, KA-B, and sends the encrypted nonce, KA-B(R)back to Bob. As in protocol ap3.1, it is the fact that Aliceknows KA-B and uses it to encrypt a value that lets Bob knowthat the message he receives was generated by Alice. Thenonce is used to ensure that Alice is "live."

4. Bob decrypts the received message. If the decrypted nonceequals the nonce he sent Alice, then Alice is authenticated.

Protocol ap4.0 is illustrated in Figure 7.11. By using the once-in-a-

Page 22: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

lifetime value, R, and then checking the returned value, KA-B(R),Bob can be sure that both Alice is who she says she is (since sheknows the secret key value needed to encrypt R) and is "live"(since she has encrypted the nonce, R, that Bob just created).

Figure 7.11: Protocol ap4.0: no failure scenario

7.3.6: Authentication Protocol ap5.0The use of a nonce and symmetric key cryptography formed thebasis of our successful authentication protocol, ap4.0. A naturalquestion is whether we can use a nonce and public keycryptography (rather than symmetric key cryptography) to solvethe authentication problem. The use of a public key approachwould obviate a difficulty in any shared key system--worrying abouthow the two parties learn the secret shared key value in the firstplace. A protocol that uses public key cryptography in a manneranalogous to the use of symmetric key cryptography in protocolap4.0 is protocol ap5.0:

1. Alice sends the message, ",�DP�$OLFH�" to Bob.

2. Bob chooses a nonce, R, and sends it to Alice. Once again,the nonce will be used to ensure that Alice is "live."

3. Alice uses her private encryption algorithm with her privatekey, dA, to the nonce and sends the resulting value dA(R) toBob. Since only Alice knows her private key, no one exceptAlice can generate dA(R).

4. Bob applies Alice’s public encryption algorithm, eA to thereceived message, that is, Bob computes eA(dA(R)). Recallfrom our discussion of RSA public key cryptography inSection 7.2 that eA(dA(R)) = R = dA(eA(R)). Thus, Bobcomputes R and authenticates Alice.

The operation of protocol ap5.0 is illustrated in Figure 7.12. Isprotocol ap5.0 as secure as protocol ap4.0? Both use nonces.Since ap5.0 uses public key techniques, it requires that Bobretrieve Alice’s public key.

Page 23: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

Figure 7.12: Protocol ap5.0 working correctlyThis leads to an interesting scenario, shown in Figure 7.13, inwhich Trudy may be able to impersonate Alice to Bob:

1. Trudy sends the message, ",�DP�$OLFH," to Bob.

2. Bob chooses a nonce, R, and sends it to Alice, but themessage is intercepted by Trudy.

3. Trudy applies her decryption algorithm with her private key,dT, to the nonce and sends the resulting value, dT(R), toBob. To Bob, dT(R) is just a bunch of bits and he doesn’tknow whether the bits represent dT(R) or dA(R).

4. Bob must now get Alice’s public key in order to apply eA tothe value he just received. He sends a message to Aliceasking her for eA (Bob might also retrieve Alice’s public keyfrom her Web site). Trudy intercepts this message as well,and replies back to Bob with eT, that is, Trudy’s public key.Bob computes eT(dT(R)) = R, and thus authenticates Trudyas Alice!

Figure 7.13: A security hold in protocol ap5.0From the above scenario, it is clear that protocol ap5.0 is only as"secure" as is the distribution of public keys. Fortunately, there aresecure ways of distributing public keys, as we will see shortly inSection 7.5.In the scenario in Figure 7.13, Bob and Alice might togethereventually discover that something is amiss, as Bob will claim tohave interacted with Alice, but Alice knows that she has neverinteracted with Bob. There is an even more insidious attack that

Page 24: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

would avoid this detection. In the scenario in Figure 7.14, bothAlice and Bob are talking to each other, but by exploiting the samehole in the authentication protocol, Trudy is able to transparentlyinterpose herself between Alice and Bob. In particular, if Bobbegins sending encrypted data to Alice using the encryption key hereceives from Trudy, Trudy can recover the plaintext of thecommunication from Bob to Alice. At the same time, Trudy canforward Bob’s data to Alice (after re- encrypting data using Alice’sreal public key).

Figure 7.14: A "man-in-the-middle" attackBob is happy to be sending encrypted data, and Alice is happy tobe receiving data encrypted using her own public key; both areunaware of Trudy’s presence. Should Bob and Alice meet laterand discuss their interaction, Alice will have received exactly whatBob sent, so nothing will be detected as being amiss. This is oneexample of the so-called man-in-the-middle attack (moreappropriately here, a "woman-in-the-middle" attack). It is alsosometimes known as a bucket-brigade attack, since Trudy’spassing of data between Alice and Bob resembles the passing ofbuckets of water along a chain of people (a so-called "bucketbrigade") who are putting out a fire using a remote source of water.

© 2000-2001 by Addison Wesley LongmanA division of Pearson Education

Online Book

Page 25: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

7.4: IntegrityThink of the number of the times you’ve signed your name to apiece of paper during the last week. You sign checks, credit cardstatements, legal documents, and letters. Your signature attests tothe fact that you (as opposed to someone else) haveacknowledged and/or agreed with the document’s contents. In adigital world, one often wants to indicate the owner or creator of adocument, or to signify one’s agreement with a document’scontent. A digital signature is a cryptographic technique forachieving these goals in a digital world.

Just as with human signatures, digital signing should be done insuch a way that digital signatures are verifiable, nonforgeable, andnonrepudiable. That is, it must be possible to "prove" that adocument signed by an individual was indeed signed by thatindividual (the signature must be verifiable) and that only thatindividual could have signed the document (the signature cannotbe forged, and a signer cannot later repudiate or deny havingsigned the document). This is easily accomplished with public keycryptography.

7.4.1: Generating Digital SignaturesSuppose that Bob wants to digitally sign a "document," m. Think ofthe document as a file or a message that Bob is going to sign andsend. As shown in Figure 7.15, to sign this document, Bob simplyuses his private decryption key, dB, to compute dB(m). At first, itmight seem odd that Bob is running a decryption algorithm over adocument that hasn’t been encrypted. But recall that "decryption"is nothing more than a mathematical operation (exponentiation tothe power of d in RSA; see Section 7.2) and recall that Bob’s goalis not to scramble or obscure the contents of the document, butrather to sign the document in a manner that is verifiable,nonforgeable, and nonrepudiable. Bob has the document, m, andhis digital signature of the document, dB(m).

Figure 7.15: Creating a digital signature for a document

Page 26: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

Does the digital signature, dB(m), meet our requirements of beingverifiable, nonforgeable, and nonrepudiable? Suppose Alice has mand dB(m). She wants to prove in court (being litigious) that Bobhad indeed signed the document and was the only person whocould have possibly signed the document. Alice takes Bob’s publickey, eB, and applies it to the digital signature, dB(m), associatedwith the document, m. That is, she computes eB(dB(m)), and voil��

with a dramatic flurry, she produces m, which exactly matches theoriginal document! Alice then argues that only Bob could havesigned the document because:

• Whoever signed the message must have used the privateencryption key, dB, in computing the signature dB(m), suchthat eB(dB(m)) = m.

• The only person who could have know the private key, dB, isBob. Recall from our discussion of RSA in Section 7.2 thatknowing the public key, eB, is of no help in learning theprivate key, dB. Therefore, the only person who could knowdB is the person who generated the pair of keys, (eB,dB), inthe first place, Bob. (Note that this assumes, though, thatBob has not given dB to anyone, nor has anyone "stolen" dB

from Bob.)

It is also important to note that if the original document, m, is evermodified to some alternate form, m’, the signature that Bob createdfor m will not be valid for m’, since eB(dB(m)) does not equal m’.Thus we see that public key cryptography techniques provide asimple and elegant way to digitally sign documents that isverifiable, nonforgeable, and nonrepudiable, and that protectsagainst later modification of the document.

7.4.2: Message DigestsWe have seen above that public key encryption technology can beused to create a digital signature. One concern with signing databy encryption, however, is that encryption and decryption arecomputationally expensive. When digitally signing a reallyimportant document, say a merger between two large multinationalcorporations or an agreement with a child to have him/her cleanher room weekly, computational cost may not be important.However, many network devices and processes (for example,routers exchanging routing table information and e-mail useragents exchanging e-mail) routinely exchange data that may notneed to be encrypted. Nonetheless, they do want to ensure that:

• The sender of the data is as claimed, that is, that the senderhas signed the data and this signature can be checked.

• The transmitted data has not been changed since the

Page 27: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

sender created and signed the data.

Given the overheads of encryption and decryption, signing data viacomplete encryption/decryption can be overkill. A more efficientapproach, using so-called message digests, can accomplish thesetwo goals without full message encryption.A message digest is in many ways like a checksum. Message-digest algorithms take a message, m, of arbitrary length andcompute a fixed length "fingerprint" of the data known as amessage digest, H(m). The message digest protects the data inthe sense that if m is changed to m’ (either maliciously or byaccident) then H(m), computed for the original data (andtransmitted with that data), will not match the H(m) computed overthe changed data. While the message digest provides for dataintegrity, how does it help with signing the message m? The goalhere is that rather than having Bob digitally sign (encrypt) theentire message by computing dB(m), he should be able to sign justthe message digest by computing dB(H(m)). That is, having m anddB(H(m)) together (note that m is not encrypted) should be "just asgood as" having a signed complete message, dB(m). This meansthat m and dB(H(m)) together should be nonforgeable, verifiable,and nonrepudiable. Nonforgeability will require that the message-digest algorithm that computes the message digest have somespecial properties, as we will see below.Our definition of a message digest may seem quite similar to thedefinition of a checksum (for example, the Internet checksum, seeSection 3.3.2) or a more powerful error-detection code such as acyclic-redundancy check (see Section 5.2). Is it really anydifferent? Checksums, cyclic-redundancy checks, and messagedigests are all examples of so-called hash functions. As shown inFigure 7.16, a hash function takes an input, m, and computes afixed-size string known as a hash.

Figure 7.16: Hash functions are used to create message digestsThe Internet checksum, CRCs, and message digests all meet thisdefinition. If signing a message digest is going to be "just as goodas" signing the entire message, in particular if it is going to satisfythe nonforgeability requirement, then a message-digest algorithmmust have the following additional properties:

• Given a message digest value, x, it is computationallyinfeasible to find a message, y, such that H(y) = x.

Page 28: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

• It is computationally infeasible to find any two messages xand y such that H(x) = H(y).

Informally, these two properties mean that it is computationallyinfeasible for an intruder to substitute one message for anothermessage that is protected by a message digest. That is, if(m,H(m)) are the message and message digest pair created by thesender, then an intruder cannot forge the contents of anothermessage, y, that has the same message digest value as theoriginal message. When Bob signs m by computing dB(H(m)), weknow that no other message can be substituted for m.Furthermore, Bob’s digital signature of H(m) uniquely identifiesBob as the verifiable, nonrepudiable signer of H(m) (and as aconsequence, m as well) as discussed above in Section 7.4.1.In the context of Bob sending a message to Alice, Figure 7.17provides a summary of the operational procedure of creating adigital signature. Bob puts his original long message through ahash function to create a message digest. He then encrypts themessage digest with his own private key. The original message (incleartext) along with the digitally signed message digest(henceforth referred to as the digital signature) is then sent toAlice. Figure 7.18 provides a summary of the operationalprocedure of verifying message integrity. Alice applies the sender’spublic key to the message to recover the message digest. Alicealso applies the hash function to the clear text message to obtain asecond message digest. If the two message digests match, thenAlice can be sure about the integrity and author of the message.

Page 29: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

Figure 7.17: Sending a digitally signed message

Figure 7.18: Verifying the integrity of a signed message

7.4.3: Hash Function AlgorithmsLet’s convince ourselves that a simple checksum, such as the

Page 30: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

Internet check - sum, would make a poor message digestalgorithm. Rather than performing 1- complements arithmetic (asin the Internet checksum), let us compute a checksum by treatingeach character as a byte and adding the bytes together using 4-byte chunks at a time. Suppose Bob owes Alice $100.99 andsends an IOU to Alice consisting of the text string ",28������%2%."The ASCII representation (in hexadecimal notation) for theseletters is ��, �), ��, ��, ��, ��, �(, ��, ��, ��, �), ��.Figure 7.19 (top) shows that the 4-byte checksum for this messageis %��&��'��$&. A slightly different message (and a much morecostly one for Bob) is shown in the bottom half of Figure 7.19. Themessage ",28������%2%" and ",28������%2%" have the samechecksum. Thus, this simple checksum algorithm violates the tworequirements above. Given the original data, it is simple to findanother set of data with the same checksum. Clearly, for securitypurposes. we are going to need a more powerful hash functionthan a checksum.

Message

,�2�8��

�������

��%�2�%ASCII Representation

����)������

�������(���

�������)���

�����������

%��&��'��$&

Message

,�2�8��

�������

��%�2�%ASCII Representation

����)������

�������(���

�������)���

�����������

%��&��'��$&

Figure 7.19: Initial message and fraudulent message have the samechecksum!

The MD5 message digest algorithm by Ron Rivest [RFC 1321] isin wide use today. It computes a 128-bit message digest in a four-step process consisting of a padding step (adding a one followed

Page 31: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

by enough zero’s so that the length of the message satisfiescertain conditions), an append step (appending a 64-bitrepresentation of the message length before padding), aninitialization of an accumulator, and a final looping step in whichthe message’s 16-word blocks are processed (mangled) in fourrounds of processing. It is not known whether MD5 actuallysatisfies the requirements listed above. The author of MD5 claims"It is conjectured that the difficulty of coming up with two messageshaving the same message digest is on the order of 264 operations,and that the difficulty of coming up with any message having agiven message digest is on the order of 2128 operations." No onehas argued with this claim. For a description of MD5 (including a Csource code implementation) see RFC 1321.The second major message-digest algorithm in use today is SHA-1, the Secure Hash Algorithm [FIPS 1995]. This algorithm is basedon principles similar to those used in the design of MD4 [RFC1320], the predecessor to MD5. The Secure Hash Algorithm (SHA-1), a U.S. federal standard, is required for use whenever a securemessage digest algorithm is required for federal applications. Itproduces a 160-bit message digest.

Online Book

7.5: Key Distribution and CertificationIn Section 7.2 we saw that a drawback of symmetric key cryptography wasthe need for the two communicating parties to have agreed upon theirsecret key ahead of time. With public key cryptography, this a prioriagreement on a secret value is not needed. However, as we discussed inSection 7.2, public key encryption has its own difficulties, in particular theproblem of obtaining someone’s true public key. Both of these problems--determining a shared key for symmetric key cryptography and securelyobtaining the public key for public key cryptography--can be solved using atrusted intermediary. For symmetric key cryptography, the trustedintermediary is called a key distribution center (KDC), which is a single,trusted network entity with whom one has established a shared secret key.We will see that one can use the KDC to obtain the shared keys needed tocommunicate securely with all other network entities, avoiding some of thepitfalls we uncovered in Section 7.3. For public key cryptography, thetrusted intermediary is called a certification authority (CA). A certificationauthority certifies that a public key belongs to a particular entity (a person ora network entity). For a certified public key, if one can safely trust the CA

Page 32: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

that certified the key, then one can be sure about to whom the public keybelongs. Once a public key is certified, then it can be distributed from justabout anywhere, including a public key server, a personal Web page, or adiskette.

7.5.1: The Key Distribution CenterSuppose once again that Bob and Alice want to communicate usingsymmetric key cryptography. They have never met (perhaps they just metin an online chat room) and thus have not established a shared secret keyin advance. How can they now agree on a secret key, given that they cancommunicate with each other only over the network? A solution oftenadopted in practice is to use a trusted key distribution center.The KDC is a server that shares a different secret symmetric key with eachregistered user. This key might be manually installed at the server when auser first registers. The KDC knows the secret key of each user, and eachuser can communicate securely with the KDC using this key. Let’s see howknowledge of this one key allows a user to securely obtain a key forcommunicating with any other registered user. Suppose that Alice and Bobare users of the KDC; they only know their individual key, KA-KDC and KB-KDC,respectively, for communicating securely with the KDC. Alice takes the firststep, and they proceed as illustrated in Figure 7.20.

Figure 7.20: Setting up a one-time session key using a key distribution center

1. Using KA-KDC to encrypt her communication with the KDC, Alicesends a message to the KDC saying she (A) wants to communicatewith Bob (B). We denote this message, KA-KDC(A,B).

2. The KDC, knowing KA-KDC, decrypts KA-KDC(A,B). The KDC thengenerates a random number, R1. This is the shared key value thatAlice and Bob will use to perform symmetric encryption when theycommunicate with each other. This key is referred to as a one-timesession key, as Alice and Bob will use this key for only this onesession that they are currently setting up. The KDC now needs toinform Alice and Bob of the value of R1. The KDC thus sends back amessage to Alice, encrypted using KA-KDC, containing the following:

• R1, the one-time session key that Alice and Bob will use to

Page 33: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

communicate.

• A pair of values: A, and R1, encrypted by the KDC usingBob’s key, KB-KDC. We denote this KB-KDC(A,R1). It is importantto note that KDC is sending Alice not only the value of R1 forher own use, but also an encrypted version of R1 and Alice’sname, encrypted using Bob’s key. Alice can’t decrypt this pairof values in the message (she doesn’t know Bob’s encryptionkey), but then she doesn’t really need to. We’ll see shortly thatAlice will simply forward this encrypted pair of values to Bob(who can decrypt them).

These items are put into a message and encrypted usingAlice’s shared key. The message from the KDC to Alice isthus KA-KDC(R1,KB-KDC(R1)).

3. Alice receives the message from the KDC, extracts R1 from themessage and saves it. Alice now knows the one-time session key,R1. Alice also extracts KB-KDC(A,R1) and forwards this to Bob.

4. Bob decrypts the received message, KB-KDC(A,R1), using KB-KDC andextracts A and R1. Bob now knows the one-time session key, R1,and the person with whom he is sharing this key, A. Of course, hetakes care to authenticate Alice using R1 before proceeding anyfurther.

KerberosKerberos [RFC 1510, Neuman 1994] is an authentication service developed at MIT that uses symmetric key encryptiontechniques and a key distribution center. Although it is conceptually the same as the generic KDC we described inSection 7.5.1, its vocabulary is slightly different. Kerberos also contains several nice variations and extensions of thebasic KDC mechanisms. Kerberos was designed to authenticate users accessing network servers and was initiallytargeted for use within a single administrative domain such as a campus or company. Thus, Kerberos is framed in thelanguage of users who want to access network services (servers) using application-level network programs such asTelnet (for remote login) and NFS (for access to remote files), rather than human-to-human conversants who want toauthenticate themselves to each other, as in our examples above. Nonetheless, the key (pun intended) underlyingtechniques remain the same.

The Kerberos authentication server (AS) plays the role of the KDC. The AS is the repository of not only the secret keysof all users (so that each user can communicate securely with the AS) but also information about which users haveaccess privileges to which services on which network servers. When Alice wants to access a service on Bob (who wenow think of as a server), the protocol closely follows our example in Figure 7.20:

1. Alice contacts the Kerberos AS, indicating that she wants to use Bob. All communication between Alice andthe AS is encrypted using a secret key that is shared between Alice and the AS. In Kerberos, Alice firstprovides her name and password to her local host. Alice’s local host and the AS then determine the one-timesecret session key for encrypting communication between Alice and the AS.

2. The AS authenticates Alice, checks that she has access privileges to Bob, and generates a one-timesymmetric session key, R1, for communication between Alice and Bob. The authentication server (in Kerberosparlance, now referred to as the Ticket Granting Server) sends Alice the value of R1, and also a ticket toBob’s services. The ticket contains Alice’s name, the Alice-Bob session key, R1, and an expiration time, allencrypted using Bob’s secret key (known only by Bob and the AS), as in Figure 7.20. Alice’s ticket is valid onlyuntil its expiration time, and it will be rejected by Bob if presented after that time. For Kerberos V4, the

Page 34: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

maximum lifetime of a ticket is about 21 hours. In Kerberos V5, the lifetime must expire before the end of year9999, a definite Y10K problem!

3. Alice then sends her ticket to Bob. She also sends along an R1-encrypted timestamp that is used as a nonce.Bob decrypts the ticket using his secret key, obtains the session key, and decrypts the timestamp using thejust-learned session key. Bob sends back the nonce to Alice, encrypted using R1, thus showing that Bobknows R1, and is "live."

The most recent version of Kerberos (V5) provides support for multiple Authentication Servers, delegation of accessrights, and renewable tickets. [Kaufman 1995] and [RFC 1510] provide ample details.

7.5.2: Public Key CertificationOne of the principle features of public key encryption is that it is possible fortwo entities to exchange secret messages without having to exchangesecret keys. For example, when Alice wants to send a secret message toBob, she simply encrypts the message with Bob’s public key and sends theencrypted message to Bob; she doesn’t need to know Bob’s secret (that is,private) key, nor does Bob need to know her secret key. Thus, public keycryptography obviates the need for KDC infrastructure, such as Kerberos.Of course, with public key encryption, the communicating entities still haveto exchange public keys. A user can make its public key publicly availablein many ways, for example, by posting the key on the user’s personal Webpage, placing the key in a public key server, or by sending the key to acorrespondent by e-mail. A Web commerce site can place its public key onits server in a manner such that browsers automatically download the publickey when connecting to the site. Routers can place their public keys onpublic key servers, thereby allowing other network entities to retrieve them.There is, however, a subtle, yet critical, problem with public keycryptography. To gain insight to this problem, let’s consider an Internetcommerce example. Suppose that Alice is in the pizza delivery businessand she accepts orders over the Internet. Bob, a pizza lover, sends Alice aplaintext message that includes his home address and the type of pizza hewants. In this message, Bob also includes a digital signature (that is, anencrypted message digest for the original plaintext message). As discussedin Section 7.4, Alice can obtain Bob’s public key (from his personal Webpage, a public key server, or from an e-mail message) and verify the digitalsignature. In this manner she makes sure that Bob, rather than someadolescent prankster, made the order.This all sounds fine until clever Trudy comes along. As shown in Figure7.21, Trudy decides to play a prank. Trudy sends a message to Alice inwhich she says she is Bob, gives Bob’s home address, and orders a pizza.She also attaches a digital signature, but she attaches the signature bysigning the message digest with her (that is, Trudy’s) private key. Trudyalso masquerades as Bob by sending Alice Trudy’s public key but sayingthat it belongs to Bob. In this example, Alice will apply Trudy’s public key(thinking that it is Bob’s) to the digital signature and conclude that theplaintext message was indeed created by Bob. Bob will be very surprisedwhen the delivery person brings a pizza with everything on it to his home!

Page 35: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

Figure 7.21: Trudy masquerades as Bob using public key cryptographyWe see from this example that in order for public key cryptography to beuseful, entities (users, browsers, routers, etc.) need to know for sure thatthey have the public key of the entity with which they are communicating.For example, when Alice is communicating with Bob using public keycryptography, she needs to know for sure that the public key that issupposed to be Bob’s is indeed Bob’s. We had similar concerns in ourauthentication protocols in Figures 7.13 and 7.14.Binding a public key to a particular entity is typically done by a certificationauthority (CA), whose job it is to validate identities and issue certificates. ACA has the following roles:

1. A CA verifies that an entity (a person, a router, and so on) is who itsays it is. There are no mandated procedures for how certification isdone. When dealing with a CA, one must trust the CA to haveperformed a suitably rigorous identity verification. For example, ifTrudy were able to walk into the Fly-by-Night certificate authority andsimply announce "I am Alice" and receive certificates associated withthe identity of "Alice," then one shouldn’t put much faith in publickeys certified by the Fly-by-Night certificate authority. On the otherhand, one might (or might not!) be more willing to trust a CA that ispart of a federal--or state--sponsored program (for example, [Utah1999]). One can trust the "identity" associated with a public key onlyto the extent that one can trust a CA and its identity-verificationtechniques. What a tangled web of trust we spin!

2. Once the CA verifies the identity of the entity, the CA creates acertificate that binds the public key of the identity to the identity. Thecertificate contains the public key and globally unique identifyinginformation about the owner of the public key (for example, a humanname or an IP address). The certificate is digitally signed by the CA.

Page 36: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

These steps are shown in Figure 7.22.

Figure 7.22: Bob obtains a certificate from the certification authorityLet us now see how certificates can be used to combat pizza-orderingpranksters, like Trudy, and other undesirables. When Alice receives Bob’sorder, she gets Bob’s certificate, which may be on his Web page, in an e-mail message, or in a certificate server. Alice uses the CA’s public key toverify that the public key in the certificate is indeed Bob’s. If we assume thatthe public key of the CA itself is known to all (for example, it could bepublished in a trusted, public, and well-known place, such as The New YorkTimes, so that it is known to all and cannot be spoofed), then Alice can besure that she is indeed dealing with Bob. Figure 7.22 illustrates the stepsinvolved in CA-mediated public key encryption.Both the International Telecommunication Union (ITU) and the IETF havedeveloped standards for certification authorities. ITU X.509 [ITU 1993]specifies an authentication service as well as a specific syntax forcertificates. RFC 1422 describes CA-based key management for use withsecure Internet e-mail. It is compatible with X.509 but goes beyond X.509by establishing procedures and conventions for a key managementarchitecture. Table 7.3 describes some of the important fields in acertificate.Table 7.3: Selected fields in a X.509 and RFC 1422 public key certificateField NameDescription

VersionVersion number of X.509 specification

Serial NumberCA-issued unique identifier for a certificate

Signature

Page 37: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

Specifies the algorithm used by CA to "sign" this certificate

Issuer NameIdentity of CA issuing this certificate, in so-called Distinguished Name(DN) [RFC 2253]format

Validity PeriodStart and end of period of validity for certificate

Subject NameIdentity of entity whose public key is associated with this certificate, in DN format

Subject Public KeyThe subject’s public key as well as an indication of the public key algorithm (and algorithmparameters) to be used with this key

With the recent boom in electronic commerce and the consequentwidespread need for secure transactions, there has been increased interestin certification authorities. Among the companies providing CA services areCybertrust [Cybertrust 1999], Verisign [Verisign 1999], and Netscape[Netscape Certificate 1999].A certificate issued by Thawte Consulting to Netfarmers Enterprises, Inc.,as viewed through a Netscape browser, is shown in Figure 7.23.

Figure 7.23: A certificate issued by Thawte Consulting to Netfarmers Enterprises, Inc.

Online Book

Page 38: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

7.6: Secure E-MailIn previous sections we examined fundamental issues in network security,including symmetric key and public key encryption, authentication, keydistribution, message integrity, and digital signatures. We are now going toexamine how these tools are being used to provide security in the Internet.Interestingly, it is possible to provide security services in any of the top fourlayers of the Internet protocol stack [Molva 1999]. When security isprovided for a specific application-layer protocol, then the application usingthe protocol will enjoy one or more security services, such as secrecy,authentication, or integrity. When security is provided for a transport-layerprotocol, then all applications that use that protocol enjoy the securityservices of the transport protocol. When security is provided at the networklayer on a host-to-host basis, then all transport-layer segments (and henceall application-layer data) enjoy the security services of the network layer.When security is provided on a link basis, then the data in all framestraveling over the link receive security services of the link.

In this and the following two sections we examine how the security tools arebeing used in the application, transport, and network layers. Beingconsistent with the general structure of this book, we begin at the top of theprotocol stack and discuss security at the application-layer. Our approachhere is to use a specific application, namely, e-mail, as a case study forapplication-layer security. We then move down the protocol stack. InSection 7.7 we examine the SSL protocol, which provides security at thetransport layer for TCP. In Section 7.8, we’ll consider IPsec, which providessecurity at the network layer.

You might be wondering why security functionality is being provided atmore than one layer in the Internet. Wouldn’t it suffice to simply provide thesecurity functionality at the network layer, and be done with it? There aretwo answers to this question. First, although security at the network layercan offer "blanket coverage" by encrypting all the data in the datagrams(that is, all the transport-layer segments) and by authenticating all thesource IP addresses, it can’t provide user-level security. For example, acommerce site cannot rely on IP-layer security to authenticate a customerwho is purchasing goods at the commerce site. Thus, there is a need forsecurity functionality at higher layers as well as blanket coverage at lowerlayers. Second, it is generally easier to deploy new Internet services,including security services, at the higher layers of the protocol stack. Whilewaiting for security to be broadly deployed at the network layer, which isprobably still many years in the future, many application developers "just doit" and introduce security functionality into their favorite applications. Aclassic example is PGP, which provides secure e-mail (discussed later inthis section). Requiring only client and server application code, PGP wasone of the first security technologies to be broadly used in the Internet.

Page 39: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

7.6.1: Principles of Secure E-MailIn this section we use many of the tools introduced in the previous sectionto create a high-level design of a secure e-mail system. We create thishigh-level design in an incremental manner, at each step introducing newsecurity services. When designing a secure e-mail system, let us keep inmind the racy example introduced in Section 7.1--the love affair betweenAlice and Bob. In the context of e-mail, Alice wants to send an e-mailmessage to Bob, and Trudy wants to intrude.Before plowing ahead and designing a secure e-mail system for Alice andBob, we should first consider which security features would be mostdesirable for them. First and foremost is secrecy. As discussed in Section7.1, neither Alice nor Bob wants Trudy to read Alice’s e-mail message. Thesecond feature that Alice and Bob would most likely want to see in thesecure e-mail system is sender authentication. In particular, when Bobreceives the message from Alice, ",�GRQW�ORYH�\RX�DQ\PRUH��,�QHYHU�ZDQW�WR�VHH\RX�DJDLQ��)RUPHUO\�\RXUV��$OLFH," Bob would naturally want to be sure that themessage came from Alice and not from Trudy. Another feature that the twolovers would appreciate is message integrity, that is, assurance that themessage Alice sends is not modified while enroute to Bob. Finally, the e-mail system should provide receiver authentication, that is, Alice wants tomake sure that she is indeed sending the letter to Bob and not to someoneelse (for example, Trudy) who is impersonating Bob.So let’s begin by addressing the foremost concern of Alice and Bob,namely, secrecy. The most straightforward way to provide secrecy is forAlice to encrypt the message with symmetric key technology (such as DES)and for Bob to decrypt the message upon message receipt. As discussed inSection 7.2, if the symmetric key is long enough, and if only Alice and Bobhave the key, then it is extremely difficult for anyone else (including Trudy)to read the message. Although this approach is straightforward, it has thefundamental difficulty that we discussed in Section 7.2--it is hard todistribute a symmetric key so that only Alice and Bob have copies of it. Sowe naturally consider an alternative tool, namely, public key cryptography(using, for example, RSA). In the public key approach, Bob makes hispublic key publicly available (for example, in a public key server or on hispersonal Web page), Alice encrypts her message with Bob’s public key,and sends the encrypted message to Bob’s e-mail address. (The encryptedmessage is encapsulated with MIME headers and sent over ordinarySMTP, as discussed in Section 2.4.) When Bob receives the message, hesimply decrypts it with his private key. Assuming that Alice knows for surethat the public key is Bob’s public key (and that the key is long enough),then this approach is an excellent means to provide the desired secrecy.One problem, however, is that public key encryption is relatively inefficient,particularly for long messages. (Long e-mail messages are nowcommonplace in the Internet, due to the increasing use of attachments,images, audio, and video.)

Page 40: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

To overcome the efficiency problem, let’s make use of a session key(discussed in Section 7.5). In particular, (1) Alice selects a symmetric key,KS, at random, (2) en - crypts her message, m, with the symmetric key, KS,(3) encrypts the symmetric key with Bob’s public key, eB, (4) concatenatesthe encrypted message and the encrypted symmetric key to form a"package," and (5) sends the package to Bob’s e-mail address. The stepsare illustrated in Figure 7.24. (In this and the subsequent figures, the "+"represents concatenation and the "-" represents de-concatenation.) WhenBob receives the package, he (1) uses his private key dB to obtain thesymmetric key, Ks, and (2) uses the symmetric key Ks to decrypt themessage m.

Figure 7.24: Alice uses a symmetric session key, KS, to send a secret e-mail to BobHaving designed a secure e-mail system that provides secrecy, let’s nowdesign another system that provides both sender authentication andintegrity. We shall suppose, for the moment, that Alice and Bob are nolonger concerned with secrecy (they want to share their feelings witheveryone!), and are concerned only about sender authentication andmessage integrity. To accomplish this task, we use digital signatures andmessage digests, as described in Section 7.4. Specifically, (1) Alice appliesa hash function, H (for example, MD5), to her message m to obtain amessage digest, (2) encrypts the result of the hash function with her privatekey, dA, to create a digital signature, (3) concatenates the original(unencrypted message) with the signature to create a package, (4) andsends the package to Bob’s e-mail address. When Bob receives thepackage, (1) he applies Alice’s public key, eA, to the message digest signedand (2) compares the result of this operation to his own hash, H, of themessage. The steps are illustrated in Figure 7.25. As discussed in Section7.5, if the two results are the same, Bob can be pretty confident that themessage came from Alice and is unaltered.

Figure 7.25: Using hash functions and digital signatures to provide sender authentication

Page 41: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

and message integrityNow let’s consider designing an e-mail system that provides secrecy,sender authentication, and message integrity. This can be done bycombining the procedures in Figure 7.24 and 7.25. Alice first creates apreliminary package, exactly as in Figure 7.25, which consists of heroriginal message along with a digitally signed hash of the message. Shethen treats this preliminary package as a message in itself, and sends thisnew message through the sender steps in Figure 7.24, creating a newpackage that is sent to Bob. The steps applied by Alice are shown in Figure7.26. When Bob receives the package, he first applies his side of Figure7.24 and then his side of Figure 7.25. It should be clear that this designachieves the goal of providing secrecy, sender authentication, andmessage integrity. Note in this scheme that Alice applies public keyencryption twice: once with her own private key and once with Bob’s publickey. Similarly, Bob applies public key encryption twice--once with hisprivate key and once with Alice’s public key.

Figure 7.26: Alice uses symmetric key cryptography, public key cryptography, a hashfunction, and a digital signature to provide secrecy, sender authentication, and message

integrityThe secure e-mail design outlined in Figure 7.26 probably providessatisfactory security for most e-mail users for most occasions. But there isstill one important issue that remains to be addressed. The design in Figure7.26 requires Alice to obtain Bob’s public key, and requires Bob to obtainAlice’s public key. The distribution of these public keys is a nontrivialproblem. For example, Trudy might masquerade as Bob and give Alice herown public key while saying that it is Bob’s public key. As we learned inSection 7.5, a popular approach for securely distributing public keys is tocertify the public keys.

7.6.2: PGPOriginally written by Phil Zimmermann in 1991, pretty good privacy (PGP) isan e-mail encryption scheme that has become a de-facto standard. Itswebsite serves more than a million pages a month to users in 166 differentcountries. [PGPI 2000]. Versions of PGP are available in the public domain;for example, you can find the PGP software for your favorite platform aswell as lots of interesting reading at the International PGP Home Page[PGPI 2000]. (A particularly interesting essay by the author of PGP is[Zimmermann 1999]. PGP is also commercially available [NetworkAssociates 1999], and is also available as a plug-in for many e-mail useragents, including Microsoft’s Exchange and Outlook, and Qualcomm’s

Page 42: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

Eudora.The PGP design is, in essence, the same as the design shown in Figure7.26. Depending on the version, the PGP software uses MD5 or SHA forcalculating the message digest; CAST, Triple-DES, or IDEA for symmetrickey encryption; and RSA for the public key encryption. In addition, PGPprovides data compression.When PGP is installed, the software creates a public key pair for the user.The public key can be posted on the user’s Web site or placed in a publickey server. The private key is protected by the use of a password. Thepassword has to be entered every time the user accesses the private key.PGP gives the user the option of digitally signing the message, encryptingthe message, or both digitally signing and encrypting. Figure 7.27 shows aPGP signed message. This message appears after the MIME header. Theencoded data in the message is dA (H(m)), that is, the digitally signedmessage digest. As we discussed above, in order for Bob to verify theintegrity of the message, he needs to have access to Alice’s public key.�����%(*,1�3*3�6,*1('�0(66$*(�����

+DVK���6+$�

%RE�

0\�KXVEDQG�LV�RXW�RI�WRZQ�WRQLJKW�

3DVVLRQDWHO\�\RXUV��$OLFH

�����%(*,1�3*3�6,*1$785(�����

9HUVLRQ��3*3�IRU�3HUVRQDO�3ULYDF\����

&KDUVHW���QRFRQY

\K+-5+K*-*KJJ���(S-�OR�J(�Y%�PT-K)(Y=3�W�Q�*�P�*Z�

�����(1'�3*3�6,*1$785(�����

Figure 7.27: A PGP signed messageFigure 7.28 shows a PGP secret message. This message also appearsafter the MIME header. Of course, the plaintext message is not includedwithin the secret e-mail message. When a sender (such as Alice) wantsboth secrecy and integrity, PGP would contain a message like that ofFigure 7.28 within the message of Figure 7.27.�����%(*,1�3*3�0(66$*(�����

9HUVLRQ��3*3�IRU�3HUVRQDO�3ULYDF\����

X�5�G��M.PQ�%F��KJ'VT$HZV'IU*GV];��OL.P�)�*F�V'IF;\W

5IG6��MX+JEFI'VV:H��. O.KQ0LN/R����%YF;�W 8MN�3EF'�

7KGI�DZ4IJ+EQP.ORN�L\�J7KOS

Page 43: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

�����(1'�3*3�0(66$*(

Figure 7.28: A secret PGP messagePGP also provides a mechanism for public key certification, but themechanism is quite different from the more conventional certificationauthority. PGP public keys are certified by a web of trust. Alice herself cancertify any key/user name pair when she believes the pair really belongstogether. In addition, PGP permits Alice to say that she trusts another userto vouch for the authenticity of more keys. Some PGP users sign eachother’s keys by holding key signing parties. Users physically gather,exchange floppy disks containing public keys, and certify each other’s keysby signing them with their private keys. PGP public keys are also distributedby PGP public key servers on the Internet. When a user submits a publickey to such a server, the server stores a copy of the key, sends a copy ofthe key to all the other public-key servers, and serves the key to anyonewho requests it. Although key signing parties and PGP public key serversactually exist, by far the most common way for users to distribute theirpublic keys is by posting them on their personal Web pages. Of course,keys on personal Web pages are not certified by anyone, but they are easyto access.

Phil Zimmermann and PGPPhilip R. Zimmermann is the creator of Pretty Good Privacy (PGP). For that, he was thetarget of a three-year criminal investigation, because the government held that U.S. exportrestrictions for cryptographic software were violated when PGP spread all around the worldfollowing its 1991 publication as freeware. After releasing PGP as shareware, someoneelse put it on the Internet and foreign citizens downloaded it. Cryptography programs in theUnited States are classified as munitions under federal law and may not be exported.

Despite the lack of funding, the lack of any paid staff, the lack of a company to stand behind it, and despite governmentinterventions, PGP nonetheless became the most widely used e-mail encryption software in the world. Oddly enough, theU.S. government may have inadvertently contributed to PGP’s spread, by making it more popular because of theZimmermann case.

The U.S. government dropped the case in early 1996. The announcement was met with celebration by Internet activists.The Zimmermann case had become the story of an innocent person fighting for his rights against the abuses of biggovernment. The government’s giving in was a welcome news, in part because of the campaign for Internet censorship inCongress and the push by the FBI to allow increased government snooping.

After the government dropped its case, Zimmermann founded PGP Inc., which was acquired by Network Associates inDecember 1997. Zimmermann is now a Senior Fellow at Network Associates, as well as an independent consultant inmatters cryptographic.

© 2000-2001 by Addison Wesley LongmanA division of Pearson Education

Page 44: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

Online Book

7.7: Internet CommerceIn the previous section, we considered the application-layer use (in secure e-mail) of the various security technologies that we studied earlier in this chapter:encryption, authentication, key distribution, message integrity, and digitalsignatures. In this section, we’ll continue our case study of various securitymechanisms by dropping down a layer in the protocol stack and covering securesockets and a secure transport layer. We’ll take Internet commerce as amotivating application, since business and financial transactions are an importantdriver for Internet security.

We define Internet commerce to be the purchasing of "goods" over the Internet.Here we consider goods in a very broad sense to include books, CDs, hardware,software, airline tickets, stocks and bonds, consulting services, and so on. In the1990s many schemes were designed for Internet commerce, some providingminimal levels of security and others providing a high-level of security along withcustomer anonymity (similar to the anonymity provided by ordinary person-to-person cash transactions [Loshin 1997].) In the late 1990s, however, there was amajor shake out, as only a few of these schemes were widely implemented inWeb browsers and servers. As of this writing, two schemes have taken hold:SSL, which is currently used by the vast majority of Internet transactions; andSET, which is expected to fiercely compete with SSL in the upcoming years.

Internet commerce, whether with SSL or SET, makes extensive use of theexisting payment card (credit and debit) infrastructure that consumers,merchants, and financial institutions have used for many years. There are threemajor players in this infrastructure: the customer who is purchasing a product, themerchant who is selling the product, and the merchant’s bank, which authorizesthe purchase. We shall see in our discussion below that Internet commerce withSSL provides security for communication between the first two of these threeplayers (that is, the customer and the merchant), whereas SET provides securityfor communication among all three players.

7.7.1: Internet Commerce Using SSLLet us walk through a typical Internet commerce scenario. Bob is surfing the Weband arrives at the Alice Incorporated site, which is selling some durable good.The Alice Incorporated site displays a form in which Bob is supposed to enter thequantity desired, his address, and his payment card number. Bob enters thisinformation, clicks on "submit," and then expects to receive (say, via, ordinarymail) the good; he also expects to receive a charge for the good in his nextpayment card statement. This all sounds good, but if no security measures aretaken--such as encryption or authentication--Bob could be in for a few surprises:

• An intruder could intercept the order and obtain Bob’s payment card

Page 45: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

information. The intruder could then make purchases at Bob’s expense.

• The site could display Alice Incorporated’s famous logo, but actually be asite maintained by Trudy, who is masquerading as Alice Incorporated.Trudy could take Bob’s money and run. Or Trudy could make her ownpurchases and have them billed to Bob’s account.

Many other surprises are possible, and we will discuss a few of these in the nextsubsection. But the two problems listed above are two of the most seriousproblems. Internet commerce using the SSL protocol can address both theseproblems.Secure sockets layer (SSL), originally developed by Netscape, is a protocoldesigned to provide data encryption and authentication between a Web clientand a Web server. The protocol begins with a handshake phase that negotiatesan encryption algorithm (for example, DES or IDEA) and keys, and authenticatesthe server to the client. Optionally, the client can also be authenticated to theserver. Once the handshake is complete and the transmission of application databegins, all data is encrypted using session keys negotiated during the handshakephase. SSL is widely used in Internet commerce, being implemented in almost allpopular browsers and Web servers. Furthermore, it is also the basis of theTransport Layer Security (TLS) protocol [RFC 2246].SSL and TLS are not limited to the Web application; for example, they cansimilarly be used for authentication and data encryption for IMAP mail access.SSL can be viewed as a layer that sits between the application layer and thetransport layer. On the sending side, SSL receives data (such as an HTTP orIMAP message from an application), encrypts the data, and directs the encrypteddata to a TCP socket. On the receiving side, SSL reads from the TCP socket,decrypts the data, and directs the data to the application. Although SSL can beused with many Internet applications, we’ll discuss it in the context of the Web,where it is principally being used today for Internet commerce.SSL provides the following features:

• SSL server authentication, allowing a user to confirm a server’s identity.An SSL-enabled browser maintains a list of trusted certification authorities(CAs) along with the public keys of the CAs. When the browser wants todo business with an SSL-enabled Web server, the browser obtains acertificate from the server containing the server’s public key. Thecertificate is issued (that is, digitally signed) by a certification authority(CA) listed in the client’s list of trusted CAs. This feature allows thebrowser to authenticate the server before the user submits a payment cardnumber. In the context of the earlier example, this server authenticationenables Bob to verify that he is indeed sending his payment card numberto Alice Incorporated, and not to someone else who might bemasquerading as Alice Incorporated.

• SSL client authentication, allowing a server to confirm a user’s identity.Analogous to server authentication, client authentication makes use ofclient certificates, which have also been issued by CAs. This

Page 46: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

authentication is important if the server, for example, is a bank sendingconfidential financial information to a customer and wants to check therecipient’s identity. Client authentication, although supported by SSL, isoptional. To keep our discussion focused, we will henceforth ignore it.

• An encrypted SSL session, in which all information sent between browserand server is encrypted by the sending software (browser or Web server)and decrypted by the receiving software (browser or Web server). Thisconfidentiality may be important to both the customer and the merchant.Also, SSL provides a mechanism for detecting tampering of theinformation by an intruder.

How SSL WorksA user, say Bob, surfs the Web and clicks on a link that takes him to a securepage housed by Alice’s SSL-enabled server. The protocol part of the URL for thispage is "https" rather than the ordinary "http." The browser and server then runthe SSL handshake protocol, which (1) authenticates the server and (2)generates a shared symmetric key. Both of these tasks make use of RSA publickey technology. The main flow of events in the handshake phase is shown inFigure 7.29. During this phase, Alice sends Bob her certificate, from which Bobobtains Alice’s public key. Bob then creates a random symmetric key, encrypts itwith Alice’s public key, and sends the encrypted key to Alice. Bob and Alice nowshare a symmetric session key. Once this handshake protocol is complete, alldata sent between the browser and server (over TCP connections) is encryptedusing the symmetric session key.

Page 47: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

Figure 7.29: High-level overview of the handshake phase of SSLHaving given a high-level overview of SSL, let’s take a closer look at some of themore important details. The SSL handshake performs the following steps:

1. The browser sends the server the browser’s SSL version number andcryptography preferences. The browser sends its cryptographypreferences because the browser and server negotiate which symmetrickey algorithm they are going to use.

2. The server sends the browser the server’s SSL version number,cryptography preferences, and its certificate. Recall that the certificateincludes the server’s RSA public key and is certified by some CA, that is,the certificate has been encrypted by a CA’s private key.

3. The browser has an entrusted list of CAs and a public key for each CA onthe list. When the browser receives the certificate from the server, itchecks to see if the CA is on the list. If not, the user is warned of theproblem and informed that an encrypted and authenticated connectioncannot be established. If the CA is on the list, the browser uses the CA’spublic key to decrypt the certificate and obtain the server’s public key.

4. The browser generates a symmetric session key, encrypts it with theserver’s public key, and sends the encrypted session key to the server.

5. The browser sends a message to the server informing it that futuremessages from the client will be encrypted with the session key. It thensends a separate (encrypted) message indicating that the browser portionof the handshake is finished.

6. The server sends a message to the browser informing it that futuremessages from the server will be encrypted with the session key. It thensends a separate (encrypted) message indicating that the server portion ofthe handshake is finished.

7. The SSL handshake is now complete, and the SSL session has begun.The browser and the server use the session keys to encrypt and decryptthe data they send to each other and to validate its integrity.

The SSL handshake actually has many more steps than listed above. You canfind more information about SSL at Netscape’s Security Developer Central[Netscape Security 1999]. In addition to payment card purchases, we point outhere that SSL can be (and is) used for other financial transactions includingonline banking and stock trading.

SSL in ActionWe recommend that you visit a secure Web site, such as a Quebec maple syrup site (http://www.jam.ca/syrup). When you enter a

Page 48: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

secure section of such a site, SSL will perform the handshake protocol. Assuming that the server’s certificate checks out, thebrowser will notify you, for example by displaying a special icon. All information sent between you and the server will now beencrypted. Your browser should let you actually see the certificate for the merchant. (For example, with Internet Explorer, go toFile, Properties, Certificates.) In February 2000, the maple syrup site’s certificate included the following information:

Company: Netfarmers Enterprises Inc.

Certification Authority: Thawte Certification

Public Key (in hexadecimal): 3E:BD:DD:46:10:DI:92:95:D6:12:ED:A8:18:88:51:60

If your browser lets you do secure transactions with the merchant, then you should also be able to see the certificate for CA, thatis, Thawte Certification. (For example, with Internet Explorer, go to View, Internet Options, Content, Certificate Authorities.)

The Limitations of SSL in Internet CommerceDue to its simplicity and early development, SSL is widely implemented inbrowsers, servers, and Internet commerce products. These SSL-enabled serversand browsers provide a popular platform for payment card transactions.Nevertheless, we should keep in mind that SSL was not specifically tailored forpayment card transactions, but instead for generic secure communicationbetween a client and server. Because of this generic design, SSL lacks manyfeatures that the payment-card industry would like to see in an Internetcommerce protocol.Consider once again what happens when Bob makes a purchase from AliceIncorporated over SSL. The signed certificate that Bob receives from Aliceassures Bob that he is really dealing with Alice Incorporated, and that AliceIncorporated is a bona fide company. However, the generic certificate does notindicate whether Alice Incorporated is authorized to accept payment-cardpurchases nor if the company is a reliable merchant. This opens the door formerchant fraud. And there is a similar problem for client authorization. Even ifSSL client authentication is used, the client certificate does not tie Bob to aspecific authorized payment card; thus, Alice Incorporated has no assuranceabout whether Bob is authorized to make a payment-card purchase. This opensthe door to all kinds of fraud, including purchases with stolen credit cards andcustomer repudiation of purchased goods [Abbott 1999].Of course, this kind of fraud is already rampant in mail order and telephone order(MOTO) purchases. With MOTO transactions, the law dictates that the merchantaccepts liability for fraudulent transactions. Thus, if a customer makes a MOTOpurchase with a payment card and claims to have never made the purchase,then the merchant is liable, that is, the merchant is legally bound to return themoney to the customer (unless the merchant can prove that the customeractually ordered and received the goods). Similarly, if a MOTO purchase is madewith a stolen payment card, the merchant is again liable. On the other hand, withphysically present transactions, the merchant’s bank accepts the liability. As youmight expect, it is more difficult for a customer to repudiate a physically presentpurchase that involves a hand-written signature or a PIN.SSL purchases are similar to MOTO purchases, and naturally the merchant isliable for a fraudulent SSL purchase. It would be preferable, of course, to use aprotocol that provides superior authentication of the customer and of themerchant, something that is as good or better than a physically presenttransaction. Authentication involving payment-card authorization would reduce

Page 49: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

fraud and merchant liability.

7.7.2: Internet Commerce Using SETSecure electronic transactions (SET) is a protocol specifically designed tosecure payment-card transactions over the Internet. It was originally developedby Visa International and MasterCard International in February 1996 withparticipation from leading technology companies around the world. SET SecureElectronic Transaction LLC (commonly referred to as SETCo) was established inDecember 1997 as a legal entity to manage and promote the global adoption ofSET [SetCo 1999]. Some of the principle characteristics of SET are as follows:

• SET is designed to encrypt specific kinds of payment-related messages; itcannot be used to encrypt arbitrary data (such as text and images) as canSSL.

• The SET protocol involves all three players mentioned at the beginning ofthis section, namely, the customer, the merchant, and the merchant’sbank. All sensitive information sent between the three parties is encrypted.

• SET requires all three players to have certificates. The customer’s andmerchant’s certificates are issued by their banks, thereby assuring thatthese players are permitted to make and receive payment-card purchases.The customer certificate provides merchants with assurance thattransactions will not be fraudulently charged back. It is an electronicrepresentation of the customer’s payment card. It contains informationabout the account, the issuing financial institution, and other cryptographicinformation. The merchant certificate assures the consumer that thatmerchant is authorized to accept payment-card purchases. It containsinformation about the merchant, the merchant’s bank, and the financialinstitution issuing the certificate.

• SET specifies the legal meaning of the certificates held by each party andthe apportionment of liabilities connected with a transaction [Abbott 1999].

• In a SET transaction, the customer’s payment-card number is passed tothe merchant’s bank without the merchant ever seeing the number in plaintext. This feature prevents fraudulent or careless merchants from stealingor accidentally leaking the payment-card number.

A SET transaction uses three software components:

• Browser wallet. The browser wallet application is integrated with thebrowser and provides the customer with storage and management ofpayment cards and certificates while shopping. It responds to SETmessages from the merchant, prompting the customer to select a paymentcard for payment.

• Merchant server. The merchant server is the merchandising and fulfillmentengine for merchants selling on the Web. For payments, it processescardholder transactions and communicates with the merchant’s bank for

Page 50: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

approval and subsequent payment capture.

• Acquirer gateway. The acquirer gateway is the software component at themerchant’s bank. It processes the merchant’s payment card transaction forauthorization and payment.

In what follows, we give a highly simplified overview of the SET protocol. Inreality, the protocol is substantially more complex.Steps in Making a PurchaseSuppose Bob wants to purchase a good over the Internet from Alice Incorporatedusing SET.

1. Bob indicates to Alice that he is interested in making a credit cardpurchase.

2. Alice sends Bob an invoice and a unique transaction identifier.

3. Alice sends Bob the merchant’s certificate, which includes the merchant’spublic key. Alice also sends the certificate for her bank, which includes thebank’s public key. Both of these certificates are encrypted with the privatekey of a certifying authority.

4. Bob uses the certifying authority’s public key to decrypt the twocertificates. Bob now has Alice’s public key and the bank’s public key.

5. Bob generates two packages of information: the order information (OI)package and the purchase instructions (PI) package. The OI, destinedfor Alice, contains the transaction identifier and brand of card being used;it does not include Bob’s card number. The PI, destined for Alice’s bank,contains the transaction identifier, the card number, and the purchaseamount agreed to by Bob. The OI and PI are dual encrypted: the OI isencrypted with Alice’s public key; the PI is encrypted with Alice’s bank’spublic key. (We are bending the truth here in order to see the big picture.In reality, the OI and PI are encrypted with a customer-merchant sessionkey and a customer-bank session key.) Bob sends the OI and the PI toAlice.

6. Alice generates an authorization request for the card payment request,which includes the transaction identifier.

7. Alice sends to her bank a message encrypted with the bank’s public key.(Actually, a session key is used.) This message includes the authorizationrequest, the PI package received from Bob, and Alice’s certificate.

8. Alice’s bank receives the message and unravels it. The bank checks fortampering. It also makes sure that the transaction identifier in theauthorization request matches the one in Bob’s PI package.

9. Alice’s bank then sends a request for payment authorization to Bob’spayment-card bank through traditional bank-card channels--just as Alice’s

Page 51: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

bank would request authorization for any normal payment-cardtransaction.

10. Once Bob’s bank authorizes the payment, Alice’s bank sends a responseto Alice, which is (of course) encrypted. The response includes thetransaction identifier.

11. If the transaction is approved, Alice sends her own response message toBob. This message serves as a receipt and informs Bob that the paymentwas accepted and that the goods will be delivered.

One of the key features of SET is the nonexposure of the credit number to themerchant. This feature is provided in Step 5, in which the customer encrypts thecredit-card number with the bank’s key. Encrypting the number with the bank’skey prevents the merchant from seeing the credit card. Note that the SETprotocol closely parallels the steps taken in a standard payment-card transaction.To handle all the SET tasks, the customer will have a so-called digital wallet thatruns the client-side of the SET protocol and stores customer payment-cardinformation (card number, expiration date, etc.). Readers interested in learningmore about SET are encouraged to see the SETCo page [SetCo 1999] or theSET documentation at the MasterCard site [MasterCard 1999]. There are alsoseveral good books on SET [Merkow 1998; Loeb 1998].

Online Book

7.8: Network Layer Security: IPsecThe IP security protocol, more commonly known as IPsec, is a suite ofprotocols that provides security at the network layer. IPsec is a rathercomplex animal, and different parts of it are described in more than a dozenRFCs. In this section, we will discuss IPsec in a specific context, namely, inthe context that all hosts in the Internet support IPsec. Although this contextis many years away, the context will simplify the discussion and help usunderstand the key features of IPsec. Two key RFCs are RFC 2401, whichdescribes the overall IP security architecture and RFC 2411, whichprovides an overview of the IPsec protocol suite and the documentsdescribing it. A nice introduction to IPsec is given in [Kessler 1998].

Before getting into the specifics of IPsec, let us step back and considerwhat it means to provide security at the network layer. Consider first what itmeans to provide network-layer secrecy. The network layer would providesecrecy if all the data carried by all IP datagrams were encrypted. Thismeans that whenever a host wants to send a datagram, it encrypts the datafield of the datagram before shipping it out into the network. In principle, the

Page 52: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

encryption could be done with symmetric key encryption, public keyencryption, or with session keys that are negotiated using public keyencryption. The data field could be a TCP segment, a UDP segment, anICMP message, and so on. If such a network-layer service were in place,all data sent by hosts--including e-mail, Web pages, control, andmanagement messages (such as ICMP and SNMP)--would be hidden fromany third party that is "wire tapping" the network. Thus, such a servicewould provide a certain "blanket coverage" for all Internet traffic, therebygiving all of us a certain sense of security.

In addition to secrecy, one might want the network layer to also providesource authentication. When a destination host receives an IP datagramwith a particular IP source address, it authenticates the source by makingsure that the IP datagram was indeed generated by the host with that IPsource address. Such a service prevents attackers from spoofing IPaddresses.

In the IPsec protocol suite there are two principal protocols: theAuthentication Header (AH) protocol and the Encapsulation SecurityPayload (ESP) protocol. When a source host sends secure datagrams toa destination host, it does so with either the AH protocol or with the ESPprotocol. The AH protocol provides source authentication and data integritybut does not provide secrecy. The ESP protocol provides data integrity,authentication, and secrecy. Providing more services, the ESP protocol isnaturally more complicated and requires more processing than the AHprotocol. We will discuss both of these protocols below.

For both the AH and the ESP protocols, before sending secured datagramsfrom a source host to a destination host, the source and network hostshandshake and create a network-layer logical connection. This logicalchannel is called a security agreement (SA). Thus, IPsec transforms thetraditional connectionless network layer of the Internet to a layer with logicalconnections! The logical connection defined by an SA is a simplexconnection, that is, it is unidirectional. If both hosts want to send securedatagrams to each other, then two SAs (that is, logical connections) need tobe established, one in each direction. An SA is uniquely identified by a 3-tuple consisting of:

• a security protocol (AH or ESP) identifier

• the source IP address for the simplex connection

• a 32-bit connection identifier called the Security Parameter Index(SPI)

For a given SA (that is, a given logical connection from source host todestination host), each IPsec datagram will have a special field for the SPI.All of the datagrams in the SA will use the same SPI value in this field.

Page 53: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

7.8.1: Authentication Header (AH) ProtocolAs mentioned above, the AH protocol provides source host identificationand data integrity but not secrecy. When a particular source host wants tosend one or more datagrams to a particular destination, it first establishesan SA with the destination. After having established the SA, the source cansend secure datagrams to the destination host. The secure datagramsinclude the AH header, which is inserted between the original IP datagramdata (for example, a TCP or UDP segment) and the IP header, as shown inFigure 7.30. Thus the AH header augments the original data field, and thisaugmented data field is encapsulated as a standard IP datagram. For theprotocol field in the IP header, the value 51 is used to indicate that thedatagram includes an AH header. When the destination host receives theIP datagram, it takes note of the 51 in the protocol field, and processes thedatagram using the AH protocol. (Recall that the protocol field in the IPdatagram is used to determine the upper-layer protocol (e.g., UDP, TCP, orICMP) that will be passed the data portion of an IP datagram.) Intermediaterouters process the datagrams just as they always have--they examine thedestination IP address and route the datagrams accordingly.

Figure 7.30: Position of the AH header in the IP diagramThe AH header includes several fields, including:

• Next Header field, which has the role that the protocol field has foran ordinary datagram. It indicates whether the data following the AHheader is a TCP segment, UDP segment, ICMP segment, etc.(Recall that the protocol field in the IP datagram is now being used toindicate the AH protocol, so it can no longer be used to indicate thetransport-layer protocol.)

• Security Parameter Index (SPI) field, an arbitrary 32-bit value that, incombination with the destination IP address and the securityprotocol, uniquely identifies the SA for the datagram.

• Sequence Number field, a 32-bit field containing a sequence numberfor each datagram. It is initially set to 0 at the establishment of anSA. The AH protocol uses the sequence numbers to preventplayback and man-in-the-middle attacks (see Section 7.3).

• Authentication Data field, a variable-length field containing a signedmessage digest (that is, a digital signature) for this datagram. Themessage digest is calculated over the original IP datagram, therebyproviding source host authentication and IP datagram integrity. Thedigital signature is computed using the authentication algorithm

Page 54: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

specified by the SA, such as DES, MD5, or SHA.

When the destination host receives an IP datagram with an AH header, itdetermines the SA for the datagram and then authenticates the datagram’sintegrity by processing the authentication data field. The IPsecauthentication scheme (for both the AH and ESP protocols) uses a schemecalled HMAC, which is an encrypted message digest described in RFC2104. HMAC uses a shared secret key between two parties rather thanpublic key methods for message authentication. Further details about theAH protocol can be found in RFC 2402.

7.8.2: The ESP ProtocolThe ESP protocol provides network-layer secrecy as well as source hostauthentication. Once again, it all begins with a source host establishing anSA with a destination host. Then the source host can send secureddatagrams to the destination host. As shown in Figure 7.31, a secureddatagram is created by surrounding the original IP datagram data withheader and trailer fields, and then inserting this encapsulated data into thedata field of an IP datagram. For the protocol field in the header of the IPdatagram, the value 50 is used to indicate that the datagram includes anESP header and trailer. When the destination host receives the IPdatagram, it takes note of the 50 in the protocol field, and processes thedatagram using the ESP protocol. As shown in Figure 7.31, the original IPdatagram data along with the ESP Trailer field are encrypted. Secrecy isprovided with DES-CBC encryption [RFC 2405]. The ESP header consistsof a 32-bit field for the SPI and 32-bit field for the sequence number, whichhave exactly the same role as in the AH protocol. The trailer includes theNext Header field, which also has exactly the same role as in AH. Note thatbecause the Next Header field is encrypted along with the original data, anintruder will not be able to determine the transport protocol that is beingused. Following the trailer there is the Authentication Data field, which alsoserves the same role as in the AH protocol. Further details about the ESPprotocol can be found in RFC 2406.

Figure 7.31: The ESP fields in the IP diagram

7.8.3: SA and Key ManagementFor successful deployment of IPsec, a scalable and automated SA and keymanagement scheme is necessary. Several protocols have been definedfor these tasks, including:

• The Internet Key Exchange (IKE) algorithm [RFC 2409] is the default

Page 55: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

key management protocol for IPsec.

• The Internet Security Association and Key Management Protocol(ISKMP) defines procedures for establishing and tearing down SAs[RFC 2407; RFC 2408]. ISKMP’s security association is completelyseparate from IKE key exchange.

This wraps up our summary of IPsec. We have discussed IPsec in thecontext of IPv4 and the "transport mode." IPsec also defines a "tunnelmode," in which routers introduce the security functionality rather than thehosts. Finally, IPsec describes encryption procedures for IPv6 as well asIPv4.

Online Book

7.9: SummaryIn this chapter, we’ve examined the various mechanisms that our secretlovers, Bob and Alice, can use to communicate "securely." We’ve seen thatBob and Alice are interested in secrecy (so that they alone are able tounderstand the contents of a transmitted message), authentication (so thatthey are sure that they are talking with each other), and message integrity(so that they are sure that their messages are not altered in transit). Ofcourse, the need for secure communication is not confined to secret lovers.Indeed, we saw in Section 7.1 that security is needed at various layers in anetwork architecture to protect against "bad guys" who may sniff packets,remove packets from the network, or inject their packets into the network.

The first part of this chapter presented various principles underlying securecommunication. In Section 7.2 we covered cryptographic techniques forcoding and decoding data, including both symmetric key cryptography andpublic key cryptography. DES and RSA were examined as specific casestudies of these two major classes of cryptographic techniques in use intoday’s networks. In Section 7.3 we turned our attention to authenticationand developed a series of increasingly sophisticated authenticationprotocols to ensure that a conversant is indeed who he/she claims to be,and is "live." We saw that both symmetric key cryptography and public keycryptography can play an important role not only in disguising data(encryption/decryption), but also in performing authentication. Techniquesfor "signing" a digital document in a manner that is verifiable, nonforgeable,and nonrepudiable were covered in Section 7.4. Once again, theapplication of cryptographic techniques proved essential. We examinedboth digital signatures and message digests, the latter being a shorthand

Page 56: Chapter 7: Security in Computer Networks · Chapter 7: Security in Computer Networks The first part of this chapter presents various principles underlying ... transactions are the

way of signing a digital document. In Section 7.5 we examined keydistribution protocols. We saw that for symmetric key encryption, a keydistribution center--a single trusted network entity--can be used to distributea shared symmetric key among communicating parties. For public keyencryption, a certification authority distributes certificates to validate publickeys.

Armed with the techniques covered in Sections 7.2 through 7.5, Bob andAlice can communicate securely (one can only hope that they arenetworking students who have learned this material and can thus avoidhaving their tryst uncovered by Trudy!). In the second part of this chapterwe thus turned our attention to the use of various security techniques innetworks. In Section 7.6, we used e-mail as a case study for application-layer security, designing an e-mail system that provided secrecy, senderauthentication, and message integrity. We also examined the use of PGPas a public-key e-mail encryption scheme. Our case studies continued aswe headed down the protocol stack and examined the secure sockets layer(SSL) and secure electronic transactions, the two primary protocols in usetoday for secure electronic commerce. Both are based on public keytechniques. Finally, in Section 7.8 we examined a suite of security protocolsfor the IP layer of the Internet--the so-called IPsec protocols. These can beused to provide secrecy, authentication, and message integrity betweentwo communicating IP devices.

© 2000-2001 by Addison Wesley LongmanA division of Pearson Education

© 2000-2001 by Addison Wesley LongmanA division of Pearson Education