Intel

AIKIDO-2026-546974

napi is vulnerable to Double Free

Double FreeGHSA-wrm3-6gmv-vpmw Published 3 days ago

81

High Risk

This Affects:

RUSTnapi
3.0.0 - 3.12.1
Fixed in 3.12.2
Are you affected? Scan for Free

TL;DR

The PromiseRaw then, catch, and finally methods box a Rust callback and pass a raw pointer to a native trampoline that unconditionally reconstructs and drops the box on every invocation. Because JavaScript resolves then by name from the promise object, untrusted code can override Promise.prototype.then or supply a custom thenable that invokes the callback more than once. Repeated invocation double-frees the boxed callback, and finally can additionally leak memory depending on the invocation pattern. The fix redesigns callback ownership and finalization and adds error-path cleanup.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range and your native addon returns a PromiseRaw whose then, catch, or finally can be driven by untrusted JavaScript.

Background info

napi is vulnerable to Double Free in versions 3.0.0 - 3.12.1.

How to fix this

Upgrade the napi library to the patch version.