![]() |
|
How to Perform Man-in-the-Middle (MitM) Attacks - Printable Version +- Hack Forums (https://hackforums.net) +-- Forum: Hacks, Exploits, and Various Discussions (https://hackforums.net/forumdisplay.php?fid=45) +--- Forum: Blackhat • Red Team • Offensive Security (https://hackforums.net/forumdisplay.php?fid=447) +---- Forum: Cryptography, Encryption, and Decryption (https://hackforums.net/forumdisplay.php?fid=126) +---- Thread: How to Perform Man-in-the-Middle (MitM) Attacks (/showthread.php?tid=6285709) |
How to Perform Man-in-the-Middle (MitM) Attacks - 7 - Nov 30, 2024 ![]() Man-in-the-Middle (MitM) attacks are a type of cyber attack where an attacker intercepts communication between two parties, typically a user and a server, and can eavesdrop on, modify, or redirect the communication. This can be done by placing the attacker in the middle of the communication path, between the user and the server, without the user's knowledge. Prerequisites: - A local network with a vulnerable device (e.g., a router, switch, or Wi-Fi access point) that can be used as a proxy server. - A device capable of running a packet sniffer and a web server (e.g., a Raspberry Pi with a Wi-Fi dongle and Apache). Tools and Setup: - A packet sniffer like Wireshark or tcpdump to capture network traffic. - A web server like Apache or Nginx to serve the malicious content. - A tool like Ettercap or Bettercap for performing the MitM attacks. ![]() Procedure: 1. Configure the vulnerable device as a proxy server and forward all traffic to the attacker's device. - For routers and switches, you can usually find the proxy server settings in the web interface or by using the command line (e.g., using `ip route` or `route` commands). - For Wi-Fi access points, you may need to configure the proxy server settings through the web interface or by modifying the configuration file. 2. Start the packet sniffer on the attacker's device to capture network traffic. - Wireshark: `sudo wireshark -i eth0` - tcpdump: `sudo tcpdump -i eth0 -w capture.pcap` The script below will automatically detect the router's IP address, scan it for vulnerabilities, and then capture packets from the local network using the specified interface. This can be copy and pasted into a text document and saved as step2.py and ran with python step2.py Code from scapy.all import *3. Use Ettercap or Bettercap to perform the MitM attack. This script will check if ettercap and bettercap are installed on the system. If either one is found, it will prompt the user to choose between the two tools. It will then scan the router for vulnerabilities and perform the chosen MiTM attack. Remember to run this script with appropriate permissions or using tools like sudo to scan the router and perform the MiTM attacks. This can be copy and pasted into a text document and saved as step3.py and ran with python step3.py Code import os4. Set up a web server on the attacker's device to serve a malicious page. - Apache: - Install Apache on the Raspberry Pi: `sudo apt-get install apache2` - Create a malicious HTML page (e.g., `malicious.html`) with the desired content. - Place the malicious page in the Apache document root (usually `/var/www/html/`). 5. Redirect the user's browser to the malicious page using the web server. - On the vulnerable device, configure the proxy server to redirect traffic to the attacker's device. - For example, if the malicious page is located at `http://attacker.local/malicious.html`, the proxy server should be configured to redirect traffic to this URL. 6. Intercept and modify the user's traffic as needed (e.g., stealing passwords or cookies). - Ettercap and Bettercap can be used to intercept and modify the user's traffic. - For example, you can use the `redirect` command in Ettercap to redirect the user to a different URL: `redirect / http://example.com/` - You can also use the `set http.proxy.script` command in Bettercap to execute a script that modifies the user's traffic. 7. Redirect the user to the legitimate website or perform other malicious activities. - You can use the `redirect` command in Ettercap or the `http.proxy.script` command in Bettercap to redirect the user to the legitimate website. - You can also use the `http.proxy.script` command to execute a script that modifies the user's traffic in a more advanced way. ![]() Note: - Performing MitM attacks requires authorization and should be done in a controlled environment. 😈 - Always obtain explicit permission before performing any MitM attack. 😴 - Keep the attacker's device secure and use it only for legitimate purposes. 🤑 Conclusion: Man-in-the-Middle attacks can be a powerful tool for penetration testing and security research. By intercepting and modifying network traffic, attackers can steal sensitive information, redirect users to malicious websites, or perform other malicious activities. However, it is important to use these techniques responsibly and ethically. RE: How to Perform Man-in-the-Middle (MitM) Attacks - tkboom - Nov 30, 2024 It seems like a very constructive solution. RE: How to Perform Man-in-the-Middle (MitM) Attacks - 7 - Nov 30, 2024 (Nov 30, 2024 06:56 AM)tkboom Wrote: It seems like a very constructive solution. Thank you mate, There are some very useful scripts and tools in here RE: How to Perform Man-in-the-Middle (MitM) Attacks - Miles Teller - Nov 30, 2024 Awesome share man, good stuff! RE: How to Perform Man-in-the-Middle (MitM) Attacks - 7 - Dec 1, 2024 (Nov 30, 2024 01:56 PM)Miles Teller Wrote: Awesome share man, good stuff! Thank you hopefully you find it useful RE: How to Perform Man-in-the-Middle (MitM) Attacks - ImaginaryMoose - Jan 12, 2025 detailed and concise please keep content like this coming! RE: How to Perform Man-in-the-Middle (MitM) Attacks - Tyr - Jan 12, 2025 Fantastic post with well detailed information for performing these type of attacks. Thanks @7@. RE: How to Perform Man-in-the-Middle (MitM) Attacks - RootRXXT - Jan 12, 2025 awesome kb @7@ , cheers man RE: How to Perform Man-in-the-Middle (MitM) Attacks - vandall666 - Feb 8, 2025 Thank you for posting, this is great informarion RE: How to Perform Man-in-the-Middle (MitM) Attacks - Cricc - Feb 21, 2025 Nice! Thanks for sharing. |