This tool is designed for educational purposes and authorized network security testing only. Using this tool on networks you don't own or without explicit permission is illegal and unethical. Always ensure you have proper authorization before conducting any network security research.
Evil DHCP is an experimental network security research tool that demonstrates how rogue DHCP and DNS servers can be deployed for network analysis and penetration testing. The tool automatically discovers network topology, scans for devices, and sets up containerized rogue services.
This project explores the theoretical concept of:
- Rogue DHCP Server Deployment: Automatically configuring and deploying a DHCP server that can intercept network requests
- DNS Manipulation: Setting up a custom DNS server for traffic redirection
- Network Discovery: Automated network topology mapping and device enumeration
- Container-based Infrastructure: Using Docker for isolated and portable service deployment
┌─────────────────┐ ┌──────────────────┐ ┌─────────────────┐
│ Go Controller │────│ DHCP Server │────│ DNS Server │
│ │ │ (Container) │ │ (Container) │
│ - Network Scan │ │ - ISC DHCP │ │ - BIND9 │
│ - Config Gen │ │ - Dynamic Range │ │ - Custom Zones │
│ - Orchestration │ │ - Lease Mgmt │ │ - Resolution │
└─────────────────┘ └──────────────────┘ └─────────────────┘
- Network Discovery: Automatically detects host IP, subnet mask, and network interface
- Device Enumeration: Uses nmap to scan and identify devices on the network
- Configuration Generation: Creates DHCP server configurations using Go templates
- Container Setup: Docker configurations for both DHCP and DNS servers
- Gateway Detection: Automatically identifies the default gateway
-
DHCP Range Calculation:
- Currently
RangeStartandRangeEndare empty strings - Need to implement logic to calculate available IP ranges
- Should exclude gateway, broadcast, and known devices
- Currently
-
Goroutine Implementation:
- Network scanning is currently synchronous
- Comments indicate nmap scanning should use goroutines for performance
-
DNS Template Processing:
- DNS zone templates exist but aren't being generated
- Need to implement DNS configuration generation similar to DHCP
- Error Handling: Improve robustness with better error handling
- Logging System: Add structured logging for debugging and monitoring
- Configuration Validation: Validate generated configurations before deployment
- Service Orchestration: Automated Docker container management
- CLI Interface: Command-line flags for customization
- Multiple Interface Support: Handle systems with multiple network interfaces
- Traffic Monitoring: Real-time monitoring of DHCP/DNS requests
This project includes a comprehensive Makefile that automates common tasks:
- One-command setup:
make dev-setupinstalls dependencies and builds everything - Simplified deployment:
make deployruns discovery and starts all services - Container management: Build, run, stop, and clean containers with simple commands (supports both Docker and Podman)
- Development workflow: Automatic dependency management and build optimization
- System integration: Automated installation of system dependencies
- Monitoring: Easy access to container logs and service status
- Safety checks: Validates prerequisites and provides helpful error messages
Run make help to see all available commands with descriptions.
- Go 1.22.1 or later
- Docker or Podman (container engine)
- nmap installed on the system
- Root/sudo privileges (required for DHCP server operations)
git clone https://github.com/your-username/evil-dhcp.git
cd evil-dhcp
make deps# Show all available commands
make help
# Install system dependencies (Ubuntu/Debian)
make install
# Set up development environment
make dev-setup
# Run network discovery and configuration generation
sudo make run
# Build and start all services
make deploy
# View service status
make status
# Stop all services
make docker-stop
# Use Podman instead of Docker
make CONTAINER_TOOL=podman docker-build
make CONTAINER_TOOL=podman docker-run# Run network discovery and configuration generation
sudo go run .
# Build and run DHCP container
cd evil-dhcp
docker build -t evil-dhcp .
docker run --rm --network host evil-dhcp
# Build and run DNS container
cd evil-dns
docker build -t evil-dns .
docker run --rm -p 53:53/udp evil-dnsevil-dhcp/
├── main.go # Entry point and orchestration
├── net.go # Network discovery and scanning
├── tmpl.go # Configuration template processing
├── utils.go # Utility functions (IP/mask conversion)
├── Makefile # Build automation and task management
├── go.mod # Go module dependencies
├── evil-dhcp/
│ ├── dhcpd.conf.tmpl # DHCP server configuration template
│ ├── Dockerfile # DHCP server container
│ └── dhcpd.conf # Generated DHCP configuration
├── evil-dns/
│ ├── named.conf.local # DNS zone configuration
│ ├── db.example.com.tmpl # DNS zone template
│ ├── Dockerfile # DNS server container
│ └── named.conf.options # DNS server options
└── README.md # This file
Once completed, this tool could be used for:
- DHCP Starvation Testing: Exhaust legitimate DHCP pools
- Man-in-the-Middle Setup: Redirect traffic through controlled infrastructure
- DNS Hijacking Simulation: Demonstrate DNS-based attacks
- Network Segmentation Validation: Test network isolation controls
- DHCP Snooping Verification: Validate DHCP security features
- Concurrent Scanning: Implement goroutines for network operations
- Resource Management: Proper container lifecycle management
- Memory Usage: Efficient handling of large network scans
- Network Impact: Minimize disruption to production networks
This is an experimental project perfect for learning network security concepts. Areas where contributions would be valuable:
- Core Functionality: Complete the missing features listed above
- Security Features: Add detection avoidance mechanisms
- Monitoring: Implement comprehensive logging and monitoring
- Documentation: Expand technical documentation and examples
- Testing: Create automated tests for network scenarios
This project demonstrates several important networking and security concepts:
- DHCP Protocol: How dynamic IP allocation works
- DNS Resolution: Custom DNS server implementation
- Network Discovery: Automated topology mapping
- Containerization: Service isolation and deployment
- Go Networking: Systems programming in Go
- Security Research: Responsible disclosure and testing practices
- Always test in isolated environments first
- Understand legal implications in your jurisdiction
- Document and report vulnerabilities responsibly
- Never deploy on networks without authorization
- Consider network impact and availability
This project is for educational and research purposes. Please use responsibly and in accordance with applicable laws and regulations.
Note: This is an experimental project that demonstrates network security concepts. The author is not responsible for any misuse of this tool.