Web Application Firewall 2.0
Our Web Application Firewall 3.0 module will be shortly be released with Caddy Server, replacing our previous WAF 2.0 technology (Nginx and HAProxy - SslTerminating) to take Web Application Firewall's Peformance, Security and SSL Certificate Collecting to the next level.
- Web Application Firewall 2.0
- Introduction
- Technical overview
- Compatibility
- Pre-requirements
- Enable the Transparent Proxy
- WAF 2.0 with HTTPS
- Preparing log files
- Using Apache *Required for DNAT redirection only
- Apache with Plesk
- cPanel on Apache *Required for DNAT redirection only
- cPanel on LiteSpeed server
- cPanel on an NGINX *Required for DNAT redirection only
- Installing mod_remoteip *Required for DNAT redirection only
- Installing mod_remoteip on cPanel servers *Required for DNAT redirection only
- Installing mod_rpaf on Debian/Ubuntu
- Installing mod_rpaf on CentOs and others
- Activating and Deactivating the WAF 2.0 module
- Activation
- Deactivation
- Issues with the WAF module?
- Configuration
- Web Application Firewall: Rate limiting feature
- ModSecurity
- Domain pattern configuration
- Safe implementation best practices
- Relation to other modules
- Log files
- Modifying Nginx reverse proxy settings
- FAQ
- How can I handle false positives?
- Does the WAF 2.0 work on AWS or Azure?
The web is the most vulnerable interface on most servers. Having a powerful web application firewall is an essential part of the defense toolset if you host any web content. The biggest challange of a WAF is to find the balance between security level and false positive rate. You don't want a weak web application firewall, but you can't afford many false positives either. Finding this balance was the leading cause of the WAF 2.0 BitNinja module to be born.
Introduction
Generally speaking, web application firewalls monitor, filter, and block incoming and outgoing traffic on HTTP protocol. Through analysis, it's a good protection shield against common web hacks, like injection flaws (eg. SQL injection), cross site scripting (XSS), session hijacking, remote and local file inclusions and other attacks.
We created an application layer firewall that is also known as a proxy-based firewall. You can easily activate it on the Dashboard (see instructions below).
BitNinja WAF 2.0 only scans incoming traffic currently, in real-time, with the built-in HTTP proxy solution. Upon activation, BitNinja adds an iptables rule to your nat iptables table to redirect all traffic coming from port 80 to a port dedicated for BitNinja WAF 2.0. The WAF 2.0 process analyzes the incoming traffic and makes a connection to your local HTTP server to fetch the actual content.
HTTPS support for our WAF 2.0 is also available, however in order for this to work, you must have SslTerminating enabled.
This is to ensure that the certificates are collected properly and BitNinja agent can see the attackers behind HTTPS
We maintain filter patterns, and update and fine-tune regularly with new BitNinja versions. If BitNinja finds any suspicious connections, it will challenge list the IP and send the incident to the BitNinja Analyzer Central.
Technical overview
Through the development of the original WAF module, we realized there are way too many features that we need to implement just to catch up with the open-source solutions. That's why we decided to change our technology stack here and use industry-standard technologies. We started to look for different WAF models and then decided to choose a model used by CloudFlare and Incapsula. The WAF 2.0 is based on a very fast reverse proxy engine, the well-known nginx 1.23. Plus, supported by a well-known and very reliable WAF engine (mod_security v3) and a battle-tested ruleset from the Open Web Application Security Project, the OWASP crs v3.
This setup works very well. The performance is killer. In the near future, we will constantly update and finetune the ruleset, add other rulesets and implement more and more rules. We monitor the false positive rates of all rules and based on this we can tweak risky rules on the fly, and release the fixes very often.
We ship the custom-built and tuned nginx + lib-modsecurity package with bitninja. The package is called
bitninja-waf and it installs in /opt/bintinja-waf.
The waf-manager BitNinja module is responsible for managing the nginx + lib-modsecurity stack. It automatically installs, starts, configures, reconfigures and stops the nginx instances.
When nginx is started and it is ready to accept connections for filtration, the waf-manager module sets up the redirection rules to redirect incoming traffic to the WAF 2.0. The WAF 2.0 then uses the currently used http server as a backend and pass the filtered traffic on.