Ettercap

Comprehensive Suite for Man-in-the-Middle Attacks

CRITICAL WARNING: Ettercap is for authorized security testing only. Unauthorized use violates computer crime laws. Only use on networks you own or have explicit written permission to test. These techniques can cause network disruption and data interception.

Interactive Ettercap Command Builder

Primary wired network interface
Intercept traffic between two hosts
Sniff on single network segment
ettercap -T -i eth0 -T -M arp:remote /192.168.1.1// /192.168.1.100//HIGH RISK

What is Ettercap?

Multi-Platform Network Security Tool

Ettercap is a comprehensive suite for man-in-the-middle attacks on LANs. It provides:

  • Active Sniffing: Intercept traffic on switched networks
  • Protocol Analysis: Support for many protocols and real-time decoding
  • Password Collection: Automatic credential harvesting
  • Content Filtering: On-the-fly packet manipulation
  • Plugin Architecture: Extensible attack framework
Key Capabilities
Protocol Support:
HTTP, HTTPS, SSH, FTP, POP, IMAP, SMB, LDAP, MySQL, PostgreSQL
Attack Vectors:
ARP poisoning, DNS spoofing, DHCP spoofing, Port stealing, SSL stripping
Password Collection:
Automatic extraction of usernames and passwords from protocols
Educational Purpose:

This lesson is for understanding attack vectors to better defend against them. Always obtain proper authorization before testing.

Common Attack Scenarios

Man-in-the-Middle Attack
High Risk
ettercap -T -M arp:remote -i eth0 /192.168.1.1// /192.168.1.100//

Position between gateway and target to intercept traffic

Network-wide ARP Poisoning
Critical Risk
ettercap -T -M arp:remote -i eth0 /192.168.1.0/24//

Poison entire subnet to intercept all traffic

DNS Hijacking Attack
High Risk
ettercap -T -M arp:remote -P dns_spoof -i eth0 /192.168.1.1// //

Redirect DNS queries to controlled servers

HTTPS Downgrade Attack
High Risk
ettercap -T -M arp:remote -P sslstrip -i eth0 /192.168.1.1// //

Strip SSL/TLS encryption from web traffic

Essential Ettercap Commands

CommandDescriptionRisk LevelUse Case
ettercap -T -LList available network interfacesSafeInterface discovery
ettercap -T -P listList all available pluginsSafePlugin discovery
ettercap -T -i eth0Passive sniffing on interfaceMediumNetwork monitoring
ettercap -T -M arp:remote /target1// /target2//ARP poisoning between two targetsHighMITM attack
ettercap -T -M dhcp:192.168.1.1/24/192.168.1.1DHCP spoofing attackCriticalNetwork takeover
ettercap -T -P dns_spoof -M arp:remote //DNS spoofing with ARP poisoningHighDNS hijacking

Ettercap Plugin System

Ettercap's plugin architecture allows for extensible attack capabilities. Here are some key plugins:

Attack Plugins
dns_spoof
DNS spoofing attacks
Attack
sslstrip
SSL/TLS stripping
Attack
dos_attack
Denial of service attacks
Attack
fraggle_attack
UDP fraggle attack
Attack
Analysis & Discovery
autoadd
Automatically add new hosts
Discovery
chk_poison
Check ARP poisoning effectiveness
Analysis
finger
OS fingerprinting
Discovery
gre_relay
GRE tunnel relay
Tunneling
Using Plugins:
ettercap -T -P plugin_name -M attack_mode //target1// //target2//

Defensive Measures Against MITM Attacks

Understanding Ettercap attacks helps implement proper defenses:

Defensive MeasureDescriptionEffectivenessImplementation
Static ARP TablesConfigure static ARP entries to prevent ARP poisoningHighNetwork Configuration
ARP MonitoringMonitor for suspicious ARP traffic and MAC address changesHighNetwork Monitoring
Network SegmentationIsolate critical systems using VLANs and subnetsMediumNetwork Architecture
Switch Port SecurityEnable port security features on managed switchesHighSwitch Configuration
HTTPS EnforcementUse HSTS and certificate pinning to prevent SSL strippingHighWeb Security
DNS SecurityImplement DNS over HTTPS (DoH) or DNS over TLS (DoT)HighDNS Configuration
Layered Defense Strategy:
  • Network Level: Switch security features, VLANs, network segmentation
  • Protocol Level: TLS/SSL enforcement, certificate validation, DNSSEC
  • Application Level: HSTS, certificate pinning, secure authentication
  • Monitoring Level: Network anomaly detection, ARP table monitoring

Legal and Ethical Considerations

⚖️ Legal Requirements
  • Written Authorization: Always obtain explicit written permission
  • Scope Definition: Clearly define what systems are in scope
  • Data Protection: Follow privacy laws (GDPR, HIPAA, etc.)
  • Incident Response: Have procedures for accidental data exposure
  • Documentation: Maintain detailed logs of all testing activities
Criminal Penalties

Unauthorized network interception can result in:

  • Federal computer crime charges
  • Wiretapping and eavesdropping violations
  • Civil liability for damages
  • Professional license revocation
🛡️ Ethical Guidelines
  • Principle of Least Harm: Minimize network disruption
  • Data Minimization: Collect only necessary information
  • Confidentiality: Protect all captured sensitive data
  • Transparency: Report findings responsibly
  • Education Focus: Use knowledge to improve security
Legitimate Use Cases
  • Penetration Testing: Authorized security assessments
  • Red Team Exercises: Simulated attack scenarios
  • Network Forensics: Incident response and investigation
  • Security Research: Academic and professional research
  • Defense Training: Understanding attack methods

Knowledge Check

Answer: Unified sniffing (-T) operates on a single network segment and is suitable for most scenarios including switched networks. Bridged sniffing (-B) requires two network interfaces and acts as a transparent bridge between network segments, useful for intercepting traffic between different network segments.

Answer: ARP poisoning works by sending fake ARP responses that associate the attacker's MAC address with the IP address of the gateway or target host. This causes victims to send their traffic to the attacker instead of the legitimate destination, allowing interception and analysis of the traffic before forwarding it to the real destination.

Answer: Key defenses include: (1) Static ARP tables to prevent ARP poisoning, (2) Switch port security features, (3) Network segmentation with VLANs, (4) ARP monitoring and anomaly detection, (5) HTTPS enforcement with HSTS, (6) Certificate pinning to prevent SSL stripping, and (7) DNS over HTTPS/TLS to prevent DNS spoofing.