* [PATCH net] l2tp: reject short IPv6 address attributes
@ 2026-11-17 9:21 Hyunjung Ko
2026-11-17 9:27 ` netdev-bot+sinfo
0 siblings, 1 reply; 3+ messages in thread
From: Hyunjung Ko @ 2026-11-17 9:21 UTC (permalink / raw)
To: James Chapman, Jakub Kicinski
Cc: David S . Miller, Eric Dumazet, Paolo Abeni, Simon Horman,
Chris Elston, netdev, linux-kernel, stable, Hyunjung Ko
L2TP_ATTR_IP6_SADDR and L2TP_ATTR_IP6_DADDR are NLA_BINARY with .len set
to sizeof(struct in6_addr), which only bounds the attribute from above.
l2tp_tunnel_sock_create() then copies a full in6_addr out of each one,
so a shorter attribute makes it read past the payload. If the attribute
is the last one in the message this picks up whatever lies behind the
skb tail (stale heap data unless init_on_alloc is set), which ends up
in the socket address and can be read back with L2TP_CMD_TUNNEL_GET.
The commands are GENL_UNS_ADMIN_PERM, so this is reachable from a user
namespace.
Require the exact length.
Fixes: f9bac8df908d ("l2tp: netlink api for l2tpv3 ipv6 unmanaged tunnels")
Cc: stable@vger.kernel.org
Signed-off-by: Hyunjung Ko <hj351016@gmail.com>
---
net/l2tp/l2tp_netlink.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c
index 89ef04c78787..a07009d4cb00 100644
--- a/net/l2tp/l2tp_netlink.c
+++ b/net/l2tp/l2tp_netlink.c
@@ -910,14 +910,8 @@ static const struct nla_policy l2tp_nl_policy[L2TP_ATTR_MAX + 1] = {
[L2TP_ATTR_MTU] = { .type = NLA_U16, },
[L2TP_ATTR_MRU] = { .type = NLA_U16, },
[L2TP_ATTR_STATS] = { .type = NLA_NESTED, },
- [L2TP_ATTR_IP6_SADDR] = {
- .type = NLA_BINARY,
- .len = sizeof(struct in6_addr),
- },
- [L2TP_ATTR_IP6_DADDR] = {
- .type = NLA_BINARY,
- .len = sizeof(struct in6_addr),
- },
+ [L2TP_ATTR_IP6_SADDR] = NLA_POLICY_EXACT_LEN(sizeof(struct in6_addr)),
+ [L2TP_ATTR_IP6_DADDR] = NLA_POLICY_EXACT_LEN(sizeof(struct in6_addr)),
[L2TP_ATTR_IFNAME] = {
.type = NLA_NUL_STRING,
.len = IFNAMSIZ - 1,
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net] l2tp: reject short IPv6 address attributes
2026-11-17 9:21 [PATCH net] l2tp: reject short IPv6 address attributes Hyunjung Ko
@ 2026-11-17 9:27 ` netdev-bot+sinfo
2026-11-17 9:34 ` khj
0 siblings, 1 reply; 3+ messages in thread
From: netdev-bot+sinfo @ 2026-11-17 9:27 UTC (permalink / raw)
To: Hyunjung Ko
Cc: James Chapman, Jakub Kicinski, David S . Miller, Eric Dumazet,
Paolo Abeni, Simon Horman, Chris Elston, netdev, linux-kernel,
stable
Hi!
This is an automated message. This series looks like a fix, but its
commit messages seem to be missing some information:
- How the issue was discovered, e.g. hit in production, hit during
development, syzbot report, manual code inspection, LLM or static
analysis tool scan.
- Whether the issue was actually triggered, or is only theoretical
(e.g. found by LLM and not proven at runtime). If it was triggered
please include the symptoms, like the stack trace or kernel messages.
Please do not repost the series just to address the above. Instead,
reply to this email with the missing information, so that reviewers
can take it into account.
*IMPORTANT*: If you do repost (for other reasons) - please include
the relevant info in the cover letter or commit messages.
--
The evaluation is done by an LLM so it may be wrong, if you think
that is the case please reply and explain.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] l2tp: reject short IPv6 address attributes
2026-11-17 9:27 ` netdev-bot+sinfo
@ 2026-11-17 9:34 ` khj
0 siblings, 0 replies; 3+ messages in thread
From: khj @ 2026-11-17 9:34 UTC (permalink / raw)
To: netdev-bot+sinfo
Cc: James Chapman, Jakub Kicinski, David S . Miller, Eric Dumazet,
Paolo Abeni, Simon Horman, Chris Elston, netdev, linux-kernel,
stable
The issue was found by a static analysis scan (pattern rules for
NLA_BINARY attributes that are read with a fixed size, LLM-assisted),
then confirmed by reading the code.
It was triggered at runtime on 7.4-rc1 in QEMU: an unprivileged user in
its own user+net namespace creates an L2TPv3 IPv6 tunnel with a 0 or
4 byte L2TP_ATTR_IP6_DADDR, and L2TP_CMD_TUNNEL_GET returns 16 bytes,
the missing ones being stale heap data:
sent 0 byte(s): 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41 41
sent 4 byte(s): 20 20 20 20 41 41 41 41 41 41 41 41 41 41 41 41
There is no KASAN report, since the read stays inside the skb head
allocation. The leaked bytes are non-zero only with init_on_alloc=0.
2026년 11월 17일 (화) 오후 6:27, <netdev-bot+sinfo@kernel.org>님이 작성:
>
> Hi!
>
> This is an automated message. This series looks like a fix, but its
> commit messages seem to be missing some information:
>
> - How the issue was discovered, e.g. hit in production, hit during
> development, syzbot report, manual code inspection, LLM or static
> analysis tool scan.
>
> - Whether the issue was actually triggered, or is only theoretical
> (e.g. found by LLM and not proven at runtime). If it was triggered
> please include the symptoms, like the stack trace or kernel messages.
>
> Please do not repost the series just to address the above. Instead,
> reply to this email with the missing information, so that reviewers
> can take it into account.
>
> *IMPORTANT*: If you do repost (for other reasons) - please include
> the relevant info in the cover letter or commit messages.
> --
> The evaluation is done by an LLM so it may be wrong, if you think
> that is the case please reply and explain.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-11-17 9:35 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-17 9:21 [PATCH net] l2tp: reject short IPv6 address attributes Hyunjung Ko
2026-11-17 9:27 ` netdev-bot+sinfo
2026-11-17 9:34 ` khj
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox