HIGH 7.8

CVE-2026-45257: FreeBSD KTLS Local Privilege Escalation via File Overwrite

A vulnerability in FreeBSD's kernel TLS (KTLS) implementation allows an unprivileged local user to overwrite arbitrary files on the system. The flaw stems from the KTLS receive path decrypting data in place without properly handling file-backed memory. When a user sends a file via sendfile(2) over a loopback connection with KTLS receive enabled, the decryption operation overwrites the original file's contents instead of a private copy. An attacker can exploit this to corrupt or replace critical system files, including setuid binaries, achieving local privilege escalation and potential full system compromise.

Source data · NVD / CISA · public domain

CVSS
3.1 · 7.8 HIGH · CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
Weaknesses (CWE)
CWE-123
Affected products
33 configuration(s)
Published / Modified
2026-06-26 / 2026-06-27

NVD description (verbatim)

The KTLS receive path decrypted each record in place, assuming that the mbufs holding received data were anonymous and safe to modify. This assumption does not hold for data placed on a socket by sendfile(2), which can reference file-backed memory directly through non-anonymous M_EXTPG pages or EXT_SFBUF mbufs. When the sender transmits such data over a loopback connection without enabling KTLS on the transmit side, the file-backed mbufs reach the receiver's decryption path unchanged. Decrypting a record in place then overwrites the backing file's page cache instead of a private copy of the data. An unprivileged local user who can read a file can overwrite its contents with data of their choosing by sending the file over a loopback connection on which they have enabled KTLS receive. The write modifies the page cache directly, so it bypasses file flags such as schg and is written back to disk. By overwriting a setuid binary or other trusted file, a local user can escalate privileges, potentially gaining full control of the affected system.

4 reference(s) · View on NVD →

SEC.co analysis · AI-assisted, reviewed against source

Technical summary

CVE-2026-45257 is a write-after-free vulnerability in FreeBSD's KTLS receive path. The kernel's implementation assumes all received data resides in anonymous, writable memory buffers (mbufs). However, data transmitted via sendfile(2) can reference file-backed memory directly through non-anonymous M_EXTPG pages or EXT_SFBUF mbufs. When such file-backed data traverses a loopback socket with KTLS receive enabled but KTLS transmit disabled, the mbufs remain unencrypted and unchanged. The receive-side decryption operation then modifies these mbufs in place, directly corrupting the page cache backing the original file. This bypasses standard file protection mechanisms (immutable flags) and persists to disk, enabling arbitrary file modification with user-level privileges.

Business impact

Organizations running FreeBSD as a server, workstation, or containerized environment face significant risk of data integrity compromise and privilege escalation attacks. A local user with filesystem read access can weaponize this flaw to overwrite system binaries, configuration files, or application code, leading to unauthorized command execution, lateral movement, and potential data theft. Systems with shared user accounts or multi-tenant deployments are particularly vulnerable. The ability to bypass immutable file flags and directly corrupt disk-backed data means standard protective measures provide limited defense.

Affected systems

FreeBSD systems running versions with KTLS support. The vendor data indicates multiple FreeBSD releases are affected. Verify the specific versions and patch status against FreeBSD's official security advisories, as the ground-truth data does not enumerate precise version ranges. Systems must have KTLS receive configured on loopback interfaces for exploitation to succeed, which may limit exposure in air-gapped or non-network-facing deployments.

Exploitability

Exploitability is high for affected systems. The attack requires only local user access and does not demand special kernel privileges. No user interaction or complex race conditions are necessary—the vulnerability triggers reliably when sending file-backed data over loopback with KTLS receive active. The attack surface is limited by whether KTLS is deployed on loopback interfaces in production, but the simplicity of the exploitation mechanism and low barrier to entry make this a high-priority local privilege escalation vector.

Remediation

Apply security patches from FreeBSD as soon as they become available. The fix likely modifies the KTLS receive path to copy file-backed mbufs to anonymous memory before decryption, rather than decrypting in place. Disable or restrict KTLS receive on loopback interfaces if KTLS transmit is not symmetrically enabled, pending patch deployment. Limit local user access where feasible. Organizations should verify patch availability and deployment timelines against FreeBSD's official security advisory.

Patch guidance

Consult FreeBSD's official security advisories for patch availability and version information. Apply patches to all affected FreeBSD systems as part of a coordinated change management process. Test patches in non-production environments first to confirm compatibility with local configurations and dependent services. After patching, verify that KTLS functionality continues to operate correctly and that loopback communication is not disrupted. Monitor for any post-patch anomalies in file integrity or system behavior.

Detection guidance

Monitor for suspicious file modifications, particularly to setuid binaries, system libraries, and kernel modules. Audit filesystem access logs for writes to protected files by unprivileged users. Enable file integrity monitoring (FIM) tools to detect unauthorized changes to critical system files. Look for unusual sendfile(2) or loopback socket activity in syscall audit logs. Check for mismatched KTLS receive and transmit configurations on loopback interfaces. Monitor page cache behavior for signs of direct memory writes bypassing normal file operations.

Why prioritize this

This vulnerability merits high priority due to its direct path to local privilege escalation, ease of exploitation, and potential for persistent system compromise. The ability to overwrite setuid binaries and bypass immutable file flags makes this a critical threat to system integrity. While exploitation requires local access, the low complexity and lack of special privilege requirements elevate risk. Organizations should treat this as a priority patch, especially on multi-user or shared systems.

Risk score, explained

The CVSS 3.1 score of 7.8 (HIGH) reflects high impact across confidentiality, integrity, and availability, combined with a low attack complexity and local attack vector. The vulnerability requires user-level privileges but enables full system compromise through file overwrites. The score appropriately captures the severity of unrestricted file modification and privilege escalation, though it does not account for the practical requirement that KTLS receive must be explicitly enabled on loopback interfaces.

Frequently asked questions

Does this vulnerability affect FreeBSD systems that do not use KTLS?

No. KTLS must be explicitly enabled on the receive side for exploitation to succeed. Systems not using KTLS are not vulnerable. However, if KTLS is enabled on any loopback interface, the system is at risk.

Can this vulnerability be exploited remotely?

No. The attack requires local user access to the system and involves sending data over loopback interfaces, which are not accessible from remote networks by default. This is a strictly local privilege escalation vulnerability.

Does enabling KTLS on both transmit and receive sides prevent exploitation?

Yes. The vulnerability only occurs when the transmit side lacks KTLS encryption but the receive side has KTLS decryption enabled. When both sides are symmetrically configured with KTLS, data is encrypted in transit and the mbufs do not remain file-backed by the time they reach the receive path.

What files are most at risk of being overwritten?

Any file readable by the unprivileged user can potentially be overwritten, but setuid binaries, system libraries, and trusted executables represent the highest-impact targets for privilege escalation. Files on the root filesystem are at particular risk if the attacker possesses read permissions.

This analysis is provided for informational purposes and reflects the state of CVE-2026-45257 as of the publication date. Security vulnerabilities evolve as patches are released and threat intelligence matures. Organizations should verify all technical details, patch availability, and remediation guidance against official FreeBSD security advisories and vendor communications. SEC.co does not provide legal, compliance, or operational security advice. Readers should consult their own security teams and risk management frameworks when prioritizing remediation efforts. This document does not constitute a recommendation to enable, disable, or modify system configurations without proper testing and validation. Source: NVD (public-domain), retrieved 2026-08-05. Analysis generated by SEC.co (claude-haiku-4-5).