Skip to content
OpenAdvisories
Critical GHSA-2fjw-whxm-9v4q RUSTSEC-2025-0126

libnftnl has Heap-based Buffer Overflow in nftnl::Batch::with_page_size (nftnl-rs)

Published Nov 25, 2025 · Updated Dec 1, 2025 · Assigned by GHSA

Description

A heap-buffer-overflow vulnerability exists in the Rust wrapper for libnftnl, triggered via the nftnl::Batch::with_page_size constructor. When a small or malformed page size is provided, the underlying C code allocates an insufficient buffer, leading to out-of-bounds writes during batch initialization.

The flaw was fixed in commit 94a286f by adding an overflow check:
```Rust
batch_page_size
.checked_add(crate::nft_nlmsg_maxsize())
.expect("batch_page_size is too large and would overflow");
```

Affected packages

EcosystemPackageAffectedFixedRecord
crates.io nftnl < 0.9.0 0.9.0 GHSA-2fjw-whxm-9v4q
crates.io nftnl >= 0.0.0-0, < 0.9.0 0.9.0 RUSTSEC-2025-0126

References