Article View: linux.kernel.netdev
Article #6468Re: [PATCH] tcp: fix authentication bypass via unsupported TCP auth options
From: Eric Dumazet
Date: Thu, 22 Oct 2026 14:46
Date: Thu, 22 Oct 2026 14:46
83 lines
11933 bytes
11933 bytes
Le mer. 21 oct. 2026 à 21:32, Jérémy Jean
<Jeremy.Jean@oss.cyber.gouv.fr> a écrit :
>
> tcp_inbound_hash() parses both TCP-MD5 and TCP-AO options when at
> least one of the two features is enabled. With TCP_MD5SIG=y and
> TCP_AO=n, a packet with an AO option reaches the disabled
> tcp_inbound_ao_hash() stub. That stub returns success, so sockets
> configured to require MD5 authentication end up accepting
> unauthenticated data.
>
> The inverse configuration with TCP_MD5SIG=n and TCP_AO=y has the same
> problem for an MD5 option on AO sockets.
>
> Make the disabled stubs reject options for the unsupported
> authentication scheme.
>
> Fixes: 0a3a809089eb ("net/tcp: Verify inbound TCP-AO signed segments")
> Cc: stable@vger.kernel.org
> Signed-off-by: Jérémy Jean <Jeremy.Jean@oss.cyber.gouv.fr>
> ---
> include/net/tcp_ao.h | 2 +-
> net/ipv4/tcp.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/include/net/tcp_ao.h b/include/net/tcp_ao.h
> index 9a2333e62e994..bb249d6df8723 100644
> --- a/include/net/tcp_ao.h
> +++ b/include/net/tcp_ao.h
> @@ -303,7 +303,7 @@ static inline enum skb_drop_reason tcp_inbound_ao_hash(struct sock *sk,
> const struct request_sock *req, int l3index,
> const struct tcp_ao_hdr *aoh)
> {
> - return SKB_NOT_DROPPED_YET;
> + return SKB_DROP_REASON_TCP_AOUNEXPECTED;
> }
>
> static inline struct tcp_ao_key *tcp_ao_do_lookup(const struct sock *sk,
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> index 87ef6d5cbfeba..7d800b6283bd2 100644
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ -4962,7 +4962,7 @@ tcp_inbound_md5_hash(const struct sock *sk, const struct sk_buff *skb,
> const void *saddr, const void *daddr,
> int family, int l3index, const __u8 *hash_location)
> {
> - return SKB_NOT_DROPPED_YET;
> + return SKB_DROP_REASON_TCP_MD5UNEXPECTED;
> }
>
> #endif
> --
> 2.47.3
>
Good catch, thanks.
The forged AO option makes us skip the unsigned fast path, which is
the only place where tcp_md5_do_lookup() can return MD5NOTFOUND.
An attacker able to hit the window of an MD5-protected session (BGP...)
can therefore inject RST or data with a junk AO option, which is
exactly what RFC 2385 is supposed to prevent.
Please mention in the changelog that TCP_AO depends on 64BIT: every
32-bit kernel with TCP_MD5SIG=y is in the vulnerable configuration.
With your patch the stubs now return what the real helpers return for
a socket without keys (AOUNEXPECTED / MD5UNEXPECTED), so behavior
becomes consistent across configs. One visible change is that MD5=n,
AO=y kernels will now drop segments carrying an MD5 option to unkeyed
sockets, as MD5=y kernels already do. That is fine, but worth one
sentence.
Optional: bumping LINUX_MIB_TCPAOKEYNOTFOUND / LINUX_MIB_TCPMD5UNEXPECTED
from the stubs would make these drops visible in nstat.
This is a fix, please send v2 as [PATCH net].
Also please CC TCP-AO folks from Arista
Reviewed-by: Eric Dumazet <edumazet@kernel.org>
Technical Details
Message-ID:
<CAL4WiiqYwtZ0851Y0M1gOAQ5uU=kjU29Puwjx7+kyR7BqKEpUg@mail.gmail.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350611-linux-kernel-netdev=dewy.ruReferences:
<20261021193151.1819085-2-Jeremy.Jean@oss.cyber.gouv.fr>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-350611-linux-kernel-netdev=dewy.ru
From: edumazet@kernel.org (Eric Dumazet)
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH] tcp: fix authentication bypass via unsupported TCP auth options
Date: Thu, 22 Oct 2026 16:46:21 +0200
Organization: Usenet Network
Message-ID: <CAL4WiiqYwtZ0851Y0M1gOAQ5uU=kjU29Puwjx7+kyR7BqKEpUg@mail.gmail.com>
References: <20261021193151.1819085-2-Jeremy.Jean@oss.cyber.gouv.fr>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: usenet.network;
logging-data="235532"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:8Sw0QknbpvZor9ovxe3V2L3O7rA= sha256:YV7XRavEHAODq0LASyU7JnOdtqkU0CKvTqVhTZeZ3qA=
sha1:sssim9xBZjD+eCMzJGqKIQDXed8= sha256:JGz5rC3DOZJVMD9xShyWvrNaeJgDbVv2BpNybIfiZRo=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 584EF1112B0; Thu, 22 Oct 2026 17:53:20 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.739
X-Spam-Status: No, score=-3.739 tagged_above=-9999 required=6.31
tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.339, DKIM_SIGNED=0.1,
DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id TT1CHpES5-OQ;
Thu, 22 Oct 2026 17:53:17 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-350611-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id 88C601112A8; Thu, 22 Oct 2026 17:53:09 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sea.lore.kernel.org (Postfix) with ESMTP id 72FA634033; Thu, 22 Oct 2026 14:46:41 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1792680401;
b=fSpqeF0naNu37WMixua1zkZmIarvKW71f+lHaBLcioraU9qce7Q54iMQ07bOx8XVaSTj
mdJsWsrirdl91envtRlVdao0Pg6mozNUJwN1IEMGBNNtTBJ87iL221/NLtJs2qAULMTrv
rnbHfMvay2/Nhi9tWkTHxyT0+b3BTkmnrCHPuWUFOE2vxSBdaGqcGwL2KPowWJ8iTq9uA
BsVjvfFDHCJrdodm5ITHmEYFT+l1CTZ2J7ZAwj7I00ZSuEo1LJ5hasn6By6FFYwHtNE4U
bWxyJlcL2qztMw2PNLxTRqOkqTZsmSYNMDE5qSjDPwLsPAS2BYg/L4ZGyZGFXskrUrg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1792680401;
h=X-Original-To:Received:Received:DKIM-Signature:Received:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Received:X-Mailing-List:
List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
List-Owner:Precedence:MIME-Version:References:In-Reply-To:From:Date:
X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID:Subject:To:Cc:
Content-Type:Content-Transfer-Encoding;
bh=+oHYwW+2+REHEr6vVJAo/VLToYTJjn8LSKpd6kIFqVk=;
b=dIxoWRhfuVsIlZkFg1zEggtNYFc/796njdSPKfvoIySb1sVXpHaQirRYBxDUN6WLi1Jn
zyuwR968as3A8+kXv6xrXQV5heq+gwSCgtFb8JyDIF+5f5xMO4dbShmTdKBR8zsnEY+AT
9FUvvs8pNLAfxCYJqISPSDbG+zebpnZAsKafOAR8YLJGtuZl97RysxqHn4Hr2SP/MLjMf
oOdIA62CtmvNsn8/h693SCLT/XmwniwxsVAd+w6PV9ERcHUdtAZX/oCCAG4ksQbRHyQs6
PhYhJxCSKj3Z2NbQ56vBrKorumf1MBDa70DxZtb7jM0YzkhnKrGKI3Ibms5iqVrWIqg==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MDnhHOoR;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id E5E6F606A31E;
Thu, 22 Oct 2026 14:46:40 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key, unprotected) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MDnhHOoR
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1792680395;
b=g1KZoDUnpYfrti+uO/6BZmPv0BMyu9TncCrQOOQ/WPCHvnSEIJhBzlUHIXnQ/HySkmNW
QbTaS0vw/5+Ve8BuBqM2rVwI1p8xJ8SUmLToMbJbLuAmiKFOhwlRQchgI0ycE4Dc52iVc
I7WmyNVVqyvpX9L3tM4+CztzO0u3ky0vkghJRpAGBvX00/JKkPJhy8z1rOUqFBqv6ep5h
1twvttE4jFBySN5tLufZAbhxl61y1UbMW16VEdU1hwxHm3+/3fvTWXlboGToOnLRyzcTT
0wRWPzOh5lH9Hh7+UuyeAP29hUYQL0jRteS2qH+JmRmF0DWXGh1KKb7hBYR0smpPq0Q==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1792680395;
h=Received:DKIM-Signature:Received:X-Forwarded-Encrypted:
X-Gm-Message-State:X-Received:MIME-Version:References:In-Reply-To:
From:Date:X-Gmail-Original-Message-ID:X-Gm-Features:Message-ID:
Subject:To:Cc:Content-Type:Content-Transfer-Encoding;
bh=+oHYwW+2+REHEr6vVJAo/VLToYTJjn8LSKpd6kIFqVk=;
b=iZ1a6wiA+DnqOlxNUf8MYCGIh9+rLHR2WfvT2X2UDP31jCpiSlsOlWVyqge14EPMwNMp
N7mFbG/b3RUl9noVvXEdDrgvGqllS2j6YPqZ5zhfErflF0+URJjXEZeFoJOlV+4rqf/sV
fgFATkUl0/oS2BoldOvxCFDrEAcS9bWTWRaYOzxm6d1DAICupLihZcwlbqGdLNtt0tDf2
7CYnNPlHTxe6JEVnOpGJZtkwIvUrQuWdrTHCzblq1uGwmIrVGXrzHByUHlU2FyVC6CCXa
4/V1D0xlaMoOrPO2VTpaIe94nzynmaiuT1+h6mRL0ighXnu327HY5DkZcEdQyFxhzpw==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=MDnhHOoR;
arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
key-exchange X25519 server-signature ECDSA (prime256v1))
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id 247D9606A31B
for <netdev@vger.kernel.org>; Thu, 22 Oct 2026 14:46:33 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id B56E71F000C5
for <netdev@vger.kernel.org>; Thu, 22 Oct 2026 14:46:33 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
s=k20260515; t=1792680393;
bh=+oHYwW+2+REHEr6vVJAo/VLToYTJjn8LSKpd6kIFqVk=;
h=References:In-Reply-To:From:Date:Subject:To:Cc;
b=MDnhHOoR0YdNyYJ1me1ajZRLCz1Bq2Ck49Vz5d+G10/s2Pc0vz9gxuzmKyA91IGMO
G6NhvrtMY0x9cK2OtbfgmCW3x9iSDOG6Si8JrVrdsBElR03vfPNsiu39jKtJGgc1eR
Vl3tCGM69Rk0puqxY52folQycDewZMmKYfsfpLaKhhiOp8izSp2BxUsD5Qk/9Lziqj
oxjUth7jX45n3PGv8xRt5oV7yRwwknaEY9COPEpJnC7g/7VT8m2hyMaNqD0fiVpTav
sig2OVOtnW/z31nf6/sfgjgX4tYeE1Tf+fnWm+WTUWSc20TVDnCzYnie1sX53xqK+x
5Bvk20EKE7L+Q==
X-Received: by mail-oo1-f44.google.com with SMTP id 006d021491bc7-6fe4372c5f3so1283429eaf.3
for <netdev@vger.kernel.org>; Thu, 22 Oct 2026 07:46:33 -0700 (PDT)
X-Forwarded-Encrypted: i=1; AKwUvBwKEz0e1e6Yaa4ZiVRgtkXlgm8pOsFIiEID8xR795Rqvld/bSyePdKnDjdJHxjfVB+WxXom2RE=@vger.kernel.org
X-Gm-Message-State: AFq9FYLTr05yofa8cUR/KaLUrmxYRC17YbquXjFlJ9O18pT9X3oqyxNa
PeYjIVbQz/FVVyNvdbfbQuNvjoNoL8RVycOg9Tx7aRNiPlnRKKGZ9EC2smdyjVCbxoR4OwKln5w
fLMx7purGMcHjBYROeZ7vGyEUh/EPoC4=
X-Received: by 2002:a05:6820:160a:b0:6fc:373a:1775 with SMTP id
006d021491bc7-70941a50e37mr3218344eaf.79.1792680393015; Thu, 22 Oct 2026
07:46:33 -0700 (PDT)
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list
X-In-Reply-To: <20261021193151.1819085-2-Jeremy.Jean@oss.cyber.gouv.fr>
X-Gmail-Original-Message-ID: <CAL4WiiqYwtZ0851Y0M1gOAQ5uU=kjU29Puwjx7+kyR7BqKEpUg@mail.gmail.com>
X-Gm-Features: AclHuK_eJ8qt7rFIbVyfxXEh_VsPWT_SRnJGCQzv1xMfMCKNtYZIIndkv2R0CTA
X-Cc: Neal Cardwell <ncardwell@google.com>, Kuniyuki Iwashima <kuniyu@google.com>, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org