NAXSI – Open-Source WAF For Nginx

The New Acunetix V12 Engine


NAXSI is an open-source WAF for Nginx (Web Application Firewall) which by default can block 99% of known patterns involved in website vulnerabilities. NAXSI means Nginx Anti XSS & SQL Injection

NAXSI - Open-Source WAF For Nginx

Technically, it is a third party Nginx module, available as a package for many UNIX-like platforms. This module, by default, reads a small subset of simple (and readable) rules containing 99% of known patterns involved in websites vulnerabilities. For example, <, | or drop are not supposed to be part of a URI.

Being very simple, those patterns may match legitimate queries, it is NAXSI's administrator duty to add specific rules that will whitelist those legitimate behaviours. The administrator can either add whitelists manually by analyzing Nginx's error log, or (recommended) start the project by an intensive auto-learning phase that will automatically generate whitelisting rules regarding website's behaviour.


In short, NAXSI behaves like a DROP-by-default firewall, the only job needed is to add required ACCEPT rules for the target website to work properly. I love Nginx and use it for everything, so having a bit of extra protection for it, without too much hassle is great.

Why is it Different?

On the contrary of most Web Application Firewall, Naxsi doesn't rely on a signature base, like an antivirus, and thus cannot be circumvented by an "unknown" attack pattern. Another main difference between NAXSI and other WAF, NAXSI filters only GET and POST resquests, is a Free software (as in freedom) and free (as in free beer) to use.

Do note though, this model requires a bit more effort as you have to whitelist to get things to work but it will block more obfuscated and uncommon attacks without updates or modifications.

You can download the latest version of the module source code here:

naxsi-0.54.zip

But it's most easily installed with an optional distro friendly NAXSI included version of Nginx, which you just need to tweak the config for. On Ubuntu systems for example you'd just do:

One downside of this is you won't get the newest version of NAXSI (or most likely the latest Nginx either) but it will be stable. As Nginx doesn't support runtime module loading you can't update NAXSI outside of recompiling Nginx (not ideal).

You can also read more here.

Posted in: Countermeasures, Security Software

,


Latest Posts:


Malcom - Malware Communication Analyzer Malcom – Malware Communication Analyzer
Malcom is a Malware Communication Analyzer designed to analyze a system's network communication using graphical representations of network traffic.
WepAttack - WLAN 802.11 WEP Key Hacking Tool WepAttack – WLAN 802.11 WEP Key Hacking Tool
WepAttack is a WLAN open source Linux WEP key hacking tool for breaking 802.11 WEP keys using a wordlist based dictionary attack.
Eraser - Windows Secure Erase Hard Drive Wiper Eraser – Windows Secure Erase Hard Drive Wiper
Eraser is a hard drive wiper for Windows which allows you to run a secure erase and completely remove sensitive data from your hard drive by overwriting it several times with carefully selected patterns.
Insecure software versions are a problem Web Security Stats Show XSS & Outdated Software Are Major Problems
Netsparker just published some anonymized Web Security Stats about the security vulnerabilities their online solution identified on their users’ web applications and web services during the last 3 years.
CTFR - Abuse Certificate Transparency Logs For HTTPS Subdomains CTFR – Abuse Certificate Transparency Logs For HTTPS Subdomains
CTFR is a Python-based tool to Abuse Certificate Transparency Logs to get subdomains from a HTTPS website in a few seconds.
testssl.sh - Test SSL Security Including Ciphers, Protocols & Detect Flaws testssl.sh – Test SSL Security Including Ciphers, Protocols & Detect Flaws
testssl.sh is a free command line tool to test SSL security, it checks a server's service on any port for the support of TLS/SSL ciphers, protocols as well as recent cryptographic flaws and more.


2 Responses to NAXSI – Open-Source WAF For Nginx

  1. Vladimir Smitka March 22, 2016 at 2:30 pm #

    Nginx 1.9.11 and newer supports runtime module loading ;-)

    https://www.nginx.com/blog/dynamic-modules-nginx-1-9-11/

    • Darknet March 22, 2016 at 5:09 pm #

      Oh nice, no wonder the separate nginx-nasxi package isn’t going to be supported any more. Current Ubuntu LTS version is only at nginx 1.4.6 tho – so a fair way behind.