From: Jakub Kicinski <kuba@kernel.org>
To: Daehyeon Ko <4ncienth@gmail.com>
Cc: "Paul Moore" <paul@paul-moore.com>,
"Ondrej Mosnáček" <omosnacek@gmail.com>,
"David S . Miller" <davem@davemloft.net>,
"Eric Dumazet" <edumazet@kernel.org>,
"Paolo Abeni" <pabeni@redhat.com>,
"Simon Horman" <horms@kernel.org>,
netdev@vger.kernel.org, linux-security-module@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] cipso: adjust cached option offsets when removing CIPSO
Date: Mon, 5 Oct 2026 15:38:12 -0700 [thread overview]
Message-ID: <20261005153812.27a84bac@kernel.org> (raw)
In-Reply-To: <20260930140400.2955466-1-4ncienth@gmail.com>
On Wed, 30 Sep 2026 23:04:00 +0900 Daehyeon Ko wrote:
> cipso_v4_skbuff_delattr() shifts every IPv4 option after CIPSO left by
> cipso_len, but leaves the cached srr, rr, ts and router_alert offsets at
> their old locations.
>
> With a valid eight-byte CIPSO option followed by a seven-byte RR option,
> RR moves from offset 28 to 20 while opt->rr remains 28. The stale offset
> then points into packet payload, letting the sender control both the
> length and bytes copied by __ip_options_echo(). Setting the length to
> 255 produced this condensed KASAN result:
>
> BUG: KASAN: stack-out-of-bounds in __ip_options_echo
> Write of size 255
> Call Trace:
> __ip_options_echo
> run_cipso_stale_offset [net_candidate_probe]
>
> The destination holds 40 bytes of option data. In an existing
> uninstrumented x86-64 v7.2 build, __icmp_send() places that buffer
> immediately before its stack canary, and the 255-byte copy also crosses
> the saved return address. A canary mismatch unconditionally panics;
> no canary disclosure or control-flow exploit was demonstrated.
>
> Mirror cipso_v4_delopt() and subtract cipso_len from each cached offset
> that follows CIPSO. cipso_len is the logical distance moved by the first
> memmove(); hdr_len_delta includes padding, while the later header move and
> network-header reset relocate the bytes and their base together.
>
> The adjusted input leaves rr at 20 with length 7 and completes without a
> sanitizer report. Natural remote reachability requires a configured
> SELinux/NetLabel gateway and a later option consumer; the retained test
> invokes the real mutation and echo consumer directly because the available
> rootfs has no SELinux policy or netlabelctl.
AI points out that the example given can't happen in practice:
https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260930140400.2955466-1-4ncienth@gmail.com
Please adjust the commit msg and the code per Ondrej's suggestion.
--
pw-bot: cr
prev parent reply other threads:[~2026-10-05 22:38 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-30 14:04 Daehyeon Ko
2026-10-01 7:28 ` Ondrej Mosnáček
2026-10-05 22:38 ` Jakub Kicinski [this message]
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=20261005153812.27a84bac@kernel.org \
--to=kuba@kernel.org \
--cc=4ncienth@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-security-module@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=omosnacek@gmail.com \
--cc=pabeni@redhat.com \
--cc=paul@paul-moore.com \
/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®