In the Linux kernel through 5.8.7, local attackers able to inject conntrack netlink configuration could overflow a local buffer, causing crashes or triggering use of incorrect protocol numbers in ctnetlink_parse_tuple_filter in net/netfilter/nf_conntrack_netlink.c. References: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1cc5ef91d2ff94d2bf2de3b3585423e8a1051cb6 https://twitter.com/grsecurity/status/1303646421158109185
Created kernel tracking bugs for this issue: Affects: fedora-all [bug 1877572]
The bug didn't exist before 5.8 kernels, because function ctnetlink_parse_tuple_filter(..) added starting with 5.8 to the net/netfilter/nf_conntrack_netlink.c. All rhel* non-affected as result.
> The bug didn't exist before 5.8 kernels, because function ctnetlink_parse_tuple_filter(..) added starting with 5.8 to the net/netfilter/nf_conntrack_netlink.c. Looks like the affected code is still present in RHEL kernels, in ctnetlink_parse_tuple(). At least, 3.10.0-1127.18.2.el7 has it: static int ctnetlink_parse_tuple(const struct nlattr * const cda[], struct nf_conntrack_tuple *tuple, enum ctattr_type type, u_int8_t l3num, struct nf_conntrack_zone *zone) { struct nlattr *tb[CTA_TUPLE_MAX+1]; int err; memset(tuple, 0, sizeof(*tuple)); err = nla_parse_nested(tb, CTA_TUPLE_MAX, cda[type], tuple_nla_policy); if (err < 0) return err; if (!tb[CTA_TUPLE_IP]) return -EINVAL; tuple->src.l3num = l3num; // l3num is not validated here at all <...> } The commit message of the
The commit message of the upstream fix also states that the bug happened with the kernel 4.14.180 and crash could be triggered in the kernels up to 5.4 exclusive. No public reproducer though.
FEDORA-2020-5920a7a0b2 has been pushed to the Fedora 31 stable repository. If problem still persists, please make note of it in this bug report.
FEDORA-2020-3c6fedeb83 has been pushed to the Fedora 32 stable repository. If problem still persists, please make note of it in this bug report.
This bug is now closed. Further updates for individual products will be reflected on the CVE page(s): https://access.redhat.com/security/cve/cve-2020-25211
In reply to comment #3: > > The bug didn't exist before 5.8 kernels, because function ctnetlink_parse_tuple_filter(..) added starting with 5.8 to the net/netfilter/nf_conntrack_netlink.c. > > Looks like the affected code is still present in RHEL kernels, in > ctnetlink_parse_tuple(). At least, 3.10.0-1127.18.2.el7 has it: > > static int > ctnetlink_parse_tuple(const struct nlattr * const cda[], > .. Looking to the original patch, it is for ctnetlink_parse_tuple_filter(..), but not for ctnetlink_parse_tuple(..): https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1cc5ef91d2ff94d2bf2de3b3585423e8a1051cb6 diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index 832eabecfbddc..d65846aa80591 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c @@ -1404,7 +1404,8 @@ ctnetlink_parse_tuple_filter(const struct nlattr * const cda[], if (err < 0) return err; - + if (l3num != NFPROTO_IPV4 && l3num != NFPROTO_IPV6) + return -EOPNOTSUPP; tuple->src.l3num = l3num; if (flags & CTA_FILTER_FLAG(CTA_IP_DST) || , but both I can see that ctnetlink_parse_tuple(..) is wrapper around ctnetlink_parse_tuple_filter(..): static int ctnetlink_parse_tuple(const struct nlattr * const cda[], struct nf_conntrack_tuple *tuple, u32 type, u_int8_t l3num, struct nf_conntrack_zone *zone) { return ctnetlink_parse_tuple_filter(cda, tuple, type, l3num, zone, CTA_FILTER_FLAG(ALL)); } , so you are right that need to apply the patch for the older versions too (but to func ctnetlink_parse_tuple(..) instead of ctnetlink_parse_tuple_filter(..)). Thank you.
Mitigation: To mitigate this issue, prevent module nf_conntrack_netlink from being loaded. Please see https://access.redhat.com/solutions/41278 for how to blacklist a kernel module to prevent it from loading automatically.
Acknowledgments: Name: Will McVicker (Google)
External References: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=1cc5ef91d2ff94d2bf2de3b3585423e8a1051cb6
Statement: This flaw is rated as having Moderate impact (Red Hat Enterprise Linux 7 and lower) because of the need to have CAP_NET_ADMIN privileges. This flaw is rated as having Important (Red Hat Enterprise Linux 8) impact because of the need to have CAP_NET_ADMIN privileges. Red Hat Enterprise Linux 8 enabled unprivileged user/network namespaces by default which can be used to exercise this vulnerability.
This issue has been addressed in the following products: Red Hat Enterprise Linux 8 Via RHSA-2021:0004 https://access.redhat.com/errata/RHSA-2021:0004
This issue has been addressed in the following products: Red Hat Enterprise Linux 8 Via RHSA-2021:0003 https://access.redhat.com/errata/RHSA-2021:0003
This issue has been addressed in the following products: Red Hat Enterprise Linux 8.1 Extended Update Support Via RHSA-2021:0184 https://access.redhat.com/errata/RHSA-2021:0184
This issue has been addressed in the following products: Red Hat Enterprise Linux 8.1 Extended Update Support Via RHSA-2021:0189 https://access.redhat.com/errata/RHSA-2021:0189
This issue has been addressed in the following products: Red Hat Enterprise Linux 8.2 Extended Update Support Via RHSA-2021:0763 https://access.redhat.com/errata/RHSA-2021:0763
This issue has been addressed in the following products: Red Hat Enterprise Linux 8.2 Extended Update Support Via RHSA-2021:0774 https://access.redhat.com/errata/RHSA-2021:0774
This issue has been addressed in the following products: Red Hat Enterprise Linux 8.2 Extended Update Support Via RHSA-2021:0765 https://access.redhat.com/errata/RHSA-2021:0765
This issue has been addressed in the following products: Red Hat Enterprise Linux 7 Via RHSA-2021:0856 https://access.redhat.com/errata/RHSA-2021:0856
This issue has been addressed in the following products: Red Hat Enterprise Linux 7 Via RHSA-2021:0857 https://access.redhat.com/errata/RHSA-2021:0857
This issue has been addressed in the following products: Red Hat Enterprise Linux 7.7 Extended Update Support Via RHSA-2021:1531 https://access.redhat.com/errata/RHSA-2021:1531
This issue has been addressed in the following products: Red Hat Enterprise Linux 7.4 Advanced Update Support Red Hat Enterprise Linux 7.4 Update Services for SAP Solutions Red Hat Enterprise Linux 7.4 Telco Extended Update Support Via RHSA-2021:2164 https://access.redhat.com/errata/RHSA-2021:2164
This issue has been addressed in the following products: Red Hat Enterprise Linux 7.6 Advanced Update Support Red Hat Enterprise Linux 7.6 Update Services for SAP Solutions Red Hat Enterprise Linux 7.6 Telco Extended Update Support Via RHSA-2021:2355 https://access.redhat.com/errata/RHSA-2021:2355