7.8high
Heap out-of-bounds access in semctl(2)
- Severity
- 7.8high CVSS:3.1 by CISA-ADP
- Exploit likelihood
- 0.12% (higher than 2% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- freebsd
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.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| FreeBSD FreeBSD | from 15.1-RELEASE before p2, from 15.0-RELEASE before p12, from 14.4-RELEASE before p8, 14.4, 15.0, 15.1 | CVE List, NVD |
Classification
What each source says
CVE List
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.
NVD (es)
Los comandos GETALL y SETALL en semctl(2) registraron el número de semáforos en el conjunto objetivo, liberaron el bloqueo que protegía el conjunto, asignaron un búfer dimensionado para esa cantidad y volvieron a adquirir el bloqueo. Se utilizó una verificación de número de secuencia para verificar que el conjunto no había sido reemplazado en el ínterin, pero el número de secuencia se reinicia después de 0x8000 ciclos de creación/destrucción. Al destruir y recrear rápidamente conjuntos de semáforos en el mismo índice, otro proceso puede hacer que el número de secuencia se reinicie, permitiendo que un conjunto con un número diferente de semáforos pase la validación. La copia subsiguiente entonces lee o escribe más allá del final del búfer asignado. Un usuario local sin privilegios puede desencadenar lecturas y escrituras fuera de límites en la memoria del heap del kernel, lo que podría conducir a una escalada de privilegios.
References
| https://security.freebsd.org/advisories/FreeBSD-SA-26:54.sysvsem.asc | mailing-list, vendor-advisory | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-58087 changed 2026-08-20 | CVE Terms of Use |
| NVD | CVE-2026-58087 changed 2026-10-27 | Public domain |