FreeBSDOperating system

CVE-2023-5941

CRITICAL · 9.8 CVSS v3.1 Published 2023-11-08
Fix available
A fix is available. Upgrade to 12.4 / 13.2 or later.
See remediation →
100/100
Remediation priority · Urgent
Remotely reachable No privileges Zero-click

Official description Straight from the sourceThe vendor's or NVD's own wording, published unedited. Authoritative, but often terse — it says what broke, rarely what to do.

NVD · unedited
In versions of FreeBSD 12.4-RELEASE prior to 12.4-RELEASE-p7 and FreeBSD 13.2-RELEASE prior to 13.2-RELEASE-p5 the __sflush() stdio function in libc does not correctly update FILE objects' write space members for write-buffered streams when the write(2) system call returns an error.  Depending on the nature of an application that calls libc's stdio functions and the presence of errors returned from the write(2) system call (or an overridden stdio write routine) a heap buffer overflow may occur. Such overflows may lead to data corruption or the execution of arbitrary code at the privilege level of the calling program.

Technical summary Written by usOur analysis, written from the advisory, the CVSS vector and the affected-version data. It adds context the advisory leaves out, and never invents facts that are not in the source.

dbcve analysis · high confidence

Heap buffer overflow in FreeBSD libc's __sflush() function. When write(2) returns an error, the function fails to properly update FILE structure members for write-buffered streams, allowing overflow into adjacent heap memory. This can lead to data corruption or arbitrary code execution at the application's privilege level.

MitigationApply FreeBSD security patches: upgrade to 12.4-RELEASE-p7 or 13.2-RELEASE-p5 or later. This is a libc library update requiring system reboot or service restart to take effect.

Verify against the referenced sources before acting — the references below are authoritative for this CVE, this summary is not.

Affected products & versions What the vendor confirmedThe version ranges the vendor confirmed as vulnerable. If your version sits inside a range here, treat yourself as exposed until you have upgraded.

NVD · CPE data
FreeBSDOperating system
Affected:< 12.4>= 13.0, < 13.2= 12.4= 13.2

CVSS breakdown How the score is builtThe industry scoring standard. It rates how the flaw is reached, what it takes to exploit, and what an attacker gains — the score is derived from those, not the other way round.

From the vector
Attack vector
Network
Complexity
Low
Privileges
None
User interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Am I affected? How to checkSteps we derive from the advisory and the affected-version data, so you can decide whether this CVE reaches your setup. They are a guide, not a scan — your own configuration is the authority.

dbcve checks

Work through these to decide whether this CVE applies to you.

  1. Check the running FreeBSD kernel version
    Run `uname -a` and note the version string (e.g., 12.4-RELEASE or 13.2-RELEASE)
    Affected if The version shows FreeBSD 12.x before 12.4-RELEASE-p7, or FreeBSD 13.x before 13.2-RELEASE-p5, or any version earlier than 12.4 or between 13.0 and 13.1
  2. Check the installed FreeBSD base system version
    Run `freebsd-version -k` to get the installed kernel version
    Affected if The output indicates an unpatched version matching the vulnerable ranges above
  3. Verify the libc library patch level
    Run `freebsd-version` (without flags) to see both running and installed versions, or check for patch level in `uname -a` output after -p (e.g., -p7)
    Affected if The patch level number (after -p) is less than 7 for 12.4, or less than 5 for 13.2, or absent entirely for versions in the affected range

If the system runs FreeBSD 12.x < 12.4-RELEASE-p7 or FreeBSD 13.x < 13.2-RELEASE-p5, the libc containing the vulnerable __sflush() code is present.

Generated from the published advisory. Verify against your own configuration.

Check your environment

Paste your version and any relevant configuration and it will be compared against the affected criteria above. Do not include secrets or credentials.

AI-assisted, checked against the advisory. Informational, not a guarantee.

Remediation Closing itWhat it takes to close this. Where a vendor fix exists we point at it; where none exists we say so plainly, and can build one. Effort estimates are scoped from the advisory, not from your codebase.

dbcve · scoped
Upgrade available Upgrade to 12.4 / 13.2 or later
Fixed in 12.413.2
Interim mitigation

Apply FreeBSD security patches: upgrade to 12.4-RELEASE-p7 or 13.2-RELEASE-p5 or later. This is a libc library update requiring system reboot or service restart to take effect.

Recommended fix High confidence

FreeBSD 12.4-RELEASE-p7 or FreeBSD 13.2-RELEASE-p5 (via freebsd-update or source rebuild)

  1. Run 'freebsd-version -u' to confirm your current FreeBSD version
  2. For FreeBSD 12.x systems: Run 'freebsd-update fetch install' to update to 12.4-RELEASE-p7 or later
  3. For FreeBSD 13.x systems: Run 'freebsd-update fetch install' to update to 13.2-RELEASE-p5 or later
  4. Alternatively, rebuild world and kernel from source using 'make buildworld buildkernel' and install with 'make installworld installkernel' from branches/releng/12_4 or branches/releng/13_2 after patches are applied
  5. Reboot the system after applying updates
  6. Verify the patch level with 'uname -a' to confirm the p7 or p5 patch level is installed
Caveat Standard FreeBSD patch apply risk - minor point releases typically have low risk but test in staging first

Generated from the published advisory — verify against the referenced sources before acting.

Fix this in FreeBSD Scoped from the published advisory
  • Consultation2.0 h
  • Implementation3.0 h
  • Testing2.0 h
  • Review / QA1.0 h
8.0 hours of engineering $1,420
Get the upgrade done

An estimate, not a bill — we confirm scope with you before any work starts. Need it this week? Rush from $2,272.

Scan for this in your stack

Free · runs locally
dbcve dependency scanner

Check whether your project pulls in CVE-2023-5941 — or any other known-vulnerable package — straight from your lock files. Free and open source; it runs locally and uploads nothing.

References Go to the primary sourcePrimary sources — vendor advisories, patches and trackers. Where our summary and a reference disagree, the reference wins.

Primary sources

Practitioner notes

Contributed

Peer-ranked notes from engineers who’ve handled CVE-2023-5941 in production — separate from our analysis above.

No notes yet

Be the first to add a field note for this CVE — a mitigation you’ve verified, a version caveat, or a link to a working fix. Sign in above to contribute.

What this is

A place for practitioners to share what actually worked: a mitigation you’ve tested, a configuration change, a version- or environment-specific caveat, or a link to a verified patch. The most useful notes rise to the top as peers upvote them, so the signal stays high.

What belongs here
  • Verified mitigations, workarounds, and config changes
  • Version or environment caveats, and links to real fixes
  • No weaponised exploit code, or anything meant to cause harm
  • No spam, self-promotion, credentials, or personal data