Password Cracking with Brute Force Algorithm and Dictionary Attack Using Parallel Programming
Abstract
:1. Introduction
2. Literature Review
3. Proposed Techniques
3.1. Applying Brute Force Using “ProcessPoolExecutor” in Python #1
3.2. Applying Dictionary Attack Using “Multiprocessing” Module in Python #2
3.3. Applying Dictionary Attack Using OpenMP in C++ Technique #3
- 1.
- Sequential code. Figure 5 illustrates the sequential code.
- 2.
- Parallel code with 4 cores using static scheduling. Figure 6 demonstrates the parallel code with 4 cores using static scheduling.
- 3.
- Parallel code with 8 cores using static scheduling. Figure 7 illustrates the parallel code with 8 cores using static scheduling.
- 4.
- Parallel code with 8 cores using dynamic scheduling in one chunk. Figure 8 demonstrates the parallel code with 8 cores using dynamic scheduling in one chunk.
- 5.
- Parallel code with 8 cores using dynamic scheduling in two chunks. Figure 9 illustrates the parallel code with 8 cores using dynamic scheduling in two chunks.
- 6.
- Parallel code with 8 cores using dynamic scheduling in four chunks. Figure 10 demonstrates the parallel code with 8 cores using dynamic scheduling in four chunks.
3.4. Applying Brute Force and Dictionary Attacks Using Hashcat #4
4. Empirical Studies
4.1. Description of the Dataset
4.2. Experimental Setup
4.2.1. Brute Force Setup
- “length”: This is a parameter for the “attempt_match” function that specifies the length of the password combinations being generated and checked.
- “target”: This is a parameter for the attempt_match function that specifies the target password to be cracked. It can either be passed as an argument or obtained by user input.
- “Numb_of_cores”: This is a parameter obtained by user input that specifies the number of CPU cores to be used for the concurrent execution of the password-checking task. It is passed to the ProcessPoolExecutor class as the max_workers argument.
- “start_time”: This is a variable that stores the current time when the password-cracking process starts.
- “end_time”: This is a variable that stores the current time when the password-cracking process ends.
- “total_time”: This is a variable that stores the time elapsed between start_time and end_time and represents the total time taken to complete the password-cracking process.
4.2.2. Dictionary Attack Setup
- “dictionary”: a list of strings representing a dictionary of possible passwords.
- “target”: a string representing the target password to be found.
- “start_index”: an integer representing the starting index of the portion of the dictionary to be checked by a child process.
- “end_index”: an integer representing the ending index of the portion of the dictionary to be checked by a child process.
- “num_processes”: an integer representing the number of child processes to be created and used for parallelizing password checking.
- “chunk_size”: an integer representing the size of each chunk of the dictionary, calculated as the length of the dictionary divided by “num_processes”.
- “processes”: a list to store the created child processes.
- “file”: a file object representing the “dictionary.txt” file.
- “passwd”: a string representing a password from the “dictionary.txt” file, read one at a time in a loop.
- “p”: a process object representing a child process.
- “num_threads(8)”: This sets the number of threads to be used in the parallel for-loop. The value of 8 means that 8 threads will be created to execute the loop in parallel.
- “schedule(type, chunk)”: This sets the scheduling method for distributing iterations among the threads with the number of chunks.
- “target”: This is the target password that the program is trying to find in the “dictionary.txt” file. The user is prompted to enter the target password.
- “dictionary”: This is a vector that stores the list of potential passwords read from the “dictionary.txt” file.
- “pass”: This is a string variable that is used to temporarily store each password read from the “dictionary.txt” file.
- “i”: This is the loop variable for the for-loop that iterates through the “dictionary” vector.
- “omp_get_thread_num()”: This is a function from the OpenMP library that returns the number of threads executing the code.
5. Results and Discussion
6. Comparison and Analysis
7. Conclusions
Author Contributions
Funding
Institutional Review Board Statement
Informed Consent Statement
Data Availability Statement
Acknowledgments
Conflicts of Interest
References
- Grover, V.; Gagandeep. An Efficient Brute Force Attack Handling Techniques for Server Virtualization. SSRN Electron. J. 2020. [Google Scholar] [CrossRef]
- Liu, P.; Li, S.; Ding, Q. An Energy-Efficient Accelerator Based on Hybrid CPU-FPGA Devices for Password Recovery. IEEE Trans. Comput. 2018, 68, 170–181. [Google Scholar] [CrossRef]
- Tirado, E.; Turpin, B.; Beltz, C.; Roshon, P.; Judge, R.; Gagneja, K. A New Distributed Brute-Force Password Cracking Technique. In Proceedings of the Future Network Systems and Security: 4th International Conference, FNSS 2018, Paris, France, 9–11 July 2018; Springer: Cham, Switzerland, 2018; pp. 117–127. [Google Scholar]
- Hranický, R. Digital Forensics: The Acceleration of Password Cracking. Ph.D. Thesis, Brno University of Technology, Brno, Czechia, 2022. [Google Scholar]
- Swathi, K. Brute Force Attack on Real World Passwords. Int. J. Res. Public Rev. 2022, 3, 552–558. [Google Scholar]
- Ge, C.; Xu, L.; Qiu, W.; Huang, Z.; Guo, J.; Liu, G.; Gong, Z. Optimized Password Recovery for SHA-512 on GPUs. In Proceedings of the 2017 IEEE International Conference on Computational Science and Engineering (CSE) and IEEE International Conference on Embedded and Ubiquitous Computing (EUC), Guangzhou, China, 21–24 July 2017; IEEE: Piscataway, NJ, USA, 2017; Volume 2, pp. 226–229. [Google Scholar]
- Laatansa; Saputra, R.; Noranita, B. Analysis of GPGPU-Based Brute-Force and Dictionary Attack on SHA-1 Password Hash. In Proceedings of the 2019 3rd International Conference on Informatics and Computational Sciences (ICICoS), Semarang, Indonesia, 29–30 October 2019; IEEE: Piscataway, NJ, USA, 2019; pp. 1–4. [Google Scholar]
- Zhang, Z.; Liu, P. A Hybrid-CPU-FPGA-Based Solution to the Recovery of Sha256crypt-Hashed Passwords. IACR Trans. Cryptogr. Hardw. Embed. Syst. 2020, 2020, 1–23. [Google Scholar] [CrossRef]
- Hranický, R.; Matoušek, P.; Ryšavý, O.; Veselý, V. Experimental Evaluation of Password Recovery in Encrypted Documents. In Proceedings of the ICISSP, Rome, Italy, 19–21 February 2016; SciTePress-Science and Technology Publications: Setúbal, Portugal, 2016; Volume 2016, pp. 299–306. [Google Scholar]
- Nakhila, O.; Attiah, A.; Jinz, Y.; Zou, C. Parallel Active Dictionary Attack on WPA2-PSK Wi-Fi Networks. In Proceedings of the Proceedings—IEEE Military Communications Conference MILCOM, Tampa, FL, USA, 26–28 October 2015; IEEE: Piscataway, NJ, USA, 2015; Volume 2015-Decem, pp. 665–670. [Google Scholar]
- Hendarto, I.L.S.; Kurniawan, Y. Performance Factors of a CUDA GPU Parallel Program: A Case Study on a PDF Password Cracking Brute-Force Algorithm. In Proceedings of the 2017 International Conference on Computer, Control, Informatics and its Applications (IC3INA), Jakarta, Indonesia, 23–26 October 2017; IEEE: Piscataway, NJ, USA, 2017; pp. 35–40. [Google Scholar]
- Mount, S.; Newman, R. Energy-Efficient Brute Force Password Cracking. In Proceedings of the 2015 European Intelligence and Security Informatics Conference, Manchester, UK, 7–9 September 2015; IEEE: Piscataway, NJ, USA, 2015; p. 189. [Google Scholar]
- Wang, F.; Yang, C.; Wu, Q.; Shi, Z. Constant Memory Optimizations in MD5 Crypt Cracking Algorithm on GPU-Accelerated Supercomputer Using CUDA. In Proceedings of the 2012 7th International Conference on Computer Science & Education (ICCSE), Melbourne, Australia, 14–17 July 2012; IEEE: Piscataway, NJ, USA, 2012; pp. 638–642. [Google Scholar]
- Abdelrahman, A.; Khaled, H.; Shaaban, E.; Elkilani, W.S. WPA-WPA2 Psk Cracking Implementation on Parallel Platforms. In Proceedings of the 2018 13th International Conference on Computer Engineering and Systems (ICCES), Cairo, Egypt, 18–19 December 2018; IEEE: Piscataway, NJ, USA, 2018; pp. 448–453. [Google Scholar]
- Qabalin, M.K.; Arida, Z.A.; Saraereh, O.A.; Wu, F.; Khan, I.; Uthansakul, P.; Alsafasfeh, M. An Improved Dictionary Cracking Scheme Based on Multiple GPUs for Wi-Fi Network. Comput. Mater. Contin. 2021, 66, 2957–2972. [Google Scholar] [CrossRef]
- Apostal, D.; Foerster, K.; Chatterjee, A.; Desell, T. Password Recovery Using MPI and CUDA. In Proceedings of the 2012 19th International Conference on High Performance Computing, Pune, India, 18–21 December 2012; IEEE: Piscataway, NJ, USA, 2012; pp. 1–9. [Google Scholar]
- Vu, A.-D.; Han, J.-I.; Nguyen, H.-A.; Kim, Y.-M.; Im, E.-J. A Homogeneous Parallel Brute Force Cracking Algorithm on the GPU. In Proceedings of the ICTC 2011, Seoul, Republic of Korea, 28–30 September 2011; IEEE: Piscataway, NJ, USA, 2011; pp. 561–564. [Google Scholar]
- Gillela, M.; Prenosil, V.; Ginjala, V.R. Parallelization of Brute-Force Attack on MD5 Hash Algorithm on FPGA. In Proceedings of the 2019 32nd International Conference on VLSI Design and 2019 18th International Conference on Embedded Systems (VLSID), Delhi, India, 5–9 January 2019; IEEE: Piscataway, NJ, USA, 2019; pp. 88–93. [Google Scholar]
- Ji, Q.; Yin, H. Speedup and Password Recovery for Encrypted WinRAR3 without Encrypting Filename on GPUs. J. Phys. Conf. Ser. 2020, 1673, 12047. [Google Scholar] [CrossRef]
- Ding, Q.; Zhang, Z.; Li, S.; Liu, P. Energy-Efficient RAR3 Password Recovery with Dual-Granularity Data Path Strategy. In Proceedings of the 2019 IEEE International Symposium on Circuits and Systems (ISCAS), Sapporo, Japan, 26–29 May 2019; IEEE: Piscataway, NJ, USA, 2019; pp. 1–5. [Google Scholar]
- Hu, G.; Ma, J.; Huang, B. Password Recovery for RAR Files Using CUDA. In Proceedings of the 2009 Eighth IEEE International Conference on Dependable, Autonomic and Secure Computing, Chengdu, China, 12–14 December 2009; IEEE: Piscataway, NJ, USA, 2009; pp. 486–490. [Google Scholar]
- Pi, J.; De, P.; Mueller, K. Using Gpus to Crack Android Pattern-Based Passwords. In Proceedings of the 2013 International Conference on Parallel and Distributed Systems, Seoul, Republic of Korea, 15–18 December 2013; IEEE: Piscataway, NJ, USA, 2013; pp. 450–451. [Google Scholar]
- An, X.; Jia, H.; Zhang, Y. Optimized Password Recovery for Encrypted RAR on GPUs. In Proceedings of the 2015 IEEE 17th International Conference on High Performance Computing and Communications, 2015 IEEE 7th International Symposium on Cyberspace Safety and Security, and 2015 IEEE 12th International Conference on Embedded Software and Systems, New York, NY, USA, 24–26 August 2015; IEEE: Piscataway, NJ, USA, 2015; pp. 591–598. [Google Scholar]
- Niu, H.; Wu, B.; Wang, Q.; Zhu, Z. Research on Steel Barrel Flattened Seam Recognition Based on Machine Vision. J. Phys. Conf. Ser. 2020, 1633, 12014. [Google Scholar] [CrossRef]
- Digman, E.S.; Orantoy, R.S.; Velasco, J.A.; Blanco, M.C.; Regala, R.; Cortez, D.M. Enhancement of Hakak’s Split-Based Searching Algorithm through Multiprocessing. Int. J. Innov. Sci. Res. Technol. 2022, 7, 1068–1072. [Google Scholar]
- Norouzi, M.; Wolf, F.; Jannesari, A. Automatic Construct Selection and Variable Classification in OpenMP. In Proceedings of the ACM International Conference on Supercomputing, Phoenix, AZ, USA, 26–28 June 2019; pp. 330–341. [Google Scholar]
- Burns, W.J. Common Password List (Rockyou.Txt). Available online: https://www.kaggle.com/datasets/wjburns/common-password-list-rockyoutxt (accessed on 15 February 2023).
- Alnoon, H.; Al Awadi, S. Executing Parallelized Dictionary Attacks on Cpus and Gpus. Moais. Imago Fr. 2009. Available online: https://moais.imag.fr/membres/jean-louis.roch/perso_html/transfert/2009-06-19-IntensiveProjects-M1-SCCI-Reports/HassanShayma.pdf (accessed on 7 March 2023).
Ref. | Dataset | Number of Samples | Number of Threads/Processors | Techniques | Best Result |
---|---|---|---|---|---|
[11] | 3906 for modulo and 4160 for bitwise. | None. | 32, 64, 128, and 256 threads per block. | Using CUDA with GPU for parallel password cracking and optimized shared memory for 6-byte numeric passwords. | 4.77 speedup. |
[12] | None. | 100 plain texts of length 4. | 16 processors/threads. | Parallel implementation of a brute force algorithm for the Epiphany co-processor. | Speedup of up to 16 times that of the serial version. |
[6] | None. | None. | 2560. | They used several optimization techniques: combination of passwords, repetition of register utilization, faster instructions execution, and meet-in-middle. | 1055 M hash/s. |
[13] | None. | None. | Each node of Tianhe-1A supercomputer has two CPUs, one GPU. The CPU has 6 cores while the GPU has 448 cores operating. | Using both the CPUs and the GPU on one single node. | 326,000 MD5 hashes are searched per second, which is 5.6 times faster than the performance of the CPU-only version. |
[14] | None. | 2. | The computer has an Intel i7-4710HQ processor (2.50 GHz, 4 physical cores, 8 threads). The multi-core version was tested on a different computer (Intel i7-2630 QM, 2 GHz, 4 cores, 8 threads) using Ubuntu 12.04. The GPU used was a GeForce GTX 860 M. | They used the shared memory model. | They archive the best score by using GPU platform on the Windows operating system with 1,000,000 passwords in 384 s. |
[15] | None. | N/A. | The server has two 16-core CPUs, 192 GB memory, and four GeForce GTX 1080 graphics chips, each with 8 GB video memory. | Hybrid parallel processing using Multi-CPU-GPU for calculations. | The performance of a single-core GPU is about 80 times higher than that of a single-core CPU. |
[16] | 1 M. | N/A. | 8 GPUs. | Parallel brute force using the GPU with MPI and CUDA. | 17× speedup. |
[17] | None. | 5. | The Tesla C1060 has 240 cores with 1.3 GHz clock speed; the Tesla C2050 has 480 cores and runs at 1.15 GHz. | Parallel brute force using the GPU. | They could crack a 6-character password in less than a second. |
[20] | None. | None. | NVIDIA GTX 1060 GPU. | Dual-granularity data path adjustment strategy. | It achieved an improvement of 3.3 speedup in energy efficiency. |
[18] | None. | There were three sample passwords to be cracked. | The FPGA they utilized, the Virtex-7, contains 485,760 logic cells and 75,900 slices. Four LUTs and eight flip-flops are found on each slice of the Xilinx 7 series FPGA. | Cracking a hashed password using their architecture-3 (Arch-3) with 26 instances, and it deals with passwords of alphabets only on Virtex-7 FPGA. | They were able to crack a hashed password with 7 digits within 156 s. |
[7] | 6,458,020 hashed passwords. | None. | The used device’s GPU is 2 × MSI GeForce RTX 2080 Ti Gaming X Trio. | Using brute force and dictionary attacks by utilizing the software Hashcat v5.1.0. However, CPU resources were not utilized at all; instead, tests were conducted using both RTX 2080 Ti units with CUDA with a limit of 30 min. | Brute force cracked 770,884 short passwords (6 to 7 characters) while dictionary attack succeeded in cracking 63,119 long passwords (9 or more characters). |
[19] | None. | None. | CPU: Xeon(r)e5-2620 Number of cores: 8 Number of threads: 16. GPU: GTX 1080 Ti: 3584 Cores. | It uses CPU + GPU pipeline collaboration to speed up computation times and boost performance. In order to simplify the decompression computation, the approach additionally takes advantage of magic number matching. | The cracking algorithm now runs at 24,423 passwords per second, which is a 2.3 times better performance than its previous speed. |
[21] | None. | None. | CPU: Intel Core2 Duo E7300: 2-core GPU: GTX 9800: 128 Cores. | They concentrated on the process of generating keys for AES encryption, which is the step that takes the longest during the RAR encryption/decryption process, and they used GPU instead of CPU because GPU performs better than CPU in this case. | The average time for computing a single key reaches a maximum when computing around 16,384 keys. The average time per key is estimated to be 1.5 ms. |
[22] | None. | None. | Intel Xeon E5-2630 and Nvidia Quadro 4000 GPU with 256 CUDA cores. | Utilizing parallel processing on general-purpose GPU to conduct exhaustive graph search. | The study shows the limitations of Android’s pattern lock system and establishes the foundation for developing tools that can assess the security of passwords based on patterns. |
[9] | MySpace: 37,000. phpbb: 180,000. RockYou: 14,000,000. singles: 12,000. Facebook: 2441. pwgenl (generated): 1,000,000. | None. | GPU: features 2816 shaders and 64 ROPs. CPU: 4 cores + 4 with hyperthreading. | Exhaustive search. | 12% speedup. |
[23] | None. | None. | GPU: 1792 stream processors, 32 color ROPs. CPU: 4 cores + 4 with hyperthreading. | Asynchronous parallel between CPU and GPU. | The final version resulted in an increase in performance speed that ranges from 43 to 57 times. |
[8] | None. | None. | Hybrid CPU-FPGA: Xilinx Zynq-7000 XC7Z030-3 SoC. | A Hybrid-CPU-FPGA-based solution. | Energy efficiency 2.54× compared with NVIDIA GTX1080Ti GPU. Energy and resource efficiency 1.64× and 1.69× compared to the pure FPGA-based. |
Hardware | CPU | 7th Generation Intel(R) Core(TM) i7-7700HQ Quad Core (6 MB Cache, up to 3.8 GHz) |
Memory | 16 GB, DDR4, 2400 MHz | |
Storage | 1 TB 5400 rpm hard drive + 128 GB solid state drive | |
GPU 0 | Intel(R) HD Graphics 630 | |
GPU 1 | NVIDIA(R) GeForce(R) GTX 1050 Ti with 4 GB GDDR5 with 768 CUDA cores | |
Software | Operating System | Windows 11 Home 64-bit (10.0, Build 22,000) |
Driver | GeForce Driver 531.68 | |
Software | Hashcat v6.2.6 |
Password String | Hash Value (MD5) | |
---|---|---|
Password 1 | abc14 | b80eaaf275cf1d34b88d0b8c6c7da20b |
Password 2 | hd180 | decce0ac22fc85a9899a1f8ba2c08bfb |
Password 3 | a7ro1 | 0fd4d72214cd938a1bef4e1a58f4366f |
Password 4 | tynq0 | 8ea15dcb8862ccab2fa6388fb43317f6 |
Password 5 | o3kli | 670244cdc900710194338673e26dba1f |
Password 6 | v1m5e | bc4a21024aa58f2558a1e98e5839e54d |
Password 7 | x1z5l | 39db818049350277c4400cb01dd3f112 |
Password 8 | asdf32 | cb697d6d9fbd75cb15fb4670c5aaf0ca |
Password 9 | f6d3a1 | 87c818c75041578020d71acd4c2ea79f |
Password 10 | j3g3v1 | 4be9b447aa3d00aefcc69629b626d460 |
Brute Force Attack | Charset | abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 «space»!"#$%&’()*+,-./:;<=>?@[\]^_`{|}~ |
Script for CPU + GPU 0 | hashcat -m 0 -a 3 -d 3 hashedpasswords.txt -o cracked.txt -1 ?l?u?d?s ?1?1?1?1?1?1 | |
Script with GPU 1 (CUDA) | hashcat -m 0 -a 3 -d 1 hashedpasswords.txt -o cracked.txt -1 ?l?u?d?s ?1?1?1?1?1?1 --increment | |
Dictionary Attack | Charset | abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 «space»!"#$%&’()*+,-./:;<=>?@[\]^_`{|}~ |
Script for CPU + HD Graphics (Intel) | hashcat -m 0 -a 0 -d 1 hashedpasswords.txt rockyou.txt -o cracked.txt | |
Script with GPU 1 (CUDA) | hashcat -m 0 -a 0 -d 3 hashedpasswords.txt rockyou.txt -o cracked.txt |
Performance Metrics | CPU + GPU 0 (No Spec Chars) | CPU + GPU 0 (with Spec Chars) | GPU 1 Only CUDA (No Spec Chars) | GPU 1 Only CUDA (with Spec Chars) |
---|---|---|---|---|
Time (s) | 23 | 197 | 2 | 19 |
Speed (MH/s) | 254.8 | 244.3 | 2588.3 | 2639.8 |
Performance Metrics | CPU + GPU 0 | GPU 1 CUDA Only |
---|---|---|
Time (s) | 5 | 2 |
Speed (kH/s) | 2864.3 | 10,650 |
Brute Force Technique with Python #1 | Dictionary Attack with Python Technique #2 | Dictionary Attack with OpenMP in C++ Technique #3 | Brute Force Attack with Hashcat Using GPU 1 (CUDA) #4 | |
---|---|---|---|---|
Execution Time | 6.6342 s. | 0.0723827 s. | 0.041 s. | 2 s. |
Speedup | 1.9× times. | No improvement because of potential overhead caused by the Python library. However, tremendous improvement between the dictionary attack and the brute force attack by almost 930 times. | 4.4× times. | 11.5× times. |
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2023 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Alkhwaja, I.; Albugami, M.; Alkhwaja, A.; Alghamdi, M.; Abahussain, H.; Alfawaz, F.; Almurayh, A.; Min-Allah, N. Password Cracking with Brute Force Algorithm and Dictionary Attack Using Parallel Programming. Appl. Sci. 2023, 13, 5979. https://doi.org/10.3390/app13105979
Alkhwaja I, Albugami M, Alkhwaja A, Alghamdi M, Abahussain H, Alfawaz F, Almurayh A, Min-Allah N. Password Cracking with Brute Force Algorithm and Dictionary Attack Using Parallel Programming. Applied Sciences. 2023; 13(10):5979. https://doi.org/10.3390/app13105979
Chicago/Turabian StyleAlkhwaja, Ibrahim, Mohammed Albugami, Ali Alkhwaja, Mohammed Alghamdi, Hussam Abahussain, Faisal Alfawaz, Abdullah Almurayh, and Nasro Min-Allah. 2023. "Password Cracking with Brute Force Algorithm and Dictionary Attack Using Parallel Programming" Applied Sciences 13, no. 10: 5979. https://doi.org/10.3390/app13105979