Advisory Database
  • Advisories
  • Dependency Scanning
  1. cargo
  2. ›
  3. neon
  4. ›
  5. GHSA-8mj7-wxmc-f424

GHSA-8mj7-wxmc-f424: Use after free in Neon external buffers

June 17, 2022

Neon provides functionality for creating JavaScript ArrayBuffer (and the Buffer subtype) instances backed by bytes allocated outside of V8/Node. The JsArrayBuffer::external and JsBuffer::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.

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)
}

References

  • github.com/advisories/GHSA-8mj7-wxmc-f424
  • github.com/neon-bindings/neon
  • github.com/neon-bindings/neon/issues/896
  • rustsec.org/advisories/RUSTSEC-2022-0028.html

Code Behaviors & Features

Detect and mitigate GHSA-8mj7-wxmc-f424 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Dependency Scanning using SBOM also detects vulnerabilities from proprietary advisories that this site does not include. Learn more about Dependency Scanning using SBOM →

Affected versions

All versions starting from 0.8.0 before 0.10.1

Fixed versions

  • 0.10.1

Solution

Upgrade to version 0.10.1 or above.

Source file

cargo/neon/GHSA-8mj7-wxmc-f424.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Sun, 08 Nov 2026 00:16:28 +0000.