# CVE-2026-86716: Cesanta mJS heap buffer overflow in skip_spaces_and_comments

Source: https://junglewise.ai/threats/cve-2026-86716-cesanta-mjs-heap-buffer-overflow-in-skip-spaces-and-comments  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-09-08. Updated: 2026-09-26  
License: CC BY 4.0 with a link back

CVE-2026-86716 · Severity: high · CVSS 7.3 · Published 2026-09-08

Cesanta mJS is an embedded JavaScript engine used in C/C++ applications. A heap buffer overflow vulnerability in the tokenizer can crash any application that processes untrusted JavaScript code ending with whitespace, potentially allowing attackers to cause denial-of-service or trigger memory safety failures.

Vendors: [Cesanta](https://junglewise.ai/threats/vendors/cesanta).

## Quick answers

**Is CVE-2026-86716 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-86716 being exploited in the wild.

**How severe is CVE-2026-86716?** High severity, with a CVSS score of 7.3, published 8 September 2026.

**Which products and versions are affected?** Cesanta mJS up to 1.26.

**Is there a fix for CVE-2026-86716?** No fixed version is recorded yet. Check the vendor's advisory in the references below. If you run it, Junglewise drafts a mitigation that fits your setup and applies it once you approve, with senior security engineers behind it.

**How is CVE-2026-86716 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2026-86716?** Check whether you run Cesanta mJS at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## Technical details

The vulnerability is a heap-based buffer over-read (CWE-125) in the skip_spaces_and_comments() function in src/mjs_tok.c. When mjs_exec() is called with input ending in whitespace, the function attempts to read one byte past the null terminator by checking p->pos[1] without first verifying p->pos[0] != '\0'. The flaw is triggered during lexical analysis by any code path that calls mjs_exec() with untrusted JavaScript input. This requires no authentication or special privileges—any application embedding mJS is vulnerable if it accepts external JavaScript. The issue causes an out-of-bounds read (not a write), resulting in a crash under memory sanitizers and potentially information disclosure. The vendor was informed early but has not yet patched the issue.

## Affected products

- Cesanta mJS up to 1.26

## Timeline

- 2026-07-30: disclosed: Issue publicly reported on GitHub
- 2026-09-08: advisory: CVE-2026-86716 assigned and published

## References

- [https://github.com/cesanta/mjs/](https://github.com/cesanta/mjs/)
- [https://github.com/cesanta/mjs/issues/324](https://github.com/cesanta/mjs/issues/324)
