OpenBSD 7.9 reported to have a privilege-escalation chain; a 37-year-old integer overflow can gain root

Calif publicly disclosed an OpenBSD 7.9 local privilege-escalation exploit chain: a signed 16-bit integer overflow inherited from 1988 combined with a reference-count use-after-free, bypassing KARL, SMAP/SMEP to gain root. Patches were issued on September 14 with errata 018 and on September 30 with errata 026, obtainable via syspatch; the integer overflow was also fixed in 7.8. The full PoC has been published on GitHub; neither flaw has a CVE, and there is currently no evidence of in-the-wild exploitation. Source: The Hacker News

Security firm Calif has disclosed an OpenBSD 7.9 local privilege-escalation exploit chain. Both flaws were patched in September, and the full PoC and details are now online.

Hard facts first

Hard facts first
Hard facts first|News screenshot

  • First public disclosure: Calif today published a detailed analysis and released working proof-of-concept (PoC) code; the chain can gain root on OpenBSD 7.9.
  • Affected versions: OpenBSD 7.9; OpenBSD 7.8 also received the fix for the integer overflow.
  • Patch dates: The integer overflow was issued on September 14 with errata 018; the reference-count use-after-free that completes the chain was issued on September 30 with errata 026.
  • How to apply: Both are available through syspatch, covering all architectures.
  • CVE and in-the-wild status: As of publication, neither flaw has been assigned a CVE, and there is no evidence they have been used in real attacks.

A 1988 short underpins the entire chain

The entry point is an integer overflow in shared memory. The kernel uses shm_nattch to track how many processes have attached a shared memory segment; in the original BSD source, this counter was written as a signed 16-bit short (max 32,767), and no one has widened it since 1988—OpenBSD inherited the type directly.

The exploit pushes the counter past its limit: after mapping 127 shared memory segments and forking 259 processes, the counter wraps around to 32,643. A race condition then turns the bad count into a use-after-free (i.e., the kernel returns memory to the system while other processes are still using it), causing the kernel to free memory that is still referenced.

The most striking contrast is in how they were classified: the integer overflow that serves as the entry point for the entire chain was issued as a “reliability fix” rather than a security fix; the reference-count use-after-free that actually completes the chain was the security fix issued on September 30.

The second stage of the exploit likewise bypasses OpenBSD’s signature protections. An out-of-bounds write corrupts a multicast membership count in the kernel, redirecting a decrement operation at socket close to a page-table entry and changing a user-memory mapping to supervisor-accessible, thereby bypassing SMAP and SMEP (two hardware protections that make the kernel refuse to access user memory and refuse to execute code from user pages). The attacker then overwrites a function pointer at a predictable kernel address to execute their own code.

KARL didn’t stop it either: Calif researcher Andrew Griffiths points out that KARL relinks the kernel binary to randomize function and data addresses, but the kernel’s memory allocator remains deterministic—neither the boot-time allocator nor the best-fit allocator has base address randomization, so after a reboot on the same hardware, early function pointers in the lo0 and enc0 network interface handler functions land at the same address every time. The entire chain therefore requires no information-leak vulnerability.

Comparing the two errata

FlawerrataRelease dateClassificationAffected versions
shmat(4) attach function integer overflow (entry point of exploit chain)018September 14, 2026Reliability fix7.9, 7.8
Reference-count use-after-free (completes the chain)026September 30, 2026Security fix7.9

Both are available via syspatch, across all architectures.

Practical advice for readers

If you are running OpenBSD 7.9 or 7.8, the first thing to do is run syspatch once and confirm that errata 018 and 026 have been applied. Whether this machine warrants urgency depends on whether it is a multiuser, multi-tenant, or shell-providing host: local privilege escalation requires first achieving code execution on the machine, but the payoff of crossing that step is root.

If it is just a single-user router, lab machine, or offline device, the urgency is lower, but there is no reason to put it off past the next maintenance window. Don’t assume your scanner will alert you just because the flaws have no CVE IDs—neither will show up in CVE-driven alerts, so proactive patching is the only option.

Calif also proposes four hardening directions: safe-unlinking for kernel linked lists (already used by FreeBSD and NetBSD), randomization of page-table self-referential mappings, kernel allocator randomization, and compiler-level bounds checking.

Final thoughts

A type choice from 37 years ago, plus a “this is not a security problem” label, added up to a complete path straight to root. The patches have been sitting upstream for three to four weeks; the real risk window is hosts that have not yet run syspatch. The lesson from this incident is that not every privilege-escalation entry point shows up in the form of a security advisory.