Skip to content

GenWebSec: Adaptive Web Application Firewall Hardening with Co-Evolving LLM Attack and Defense Agents

Vahid Babaey, Arun Ravindran

cs.CR

Abstract

Large language models (LLMs) enable attackers to rapidly generate and adapt exploit payloads in response to defensive updates, outpacing manual web application firewall (WAF) rule maintenance. Evaluating automated defenses solely against static attack corpora leaves open whether synthesized rules remain compact and effective when attackers adapt. We present GenWebSec, an execution-grounded framework that pairs LLM attack and defense agents in a closed WAF hardening loop. Generated exploits are validated through live application execution and WAF replay; the defender then synthesizes rules individually or in groups under coverage-checked admission and strict benign false-positive bounds before renewed attack search challenges the updated defense. Across six custom SQL injection (SQLi) and cross-site scripting (XSS) targets protected by ModSecurity WAF with OWASP Core Rule Set (CRS) 4.29.0, 78.0-99.6% of application-valid payloads bypassed CRS, and every confirmed bypass also evaded Coraza and BunkerWeb WAFs under the same ruleset. On matched fixed corpora, grouped synthesis reduced median rule counts from 93.5-297 (per-payload) to 1-3 per page while blocking 99.6-100% of bypasses. Under iterative adaptive hardening, renewed search found post-update bypasses in 19 of 60 runs, yet grouped hardening converged to a median of one rule per run (range 1-4), blocked 2,420 of 2,421 in-loop bypasses, and kept mean added false positives at or below 0.28%. Frozen rules generalized across attack models (blocking 96.3-100% of attacks from a different LLM) and transferred unchanged to unseen applications (bWAPP and OWASP Juice Shop), blocking 89.4-94.9% of SQLi and 97.6-97.7% of XSS bypasses (on bWAPP) with zero added false positives on external benign traffic.

Create a lesson

Metadata

Categories
cs.CR, cs.AI