Intel

AIKIDO-2026-229227

napi is vulnerable to Type Confusion

Type ConfusionGHSA-rhpj-pggq-896v Published Today

81

High Risk

This Affects:

RUSTnapi
2.0.0 - 3.12.3
Fixed in 3.12.4
Are you affected? Scan for Free

TL;DR

Object::unwrap::<T>(), Object::remove_wrapped::<T>(), and their deprecated compat-mode twins validate a payload by reading a TypeId from its first bytes, which only holds for payloads created by Object::wrap. When a JavaScript-controlled object is passed instead, the code reads the TypeId from an incompatible allocation and can read past its end, then dereferences or detaches the forged payload. This yields out-of-bounds heap reads and JavaScript-forgeable out-of-bounds writes. The fix records wrapped payloads in a registry and checks membership before any TypeId read.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range and your add-on passes JavaScript-controlled objects to unwrap or remove_wrapped.

Background info

napi is vulnerable to Type Confusion in versions 2.0.0 - 3.12.3.

How to fix this

Upgrade the napi library to the patch version.

Are You Affected?

Connect your repositories to instantly see whether vulnerable or malicious packages exist in your codebase.

Free. No credit card required.

Aikido Platform