Day 23

You wanna know what happens to your hashes?

Welcome to Day 23 of Advent of Cyber 2024

In today’s challenge, we’ll be cracking hashes. Let’s get started!

Hashing is a process in computer science and cryptography used to transform data (usually text, like a password) into a fixed-length string of characters that represents the original data. This transformation is done by a mathematical algorithm called a hash function. The output of this process is called a hash.

Lets Begin:

  • Start the machine and wait for it to deploy

Once deployed Locate the Hash:

The hash is stored in the /home/user/AOC2024/hash1.txt file.

The hash should display as:

956a72c83a895cb767bb5be8dba791395021dcece002b689cf3b5bf5aaa20ac

Now, to find the type of hash use hash-identifier and paste the hashvalue

or

use python hash-id.py

From the output It identifies as: SHA-256

Lets try to crack the hash using rockyou.txt:

john --format=raw-sha256 --wordlist=/usr/share/wordlists/rockyou.txt hash1.txt

Unfortunately, no password was found

Lets try adding the option --rules=wordlist to john - this generates multiple passwords from each one. For instance, it appends and prepends single digits. It does various common substitutions; for example, a can be replaced with @, i can be replaced with !, and s can be replaced with $

john --format=raw-sha256 --rules=wordlist --wordlist=/usr/share/wordlists/rockyou.txt hash1.txt

Success! we found the password.

Next , lets Crack the PDF Password:

The first thing we need to do is to convert the password-protected file into a format that john can attack. Luckily, John the Ripper jumbo edition comes with the necessary tools. The different tools follow the naming style “format2john”.

Lets list all tools using : ls /opt/john/2john

From the output, we see two tools that are interesting one written in python and the other in perl from this pdf2john.pl should do the job perfectl

Convert the pdf to hash : pdf2john.pl private.pdf > pdf.hash

Create a Custom Wordlist: The Mayor’s password hints involve personal references. Use a custom wordlist with terms like:

Fluffy
FluffyCat
Mayor
Malware
MayorMalware

Save this as wordlist.txt

Now run john --rules=single --wordlist=wordlist.txt pdf.hash

We found the passoword for the pdf :

Now lets open the pdf and find the flag

To read it, lets use a pdf to text tool:

pdftotext private.pdf -upw M4y0rM41w4r3

and use head command to read the top portion of the file.

Thats it we found the flag!!

Questions

1.Crack the hash value stored in hash1.txt. What was the password?

A: fluffycat12

2.What is the flag at the top of the private.pdf file?

A: THM{do_not_GET_CAUGHT}

Stay tuned for Day 24 and Happy Hacking 🎄

Thank you!

Last updated

Was this helpful?