Presentation on theme: "C RYPTOGRAPHY – H ACKERS AND V IRUSES. O UTLINE Cryptography Public key systems RSA algorithm Why RSA algorithm is effective RSA algorithm example."— Presentation transcript:
C RYPTOGRAPHY – H ACKERS AND V IRUSES
O UTLINE Cryptography Public key systems RSA algorithm Why RSA algorithm is effective RSA algorithm example Hackers and Viruses Virus detection Exploiting the difference between the worst case and the average case
I NTRODUCTION Cryptography is the science of writing in secret code and is an ancient art. Modern techniques for encoding sensitive financial information have enabled the explosion of electronic commerce. Before computers, any useful cryptographic scheme was necessarily computationally trivial. It had to be because both senders and receivers implemented their algorithms by hand. With the advent of computers, things changed.
I NTRODUCTION In all the simplest cryptographic systems, the algorithms that will be used for both encryption and decryption are fixed and known to everyone. But those algorithms take two inputs, the text to be encoded or decoded and a key. In a symmetric key system, sender and receiver use the same key. No message can be sent unless there has been some prior agreement on a key. Even if there has been such an agreement, if the same key is used over an extended period of time, an eavesdropper may be able to infer the key and break the code.
P UBLIC K EY S YSTEMS In order to change keys, there must be some way to transmit new keys between senders and receivers. Public key systems was first introduced in 1970s. The most widely used public key system is the RSA algorithm.
RSA ALGORITHM RSA algorithm[ Rivest, Shamir and Adleman] in We assume that Bob and Alice wish to exchange secure messages and that Eve is attempting to eavesdrop. We’ll call the original(unencrypted text) as plaintext and the encrypted text as ciphertext. The most general way to describe RSA is as follows
RSA ALGORITHM Assume that Alice wants to send a message to Bob. Then 1. Bob chooses a key, private, known only to him. Bob exploits a function f to compute his public key, public = f(private). 2. Bob publishes public 3. Alice exploits Bob’s public key to compute ciphertext= encrypt(plaintext, public) and she sends ciphertext to Bob. 4. Bob exploits his private key to compute plaintext= decrypt(ciphertext, private). In order for this last step to work, encrypt and decrypt must be designed so that one is the inverse of the other.
RSA ALGORITHM If there exist efficient algorithm for performing all four of the steps, then Bob and Alice will be able to exchange messages. We assume that Eve knows the algorithm encrypt and decrypt. So she could easily eavesdrop if she could infer Bob’s private key from his public one or if she could compute decrypt without knowing Bob’s private key.
RSA ALGORITHM Alice uses the RSA algorithm to send a message to Bob as follows. 1. Bob constructs his public and private keys. 1. Bob chooses two large prime numbers p and q. From them, he computes n=p.q 2. Bob, finds a value e such that 1 < e < p.q and gcd(e.(p-1)(q-1))=1. (in other words, he finds an e such that e and (p-1).(q-1) are relatively prime) 3. Bob computes a value d such that d.e(mod(p-1).(q- 1))= 1. In RSA terminology, this value d, rather than the original numbers p and q, is referred to as Bob’s private key. 2. Bob publishes (n,e) as his public key
RSA ALGORITHM 3. Alice breaks her message plaintext into segments such that no segment corresponds to a binary number that is larger than n. Then, for each plaintext segment, Alice computes ciphertext = plaintext e (mod n). Then she sends ciphertext to Bob. 4. Bob recreates Alice’s original message by computing plaintext = ciphertext d (mod n).
RSA ALGORITHM EXAMPLE We can illustrate the RSA algorithm with a simple message from Alice to Bob. 1. Bob is expecting to receive messages. So he constructs his keys as follows: 1. He chooses two prime numbers, p=19 and q=31. He computes n=p*q= He finds an e that has no common divisors with 18*30=540. The e he selects is He finds a value d =1069. Notice that 1069*49 = Bob needs to assure that the remainder, when is divided by 540, is 1. And it is :52381=540*97+1. Bob’s private key is now Bob publishes (589,49) as his public key
RSA ALGORITHM EXAMPLE 3. Alice wishes to send the simple message “A”. The ASCII code for A is 65. So Alice computes (mod589). She does without actually computing Instead, she exploits the following two facts: n i+j =n i *n j (n*m)(mod k) =(n(mod k)*m(mod k))(mod k) Combining these, we have: n i+j (mod k) = (n i (mod k)*n j (mod k))(mod k)
RSA ALGORITHM EXAMPLE So, to compute 65 49,first observe that 49 can be expressed in binary as So 49 = Thus = The following table lists the required powers 65: 65 1 (mod589)= (mod589)=4225(mod589)= (mod589)=102 2 (mod589)=10404(mod589)= (mod589)=391 2 (mod589)=152881(mod589)= (mod589)=330 2 (mod589)=108900(mod589)= (mod589)=524 2 (mod589)=274576(mod589)=102
RSA ALGORITHM EXAMPLE So we have:65 49 (mod589) = (mod589). =(65 1 *65 16 *65 32 )(mod589) =((65 1 (mod589))*(65 16 (mod589))*(65 32 (mod589)))(mod58 9) =(65*524*102)(mod589) =((34060(mod589))*102)(mod589) =(487*102)(mod589) =198 Alice sends Bob the message Bob uses his private key(1069) to recreate Alice’s message by computing (mod589). Using the same process Alice used, he does this efficiently and retrieves the message 65.
RSA IS EFFECTIVE The function encrypt and decrypt are inverse of each other and it is proved using euler’s generalization of Fermat’s Little theorem. Bob can choose primes efficiently using the following algorithm. Randomly choose two large numbers as candidates Check the candidates to see if they are prime. This can be done efficiently using a randomized algorithm. Repeat steps 1 and 2 until two primes have been chosen. So, for example suppose Bob wants to choose a 1000 bit number. The probability of a randomly chosen number near being prime is about 1/693.
RSA IS E FFECTIVE Bob can check gcd efficiently using euler’s theorem, so he can compute e. Bob can compute d efficiently, using an extension of euclid’s algorithm that exploits the quotients that it produces at each step. Alice can implement encrypt efficiently. It is not necessary to compute plaintext and then take its remainder mod n. Similarly Bob can implement decrypt efficiently. Eve can’t recreate plaintext because She can’t simply invert encrypt and she can’t try every candidate plaintext and see is she gets one that produces ciphertext.
H ACKERS AND V IRUSES In this, we discuss the other network security issues ie., virus detection. We’ll see that the undecidability proves that the definite virus detector cannot exist. The second involves the difference between the average case and the worst case time complexity of some important algorithms. This difference may allow hackers to launch denial of service attacks and to observe “secret” behavior of remote hosts.
V IRUS D ETECTION Given a known computer virus V, consider the problem of detecting an infection by V. The most straightforward approach to solving this problem is just to scan incoming messages by. But virus can easily evade this technique by altering their text in ways that have no effect on computation that V performs. For example, source code could be modified to add blanks in meaningless places or to add leading 0’s to numbers.
V IRUS DETECTION Executable code could be modified by adding jump instructions to the next instruction. So the practical virus detection problem can be stated as “Given a known virus V and an input message M”, does M contain the text of a program that computes the same thing V computes? We know the equivalence question is undecidable for turing machines, using that the equivalence question for arbitrary programs is also undecidable.
V IRUS D ETECTION So, we can’t solve the virus problem by making a list of known viruses and comparing new code to them. Suppose that, instead of making a list of forbidden operations, we allowed users to define a “white list” of the operations that are to be allowed to be run on their machines. Then the job of a virus filter is to compare incoming code to the operations on the white list. Any code that is equivalent to some allowed operation can be declared safe. But now we have EXACTLY THE SAME PROBLEM. No test for equivalence exists.
E XPLOITING THE DIFFERENCE BETWEEN THE W ORST CASE AND THE A VERAGE CASE Some widely used algorithms have the property that their worst case time complexity is significantly different than their average case time complexity. For example: Looking up an entry in a hash table may take, on average, constant time. But if all the entries collide and hash to the same table location, the time required becomes O(n) where n is the number of entries in the table.
E XPLOITING THE DIFFERENCE BETWEEN THE W ORST CASE AND THE A VERAGE CASE Looking up an entry in a binary search tree may take, on average O(logn) time. But the tree may become unbalanced. In the worst case, it becomes a list and lookup time again becomes O(n).
E XPLOITING THE DIFFERENCE BETWEEN THE W ORST CASE AND THE A VERAGE CASE
H ACKERS Hackers can exploit these facts One way to launch a denial of service attack against a target site S is tend to S a series of messages/requests that has been crafted so that S will exhibit its worst case performance. If S was designed so that it could adequately respond to its traffic in the average case, it will no longer be able to do so. One way to get a peek inside a site S and observe properties that were not intended to be observable is to time it. For example, it is sometimes possible to observe the time required by S to perform decryption or password checking and so to infer its private key or a stored password
R EFERENCES Automata, Computability, and Complexity| Theory and Applications [book] by Elaine Rich. ok/appcsecurity_link.html?http://www.cs.rice.edu/ ~scrosby/hash