CVE-2023-5941: libc stdio buffer overflow

CVE-2023-5941 affects 119 listed versions of FreeBSD in the Dawnsentry catalogue.

9.8CVSS critical
None knownexploitation
1%EPSS (next 30 days)
8 November 2023published

Affected products and versions

The versions in the Dawnsentry catalogue this CVE affects, judged from the vendor's own advisory where there is one, otherwise from the CVE record and NVD, as each version's own page says.

FreeBSD

119 of 250 listed versions are affected. Fixed in 13.2-RELEASE-p5, 12.4-RELEASE-p7. The newest release, 15.1-p7, is not affected.

13.2-p4 13.2-p3 13.2-p2 13.2-p1 13.2 13.1-p9 13.1-p8 13.1-p7 13.1-p6 13.1-p5 13.1-p4 13.1-p3 13.1-p2 13.1-p1 13.1-b2-p2 13.1-b1-p1 13.1 13.1-rc1-p1 13.0-p13 13.0-p12 13.0-p11 13.0-p10 13.0-p9 13.0-p8 13.0-p7 13.0-p6 13.0-p5 13.0-p4 13.0-p3 13.0-p2 13.0-p1 13.0 12.4-p6 12.4-p5 12.4-p4 12.4-p3 12.4-p2 12.4-p1 12.4 12.4-rc2-p2 12.4-rc2-p1 12.3-p12 12.3-p11 12.3-p10 12.3-p9 12.3-p8 12.3-p7 12.3-p6 12.3-p5 12.3-p4 12.3-p3 12.3-p2 12.3-p1 12.3 12.2-p15 12.2-p14 12.2-p13 12.2-p12 12.2-p11 12.2-p10 and 59 more

What it is

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.

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

Published by Freebsd on 8 November 2023. Last changed 17 June 2026.

Sources

Check one version you run: look CVE-2023-5941 up, or pick a product and version in the quick lookup.

Updated 1 December 2026.