Rust advisories / nftnl
Vulnerability CriticalRUSTSEC-2025-0126 · nftnl
RUSTSEC-2025-0126: Heap-buffer-overflow in nftnl::Batch::with_page_size (nftnl-rs)
Short answerA security vulnerability in the nftnl crate: Heap-buffer-overflow in nftnl::Batch::with_page_size (nftnl-rs). GitHub rates it Critical. Fixed in 0.9.0: update to a fixed version.
| Crate | nftnl |
|---|---|
| Type | Vulnerability (memory-corruption) |
| Affected versions | Before 0.9.0. |
| Fixed in | 0.9.0 |
| Severity | Critical (GitHub rating) |
| Published | 2025-10-18 |
| Last changed | 2025-11-27 |
| Also known as | GHSA-2fjw-whxm-9v4q |
What to do
- See which version you have:
cargo tree -i nftnl(it also shows which of your dependencies pulls it in). - Update within your version requirement:
cargo update -p nftnl. If the fix is a newer major or minor than your requirement allows, raise it in Cargo.toml (for examplenftnl = "0.9.0") or update the dependency that pulls it in. - Check again with
cargo audit, or paste your Cargo.lock into our Cargo.toml checker.
Details from the advisory
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
- Package: crates.io/crates/nftnl
- Advisory: rustsec.org/advisories/RUSTSEC-2025-0126.html
- Report: github.com/mullvad/nftnl-rs/issues/76#issue-3528876468
From the RustSec Advisory Database (CC0-1.0) via the OSV export, downloaded Oct 24, 2026. Severity score computed from the published CVSS vector.
Up next
Are you affected?Check your whole dependency treePaste Cargo.lock: every advisory, for your exact versions.Read it next →Also worth your time
Did this answer your question?