# CVE-2026-87877: zstd-jni use-after-free in stream setter methods

Source: https://junglewise.ai/threats/cve-2026-87877-zstd-jni-use-after-free-in-stream-setter-methods  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-09-09. Updated: 2026-09-26  
License: CC BY 4.0 with a link back

CVE-2026-87877 · Severity: high · CVSS 7.7 · Published 2026-09-09

zstd-jni is a Java library providing compression and decompression via JNI bindings to the Zstandard algorithm. Versions before 1.5.7-14 fail to validate whether stream objects have been closed before allowing setter methods to execute, allowing attackers to write through freed native memory pointers and corrupt other objects or crash the Java virtual machine.

Technologies: [Luben Zstd-Jni](https://junglewise.ai/threats/technologies/zstd-jni). Vendors: [Luben](https://junglewise.ai/threats/vendors/luben).

## Quick answers

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

**How severe is CVE-2026-87877?** High severity, with a CVSS score of 7.7, published 9 September 2026.

**Which products and versions are affected?** Luben Zstd-Jni before 1.5.7-14.

**Is there a fix for CVE-2026-87877?** A patch was published on 2026-08-16: Fixed in version 1.5.7-14 Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-87877 attacked?** It is attacked with local access.

**Am I affected by CVE-2026-87877?** Check whether you run Luben Zstd-Jni 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 use-after-free in stream classes resulting from missing closed-state validation. The affected methods—setDict, setLongMax, setLevel, and setRefMultipleDDicts—fail to check whether their parent stream object has been closed before dereferencing native pointers. An attacker with local JVM access can invoke these methods on a closed stream instance, causing writes through dangling pointers to freed native memory, leading to heap corruption, information disclosure, or denial of service (JVM crash). The vulnerability is fixed in zstd-jni 1.5.7-14 and later.

## Affected products

- Luben zstd-jni before 1.5.7-14

## Timeline

- 2026-09-09: disclosed
- 2026-08-16: patched: Fixed in version 1.5.7-14

## References

- [https://repo1.maven.org/maven2/com/github/luben/zstd-jni/](https://repo1.maven.org/maven2/com/github/luben/zstd-jni/)
- [https://github.com/luben/zstd-jni](https://github.com/luben/zstd-jni)

## Related threats

- [luben zstd-jni use-after-free in Dictionary Sharing](https://junglewise.ai/threats/cve-2026-90852-luben-zstd-jni-use-after-free-in-dictionary-sharing)
- [zstd-jni out-of-bounds read in ZstdDictDecompress constructor](https://junglewise.ai/threats/cve-2026-90560-zstd-jni-out-of-bounds-read-in-zstddictdecompress-constructor)
- [zstd-jni input validation bypass in ZstdInputStreamNoFinalizer.read()](https://junglewise.ai/threats/cve-2026-89045-zstd-jni-input-validation-bypass-in-zstdinputstreamnofinalizer)
- [zstd-jni use-after-free in dictionary reference handling](https://junglewise.ai/threats/cve-2026-87825-zstd-jni-use-after-free-in-dictionary-reference-handling)
- [zstd-jni out-of-bounds buffer read in trainFromBufferDirect](https://junglewise.ai/threats/cve-2026-87824-zstd-jni-out-of-bounds-buffer-read-in-trainfrombufferdirect)
