Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block $bad_uri_words prototype #365

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions bots.d/bad-uri-words.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# EDIT THIS FILE AS YOU LIKE TO ADD OR REMOVE ANY BAD WORDS YOU WANT TO SCAN FOR ###
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move these rules to bad-referrer-words.conf


# THE RULES BELOW ARE ENABLED BY DEFAULT
# You can disable this default list by switching the values to 0

# Old WordPress vulnerability
"~*(?:\b)HelloThinkPHP(?:\b)" 1;

# Trigger XDebug in production
"~*(?:\b)XDEBUG_SESSION_START(?:\b)" 1;

# PHPUnit exploit:
# /vendor/phpunit/phpunit/phpunit.xsd
# /vendor/phpunit/phpunit/build.xml
# /vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php
"~*(?:\b)vendor/phpunit/phpunit(?:\b)" 1;
"~*(?:\b)phpunit/src/Util/PHP/eval-stdin\.php(?:\b)" 1;
8 changes: 8 additions & 0 deletions bots.d/blockbots.conf
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,14 @@ if ($bad_referer) {
return 444;
}

# ---------------------------------
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine

# BLOCK BAD URI WORDS
# ---------------------------------

if ($bad_uri_words) {
return 444;
}

# -----------------------------
# BLOCK IP ADDRESSES and RANGES
# -----------------------------
Expand Down
16 changes: 16 additions & 0 deletions conf.d/globalblacklist.conf
Original file line number Diff line number Diff line change
Expand Up @@ -18123,6 +18123,22 @@ geo $ratelimited {
# END SECTION 4 - ACTIVATE BLOCKER FUNCTIONS
# ==========================================


Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

# =============================
# BEGIN SECTION 5 - REQUEST URI
# =============================

map $request_uri $bad_uri_words {
default 0;
# include bots.d/whitelist-domains.conf; # ???
include bots.d/bad-uri-words.conf;
}


# ==========================================
# END SECTION 5 - ACTIVATE BLOCKER FUNCTIONS
# ==========================================

# =====================
# END BLOCKER FUNCTIONS
# =====================
Expand Down