Stack-Based Buffer Overflow in Zephyr RTOS OSDP Implementation
A vulnerability in the Zephyr RTOS OSDP Control Panel implementation allows attackers with access to the RS-485 bus to trigger a stack-based buffer overflow and potential code execution.
CVE search metadata
CVE search record: CVE-2026-76788. Severity: high. CVSS: 8.8. KEV: no. Product: Zephyr RTOS. Brief: Stack-Based Buffer Overflow in Zephyr RTOS OSDP Implementation. Brief link: https://feed.craftedsignal.io/briefs/2026-10-osdp-overflow/
CVE-2026-76788 identifies a critical buffer overflow vulnerability within the Open Supervised Device Protocol (OSDP) implementation in the Zephyr RTOS, specifically within the cp_decode_response() function. This vulnerability stems from improper bounds checking when handling REPLY_KEYPAD and REPLY_RAW frames, which are copied into stack-allocated osdp_event structures. Because the code trusts length fields provided by the Peripheral Device without validating them against the OSDP_EVENT_MAX_DATALEN constant, an attacker can supply an oversized payload.
The vulnerability is accessible to any entity with physical access to the RS-485 wiring, such as a compromised or malicious card reader. Even if Secure Channel (SC) communication is enabled, an attacker can force a secure channel deactivation by sending a single unauthenticated frame with an invalid MAC, effectively reverting the connection to plaintext. The resulting overflow can overwrite stack-based return addresses or registers on Cortex-M or RISC-V architectures, leading to either a system crash (Denial of Service) or arbitrary code execution in the context of the OSDP receive thread.
Attack Chain
- Attacker gains physical access to the RS-485 wiring connecting a peripheral device to the OSDP Control Panel.
- Attacker transmits an unauthenticated frame with an incorrect MAC to the Control Panel to trigger
sc_deactivate()and disable secure channel protection. - Attacker crafts a malicious OSDP frame containing a
REPLY_KEYPADorREPLY_RAWmessage ID. - Attacker includes a payload length in the frame that exceeds the 64-byte
OSDP_EVENT_MAX_DATALENlimit. - The Control Panel's
osdp_process_reply()function processes the packet after it passes initial CRC-16 checks. cp_decode_response()fails to validate the payload length and proceeds tomemcpy()the oversized data into the stack-allocatedosdp_eventstructure.- The
memcpy()operation overflows the stack buffer, overwriting adjacent memory including saved registers and the return address. - The OSDP thread returns execution to an attacker-controlled address, leading to arbitrary code execution or a system crash.
Impact
Successful exploitation of this vulnerability permits unauthorized control over access-control panels. An attacker may achieve persistent remote code execution on the device, potentially bypassing security gates, manipulating access logs, or disrupting facility security infrastructure. The vulnerability affects all systems utilizing Zephyr RTOS with the CONFIG_OSDP and CONFIG_OSDP_MODE_CP features enabled, provided they do not implement manual stack-protection mitigations.
Recommendation
- Upgrade all affected Zephyr RTOS deployments to a version that includes the fix for CVE-2026-76788, which explicitly adds bounds checking for
REPLY_KEYPADandREPLY_RAWhandlers usingOSDP_EVENT_MAX_DATALEN. - Restrict physical access to RS-485 bus wiring to prevent unauthorized device injection or frame manipulation.
- Enable stack protection mechanisms (e.g., stack canaries) in Zephyr RTOS configurations to detect or mitigate buffer overflow attempts.
Immediate actions
Identify all devices running Zephyr RTOS with OSDP CP enabled for immediate firmware patching.
Mitigations
Apply firmware updates provided by vendors utilizing the patched Zephyr RTOS version.
CVE-2026-76788