© Marius Iulian Mihailescu and Stefania Loredana Nita 2021
M. I. Mihailescu, S. L. NitaPro Cryptography and Cryptanalysis https://doi.org/10.1007/978-1-4842-6367-9_24

24. Implementation and Practical Approach of Cryptanalysis Methods

Marius Iulian Mihailescu1   and Stefania Loredana Nita1
(1)
Bucharest, Romania
 

In this chapter, we want to propose a methodology for cryptanalysis methods in general and how to apply it in a quick and efficient way. This method is for classic and actual (modern) cryptography/cryptanalysis algorithms and methods. Quantum cryptography is not included at this moment.

The proposed methodology (see Figure 24-1) is designed with the goal of letting the cryptanalyst know where they are situated and placed within their work and what tool or method they can use accordingly.
../images/493660_1_En_24_Chapter/493660_1_En_24_Fig1_HTML.jpg
Figure 24-1

Cryptanalysis methodology

Implementing cryptanalysis methods is a very tricky task to achieve if you don’t have the proper information about the cryptographic method. This being said, the cryptanalysis process consists of two general steps. Step 1 consists of identifying what kind of cryptanalysis should be performed, and Step 2 what we know about cryptography algorithms. Based on these two steps, we can move on to Step 3 for building a proper attack model and Step 4 for choosing the proper tools.

Step 1. What kind of cryptanalysis should be performed? This is where the cryptanalyst decides, together with their business environment, what role they will play: a legal and authorized cryptanalyst (ethical hacker) or a malicious one (cracker). Once they decide their role, they move to Step 2.

Step 2. If they are a legitimate cryptanalyst, there are two things they should know before getting started: the cryptography algorithm and the cryptographic key . According to some cryptanalysts, this is not a necessary requirement but in some cases it will be very useful to know. Once these two things are known, they can easily perform cryptanalysis methods and test the security of the business.

Step 3. Attack models or attack types will set a quantitative variable for how much information a cryptanalysis will have access to when they perform the cracking methods on the encrypted message. The most common attack models used are
  • Ciphertext-only attack

  • Known-plaintext attack

  • Chosen-plaintext attack

  • Chosen-ciphertext attack
    • Adaptive chosen-ciphertext attack

    • Indifferent chosen-ciphertext attack

Step 4. Once the attack model is chosen or another one has been created and adapted according to the situation and requirements, the next step is to choose the software tools. There are two ways, choosing from the ones that already exists or creating your own tools (this is time consuming but is good practice). The following are some examples of tools we can use in the cryptanalysis process, depending on what we are trying to “test:”
  • Penetration tools: Kali Linux, Parrot Security, BackBox

  • Forensics: DEFT, CAINE, BlackArch, Matriux

  • Databases: sqlmap (standalone version), Metasploit framework (standalone version), VulDB

  • Web and network: Wireshark, Nmap, Nessus, Burp Suite, Nikto, OpenVas

  • Other tools: CryptTool (very useful and amazing tool)

The tools mentioned above represent only a selection of those that are very powerful and can produce the desired result.

Ciphertext-Only Attack (COA)

COA is one of the weakest attacks due to the fact that it can be easily used by the cryptanalyst because he just encoded the message.

The attacker (cryptanalyst) will have access to a set of ciphertexts. The attack is deemed successful if the corresponding plaintexts are deduced together with the key.

In this type of attack (see Figure 24-2), the attacker/cryptanalyst is able to observe the ciphertext. All they see is a set of scrambled and nonsense characters which is represented as the output of the encryption process.
../images/493660_1_En_24_Chapter/493660_1_En_24_Fig2_HTML.jpg
Figure 24-2

COA representation

Known-Plaintext Attack (KPA)

This attack (see Figure 24-3) give the cryptanalyst the ability to generate the ciphertext due to the fact that he knows the ciphertext.
../images/493660_1_En_24_Chapter/493660_1_En_24_Fig3_HTML.jpg
Figure 24-3

KPA representation

The cryptanalyst will select the plaintext, but they will notice the pair formed from plaintext and ciphertext. The chance of success is better compared to COA. Simple ciphers are quite vulnerable to this attack.

Chosen-Plaintext Attack (CPA)

The cryptanalyst selects the plaintext that has been send using an encryption algorithm and he observes how the ciphertext is generated. This can be seen as an active model in which the cryptanalyst has the chance to select the plaintext and to realize the encryption.

Having the possibility to choose any plaintext, the cryptanalyst can also observe details about the ciphertext, which gives him a strong advantage to understand how the algorithm works inside and the chance to get possession of the secret key.

A professional cryptanalyst will have a database that is populated with known plaintexts, ciphertexts, and possible keys (see Listing 24-1 and Figure 24-5 for an example of generating possible keys automatically; it is a very simple example for illustrating the main point), and to use them with the pairs for determining the cipher text input (see Figure 24-4).
../images/493660_1_En_24_Chapter/493660_1_En_24_Fig4_HTML.jpg
Figure 24-4

CPA representation

using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace GeneratingKeysDatabase
{
    class Program
    {
        public static string size = Console.ReadLine();
        public static int values_based_on_length =
            Convert.ToInt32(size);
        public char first_character = 'a';
        public char last_character = 'z';
        public int string_length = values_based_on_length;
        static void Main(string[] args)
        {
            var writting_password = new Program();
            writting_password.WrittingPasswordsAndKeys(" ");
            Console.ReadLine();
        }
        //** automatically generates the
        //** passwords and create a file
        private void WrittingPasswordsAndKeys(string
                                              cryptographic_passwords)
        {
            //** location and file name that
            //** contains the passwords
            string file = "passwords_database.txt";
            //** add on each row a new password
            File.AppendAllText(file, Environment.NewLine +
                                              cryptographic_passwords);
            //** display it on the console
            Console.WriteLine(cryptographic_passwords);
            //** don't do anything if the length of the
            //** passwords is equal with the length of
            //** the string and continue with generating
            //** the passwords and keys
            if (cryptographic_passwords.Length ==
                                                 string_length)
            {
                return;
            }
            for (char c = first_character; c <=
                                                last_character; c++)
            {
                  WrittingPasswordsAndKeys(
                                           cryptographic_passwords + c);
            }
        }
    }
}
Listing 24-1

Automatic Generation of Random Keys

../images/493660_1_En_24_Chapter/493660_1_En_24_Fig5_HTML.jpg
Figure 24-5

The keys and possible passwords generated. We choose three characters for short time process purpose only

Chosen-Ciphertext Attack (CCA)

The cryptanalyst has the chance to encrypt and decrypt the information. In this attack (see Figure 24-6), they have the ability to select the plaintext, provide encryption for it, observe how the ciphertext is generated, and reverse the entire process. In this attack, the cryptanalyst will also try to find the algorithm and the secret key used for the encryption.
../images/493660_1_En_24_Chapter/493660_1_En_24_Fig6_HTML.jpg
Figure 24-6

CCA representation

Conclusion

In this chapter, we discussed how to implement cryptanalysis methods and how to define such process for a cryptanalyst. At the end of this chapter, you will be able to
  • Have a good understanding of the attack models

  • Follow a simple and straightforward methodology for knowing where you are within the cryptanalysis process

  • Simulate and generate a database with keys and possible passwords

Bibliography

  1. [1]

    Abu Yusuf Yaqub ibn Ishaq al-Sabbah Al-Kindi www.trincoll.edu/depts/phil/philo/phils/muslim/kindi.html.

     
  2. [2]

    Philosophers: Yaqub Ibn Ishaq al-Kindi Kennedy-Day, K. al-Kindi, Abu Yusuf Ya‘qub ibn Ishaq (d. c.866–73). www.muslimphilosophy.com/ip/kin.html.

     
  3. [3]

    Ahmad Fouad Al-Ehwany, “Al-Kindi” in A History of Muslim Philosophy Volume 1. New Delhi: Low Price Publications. pp. 421-434. 1961.

     
  4. [4]

    Ismail R. Al-Faruqi and Lois Lamya al-Faruqi, Cultural Atlas of Islam, New York: Macmillan Publishing Company. pp. 305-306. 1986 Encyclopaedia Britannica, Inc. (1969). Encyclopaedia Britannica. Chicago: William Benton.

     
  5. [5]

    J.J. O’Connor and E.F Robertson, E.F. Abu Yusuf Yaqub ibn Ishaq al-Sabbah Al-Kindi. 1999.

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

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