From: Florian Westphal <fw@strlen.de>
To: Jenny Guanni Qu <qguanni@gmail.com>
Cc: pablo@netfilter.org, kadlec@netfilter.org,
netfilter-devel@vger.kernel.org
Subject: Re: [PATCH] netfilter: nf_nat_sip: validate exp->dir in nf_nat_sip_expected()
Date: Sat, 14 Mar 2026 00:32:37 +0100 [thread overview]
Message-ID: <abSelah2hPOUbEng@strlen.de> (raw)
In-Reply-To: <20260313201346.562476-1-qguanni@gmail.com>
Jenny Guanni Qu <qguanni@gmail.com> wrote:
> nf_nat_sip_expected() uses exp->dir to index into the 2-element
> tuplehash[] array without bounds checking. If exp->dir has an
> out-of-range value, this causes a slab-out-of-bounds read.
>
> KASAN reports:
>
> BUG: KASAN: slab-out-of-bounds in nf_nat_sip_expected+0x804/0x938
> Read of size 8 at addr ffff0000d113e3b8
> The buggy address is located 72 bytes to the right of
> allocated 240-byte region
>
> Add a bounds check to ensure exp->dir is less than IP_CT_DIR_MAX.
Ok, but exp->dir isn't expected to contain crap.
How does exp->dir become >= IP_CT_DIR_MAX?
Are you sure this isn't papering over another bug?
In particular, there is missing validation in the ctnetlink code
for the dir argument.
https://lore.kernel.org/netdev/20260313150614.21177-3-fw@strlen.de/
next prev parent reply other threads:[~2026-03-13 23:40 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-13 20:13 [PATCH] netfilter: nf_nat_sip: validate exp->dir in nf_nat_sip_expected() Jenny Guanni Qu
2026-03-13 23:32 ` Florian Westphal [this message]
2026-03-14 11:50 ` Pablo Neira Ayuso
2026-03-14 22:21 ` Guanni Qu
2026-03-15 7:26 ` Florian Westphal
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=abSelah2hPOUbEng@strlen.de \
--to=fw@strlen.de \
--cc=kadlec@netfilter.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pablo@netfilter.org \
--cc=qguanni@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.