# CVE-2026-21870: The BACnet Protocol Stack library has an Off-by-one Stack-based Buffer Overflow in tokenizer_string

- Severity: Medium 5.5 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.27%, higher than 21% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2026-02-13T17:58:37.205Z
- Modified: 2026-06-17T10:19:03.763Z
- Weaknesses: CWE-193
- SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial
- Assigned by: GitHub_M

## Description

BACnet Protocol Stack library provides a BACnet application layer, network layer and media access (MAC) layer communications services. In 1.4.2, 1.5.0.rc2, and earlier, an off-by-one stack-based buffer overflow in the ubasic interpreter causes a crash (SIGABRT) when processing string literals longer than the buffer limit. The tokenizer_string function in src/bacnet/basic/program/ubasic/tokenizer.c incorrectly handles null termination for maximum-length strings. It writes a null byte to dest[40] when the buffer size is only 40 (indices 0-39), triggering a stack overflow.

(As written by CVE List.)

## Affected

- bacnet-stack bacnet-stack: <= 1.4.2; >= 1.5.0.rc1, <= 1.5.0.rc2
- bacnetstack bacnet_stack: up to 1.4.2; 1.5.0

## References

- <https://github.com/bacnet-stack/bacnet-stack/security/advisories/GHSA-pc83-wp6w-93mx> (exploit, vendor-advisory)
- <https://github.com/bacnet-stack/bacnet-stack/pull/1196> (patch)
- <https://github.com/bacnet-stack/bacnet-stack/commit/4e1176394a5ae50d2fd0b5790d9bff806dc08465> (patch)

## Sources

- CVE List: [CVE-2026-21870](https://www.cve.org/CVERecord?id=CVE-2026-21870), CVE Terms of Use, modified 2026-02-13
- NVD: [CVE-2026-21870](https://nvd.nist.gov/vuln/detail/CVE-2026-21870), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2026-21870 · Whole record: https://cve.day/CVE-2026-21870.json · Rebuilt by cve.day 2026-11-25T22:59:13.848Z
