Skip to content

Commit c3747b9

Browse files
committed
netfilter: nft_payload: incorrect arithmetics when fetching VLAN header bits
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2161725 Upstream Status: net commit 696e1a4 CVE: CVE-2023-0179 commit 696e1a4 Author: Pablo Neira Ayuso <pablo@netfilter.org> Date: Wed Jan 11 17:07:33 2023 +0100 netfilter: nft_payload: incorrect arithmetics when fetching VLAN header bits If the offset + length goes over the ethernet + vlan header, then the length is adjusted to copy the bytes that are within the boundaries of the vlan_ethhdr scratchpad area. The remaining bytes beyond ethernet + vlan header are copied directly from the skbuff data area. Fix incorrect arithmetic operator: subtract, not add, the size of the vlan header in case of double-tagged packets to adjust the length accordingly to address CVE-2023-0179. Reported-by: Davide Ornaghi <d.ornaghi97@gmail.com> Fixes: f6ae9f1 ("netfilter: nft_payload: add C-VLAN support") Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Florian Westphal <fwestpha@redhat.com>
1 parent a70d62a commit c3747b9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/netfilter/nft_payload.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ nft_payload_copy_vlan(u32 *d, const struct sk_buff *skb, u8 offset, u8 len)
6262
return false;
6363

6464
if (offset + len > VLAN_ETH_HLEN + vlan_hlen)
65-
ethlen -= offset + len - VLAN_ETH_HLEN + vlan_hlen;
65+
ethlen -= offset + len - VLAN_ETH_HLEN - vlan_hlen;
6666

6767
memcpy(dst_u8, vlanh + offset - vlan_hlen, ethlen);
6868

0 commit comments

Comments
 (0)