CVE-2021-45702
Memory Safety Issue when using `patch` or `merge` on `state` and assign the result back to `state`
CVE-2021-45702 is a high vulnerability (CVSS 7.5) in Linuxfoundation Tremor-script, published September 16, 2021. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 1.09%, the 65th percentile. Fixed in tremor-script 0.11.6.
An issue was discovered in the tremor-script crate before 0.11.6 for Rust. A merge operation may result in a use-after-free.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- None
- User interaction
- None
What an attacker can affect
- Confidentiality
- None
- Integrity
- None
- Availability
- High
Exploit likelihood
What each source reports
NVD Score used
7.5
An issue was discovered in the tremor-script crate before 0.11.6 for Rust. A merge operation may result in a use-after-free.
- Record
CVE-2021-45702- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - CVSS 2.0
- 5.0 Medium
AV:N/AC:L/Au:N/C:N/I:N/A:P - Weakness
- CWE-416
- Updated
- 2026-11-02
CVE List No score
An issue was discovered in the tremor-script crate before 0.11.6 for Rust. A merge operation may result in a use-after-free.
- Record
CVE-2021-45702- Updated
- 2026-11-02
EUVDEUVD-2022-0549 No score
An issue was discovered in the tremor-script crate before 0.11.6 for Rust. A merge operation may result in a use-after-free.
- Record
EUVD-2022-0549- Updated
- 2026-11-03
GitHub AdvisoriesGHSA-9qvw-46gf-4fv8
7.5
Use After Free in tremor-script
An issue was discovered in the tremor-script crate before 0.11.6 for Rust. A merge operation may result in a use-after-free.
- Record
GHSA-9qvw-46gf-4fv8- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Weakness
- CWE-416
- Updated
- 2026-11-02
GitHub AdvisoriesGHSA-3pp4-64mp-9cg9 No score
Memory Safety Issue when using `patch` or `merge` on `state` and assign the result back to `state`
Affected versions of this crate maintains references to memory that might have been freed already.
If affects the following two tremor-script language constructs:
- A Merge where we assign the result back to the target expression
and the expression to be merged needs to reference the
event:
let state = merge state of event end;
- A Patch where we assign the result back to the target expression
and the patch operations used need to reference the
event:
let state = patch state of insert event.key => event.value end;
For constructs like this (it doesnt matter what is references in the expression to be merged or the patch operations) an optimization was applied to manipulate the target value in-place, instead of cloning it.
Our Value struct which underpins all event data in tremor-script, is representing as borrowed strings beef::Cow<'lifetime, str>
that reference the actual Vec<u8> the event is based upon. We keep the raw byte-array next to the event structure inside our Event struct as a self-referential struct,
so we make sure that the structured Value and its references are valid across its whole lifetime.
The optimization was considered safe as long as it was only possible to merge or patche event data or static data.
When state was introduced to tremor-script a new possibility existed, to keep Value data around for longer than the lifetime of an event.
If event data is merged or patched into state without cloning state first, it can still reference keys or values from
the previous event, which will now be invalid. This allows access to those already freed regions of memory and to get their content out over the wire.
Workaround
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:
let tmp = merge state of event end;
let state = tmp
Fix
The flaw was corrected in tremor-script version 0.11.6 via commit 1a2efcd by removing the optimization
and always clone the target expression of a Merge or [Patch](https://www.tremor.rs/docs/tremor-script/index#patch.
- Record
GHSA-3pp4-64mp-9cg9- Updated
- 2026-11-02
OSVGHSA-9qvw-46gf-4fv8
7.5
Use After Free in tremor-script
An issue was discovered in the tremor-script crate before 0.11.6 for Rust. A merge operation may result in a use-after-free.
- Record
GHSA-9qvw-46gf-4fv8- CVSS 3.1
- 7.5 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H - Weakness
- CWE-416
- Updated
- 2026-11-02
OSVGHSA-q2x5-6q7q-r872
9.8
Use After Free in tremor-script
An issue was discovered in the tremor-script crate before 0.11.6 for Rust. A patch operation may result in a use-after-free.
- Record
GHSA-q2x5-6q7q-r872- 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 - Weakness
- CWE-416
- Updated
- 2026-11-02
OSVGHSA-3pp4-64mp-9cg9 No score
Memory Safety Issue when using `patch` or `merge` on `state` and assign the result back to `state`
Affected versions of this crate maintains references to memory that might have been freed already.
If affects the following two tremor-script language constructs:
- A Merge where we assign the result back to the target expression
and the expression to be merged needs to reference the
event:
let state = merge state of event end;
- A Patch where we assign the result back to the target expression
and the patch operations used need to reference the
event:
let state = patch state of insert event.key => event.value end;
For constructs like this (it doesnt matter what is references in the expression to be merged or the patch operations) an optimization was applied to manipulate the target value in-place, instead of cloning it.
Our Value struct which underpins all event data in tremor-script, is representing as borrowed strings beef::Cow<'lifetime, str>
that reference the actual Vec<u8> the event is based upon. We keep the raw byte-array next to the event structure inside our Event struct as a self-referential struct,
so we make sure that the structured Value and its references are valid across its whole lifetime.
The optimization was considered safe as long as it was only possible to merge or patche event data or static data.
When state was introduced to tremor-script a new possibility existed, to keep Value data around for longer than the lifetime of an event.
If event data is merged or patched into state without cloning state first, it can still reference keys or values from
the previous event, which will now be invalid. This allows access to those already freed regions of memory and to get their content out over the wire.
Workaround
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:
let tmp = merge state of event end;
let state = tmp
Fix
The flaw was corrected in tremor-script version 0.11.6 via commit 1a2efcd by removing the optimization
and always clone the target expression of a Merge or [Patch](https://www.tremor.rs/docs/tremor-script/index#patch.
- Record
GHSA-3pp4-64mp-9cg9- Updated
- 2026-11-02
OSVRUSTSEC-2021-0111 No score
Memory Safety Issue when using `patch` or `merge` on `state` and assign the result back to `state`
Affected versions of this crate maintains references to memory that might have been freed already.
If affects the following two tremor-script language constructs:
- A Merge where we assign the result back to the target expression
and the expression to be merged needs to reference the
event:
let state = merge state of event end;
- A Patch where we assign the result back to the target expression
and the patch operations used need to reference the
event:
let state = patch state of insert event.key => event.value end;
For constructs like this (it doesnt matter what is references in the expression to be merged or the patch operations) an optimization was applied to manipulate the target value in-place, instead of cloning it.
Our Value struct which underpins all event data in tremor-script, is representing as borrowed strings beef::Cow<'lifetime, str>
that reference the actual Vec<u8> the event is based upon. We keep the raw byte-array next to the event structure inside our Event struct as a self-referential struct,
so we make sure that the structured Value and its references are valid across its whole lifetime.
The optimization was considered safe as long as it was only possible to merge or patche event data or static data.
When state was introduced to tremor-script a new possibility existed, to keep Value data around for longer than the lifetime of an event.
If event data is merged or patched into state without cloning state first, it can still reference keys or values from
the previous event, which will now be invalid. This allows access to those already freed regions of memory and to get their content out over the wire.
Workaround
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:
let tmp = merge state of event end;
let state = tmp
Fix
The flaw was corrected in tremor-script version 0.11.6 via commit 1a2efcd by removing the optimization
and always clone the target expression of a Merge or [Patch](https://www.tremor.rs/docs/tremor-script/index#patch.
- Record
RUSTSEC-2021-0111- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
tremor-scriptcrates.io |
0.7.2 up to 0.11.6 | 0.11.6 |
tremor-scriptcrates.io |
0.7.3-0 up to 0.11.6 | 0.11.6 |
History
| When | Changed | Sources |
|---|---|---|
| 2026-11-03 | aliases | EUVD |
| 2026-11-02 | created | CVE List, GitHub Advisories, NVD, OSV |
References
rustsec.org/advisories/RUSTSEC-2021-0111.html
raw.githubusercontent.com/rustsec/advisory-db/main/crates/tremor-script/RUSTSEC-2021-0111.md
github.com/tremor-rs/tremor-runtime/pull/1217
github.com/advisories/GHSA-3pp4-64mp-9cg9
nvd.nist.gov/vuln/detail/CVE-2021-45702
github.com/tremor-rs/tremor-runtime/commit/1a2efcdbe68e5e7fd0a05836ac32d2cde78a0b2e