CyberSecBulletin
CVE-2023-24021NVD status: Modified

Modsecurity: Improper Null Termination

CVE-2023-24021 is a high-severity improper null termination vulnerability in Modsecurity from Trustwave, with a CVSS 3.1 base score of 7.5 out of 10. It can be exploited remotely over the network by an unauthenticated attacker, without any action from a user. The record lists version 2.9.7 as the first without the flaw, so updating Modsecurity to that release or later removes the exposure. There is no confirmed exploitation so far. EPSS estimates a 0.93% chance of exploitation within 30 days, higher than 61% of scored CVEs.

Next patch cycle

High severity with no evidence of exploitation so far.

What to do

  1. Update Modsecurity to 2.9.7 or a later version.
  2. Until you can update, restrict network access to the affected service so it is not reachable from untrusted networks.

Affected products and versions

VendorProductAffected versionsFixed in
TrustwaveModsecuritybefore 2.9.72.9.7
DebianDebian Linux10.0Not stated

Version data comes from NVD's product matching. Confirm against the vendor advisory before deciding you are unaffected.

How the severity score breaks down

Attack vector
NetworkCan be exploited remotely over a network, including the internet.
Attack complexity
LowNo special conditions are needed; the attack works reliably.
Privileges required
NoneNo account or login is needed.
User interaction
NoneNo action by a victim is required.
Scope
UnchangedImpact stays within the vulnerable component.
Confidentiality
NoneNo data is disclosed.
Integrity
HighData or code can be modified at will.
Availability
NoneAvailability is not affected.

Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N. Scored by NVD.

Scoring systemScoreSeverityScored by
CVSS 3.17.5HighNVD
CVSS 3.17.5HighCISA (ADP)

Official description

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_TMP_CONTENT collection.

Source: the CVE record as published by its numbering authority, via NVD and CVE.org.

The underlying weakness: Improper Null Termination

The product does not terminate or incorrectly terminates a string or array with a null character or equivalent terminator.

How developers prevent this class of flaw

  • Use a language that is not susceptible to these issues. However, be careful of null byte interaction errors (CWE-626) with lower-level constructs that may be written in a language that is susceptible.
  • Ensure that all string functions used are understood fully as to how they append null characters. Also, be wary of off-by-one errors when appending nulls to the end of strings.
  • If performance constraints permit, special code can be added that validates null-termination of string buffers, this is a rather naive and error-prone solution.

More Improper Null Termination vulnerabilities (CWE-170)

Timeline

  1. CVE record published.
  2. CISA published its SSVC assessment (exploitation: none, automatable: yes, technical impact: partial).
  3. Record last changed materially (score, affected products, status or references).

References

Third-party and government advisories

Recent Improper Null Termination vulnerabilities

Spotted an error? Tell us.