Fall Sale! Code FALL2024 takes 25% OFF our Pro Plugins & Books »
Web Dev + WordPress + Security

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 :)

Update: 8G Firewall is out of beta as of version 1.3, now available for download. A huge thank you to all beta testers :)
Update: 8G has been forked by Tonkünstler-on-the-Bund to use 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:

Support 8G Firewall: Donate via PayPal or your favorite digital coin »

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 :)

nG Logging: Just FYI, 7G and 8G Firewall support logging of each request, matching patterns, and more. Learn how to enable logging with nG Firewall.

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.

Download 8G FirewallVersion 1.3 ( 7.13 KB ZIP )
Note: To retain the Unix LF EOL characters (line breaks) in the 8G text file, it is recommended to use a program that supports them, such as Notepad++ (free for Windows) or TextEdit or BBEdit (free for Mac). The line breaks keep the code structured and readable, instead of a big jumbled mess.

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 :)

Support 8G Firewall: Donate via PayPal, Stripe, or your favorite digital coin »

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..

About the Author
Jeff Starr = Fullstack Developer. Book Author. Teacher. Human Being.
GA Pro: Add Google Analytics to WordPress like a pro.

130 responses to “8G Firewall”

  1. 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

    • Jeff Starr 2024/02/28 12:12 pm Reply

      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.

  2. 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

  3. 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

    • Jeff Starr 2024/03/07 11:06 am Reply

      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.

  4. 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.

  5. How do I block scappers like Opera News from my site?

  6. herr rilke 2024/03/11 2:08 amReply

    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

  7. 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?

  8. 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.

    • Jeff Starr 2024/03/13 10:23 am Reply

      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.

  9. 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…

  10. 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.

    /login/?redirect_to=https%3A%2F%2Fmydomain.com%2Fwp-admin%2F&reauth=1

    This is what the url then looks like. I also cannot access it directly via /login. Also forbidden. Might take a look?

    Thanks!

    • Jeff Starr 2024/03/23 10:32 am Reply

      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:

      RewriteCond %{REQUEST_URI} (/)(filemanager|htdocs|httpdocs|https?|login|mailman|mailto|msoffice|undefined|usage|var|vhosts|webmaster|www)(/) [NC,OR]

      2) Replace with this:

      RewriteCond %{REQUEST_URI} (/)(filemanager|htdocs|httpdocs|https?|mailman|mailto|msoffice|undefined|usage|var|vhosts|webmaster|www)(/) [NC,OR]

      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!

  11. Hi Jeff, Thanks for your amazing works! Where is the NGINX version of 8G? (or when it would be available for downloading)?

  12. 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!

Leave a reply

Name and email required. Email kept private. Basic markup allowed. Please wrap any small/single-line code snippets with <code> tags. Wrap any long/multi-line snippets with <pre><code> tags. For more info, check out the Comment Policy and Privacy Policy.

Subscribe to comments on this post

Welcome
Perishable Press is operated by Jeff Starr, a professional web developer and book author with two decades of experience. Here you will find posts about web development, WordPress, security, and more »
Banhammer: Protect your WordPress site against threats.
Thoughts
Went out walking today and soaked up some sunshine. It felt good.
I have an original box/packaging for 2010 iMac if anyone wants it free let me know.
Always ask AI to cite its sources.
All free plugins updated and ready for WP 6.6 dropping next week. Pro plugin updates in the works also complete :)
99% of video thumbnail/previews are pure cringe. Goofy faces = Clickbait.
RIP ICQ
Crazy that we’re almost halfway thru 2024.
Newsletter
Get news, updates, deals & tips via email.
Email kept private. Easy unsubscribe anytime.