Types of cyber attacks (cryptanalysis)

Raffaello Ippolito
5 min readSep 30, 2023

In the past few articles, we have stepped into the world of cryptography, which is concerned with making our communications secure. The need arises to protect us from malicious attackers who might intercept communications and access our data.

To better protect ourselves, it is also useful to understand how these malicious actors, known in technical terms as cryptanalysts, act, so that we can prepare accordingly.

Before we begin to distinguish the various types of attacks, it is important to define the notations we are going to use.
By Enc and Dec we refer to the encryption and decryption algorithms, respectively. We indicate by the letter k the keys and by Enck and Deck the encryption and decryption algorithms using the k key. We also use the letters C and P to denote the ciphertext and plaintext, respectively; in the case of multiple texts we will refer to them as C1, C2, etc. or again Ci to denote a generic one. Similarly with P.

The first class of attacks we will look at (the most common) are eavesdropping.

  • Ciphertext-only attack (COA).
    This is the simplest scenario where the intruder has a number of ciphertexts and tries to get information about the plaintext.
    More specifically:
    Given ciphertexts C1 = Enck(P1), — — — , Ci = Enck(Pi) the cryptanalyst tries to find P1, — — — , Pi, find k or an
    algorithm to deduce Pi+1.
  • Known-plaintext attack (KPA).
    In this scenario, the cryptanalyst has several pairs (P, C = Enck(P)) of plaintexts and ciphertexts and tries to obtain the key k or an algorithm to decrypt future encrypted messages.
    More precisely:
    Given the pairs (P1, C1 = Enck(P1)) — — — (Pi, Ci = Enck(Pi)) and Ci+1 the cryptanalyst tries to find k or an algorithm to deduce Pi+1.
    Known plaintexts are so-called cribs (some help), e.g., a “file header.”
  • Chosen-plaintext attack (CPA).
    In this scenario the cryptanalyst has chosen or can choose several plaintexts P1, — — — , Pi and obtain the respective ciphertexts C1, — — — , Ci. So the cryptanalyst can interleave a number of times with the Enck algorithm without knowing k by encrypting a number of texts
    in plaintext. The cryptanalyst’s goal is to find k or an algorithm to infer Pl+1 by knowing Cl+1.
  • Chosen-ciphertext attack (CCA).
    In this scenario, the cryptanalyst’s goal is to obtain key k by being able to use the Deck algorithm a certain number of times.
    More precisely:
    Given pairs P1 = Deck(C1), C1) — — — — (Pi = Deck(Ci), Ci) where the cryptograms C1, — — — , Ci are chosen by the cryptanalyst, it must find the key k.

In addition to eavesdropping, there are active attacks in which the cryptanalyst sends messages to one or both of the parties involved. We then distinguish the cases of:

  • Impersonation
    In this scenario the cryptanalyst impersonates one of the parties, i.e., communicates with one of the two parties while pretending to be the other.
  • Man-In-The-Middle
    In this scenario the cryptanalyst stands between the two parties, i.e., intercepts the messages and then sends them back to the recipient, possibly modified.

Defining security

According to Kerckhoffs principle, “the security of a cipher should be based on the secrecy of the key and not on the mode or mechanism of the cipher.”

This important principle can be inferred by observing that, keys can be generated all the time but methods cannot. Knowing the method used, one can try to use all possible keys. The problem of decrypting encrypted messages is therefore equivalent to the problem of being able to find the key, so security lies in trying to make key retrieval infeasible.

The problem of finding the key to a cipher in fact is NOT impossible, but is highly complex to solve from a numerical point of view, so complex that even using large computational powers it will take thousands of years to succeed in deciphering the message.

The field of cryptography is therefore a very unusual one.
These concepts are well expressed in Shannon’s theory:
The problem of designing a good cipher consists essentially of identifying difficult problems subject to certain conditions. This is a rather unusual situation, since we usually look for the simple, easily solvable problems in a field.

How can we be sure that a system that is not ideal and therefore has a unique solution for sufficiently large N will require a large amount of work to solve by any method of analysis? There are two approaches to this problem:

  1. We can study the possible solution methods available to the cryptanalyst and try to describe them in general enough terms to cover all the methods he might use. Then we build our system to resist this general method of solution.
  2. We can construct our cipher so that its cracking is equivalent to (or requires at some point in the process) the solution of a problem known as laborious. Examples of problems known to be laborious and that are indeed often used in cryptography may be decomposition into prime factors or even solving the discrete logarithm.

It is difficult to define the relevant ideas precisely enough to obtain results in the form of some mathematical theorems, but the conclusions, in the form of general principles, are believed to be correct.
These considerations lead us to define the concept of Perfect Secrecy, a cipher is Perfect Secrecy if and only if C and P are independent random variables. That is, they are two totally independent random variables, where the value taken by one does not influence the value taken by the other.

Entropy

The entropy H(k) of keys is a measure of the expected bits used to represent the keys. The bits used to represent each key are related to their probabilities and averaged.
Entropy can also be thought of as a measure of uncertainty or information. For example, if H(k) << 0 then surely one key is heavily used compared to the others.

It is important that the key remain private, and so it is good practice to generate keys with high entropy methods.

Conclusions

The field of cybersecurity is a vitally important one today, not surprisingly, significant investments are made every year and experts are among the most highly paid and desired professionals in the IT industry.

As we have seen decrypting an encrypted message is a laborious but not impossible problem so it is of utmost importance to continue to do research to find ever better ways to protect our data both now and in the future when the world will have new technologies at its disposal. It has been estimated, for example, that with the computing power of a hypothetical quantum computer one might be able to break systems now considered as secure in a matter of minutes.

Beyond professional or research considerations, exactly because we are talking about a topic constantly in the spotlight it is interesting and challenging to try to understand what we are talking about and get a concrete idea of what we are dealing with.

--

--

Raffaello Ippolito

Italian software developer and data analytics student. Graduated in Mathematics for Engineering talking about Big Data and Image Processing