Modsecurity
ModSecurity is a popular open-source web application firewall (WAF). It can be used to protect web applications from a wide range of attacks, including SQL injection, cross-site scripting (XSS), and many others, by monitoring HTTP traffic in real-time.
Here are the top 20 use cases for blue teams using ModSecurity, along with sample rules and commands:
1. Blocking SQL Injection
Rule:
Description: Blocks requests containing basic SQL injection patterns.
2. Blocking Cross-Site Scripting (XSS)
Rule:
Description: Blocks requests containing basic XSS patterns.
3. Blocking Command Injection
Rule:
Description: Blocks requests that attempt to execute system commands.
4. Blocking Local File Inclusion (LFI)
Rule:
Description: Blocks attempts to read the
/etc/passwd
file.
5. Blocking Remote File Inclusion (RFI)
Rule:
Description: Blocks attempts to include remote files.
6. Blocking Common Web Shells
Rule:
Description: Blocks common web shell patterns.
7. Blocking User Agents Associated with Scanners
Rule:
Description: Blocks requests from common vulnerability scanners.
8. Blocking Suspicious IP Addresses
Rule:
Description: Blocks a specific IP address.
9. Blocking HTTP Methods
Rule:
Description: Blocks TRACE, DELETE, and TRACK HTTP methods.
10. Blocking Requests with No User-Agent
Rule:
Description: Blocks requests that don't have a User-Agent header.
11. Blocking Requests with High Request Length
Rule:
Description: Blocks requests with a content length greater than 5000.
12. Blocking Suspicious Query Strings
Rule:
Description: Blocks requests containing `base64_encode` in the query string.
13. Blocking Suspicious File Uploads
Rule:
Description: Blocks file uploads with suspicious extensions.
14. Blocking Multiple URL Encodings
Rule:
Description: Blocks requests with multiple URL encodings.
15. Blocking Suspicious Cookies
Rule:
Description: Blocks requests with suspicious cookie values.
16. Blocking Suspicious Referers
Rule:
Description: Blocks requests from suspicious referers.
17. Blocking Suspicious User-Agent Strings
Rule:
Description: Blocks requests with suspicious User-Agent strings.
18. Blocking Suspicious Response Content
Rule:
Description: Blocks responses containing suspicious content.
19. Blocking Directory Traversal Attacks
Rule:
Description: Blocks directory traversal patterns.
20. Blocking Requests to Sensitive Directories
Rule:
Description: Blocks requests to the `/admin/` directory.
Last updated