Web Application Firewall Bypass in ModSecurity: CVE-2023-24021

modsecurity-apache Updated 02 Oct 2025

Summary

20/01/2023
N/A
Yes i
High
7.5

CVE-2023-24021: Incorrect handling of '\0' bytes in file uploads in ModSecurity before 2.9.7 may allow for Web Application Firewall bypasses and buffer over-reads on the Web Application Firewall when executing rules that read the FILES_... Affects modsecurity-apache versions < 2.9.3-3+deb11u2. Fixed in 2.9.3-3+deb11u2. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

Background

ModSecurity is an open-source web application firewall (WAF) designed to protect web applications from various attacks. It operates as an Apache module, providing real-time monitoring, logging, and access control for web traffic. The package is widely used for its ability to enforce security policies and mitigate threats. However, a vulnerability has been identified that compromises its effectiveness, specifically related to the handling of null ('\0') bytes in file uploads.

Vulnerability Detail

CVE-2023-24021 arises from incorrect handling of '\0' bytes in file uploads within ModSecurity versions prior to 2.9.7. This flaw may allow attackers to bypass the web application firewall, leading to potential buffer over-reads when executing rules that read the FILES_TMP_CONTENT collection. The vulnerability can be exploited to manipulate file uploads, posing a significant risk to the integrity and security of web applications protected by ModSecurity.

How To Fix

Minimum fixed version

2.9.3-3+deb11u2

This is the first release that contains the fix.

sudo apt-get install --only-upgrade modsecurity-apache

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, users can implement stricter input validation and sanitization for file uploads to mitigate the risk of exploitation until the upgrade is completed. This may include checking file types, sizes, and content before processing uploads.

Conclusion

CVE-2023-24021 represents a significant vulnerability in ModSecurity that can lead to web application firewall bypasses. Users are strongly advised to upgrade to the latest versions to protect their applications from potential exploitation. Implementing additional input validation measures can also help mitigate risks until the upgrade is completed.

See every vulnerability recorded for modsecurity-apache →

Share this vulnerability

FAQ

CVE-2023-24021 is a vulnerability in ModSecurity that allows for potential bypass of the web application firewall due to improper handling of null bytes in file uploads.

You can check if your application is affected by using the Vulert playground at Vulert Scanner, which analyzes your manifest file for vulnerabilities.

Exploitation of this vulnerability can lead to unauthorized access, data breaches, and manipulation of file uploads, compromising the security of web applications.

Yes, patches are available in the form of updated versions of ModSecurity. Users should upgrade to the specified versions to mitigate the risk.

Vulert is a service that monitors and alerts for open-source vulnerabilities in software using a manifest file. It provides real-time insights without requiring code access or installation.

Related vulnerabilities

Recent vulnerabilities recorded for modsecurity-apache.

Sponsored Lume, the Habilume companion Habilume Habit tracker with a companion that grows with you Complete habits, earn Lume Points, and watch your Lume grow as you stay consistent. App Store Google Play

How To Fix

Minimum fixed version

2.9.3-3+deb11u2

This is the first release that contains the fix.

sudo apt-get install --only-upgrade modsecurity-apache

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback