Hacking an encrypted pdf file. Hacking encrypted rar, zip, and 7z archives. Utilities pdf crack, rar crack and more

Tr0jan_Horse

Moderator
Staff member
MODERATOR
ULTIMATE
PREMIUM
MEMBER
Joined
Oct 23, 2024
Messages
304
Reaction score
8,796
Deposit
0$
In today's article, I will share examples of cracking password-encrypted pdf files and archive files. I will show examples of working with such programs as pdf crack, rar crack, John the Ripper. Naturally, these programs work on Linux (in my case Kali Linux), but under Windows I think there are analogues of these programs. And yes, in this article I will touch on examples related to john, although there may be articles related to this program on Habré (and in the Russian-speaking segment of the Internet there are definitely descriptions of how to work with it), but in this article my examples will be relevant and necessary. This is a kind of online cheat sheet on using these utilities.

I carried out all the attacks on my personal computer, where I created my own files, which I attacked, that is, all actions are legitimate.
And as always, please do not get personal in the comments, if you find a mistake, flaw or inaccuracy, just write a comment without insults or write me a personal message.
So let's get down to practice
First, we will find and install these programs in the repository

Bash:
apt search pdfcrack
sudo apt update
sudo apt install pdfcrack

1747699072754.png

It's the same with rar crack
Bash:
sudo apt install aircrack
(sudo apt update is no longer required to be entered since it performed this operation)

1747699113492.png

Next, I created my pdf from the wikipedia page (Ctrl + P in the browser) and went to the website https://www.ilovepdf.com/ru/protect-pdf where you can encrypt a pdf with a password.

1747699144201.png

1747699160730.png

1747699175413.png

After the operations, it is possible to download an encrypted pdf
1747699220178.png
1747699229488.png

Even after we fix the pdf crack issue. Open the terminal (of course) and type in the following (general syntax example):

pdfcrack --dictionary=/path/to the dictionary file/dictionary file /path_encrypt_pdf/encrypted_pdf

Or in my case

pdfcrack --wordlist=/usr/share/wordlists/rockyou.txt 1_protected.pdf

1747699388302.png

As you can see from the screenshot, the program has selected a dictionary password - freedom4me. Next, all that's left is to enter the password
We find the file, try to open it - it requires a password, enter the selected password:
1747699420924.png
1747699431688.png
1747699440185.png
As you can see, the file has opened

From the first file (which was not encrypted - 1.pdf), I created a rar archive, naturally password-protected.

Let's try to find a password for it.

For the rar crack program, the syntax (in my case) looked like this:

rarcrack 1.pdf.rar

1747699482209.png
As you can see from the screenshot, the program has selected the password - 56 (although it is elementary).

Next, we go to the archive, see that the contents are encrypted (lock on the file), try to open the file - password requirement, enter the password and get the result:

1747699505947.png
1747699520943.png
1747699536140.png
We try a three-digit password. I have created an encrypted 2.rar archive with a three-digit password.

The algorithm of operations is the same

rar crack 2.rar

1747699585828.png

We enter the selected password again (in this case 098)

1747699617176.png
1747699634235.png

I want to say the following about the aircrack program. This program does not have the ability to search through a dictionary. She tries to sort through all possible combinations, starting with two-digit passwords. Therefore, if the password is complex enough, you need to be patient, have time, and have the computing power of the hardware. And in the help (rar crack --help) it is indicated that the program can select passwords not only for rar archives, but also for zip and 7z. But no matter how much I tried to sort through the passwords for zip and 7z, the program could not find passwords for them (although I encrypted them with two-digit passwords).

However, it is possible to use John the Ripper to select a password for zip and 7z. This utility is pre-installed in Kali Linux OS. Instructions for installing it for other distributions will not be difficult to find.

To begin with, I created two archives - 3.zip and 4.7z, naturally password-protected
1747699683131.png
Further, the algorithm is as follows
  • Using the utility, we create a hash of the archive file
  • We use the utility to sort passwords using a hash

So, the syntax in my case is this (I open the terminal in the same folder where the archives are located):
Bash:
zip 2 john 3.zip > hash.txt

And here I decided to "look" at the cache and saw "gibberish" (the hash should look like this)

Bash:
cat hash.txt

1747699753102.png

After that, we go through the password using the hash. In my case, the syntax looked like this (with a search through the already familiar dictionary):

Bash:
john --wordlist=/usr/share/wordlists/rockyou.txt --format=zip hash.txt

And the password was successfully selected.

1747699810863.png

We are doing the same with the second archive.
Bash:
7z2john 3.zip > 7z.hash
John --wordlist=/usr/share/wordlists/rockyou.txt --format=7z 7z.hash

1747699892251.png

The password was successfully selected
Now all that remains is to try to unzip the files, of course you will be asked for a password, which we will enter.

1747699926420.png
1747699935037.png
1747699940535.png
1747699949969.png
Successfully

And that's all for me today, dear readers, see you soon! And congratulations on the upcoming holidays!
 
Top Bottom