GHSA-8mj7-wxmc-f424 – neon
Package
Manager: cargo
Name: neon
Vulnerable Version: >=0.8.0 <0.10.1
Severity
Level: High
CVSS v3.1: CVSS:3.1/AV:N/AC:H/PR:L/UI:N/S:U/C:L/I:L/A:N/E:P/RL:O/RC:R
CVSS v4.0: CVSS:4.0/AV:N/AC:H/AT:N/PR:L/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N
EPSS: N/A pctlN/A
Details
Use after free in Neon external buffers Neon provides functionality for creating JavaScript `ArrayBuffer` (and the `Buffer` subtype) instances backed by bytes allocated outside of V8/Node. The [`JsArrayBuffer::external`](https://docs.rs/neon/0.10.0/neon/types/struct.JsArrayBuffer.html#method.external) and [`JsBuffer::external`](https://docs.rs/neon/0.10.0/neon/types/struct.JsBuffer.html#method.external) did not require `T: 'static` prior to Neon `0.10.1`. This allowed creating an externally backed buffer from types that may be freed while they are still referenced by a JavaScript `ArrayBuffer`. The following example demonstrates use after free. It compiles on versions `<0.10.1` and fails to compile afterward. ```rust pub fn soundness_hole(mut cx: FunctionContext) -> JsResult<JsArrayBuffer> { let mut data = vec![0u8, 1, 2, 3]; // Creating an external from `&mut [u8]` instead of `Vec<u8>` since there is a blanket impl // of `AsMut<T> for &mut T` let buf = JsArrayBuffer::external(&mut cx, data.as_mut_slice()); // `buf` is still holding a reference to `data`! drop(data); Ok(buf) } ```
Metadata
Created: 2022-06-17T00:13:40Z
Modified: 2022-06-17T00:13:40Z
Source: https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2022/06/GHSA-8mj7-wxmc-f424/GHSA-8mj7-wxmc-f424.json
CWE IDs: []
Alternative ID: N/A
Finding: F138
Auto approve: 1