---
id: "CVE-2026-76788"
kind: "vulnerability"
aliases: ["CVE-2026-76788"]
title: "Zephyr OSDP: oversized reader reply overflows stack, risking control-flow hijack"
severity: "high"
cvss: 8.8
epss: null
exploited: false
status: "open"
category: "runtime"
products: [{"name": "zephyr", "fixed": ["4.5.0"], "affected": ">= 3.3.0, <= 4.4.2", "ecosystem": "vendor"}]
ecosystems: []
tags: ["access-control", "embedded", "osdp", "rtos", "runtime", "zephyr"]
not_affected_if: ["config-osdp-disabled", "no-osdp-cp-mode", "no-rs485-exposure", "osdp-peripheral-only-mode", "pd-mode-only", "zephyr-4.5.0-or-later"]
published_at: "2026-10-19T21:18:01+00:00"
first_seen_at: "2026-10-23T21:57:19+00:00"
updated_at: "2026-10-24T00:19:08+00:00"
sources: [{"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-76788", "first_seen_at": "2026-10-23T21:57:19+00:00"}, {"source": "analyst", "url": null, "first_seen_at": "2026-10-24T00:19:08+00:00"}]
---

# Zephyr OSDP: oversized reader reply overflows stack, risking control-flow hijack

Zephyr's OSDP Control Panel parser cp_decode_response() copies REPLY_KEYPPAD and REPLY_RAW payloads into 64-byte stack buffers without checking OSDP_EVENT_MAX_DATALEN. A malicious or compromised reader, or anyone able to inject frames on the RS-485 bus, can overflow the stack. Reaching it needs a valid SOM and CRC-16. CVSS 8.8 (adjacent network). Not in CISA KEV; EPSS 0.2%.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- vendor:zephyr affected >= 3.3.0, <= 4.4.2 fixed 4.5.0

## How to check

Exposed if your build has CONFIG_OSDP=y and CONFIG_OSDP_MODE_CP=y (check prj.conf / .config) with an OSDP event callback registered, and Zephyr version is >= 3.3.0 and <= 4.4.2 (check 'west list zephyr' or the VERSION file). Peripheral-mode-only builds (CONFIG_OSDP_MODE_PD) are not on the described path.

## Fix

Upgrade to Zephyr 4.5.0. The fix bounds payload lengths by OSDP_EVENT_MAX_DATALEN in cp_decode_response(); the v4.4 backport PR #116885 was still open when last seen, so on 4.4.x cherry-pick it. Otherwise disable CONFIG_OSDP_MODE_CP and physically secure the RS-485 bus and readers.

## Timeline

- 2026-10-23T21:57:19+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-76788
- 2026-10-24T00:19:08+00:00 analyst — Read Zephyr GHSA-fgg7-h8p9-9q3w (affected >=3.3.0 <=4.4.2, patched 4.5.0), backport PR #116885 (v4.4 open as of Aug), Rapid7/NVD for config. No PoC or exploitation found; no social search done (niche embedded).

## Documents

- [advisory] GHSA-fgg7-h8p9-9q3w: osdp stack OOB write in CP reply parser https://github.com/zephyrproject-rtos/zephyr/security/advisories/GHSA-fgg7-h8p9-9q3w
- [describes] Rapid7 CVE-2026-76788 https://www.rapid7.com/db/vulnerabilities/cve-2026-76788/
- [fix] Backport v4.4: bound payload lengths in CP reply parser https://github.com/zephyrproject-rtos/zephyr/pull/116885

## From the sources

The OSDP Control Panel reply parser cp_decode_response() in subsys/mgmt/osdp/src/osdp_cp.c decodes replies from a Peripheral Device into a stack-allocated struct osdp_event. For the REPLY_KEYPPAD and REPLY_RAW reply types, the payload length is taken from the received frame and the only validation performed is that the declared length is self-consistent with the number of payload bytes present in the frame. Because the attacker controls both the length field and the frame length, that check imposes no bound, and the subsequent memcpy() writes into the fixed 64-byte data arrays of struct osdp_event_keypress / struct osdp_event_cardread (OSDP_EVENT_MAX_DATALEN). The sibling REPLY_FMT handler in the same switch already carried the missing > OSDP_EVENT_MAX_DATALEN bound.

The defect is reached from cp_process_reply(), which reads bytes from the OSDP RS-485 channel and passes them through osdp_phy_check_packet() and osdp_phy_decode_packet() before dispatching on the reply ID. Triggering it requires CONFIG_OSDP with CONFIG_OSDP_MODE_CP and an application event callback registered (the normal Control Panel integration), plus a frame carrying a correct SOM, a valid CRC-16, and a matching 2-bit sequence number — all of which are computable or observable by anyone on the bus. No check ties the reply ID to the outstanding command, so an oversized REPLY_KEYPPAD or REPLY_RAW is accepted as the answer to a routine CMD_POLL. A malicious or compromised card reader, or anyone with access to the RS-485 wiring, can supply such a frame; CONFIG_OSDP_SC_ENABLED only helps while a secure channel is active, and a single unauthenticated frame carrying a bad MAC causes sc_deactivate(), after which plaintext replies are again accepted.

With the default CONFIG_OSDP_UART_BUFFER_LENGTH of 256, roughly 180 bytes of fully attacker-chosen data can be written past the end of the stack-allocated event object, over saved registers and the return address on typical Cortex-M and RISC-V frame layouts (Zephyr does not enable stack canaries by default). The impact ranges from a hard crash of the access-control panel to potential control-flow hijack in the context of the OSDP receive thread. The fix adds an OSDP_EVENT_MAX_DATALEN bound to both handlers, capping each memcpy() at the size of its destination.

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
