ModSec-Learn: Boosting ModSecurity with Machine Learning

Scano, Christian
First
;
Floris, Giuseppe
Second
;
Demetrio, Luca;Ariu, Davide;Piras, Luca;Biggio, Battista
2025-01-01

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 experiments show that ModSec-Learn achieves a significantly better trade-off between detection and false positive rates. Finally, we analyze how sparse regularization can reduce the number of rules that are relevant at inference time, by discarding more than 30% of the CRS rules. We release our open-source code and the dataset at https://github.com/pralab/modsec-learn and https://github.com/pralab/http-traffic-dataset, respectively.
2025
Inglese
Lecture Notes in Networks and Systems, vol 1198
978-3-031-76458-5
978-3-031-76459-2
Springer, Cham
GEWERBESTRASSE 11, CHAM, CH-6330
SVIZZERA
Christian Scano, et. al.
23
33
11
Distributed Computing and Artificial Intelligence, Special Sessions I, 21st International Conference
Esperti anonimi
26th-28th June, 2024
Salamanca, Spain
scientifica
Web Application Firewalls, Machine Learning, Web Security, SQL injection, OWASP ModSecurity Core Rule Set
no
4 Contributo in Atti di Convegno (Proceeding)::4.1 Contributo in Atti di convegno
Scano, Christian; Floris, Giuseppe; Montaruli, Biagio; Demetrio, Luca; Valenza, Andrea; Compagna, Luca; Ariu, Davide; Piras, Luca; Balzarotti, Davide; ...espandi
273
10
4.1 Contributo in Atti di convegno
partially_open
info:eu-repo/semantics/conferencePaper
Files in This Item:
File Size Format  
ModSec-Learn.pdf

Solo gestori archivio

Type: versione editoriale
Size 1.16 MB
Format Adobe PDF
1.16 MB Adobe PDF & nbsp; View / Open   Request a copy
ModSec_AAM_compressed.pdf

Open Access from 12/03/2026

Type: Author’s Accepted Manuscript AAM, Post-print, (version accepted by the publisher)
Size 822.05 kB
Format Adobe PDF
822.05 kB Adobe PDF View/Open

Items in DSpace are protected by copyright, with all rights reserved, unless otherwise indicated.

Questionnaire and social

Share on:
Impostazioni cookie