From: David Lee <david.lee@trailofbits.com>
To: marek.lindner@mailbox.org, sw@simonwunderlich.de,
antonio@mandelbit.com, sven@narfation.org
Cc: David Lee <david.lee@trailofbits.com>,
Kyle Zeng <kylebot@openai.com>,
Dominik 'Disconnect3d' Czarnota
<dominik.czarnota@trailofbits.com>,
b.a.t.m.a.n@lists.open-mesh.org, linux-kernel@vger.kernel.org
Subject: [PATCH] batman-adv: reject unrepresentable multicast TVLV offsets
Date: Fri, 31 Jul 2026 13:52:22 +0000 [thread overview]
Message-ID: <20260731135222.566367-1-david.lee@trailofbits.com> (raw)
The network and transport header fields in struct sk_buff are 16-bit
offsets from skb->head, and U16_MAX is reserved as the unset transport
header value. batadv_tvlv_call_handler() sets both fields without checking
that the end of a received multicast TVLV is representable.
A sufficiently large TVLV therefore wraps the transport header offset.
skb_network_header_len() then returns a bogus large length, allowing
batadv_mcast_forw_packet() to access memory beyond the skb data.
Reject multicast TVLVs whose absolute end offset cannot be represented
before changing either header field.
Fixes: 07afe1ba288c ("batman-adv: mcast: implement multicast packet reception and forwarding")
Bug found and triaged by OpenAI Security Research and
validated by Trail of Bits.
Assisted-by: Codex:gpt-5.6-sol gpt-5.5-cyber
Signed-off-by: Kyle Zeng <kylebot@openai.com>
---
Trail of Bits has a reproducer for this bug that triggers a
KASAN use-after-free and can share if needed.
net/batman-adv/tvlv.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/batman-adv/tvlv.c b/net/batman-adv/tvlv.c
index 1c9fb2198..5e9d0e2dd 100644
--- a/net/batman-adv/tvlv.c
+++ b/net/batman-adv/tvlv.c
@@ -433,6 +433,9 @@ static int batadv_tvlv_call_handler(struct batadv_priv *bat_priv,
return NET_RX_SUCCESS;
tvlv_offset = (unsigned char *)tvlv_value - skb->data;
+ if (skb_headroom(skb) + tvlv_offset + tvlv_value_len >= U16_MAX)
+ return -EINVAL;
+
skb_set_network_header(skb, tvlv_offset);
skb_set_transport_header(skb, tvlv_offset + tvlv_value_len);
--
2.53.0
next reply other threads:[~2026-07-31 13:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-31 13:52 David Lee [this message]
2026-07-31 15:46 ` Sven Eckelmann
2026-07-31 19:05 ` Sven Eckelmann
2026-07-31 15:46 ` Sven Eckelmann
2026-08-01 9:55 ` Sven Eckelmann
2026-08-01 9:54 ` [PATCH] batman-adv: reject unrepresentable multicast TVLV offsets (+ b4 check signed-off-problems) Sven Eckelmann
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260731135222.566367-1-david.lee@trailofbits.com \
--to=david.lee@trailofbits.com \
--cc=antonio@mandelbit.com \
--cc=b.a.t.m.a.n@lists.open-mesh.org \
--cc=dominik.czarnota@trailofbits.com \
--cc=kylebot@openai.com \
--cc=linux-kernel@vger.kernel.org \
--cc=marek.lindner@mailbox.org \
--cc=sven@narfation.org \
--cc=sw@simonwunderlich.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®