# CVE-2021-39228: Memory Safety Issue when using patch or merge on state and assign the result back to state

- Severity: Medium 6.5 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N`
- 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): 1.35%, higher than 72% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2021-09-17T14:00:15.000Z
- Modified: 2026-07-08T06:28:58.368Z
- Also known as: GHSA-mc22-5q92-8v85
- Weaknesses: CWE-416, CWE-825
- Assigned by: GitHub_M

## Description

Tremor is an event processing system for unstructured data. A vulnerability exists between versions 0.7.2 and 0.11.6. This vulnerability is a memory safety Issue when using `patch` or `merge` on `state` and assign the result back to `state`. In this case, affected versions of Tremor and the tremor-script crate maintains references to memory that might have been freed already. And these memory regions can be accessed by retrieving the `state`, e.g. send it over TCP or HTTP. This requires the Tremor server (or any other program using tremor-script) to execute a tremor-script script that uses the mentioned language construct. The issue has been patched in version 0.11.6 by removing the optimization and always cloning the target expression of a Merge or Patch. If an upgrade is not possible, a possible workaround is to avoid the optimization by introducing a temporary variable and not immediately reassigning to `state`.

(As written by CVE List.)

## Affected

- tremor-rs tremor-runtime: > 0.7.2, < 0.11.6
- tremor-script (crates.io): from 0.7.3 before 0.11.6
- linuxfoundation tremor: from 0.7.2 before 0.11.6

## Every score

- GitHub_M: CVSS:3.1 6.5 Medium `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N`
- GitHub: CVSS:3.1 6.5 Medium `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N`
- NVD: CVSS:3.1 9.8 Critical `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H`
- NVD: CVSS:2.0 7.5 High `AV:N/AC:L/Au:N/C:P/I:P/A:P`

## References

- <https://github.com/tremor-rs/tremor-runtime/pull/1217> (exploit, patch, third-party-advisory, web)
- <https://github.com/tremor-rs/tremor-runtime/security/advisories/GHSA-mc22-5q92-8v85> (mitigation, third-party-advisory, web)
- <https://github.com/tremor-rs/tremor-runtime/commit/1a2efcdbe68e5e7fd0a05836ac32d2cde78a0b2e> (patch, third-party-advisory, web)
- <https://github.com/tremor-rs/tremor-runtime/releases/tag/v0.11.6> (release-notes, third-party-advisory, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2021-39228> (advisory)
- <https://github.com/tremor-rs/tremor-runtime> (package)

## Sources

- CVE List: [CVE-2021-39228](https://www.cve.org/CVERecord?id=CVE-2021-39228), CVE Terms of Use, modified 2024-08-04
- GitHub Advisory Database: [GHSA-mc22-5q92-8v85](https://github.com/advisories/GHSA-mc22-5q92-8v85), CC-BY-4.0, modified 2026-07-08
- NVD: [CVE-2021-39228](https://nvd.nist.gov/vuln/detail/CVE-2021-39228), Public domain, modified 2026-06-17

---

Page: https://cve.day/CVE-2021-39228 · Whole record: https://cve.day/CVE-2021-39228.json · Rebuilt by cve.day 2026-11-25T22:58:04.030Z
