Nginx Free WAF: NAXSI vs Nemesida WAF Free

Today we would like to test and compare work of two free WAFs: NAXSI and Nemesida WAF Free. We will take into account ease of use, quality of preinstalled signatures, quantity of an attack missing and frequency of false positives.

NAXSI means Nginx Anti XSS & SQL Injection. Its operation principle is following: «everything which is not allowed is forbidden». Every HTTP request (GET|PUT|POST only) is checked on the compliance to the patterns of prohibited rules set by default in file naxsi_core.rules. These rules cover 99% of all possible variants of malicious requests. For example, by default all requests in which URL double quote mark is content are prohibited. If for normal web application work this mark is necessary, you should make the corresponding exclusion in whitelist (WL). But there is other side — if allowed rules will be elaborate bad, NAXSI will block a part of the legitimate requests. That is why the vendors put the responsibility for the result on the system administrator. As a majority of modules for Nginx, NAXSI is not available from the repository, that is why you have to download and compile it manually.

About Nemesida WAF
The dynamic module of Nemesida WAF Free is a free WAF for Nginx based on the signature method with basic protection for a web application against OWASP class attacks. Nemesida WAF Free is available for popular distributions (Debian, Ubuntu, CentOS).

A distinctive feature of Nemesida WAF Free is its own signature database which detects attacks on web applications with a minimum number of false positives, as well as:
– minimum requirements to hardware resources;
– update from repository;– installation and configuration in a few minutes;
– ease of maintenance (creating white lists for signatures, IP addresses and virtual

Setting Up

NAXSI rules

Briefly about the rules
We had added the first 5 rules in whitelist only to load the site. Rules deal with () <>, also were added in whitelist, because they are using while creating the content on the site (it is possible to write some of refinements in brackets and during the text edition use HTML tags). All in all if you will decide use NAXSI you should be ready to waste a lot of time for making WL. More than that with every WL a chance of an attack missing increases.

Nemesida WAF Free
After the installation Nemesida WAF Free a preset was not require, false positives were not detected.Configuration file Nemesida WAF Rules was not change:

Nemesida WAF default config


But if you will use URL encode, the request will change to:


and will not be blocked:

When this URL encode occurs in Body/ARGS — NAXSI will perform a preliminary request URL decoding. As an example we tried to exploit an injection on the login page to pass an authorization, but, unlike previous example, NAXSI understood our intentions:

Nemesida WAF Free
Nemesida WAF Free uses double decoding of all zones, that is why all requests were blocked:


But response splitting:

cat /etc/pas?wd

will not allow to detect the signature and the attack will perform.

It is rather difficult to create signatures for such attacks, because of their wide variation. Machine learning module is able to detect such attacks (its variations, zero day attacks etc.), which is available in full version of Nemesida WAF.


As previously mentioned, while the text content creation or edition on the site it is possible to use brackets or HTML tags. The need to add these characters to the white list for the correct site using led to possibility of performing XSS:

Nemesida WAF Free
The request was blocked:


  • preinstalled signatures do not allow to work with web application, while the whitelist creation encourage to bypass NAXSI;
  • vulnerabilities in source code allow to bypass NAXSI (lack of URL decoding in cookie etc.). High quality of the signatures database of Nemesida WAF Free allows to use the module with the settings from the box without false positives. More than that, Nemesida WAF Free has functionality of an addition users rules, easy installation from repository and does not require an additional settings for basic work.

That is all! If you use NAXSI you must try Nemesida WAF Free.

From Information Security With Love