Created
March 5, 2025 06:00
-
-
Save manojxio/9b0c01ccdec20625751dca5dba6afcdf to your computer and use it in GitHub Desktop.
Block Testing Tools Query Parameters, User-Agents and Suspicious Headers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name yourdomain.com; | |
# Block malicious query parameters | |
set $block_query 0; | |
if ($query_string ~* "(mdrv|jmeter|gatling|locust|tsung|k6|zaproxy|burp|nikto|sqlmap|metasploit)") { | |
set $block_query 1; | |
} | |
# Block malicious User-Agents | |
set $block_user_agent 0; | |
if ($http_user_agent ~* "(LoadRunner|JMeter|Gatling|Locust|Tsung|k6|ZAP|Burp|Nikto|sqlmap|Metasploit)") { | |
set $block_user_agent 1; | |
} | |
# Block requests with suspicious headers | |
set $block_header 0; | |
if ($http_referer ~* "(zaproxy|burp|nikto|sqlmap|metasploit)") { | |
set $block_header 1; | |
} | |
# Apply blocking | |
location / { | |
if ($block_query = 1) { return 403; } | |
if ($block_user_agent = 1) { return 403; } | |
if ($block_header = 1) { return 403; } | |
# Allow normal traffic | |
proxy_pass http://backend_server; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment