A web application firewall (or WAF) filters, monitors, and blocks HTTP traffic to and from a web application.
A WAF is differentiated from a regular firewall in that a WAF is able to filter the content of specific web applications while regular firewalls
serve as a safety gate between servers. By inspecting HTTP traffic, it can prevent attacks stemming from web application security flaws,
such as SQL injection, cross-site scripting (XSS), file inclusion, and security misconfigurations.
ModSecurity, sometimes called Modsec, is an open-source web application firewall (WAF).
Originally designed as a module for the Apache HTTP Server, it has evolved to provide an array of Hypertext Transfer Protocol request
and response filtering capabilities along with other security features across a number of different platforms including Apache HTTP Server,
Microsoft IIS and Nginx. It is a free software released under the Apache license 2.0.
The platform provides a rule configuration language known as 'SecRules' for real-time monitoring, logging,
and filtering of Hypertext Transfer Protocol communications based on user-defined rules.
Although not its only configuration, ModSecurity is most commonly deployed to provide protections against generic classes of
vulnerabilities using the OWASP ModSecurity Core Rule Set (CRS). This is an open-source set of rules written in ModSecurity's SecRules language.
The project is part of OWASP, the Open Web Application Security Project. Several other rule sets are also available.
To detect threats, the ModSecurity engine is deployed embedded within the webserver or as a proxy server in front of a web application.
This allows the engine to scan incoming and outgoing HTTP communications to the endpoint. Dependent on the rule configuration the engine
will decide how communications should be handled which includes the capability to pass, drop, redirect, return a given status code,
execute a user script, and more.