ModSec-Learn: Boosting ModSecurity with Machine Learning
Christian Scano, Giuseppe Floris, Biagio Montaruli, Luca Demetrio,, Andrea Valenza, Luca Compagna, Davide Ariu, Luca Piras, Davide Balzarotti,, and Battista Biggio

TL;DR
ModSec-Learn enhances ModSecurity by integrating machine learning to adapt rule contributions for improved attack detection and reduced false positives, outperforming traditional heuristic-based methods.
Contribution
This work introduces a machine learning approach that tunes CRS rule weights based on application-specific data, improving detection accuracy and reducing false positives.
Findings
Achieves better detection and false positive trade-off.
Reduces over 30% of CRS rules at inference time.
Provides open-source code and dataset for reproducibility.
Abstract
ModSecurity is widely recognized as the standard open-source Web Application Firewall (WAF), maintained by the OWASP Foundation. It detects malicious requests by matching them against the Core Rule Set (CRS), identifying well-known attack patterns. Each rule is manually assigned a weight based on the severity of the corresponding attack, and a request is blocked if the sum of the weights of matched rules exceeds a given threshold. However, we argue that this strategy is largely ineffective against web attacks, as detection is only based on heuristics and not customized on the application to protect. In this work, we overcome this issue by proposing a machine-learning model that uses the CRS rules as input features. Through training, ModSec-Learn is able to tune the contribution of each CRS rule to predictions, thus adapting the severity level to the web applications to protect. Our…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsAdvanced Data Processing Techniques · Software Engineering Research · Software Reliability and Analysis Research
MethodsSparse Evolutionary Training
