GitHub Advisoryadvisory · crates.io
GHSA-2fjw-whxm-9v4q libnftnl has Heap-based Buffer Overflow in nftnl::Batch::with_page_size (nftnl-rs)
CRITICAL
Official page ↗
- Ecosystem
- crates.io
- Packages
- nftnl
- Severity
- Critical
- CVSS vector
- CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:L/SA:N
- Weaknesses
- CWE-122
- Reviewed
- 2025-11-25
Affected packages
• crates.io nftnl: < 0.9.0 → fixed in 0.9.0
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");
```
Related
Weakness · CWE (1)
- CWE-122 Heap-based Buffer Overflow weakness