Exploration of cryptographic vulnerabilities with Python: cracking MD5, SHA1, and SHA256 (salted vs. unsalted), brute-force & dictionary attacks, and exploiting weaknesses in Diffie-Hellman through brute-force and MITM simulations. Includes practical experiments with ARP & DNS spoofing.
This repository contains my Networks & System Security (SIL765) assignment focused on exploring vulnerabilities in modern cryptographic systems.
It demonstrates hash cracking (MD5, SHA1, SHA256) and attacks on Diffie-Hellman key exchange, along with practical simulations of Man-in-the-Middle (MITM), ARP spoofing, and DNS spoofing.
All implementations are in Python with detailed experiments and results.
-
Hash Cracking (MD5, SHA1, SHA256)
- Brute-force and dictionary-based password cracking
- Comparison of salted vs unsalted hashes
- Performance evaluation with timing analysis
-
Diffie-Hellman Vulnerabilities
- Private key recovery using brute-force
- Man-in-the-Middle (MITM) attack simulation
- Client–server communication with vulnerable DH protocol
-
Network Attacks
- Attempted ARP spoofing using Ettercap (client isolation prevented success)
- Attempted DNS spoofing on hotspot (DNS relay blocked local poisoning)
- Languages & Tools: Python, Ettercap, dsniff
- Key Scripts:
attack1.py– Hash cracking (unsalted)attack2.py– Salted hash crackingclient.py,victum.py,attacker.py– Diffie-Hellman client/server/MITM setuppart2.1.py– Brute force on DH private key
- Techniques Used:
- Frequency & dictionary attacks for hash cracking
- Modular arithmetic for Diffie-Hellman brute force
- Socket programming for MITM interception
- Unsalted hashes: Successfully cracked using dictionary attack.
- Salted hashes: Significantly more resistant; required more computation.
- Diffie-Hellman: Private keys recovered (small primes), MITM successfully intercepted shared secrets.
- ARP/DNS Spoofing: Failed on mobile hotspot due to client isolation and DNS relay configuration.
- Clone the repository:
git clone https://github.com/<your-username>/cryptanalysis-hash-cracking-diffie-hellman-attacks.git cd cryptanalysis-hash-cracking-diffie-hellman-attacks
Install dependencies:
bash
pip install -r requirements.txt Run Hash Cracking:
bash
python attack1.py # Unsalted python attack2.py # Salted Run Diffie-Hellman Brute Force:
bash
python part2.1.py