GHSA-2fjw-whxm-9v4q: Nftnl :Batch::with_page_size (nftnl-rs) Vulnerability

CRITICAL
CWE-122
Published
Advisory Summary

GHSA-2fjw-whxm-9v4q is a CRITICAL :batch::with_page_size (nftnl-rs) vulnerability (CWE-122: Heap-based Buffer Overflow) affecting Nftnl libraries in the crates.io ecosystem. The issue involves :batch::with_page_size (nftnl-rs). Remediation is available by upgrading affected packages to version 0.9.0.

GHSA-2fjw-whxm-9v4q at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-2fjw-whxm-9v4q
Severity CRITICAL
CVSS v3.1 Base Score N/A
CWE Classification CWE-122: Heap-based Buffer Overflow
Affected Product Nftnl
Package Ecosystem crates.io
Published Date
Last Updated

How to Fix GHSA-2fjw-whxm-9v4q

To remediate this vulnerability, upgrade all affected Nftnl dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

nftnl fixed: 0.9.0
Upgrade nftnl to 0.9.0
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for nftnl

How to Check if You Are Affected

To determine whether your application is affected by GHSA-2fjw-whxm-9v4q, inspect your project dependencies for Nftnl:

inspect dependencies for nftnl

Analyze the terminal output to locate any version of Nftnl in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 0.9.0), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-122: Heap-based Buffer Overflow, where a heap overflow condition is a buffer overflow, where the buffer that can be overwritten is allocated in the heap portion of memory, generally meaning that the buffer was allocated using a routine such as malloc(). In Nftnl, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

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"); ```

GHSA-2fjw-whxm-9v4q Affected Nftnl Versions

1 component(s)
Fixed Versions:
0.9.0
Product / Package Ecosystem Affected Versions Fixed Version
nftnl
crates.io
< 0.9.0
0.9.0

References

Frequently Asked Questions

What is GHSA-2fjw-whxm-9v4q?
GHSA-2fjw-whxm-9v4q is a security vulnerability in Nftnl involving :Batch::with_page_size (nftnl-rs) under CWE-122: Heap-based Buffer Overflow.
Which Nftnl versions are affected?
Affected versions include releases prior to 0.9.0 across affected packages: nftnl.
What version fixes GHSA-2fjw-whxm-9v4q?
Upgrading to 0.9.0 (or the latest patched release for your respective branch) resolves the vulnerability.
Is nftnl affected?
Yes, nftnl is affected in releases prior to 0.9.0. Upgrade your dependency to 0.9.0 or later.
What CWE is associated with GHSA-2fjw-whxm-9v4q?
GHSA-2fjw-whxm-9v4q is classified under CWE-122: Heap-based Buffer Overflow (A heap overflow condition is a buffer overflow, where the buffer that can be overwritten is allocated in the heap portion of memory, generally meaning that the buffer was allocated using a routine such as malloc().).
How can I check crates.io dependencies for GHSA-2fjw-whxm-9v4q?
Run the dependency tree command: 'inspect dependencies for nftnl'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-2fjw-whxm-9v4q",
  "modified" : "2025-12-01T16:04:47Z",
  "published" : "2025-11-25T23:18:37Z",
  "aliases" : [ ],
  "summary" : "libnftnl has Heap-based Buffer Overflow in nftnl::Batch::with_page_size (nftnl-rs)",
  "details" : "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.\n\nThe flaw was fixed in commit 94a286f by adding an overflow check:\n```Rust\nbatch_page_size\n    .checked_add(crate::nft_nlmsg_maxsize())\n    .expect(\"batch_page_size is too large and would overflow\");\n```",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "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"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "crates.io",
      "name" : "nftnl"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "0.9.0"
      } ]
    } ],
    "database_specific" : {
      "last_known_affected_version_range" : "<= 0.8.0"
    }
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/mullvad/nftnl-rs/issues/76#issue-3528876468"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/mullvad/nftnl-rs/commit/94a286f87e88f431913d19668246de9006790125"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/mullvad/nftnl-rs"
  }, {
    "type" : "WEB",
    "url" : "https://rustsec.org/advisories/RUSTSEC-2025-0126.html"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-122" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2025-11-25T23:18:37Z",
    "nvd_published_at" : null
  }
}