<Vulnerability name="CVE-2026-31681">
    <DocumentDistribution xml:lang="en">Copyright © 2012 Red Hat, Inc. All rights reserved.</DocumentDistribution>
    <ThreatSeverity>Moderate</ThreatSeverity>
    <PublicDate>2026-04-25T00:00:00</PublicDate>
    <Bugzilla id="2461753" url="https://bugzilla.redhat.com/show_bug.cgi?id=2461753" xml:lang="en:us">
kernel: netfilter: xt_multiport: validate range encoding in checkentry
    </Bugzilla>
    <CVSS3 status="draft">
        <CVSS3BaseScore>6.1</CVSS3BaseScore>
        <CVSS3ScoringVector>CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:L/I:N/A:H</CVSS3ScoringVector>
    </CVSS3>
    <CWE>CWE-125</CWE>
    <Details xml:lang="en:us" source="Mitre">
In the Linux kernel, the following vulnerability has been resolved:

netfilter: xt_multiport: validate range encoding in checkentry

ports_match_v1() treats any non-zero pflags entry as the start of a
port range and unconditionally consumes the next ports[] element as
the range end.

The checkentry path currently validates protocol, flags and count, but
it does not validate the range encoding itself. As a result, malformed
rules can mark the last slot as a range start or place two range starts
back to back, leaving ports_match_v1() to step past the last valid
ports[] element while interpreting the rule.

Reject malformed multiport v1 rules in checkentry by validating that
each range start has a following element and that the following element
is not itself marked as another range start.
    </Details>
    <Details xml:lang="en:us" source="Red Hat">
A flaw was found in the Linux kernel's netfilter xt_multiport module. This vulnerability arises from insufficient validation of range encoding within the `checkentry` function. A local attacker can exploit this by crafting malformed multiport rules, which causes the `ports_match_v1()` function to read beyond its intended memory boundary. This out-of-bounds read can lead to a denial of service (DoS) or potentially disclose sensitive information.
    </Details>
    <Statement xml:lang="en:us">
An out of bounds read can occur in the xt_multiport v1 match because the range encoding uses pflags and the matcher treats any non zero pflags entry as the start of a port range and then unconditionally consumes the next ports element as the range end. The checkentry path previously validated protocol flags and count but did not validate that every range start has a following element and that two consecutive elements are not both marked as range starts. A local attacker with CAP_NET_ADMIN can install a malformed rule with an invalid pflags layout and later trigger the match during packet processing. This can lead to a kernel crash. For the CVSS the PR is L because installing or modifying iptables or ip6tables rules requires administrative networking privileges.
    </Statement>
    <Mitigation xml:lang="en:us">
In order to trigger the issue, it requires the ability to create user/net namespaces.

On non-containerized deployments of Red Hat Enterprise Linux 8, it is recommended to disable user namespaces by setting user.max_user_namespaces to 0:

# echo "user.max_user_namespaces=0" &gt; /etc/sysctl.d/userns.conf
# sysctl -p /etc/sysctl.d/userns.conf

On containerized deployments, such as Red Hat OpenShift Container Platform, do not use this mitigation as the functionality is needed to be enabled.
    </Mitigation>
    <PackageState cpe="cpe:/o:redhat:enterprise_linux:10">
        <ProductName>Red Hat Enterprise Linux 10</ProductName>
        <FixState>Fix deferred</FixState>
        <PackageName>kernel</PackageName>
    </PackageState>
    <PackageState cpe="cpe:/o:redhat:enterprise_linux:6">
        <ProductName>Red Hat Enterprise Linux 6</ProductName>
        <FixState>Out of support scope</FixState>
        <PackageName>kernel</PackageName>
    </PackageState>
    <PackageState cpe="cpe:/o:redhat:enterprise_linux:7">
        <ProductName>Red Hat Enterprise Linux 7</ProductName>
        <FixState>Fix deferred</FixState>
        <PackageName>kernel</PackageName>
    </PackageState>
    <PackageState cpe="cpe:/o:redhat:enterprise_linux:7">
        <ProductName>Red Hat Enterprise Linux 7</ProductName>
        <FixState>Fix deferred</FixState>
        <PackageName>kernel-rt</PackageName>
    </PackageState>
    <PackageState cpe="cpe:/o:redhat:enterprise_linux:8">
        <ProductName>Red Hat Enterprise Linux 8</ProductName>
        <FixState>Fix deferred</FixState>
        <PackageName>kernel</PackageName>
    </PackageState>
    <PackageState cpe="cpe:/o:redhat:enterprise_linux:8">
        <ProductName>Red Hat Enterprise Linux 8</ProductName>
        <FixState>Fix deferred</FixState>
        <PackageName>kernel-rt</PackageName>
    </PackageState>
    <PackageState cpe="cpe:/o:redhat:enterprise_linux:9">
        <ProductName>Red Hat Enterprise Linux 9</ProductName>
        <FixState>Fix deferred</FixState>
        <PackageName>kernel</PackageName>
    </PackageState>
    <PackageState cpe="cpe:/o:redhat:enterprise_linux:9">
        <ProductName>Red Hat Enterprise Linux 9</ProductName>
        <FixState>Fix deferred</FixState>
        <PackageName>kernel-rt</PackageName>
    </PackageState>
    <References xml:lang="en:us">
https://www.cve.org/CVERecord?id=CVE-2026-31681
https://nvd.nist.gov/vuln/detail/CVE-2026-31681
https://lore.kernel.org/linux-cve-announce/2026042545-CVE-2026-31681-3c5b@gregkh/T
    </References>
</Vulnerability>