
Dockerized honeypot for CVE-2021-44228.
Enhanced dockerized honeypot for CVE-2021-44228 with comprehensive security features, monitoring, and alerting capabilities.
# Generate SSL certificates
./generate-ssl.sh
# Start with docker-compose
docker-compose up -d
# Monitor logs
./monitor.py --tail
# Run as root for fail2ban setup
sudo ./deploy.sh
# x86_64
docker run -d -p 8080:8080 \
-e HONEYPOT_NAME="log4shell-honeypot" \
-e LOG_FORMAT="json" \
-e RATE_LIMIT_REQUESTS="100" \
--name="log4shell-honeypot" \
msanford/log4shell-honeypot:latest
# ARM (e.g., Raspberry Pi)
docker run -d -p 8080:8080 \
-e HONEYPOT_NAME="log4shell-honeypot" \
--name="log4shell-honeypot" \
msanford/log4shell-honeypot:arm-latest
# Load from config file
docker-compose --env-file config.env up -d
The honeypot detects the following Log4Shell patterns:
${jndi: - JNDI lookups (primary attack vector)${ldap: - LDAP directory lookups${rmi: - RMI remote method invocation${dns: - DNS lookups${env: - Environment variable access${sys: - System property access${java: - Java runtime information# Tail logs with formatted output
./monitor.py --tail
# Analyze last 24 hours
./monitor.py --hours 24
# Analyze last hour
./monitor.py --hours 1
curl http://localhost/health
curl http://localhost/metrics
sudo fail2ban-client status log4shell-honeypot
Enhanced JSON log format includes:
{
"timestamp": "2024-01-15T10:30:45Z",
"honeypot": "log4shell-honeypot",
"event_type": "log4shell_attempt",
"source_ip": "192.168.1.100",
"real_ip": "10.0.0.5",
"method": "POST",
"url": "http://honeypot.local/",
"user_agent": "Mozilla/5.0...",
"detected_patterns": ["${jndi:", "${env:"],
"detection_source": "form_field:username",
"headers": {...},
"form_data": {...},
"query_params": {...},
"content_length": 45
}
The structured JSON logs can be easily ingested by:
Set up alerts based on:
# Build container
docker build -t log4shell-honeypot:latest .
# Build with specific tag
docker build -t log4shell-honeypot:v2.0 .
docker-compose ps
docker-compose logs log4shell-honeypot
curl -f http://localhost/health || echo "Health check failed"
sudo fail2ban-client status
sudo tail -f /var/log/fail2ban.log
# Check for recent attacks
./monitor.py --hours 1
# View raw logs
tail -f /var/log/log4shell-honeypot.log
RATE_LIMIT_REQUESTS for legitimate high trafficMAX_LOG_SIZE and LOG_BACKUP_COUNT for log retention# In docker-compose.yml
deploy:
resources:
limits:
cpus: '0.5'
memory: 256M
reservations:
cpus: '0.1'
memory: 128M
This is an enhanced fork of BinaryDefense/log4shell-honeypot-flask with significant security and operational improvements.
| Variable | Default | Description |
|---|
HONEYPOT_NAME | log4shell-honeypot | Name identifier for the honeypot |
LOG_LEVEL | INFO | Logging level (DEBUG, INFO, WARNING, ERROR, CRITICAL) |
LOG_FORMAT | json | Log format (json or text) |
MAX_LOG_SIZE | 10485760 | Maximum log file size in bytes (10MB) |
LOG_BACKUP_COUNT | 5 | Number of backup log files to keep |
RATE_LIMIT_REQUESTS | 100 | Maximum requests per IP per window |
RATE_LIMIT_WINDOW | 3600 | Rate limit window in seconds (1 hour) |