critical
libnftnl has Heap-based Buffer Overflow in nftnl::Batch::with_page_size (nftnl-rs)
- Severity
- critical CVSS:4.0 by GitHub
- Published
- Last changed
- Also known as
- RUSTSEC-2025-0126
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:
batch_page_size
.checked_add(crate::nft_nlmsg_maxsize())
.expect("batch_page_size is too large and would overflow");
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| nftnl (crates.io) | before 0.9.0, from 0.0.0-0 before 0.9.0 | GitHub Advisory Database, RustSec Advisory Database |
Classification
What each source says
GitHub Advisory Database
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:
batch_page_size
.checked_add(crate::nft_nlmsg_maxsize())
.expect("batch_page_size is too large and would overflow");
RustSec Advisory Database
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:
batch_page_size
.checked_add(crate::nft_nlmsg_maxsize())
.expect("batch_page_size is too large and would overflow");
Mitigation
Upgrade to version 0.9.0 or later, which aborts instead.
References
Sources
| Source | Record | Licence |
|---|---|---|
| GitHub Advisory Database | GHSA-2fjw-whxm-9v4q changed 2025-12-01 | CC-BY-4.0 |
| RustSec Advisory Database | RUSTSEC-2025-0126 changed 2025-11-27 | CC0-1.0 |