8G Firewall
After more than a year of beta testing, 8G Firewall is ready for use on production sites. So you can benefit from the powerful protection provided by the latest evolution of the nG Firewall (aka nG Blacklist). The 8G Firewall offers lightweight, server-level protection against a wide range of malicious requests, bad bots, automated attacks, spam, and many other types of threats and nonsense. 8G is a lightweight (only 17KB) strong firewall that provides site security and peace of mind. Plus, 8G is open source and 100% free for everyone :)
SetEnvIf
instead of mod_rewrite
. Learn more and download at GitHub.Contents
About 8G Firewall
The 8G Firewall is a carefully crafted set of security rules for Apache and Nginx servers. It can be applied via your site’s public root .htaccess
file, or added via server configuration. Once added, 8G provides powerful server-level protection against a wide range of malicious requests, bad bots, automated attacks, spam, and many other types of threats and nonsense. It’s a lightweight (only 17KB) strong firewall that improves site security and peace of mind.
8G Firewall builds on 7G, optimizing scope with performance while minimizing false positives. Learn more about nG-series firewall, including 8G and all the details:
Reporting Bugs
As of version 1.3, 8G is out of beta and ready for production sites. Any bugs (false positives) may be reported via my contact form. Or if you have any questions or non-bug-related feedback, you are welcome to leave a comment on this post. Thank you :)
Download 8G Firewall
By downloading 8G, you agree to the terms set forth in the License and Disclaimer. You will find copy of the 8G changelog included in the zip download file. Check out the nG homepage for install steps and complete information.
License & Disclaimer
8G Firewall is open source and 100% free for all. The only requirement is that the following credit lines are included when using 8G (or any of its parts).
# 8G FIREWALL
# https://perishablepress.com/8g-firewall/
Other than that, it’s all yours!
Disclaimer
The 8G Firewall is provided “as-is”, with the intention of helping people protect their sites against bad requests and other malicious activity. The code is open and free to use and modify as long as the first two credit lines remain intact. By using this code you assume all risk and responsibility for anything that happens. So use wisely, test thoroughly, and enjoy the benefits of my work :)
Show support
I spend countless hours developing the nG Firewall. I share it freely and openly with the hope that it will help make the Web a more secure place for everyone.
If you benefit from my work with nG Firewall and would like to show support, consider buying one of my books, such as .htaccess made easy. You’ll get a complete guide to .htaccess, exclusive forum access, and a ton of awesome techniques for configuring, optimizing, and securing your site.
Of course, tweets, likes, links, and shares are super helpful and very much appreciated. Your generous support allows me to continue developing the nG Firewall and other awesome resources for the community. Thank you kindly :)
8G Notes
Any 8G-related notes will be added/updated here..
- Only use 7G or 8G, not both
- 8G is modular: each section can be removed/added as desired
- 8G is designed to work flawlessly with WordPress or any other non-WP site
- 8G adds new “HTTP COOKIE” rules
- Please report any strings or user agents that should not be blocked
- Always test well before going live and report any bugs or issues
- Joomla sites: remove “administrator” from Request URI rules
- Other 8G-related notes will be added here..
130 responses to “8G Firewall”
Thank you for your amazing work! I’m about to start testing 8G.
I have three questions, please.
Question 1: What is the purpose of the lines (which are commented out) containing:
/nG_log.php?log
Question 2: shouldn’t that contain a backslash, as
/nG_log.php\?log
Question 3: Does the 7G Addon still apply?
https://perishablepress.com/stop-aggressive-scanning-uploads/
Thank you
Glad to help:
1) It’s infrastructure for logging of nG requests, matched patterns, and more. Here is a guide that explains how to enable it.
2) Nope, that is to pass a query string with parameter of
log
. Should make more sense after reading the logging tutorial.3) Yes any nG addon is standalone or can be combined with any version of nG Firewall. There may be some overlapping rules, but each addon does provide its own unique firewall rules and patterns.
I hope this helps, let me know if I can provide any further information.
Thank you, Jeff!
How do we follow you to ensure that we know when you update 8G, or when you upgrade to 9G? As it stands, I’d have to just remember to check every two or three months!
Thank you
You can grab the feed or yeah just drop by once in a while to check.
Thank you very much for your efforts. I installed your file on .htaccess and it works perfectly with PrestaShop 8.1 / Apache. If there are any directives that are not necessary for PrestaShop, please let me know so I can remove them and minimize the file size as much as possible
You are very welcome, Alwosta. I am not a PrestaShop user, but no worries the rules are platform agnostic. The nG firewall is focused on protecting against a wide range of threats that don’t really care which app or plugin(s) you’re using.
Thank you, I suggest that you create a module for prestashop and wordpress (and if you want for other platforms…)
It’s a win/win relationship because there are users who don’t know what “ftp” is and what “htaccess” is and they only know install a module!
So you can leave this code open for free for everyone and you will also be paid on other hand for your work.
If you don’t know the Prestashop instructions on how to create a module, try talking to chatgpt or other Ai tools and it will do the rest. All you have left is the photo of the module and some simple adjustments.
How do I block scappers like Opera News from my site?
What is the user agent? That’s the first thing you need.
thanks for your work!
any idea why
https://www.domain.com/assets/css/reset.min.css,layout.min.css,responsive.min.css,form.min.css,mme...-4e26ddf1.css
results in a 403 error and so the (combined) CSS is not loaded?
thank you!
all the best
The three dots
...
would do it.From time to time I see something like this in the logs [cgi:error] [pid 812:tid 1988] [client 80.94.92.60:55428] AH02811: Script not found or stat: C:/xampp/cgi-bin not possible /luci , is it possible? How to effectively protect yourself against this?
I’ve been trying to use the firewall with Open Journal Systems (ver. 3.3.0-14), but this results in the layout being damaged (all styles seem to be removed). This is widely used software and your firewall might be great addition to make it more secure.
If there is any false positive, I just need to know the URL(s) involved. From there, it is possible to test and isolate (and remove) the offending pattern.
Hi, is there a possibility to “Whitelist” two IP addresses? The background is that I have here two SEO tools that require access. If I uncomment the lines with “python” , it works. But the protection is then disabled for my site…
Hey Jeff, first of all thanks for that amazing firewall! I am facing a little issue when using a custom login page with Bricksbuilder. Tbh I don’t know which rule affects this but it results in a 403 forbidden error. So I think it must be something inside the request uri section. The login page is /login and /wp-admin redirects to that url.
This is what the url then looks like. I also cannot access it directly via /login. Also forbidden. Might take a look?
Thanks!
Hi Christian, glad to help. The issue is due to blocking of
/login/
. To resolve, you can remove it as follows:1) Locate the following line:
2) Replace with this:
Save changes and done.
Thanks Jeff!
I also found this line shortly after submitting my comment, but didn’t find a way to remove it again :D
Anyways thank you very much and maybe this will help others as well!
Hi Jeff, Thanks for your amazing works! Where is the NGINX version of 8G? (or when it would be available for downloading)?
Not available yet. When it is, it will be available here: https://nginxdev.com/
Hello Jeff – Thank you for your work! I have been using 7G for many years, but I recently put a friend on the website (he has Apache+NGNIX) and he does not work part of the rules, for example Union+Select, during testing it throws to page 404, and most rules work perfectly (Eval, Base64 and others) The code is installed at the top of HTACESS. What could be the reason? Thanks again for your work!
Hi Untet, not sure. Maybe try placing the rules after other rewrite rules would help?