Netdev List
 help / color / mirror / Atom feed
* [PATCH net] sctp: validate SACK pull length against chunk length, not skb length
@ 2026-11-12 15:01 Xin Long
  2026-11-17  0:20 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 3+ messages in thread
From: Xin Long @ 2026-11-12 15:01 UTC (permalink / raw)
  To: network dev, linux-sctp
  Cc: davem, kuba, Eric Dumazet, Paolo Abeni, Simon Horman,
	Marcelo Ricardo Leitner, on Sim

sctp_sm_pull_sack() derives its pull length from the num_gap_ack_blocks
and num_dup_tsns fields in the SACK body, but validates it against
chunk->skb->len (the remaining packet data) rather than the SACK chunk's
declared length. A malformed SACK with an inflated num_dup_tsns can pass
this check when subsequent chunks pad the skb, advancing skb->data past
the SACK boundary into later chunks.

This misaligns the skb cursor for subsequent chunk processing. When an
AUTH chunk follows, sctp_sf_authenticate() reads and compares the HMAC
digest from the wrong skb offset while sctp_auth_calculate_hmac() writes
the computed HMAC through the correct chunk_hdr pointer, bypassing the
authentication check.

Fix by validating the computed pull length against the chunk's declared
body length instead of the total remaining skb data.

Fixes: 730fc3d05cd4 ("[SCTP]: Implete SCTP-AUTH parameter processing")
Reported-by: on Sim <tlatkdgus1@gmail.com>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
---
 net/sctp/sm_statefuns.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/sctp/sm_statefuns.c b/net/sctp/sm_statefuns.c
index b2f609f177fb..44b1770d43c1 100644
--- a/net/sctp/sm_statefuns.c
+++ b/net/sctp/sm_statefuns.c
@@ -6368,7 +6368,8 @@ static struct sctp_sackhdr *sctp_sm_pull_sack(struct sctp_chunk *chunk)
 	num_dup_tsns = ntohs(sack->num_dup_tsns);
 	len = sizeof(struct sctp_sackhdr);
 	len += (num_blocks + num_dup_tsns) * sizeof(__u32);
-	if (len > chunk->skb->len)
+	if (len > ntohs(chunk->chunk_hdr->length) -
+		  sizeof(struct sctp_chunkhdr))
 		return NULL;
 
 	skb_pull(chunk->skb, len);
-- 
2.47.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net] sctp: validate SACK pull length against chunk length, not skb length
@ 2026-11-12 15:08 netdev-bot+sinfo
  0 siblings, 0 replies; 3+ messages in thread
From: netdev-bot+sinfo @ 2026-11-12 15:08 UTC (permalink / raw)
  To: Xin Long
  Cc: network dev, linux-sctp, davem, kuba, Eric Dumazet, Paolo Abeni,
	Simon Horman, Marcelo Ricardo Leitner, on Sim

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. If the series needs another revision for
other reasons, please include the information in the commit messages
then.

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] sctp: validate SACK pull length against chunk length, not skb length
  2026-11-12 15:01 [PATCH net] sctp: validate SACK pull length against chunk length, not skb length Xin Long
@ 2026-11-17  0:20 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-11-17  0:20 UTC (permalink / raw)
  To: Xin Long
  Cc: netdev, linux-sctp, davem, kuba, edumazet, pabeni, horms,
	marcelo.leitner, tlatkdgus1

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 12 Nov 2026 10:01:42 -0500 you wrote:
> sctp_sm_pull_sack() derives its pull length from the num_gap_ack_blocks
> and num_dup_tsns fields in the SACK body, but validates it against
> chunk->skb->len (the remaining packet data) rather than the SACK chunk's
> declared length. A malformed SACK with an inflated num_dup_tsns can pass
> this check when subsequent chunks pad the skb, advancing skb->data past
> the SACK boundary into later chunks.
> 
> [...]

Here is the summary with links:
  - [net] sctp: validate SACK pull length against chunk length, not skb length
    https://git.kernel.org/netdev/net/c/533ec433efdc

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-17  0:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-12 15:01 [PATCH net] sctp: validate SACK pull length against chunk length, not skb length Xin Long
2026-11-17  0:20 ` patchwork-bot+netdevbpf
  -- strict thread matches above, loose matches on Subject: below --
2026-11-12 15:08 netdev-bot+sinfo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox