known_badAgents() function tests your network’s ability to detect and block HTTP requests using known malicious user agent strings. These user agents are associated with spam bots, web scrapers, vulnerability scanners, and other automated malicious activities.
Data Source
This module uses a comprehensive list of bad user agents:- Bad User Agents List -
https://raw.githubusercontent.com/mitchellkrogza/nginx-ultimate-bad-bot-blocker/master/_generator_lists/bad-user-agents.list
This list is maintained by the nginx-ultimate-bad-bot-blocker project and contains user agent strings from known malicious bots, scrapers, spammers, and attack tools.
How It Works
Download Bad User Agents List
Downloads the latest list of known malicious user agent strings from the GitHub repository.
HTTP Requests with Bad User Agents
Sends HTTPS requests to Google using each malicious user agent string in the HTTP headers.
Output Format
Results are saved to Agent_Results.txt with the following format:What to Monitor
Web Application Firewalls
WAF should block or flag requests with known malicious user agent strings.
Web Server Logs
Review access logs for requests using suspicious or malicious user agents.
API Gateways
API security should validate user agents and block known malicious ones.
SIEM Correlation
Security monitoring should correlate bad user agents with other attack indicators.
Types of Malicious User Agents
Vulnerability Scanners
Vulnerability Scanners
Automated tools that scan for security vulnerabilities:
- sqlmap - SQL injection testing tool
- Nikto - Web server scanner
- Acunetix - Commercial vulnerability scanner
- masscan - Port scanner
- ZmEu - Vulnerability scanner
Content Scrapers
Content Scrapers
Bots that steal website content:
- Email harvesting bots
- Copyright infringement scrapers
- Competitor intelligence bots
- SEO manipulation tools
Spam Bots
Spam Bots
Automated tools for spreading spam:
- Comment spam bots
- Form submission bots
- Registration bots
- Referrer spam bots
Malware and Backdoors
Malware and Backdoors
User agents associated with malicious software:
- Botnet command & control
- Backdoor communication
- Data exfiltration tools
- Trojan downloaders
DoS Tools
DoS Tools
Distributed denial of service attack tools:
- Low Orbit Ion Cannon (LOIC)
- High Orbit Ion Cannon (HOIC)
- Slowloris variants
- HTTP flood tools
Common Bad User Agent Examples
The test may include user agents from tools like:- sqlmap - Automated SQL injection tool
- Nikto - Web server security scanner
- masscan - High-speed port scanner
- Python-urllib - Often used by malicious scripts
- Go-http-client - Frequently abused for automated attacks
- curl - Command-line tool (legitimate but often abused)
- Wget - Download tool (legitimate but often abused)
- ZmEu - Known vulnerability scanner
- MJ12bot - Aggressive crawler often blocked
- AhrefsBot - SEO crawler sometimes unwanted
While some tools like curl and wget have legitimate uses, they frequently appear in attack traffic and are often blocked by default in security policies.
Testing Workflow
Detection and Blocking Strategies
Security Controls to Validate
- Web Application Firewalls (WAF) - Should block requests with known bad user agents
- API Gateways - Should validate user agents for API requests
- Bot Management Solutions - Should identify and block malicious bots
- Rate Limiting - Should throttle or block automated requests
- SIEM Rules - Should alert on malicious user agent patterns
- CDN Security - Should filter bad bots at the edge
Advanced Evasion Techniques
Be aware that sophisticated attackers may:- Rotate user agents to mimic legitimate browsers
- Use user agent strings from real browsers
- Randomize user agents to avoid pattern detection
- Combine user agent spoofing with other evasion techniques
Effective bot protection requires multiple layers:
- User agent filtering (basic)
- JavaScript challenges
- CAPTCHA for suspicious requests
- Behavioral analysis
- Machine learning-based detection
Impact of Malicious Bots
Uncontrolled bot traffic can cause:- Performance Degradation - Excessive resource consumption
- Increased Costs - Higher bandwidth and infrastructure expenses
- Data Theft - Scraping of proprietary content and user data
- Security Risks - Vulnerability scanning leading to exploits
- Analytics Pollution - Skewed metrics and reporting
- Competitive Intelligence - Unauthorized data collection by competitors
Best Practices
- Maintain Blocklists - Keep user agent blocklists updated regularly
- Monitor Trends - Track emerging malicious user agents
- Layer Defense - Don’t rely solely on user agent filtering
- Log Everything - Maintain detailed logs for forensic analysis
- Regular Testing - Use tools like Somnium to validate controls
- Tune Rules - Balance security with legitimate automated access