Presentation is loading. Please wait.

Presentation is loading. Please wait.

Cryptography – Hackers and Viruses

Similar presentations


Presentation on theme: "Cryptography – Hackers and Viruses"— Presentation transcript:

1 Cryptography – Hackers and Viruses

2 Outline Cryptography Hackers and Viruses 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

3 Introduction 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.

4 Introduction 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.

5 Public Key Systems 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.

6 RSA algorithm RSA algorithm[ Rivest , Shamir and Adleman] in 1978.
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

7 RSA algorithm Assume that Alice wants to send a message to Bob. Then
Bob chooses a key, private, known only to him. Bob exploits a function f to compute his public key, public = f(private). Bob publishes public Alice exploits Bob’s public key to compute ciphertext= encrypt(plaintext, public) and she sends ciphertext to Bob. 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.

8 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.

9 RSA algorithm Alice uses the RSA algorithm to send a message to Bob as follows. Bob constructs his public and private keys. Bob chooses two large prime numbers p and q. From them, he computes n=p.q 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) 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. Bob publishes (n,e) as his public key

10 RSA algorithm 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 = plaintexte(mod n). Then she sends ciphertext to Bob. Bob recreates Alice’s original message by computing plaintext = ciphertextd(mod n).

11 RSA algorithm

12 RSA algorithm example We can illustrate the RSA algorithm with a simple message from Alice to Bob. Bob is expecting to receive messages. So he constructs his keys as follows: He chooses two prime numbers, p=19 and q=31. He computes n=p*q=589 He finds an e that has no common divisors with 18*30=540. The e he selects is 49 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 1069. Bob publishes (589,49) as his public key

13 RSA algorithm example Alice wishes to send the simple message “A”. The ASCII code for A is 65. So Alice computes 6549(mod589). She does without actually computing Instead, she exploits the following two facts: ni+j=ni*nj (n*m)(mod k) =(n(mod k)*m(mod k))(mod k) Combining these, we have: ni+j(mod k) = (ni(mod k)*nj(mod k))(mod k)

14 RSA algorithm example So, to compute 6549,first observe that 49 can be
expressed in binary as So 49 = Thus 6549 = The following table lists the required powers 65: 651(mod589)=65 652(mod589)=4225(mod589)= (mod589)=1022(mod589)=10404(mod589)= (mod589)=3912(mod589)=152881(mod589)=330 6516(mod589)=3302(mod589)=108900(mod589)=524 6532(mod589)=5242(mod589)=274576(mod589)=102

15 RSA algorithm example So we have:6549(mod589) = 651+16+32(mod589).
=((651(mod589))*(6516(mod589))*(6532(mod589)))(mod58 9) =(65*524*102)(mod589) =((34060(mod589))*102)(mod589) =(487*102)(mod589) =198 Alice sends Bob the message 198. 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.

16 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.

17 RSA is Effective 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.

18 Hackers and Viruses 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.

19 Virus Detection 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 <V>. 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.

20 Virus 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.

21 Virus Detection 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.

22 Exploiting the difference between the Worst case and the Average 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.

23 Exploiting the difference between the Worst case and the Average 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).

24 Exploiting the difference between the Worst case and the Average case

25 Hackers 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

26 References Automata, Computability, and Complexity| Theory and Applications [book] by Elaine Rich. ok/appcsecurity_link.html?http://www.cs.rice.edu/ ~scrosby/hash


Download ppt "Cryptography – Hackers and Viruses"

Similar presentations


Ads by Google