Skip to content

[ciqlts8_6] ipv6: icmp: clear skb2->cb[] in ip6_err_gen_icmpv6_unreach()#1331

Merged
bmastbergen merged 2 commits into
ciqlts8_6from
{bmastbergen}_ciqlts8_6
Jun 11, 2026
Merged

[ciqlts8_6] ipv6: icmp: clear skb2->cb[] in ip6_err_gen_icmpv6_unreach()#1331
bmastbergen merged 2 commits into
ciqlts8_6from
{bmastbergen}_ciqlts8_6

Conversation

@ciq-kernel-automation

@ciq-kernel-automation ciq-kernel-automation Bot commented Jun 11, 2026

Copy link
Copy Markdown

Summary

This PR has been automatically created after successful completion of all CI stages.

Commit Message(s)

ipv6: icmp: clear skb2->cb[] in ip6_err_gen_icmpv6_unreach()

jira VULN-183735
cve CVE-2026-43038
commit-author Eric Dumazet <edumazet@google.com>
commit 86ab3e55673a7a49a841838776f1ab18d23a67b5
ip6_tunnel: clear skb2->cb[] in ip4ip6_err()
jira VULN-183729
cve CVE-2026-43037
commit-author Eric Dumazet <edumazet@google.com>
commit 2edfa31769a4add828a7e604b21cb82aaaa05925

Test Results

✅ Build Stage

Architecture Build Time Total Time
x86_64 23m 29s 24m 25s
aarch64 9m 42s 10m 19s

✅ Boot Verification

✅ Kernel Selftests

Architecture Passed Failed Compared Against Status
x86_64 108 31 ciqlts8_6 ⚠️ No baseline available
aarch64 67 20 ciqlts8_6 ⚠️ No baseline available

✅ LTP Results

Architecture Passed Failed Compared Against Status
x86_64 1456 13 ciqlts8_6 ⚠️ No baseline available
aarch64 1426 13 ciqlts8_6 ⚠️ No baseline available

🤖 This PR was automatically generated by GitHub Actions
Run ID: 27349835285

jira VULN-183735
cve CVE-2026-43038
commit-author Eric Dumazet <edumazet@google.com>
commit 86ab3e5

Sashiko AI-review observed:

  In ip6_err_gen_icmpv6_unreach(), the skb is an outer IPv4 ICMP error packet
  where its cb contains an IPv4 inet_skb_parm. When skb is cloned into skb2
  and passed to icmp6_send(), it uses IP6CB(skb2).

  IP6CB interprets the IPv4 inet_skb_parm as an inet6_skb_parm. The cipso
  offset in inet_skb_parm.opt directly overlaps with dsthao in inet6_skb_parm
  at offset 18.

  If an attacker sends a forged ICMPv4 error with a CIPSO IP option, dsthao
  would be a non-zero offset. Inside icmp6_send(), mip6_addr_swap() is called
  and uses ipv6_find_tlv(skb, opt->dsthao, IPV6_TLV_HAO).

  This would scan the inner, attacker-controlled IPv6 packet starting at that
  offset, potentially returning a fake TLV without checking if the remaining
  packet length can hold the full 18-byte struct ipv6_destopt_hao.

  Could mip6_addr_swap() then perform a 16-byte swap that extends past the end
  of the packet data into skb_shared_info?

  Should the cb array also be cleared in ip6_err_gen_icmpv6_unreach() and
  ip6ip6_err() to prevent this?

This patch implements the first suggestion.

I am not sure if ip6ip6_err() needs to be changed.
A separate patch would be better anyway.

Fixes: ca15a07 ("sit: generate icmpv6 error when receiving icmpv4 error")
	Reported-by: Ido Schimmel <idosch@nvidia.com>
Closes: https://sashiko.dev/#/patchset/20260326155138.2429480-1-edumazet%40google.com
	Signed-off-by: Eric Dumazet <edumazet@google.com>
	Cc: Oskar Kjos <oskar.kjos@hotmail.com>
	Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20260326202608.2976021-1-edumazet@google.com
	Signed-off-by: Jakub Kicinski <kuba@kernel.org>
(cherry picked from commit 86ab3e5)
	Signed-off-by: Brett Mastbergen <bmastbergen@ciq.com>
jira VULN-183729
cve CVE-2026-43037
commit-author Eric Dumazet <edumazet@google.com>
commit 2edfa31

Oskar Kjos reported the following problem.

ip4ip6_err() calls icmp_send() on a cloned skb whose cb[] was written
by the IPv6 receive path as struct inet6_skb_parm. icmp_send() passes
IPCB(skb2) to __ip_options_echo(), which interprets that cb[] region
as struct inet_skb_parm (IPv4). The layouts differ: inet6_skb_parm.nhoff
at offset 14 overlaps inet_skb_parm.opt.rr, producing a non-zero rr
value. __ip_options_echo() then reads optlen from attacker-controlled
packet data at sptr[rr+1] and copies that many bytes into dopt->__data,
a fixed 40-byte stack buffer (IP_OPTIONS_DATA_FIXED_SIZE).

To fix this we clear skb2->cb[], as suggested by Oskar Kjos.

Also add minimal IPv4 header validation (version == 4, ihl >= 5).

Fixes: c4d3efa ("[IPV6] IP6TUNNEL: Add support to IPv4 over IPv6 tunnel.")
	Reported-by: Oskar Kjos <oskar.kjos@hotmail.com>
	Signed-off-by: Eric Dumazet <edumazet@google.com>
	Reviewed-by: Ido Schimmel <idosch@nvidia.com>
Link: https://patch.msgid.link/20260326155138.2429480-1-edumazet@google.com
	Signed-off-by: Jakub Kicinski <kuba@kernel.org>
(cherry picked from commit 2edfa31)
	Signed-off-by: Brett Mastbergen <bmastbergen@ciq.com>
@ciq-kernel-automation ciq-kernel-automation Bot added the created-by-kernelci Tag PRs that were automatically created when a user branch was pushed to the repo (kernelCI) label Jun 11, 2026
@github-actions

Copy link
Copy Markdown

🤖 Validation Checks In Progress Workflow run: https://github.com/ctrliq/kernel-src-tree/actions/runs/27364966796

@github-actions

Copy link
Copy Markdown

Validation checks completed successfully View full results: https://github.com/ctrliq/kernel-src-tree/actions/runs/27364966796

@PlaidCat PlaidCat left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@bmastbergen bmastbergen self-requested a review June 11, 2026 18:33

@bmastbergen bmastbergen left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥌

@bmastbergen bmastbergen merged commit 3126133 into ciqlts8_6 Jun 11, 2026
5 checks passed
@bmastbergen bmastbergen deleted the {bmastbergen}_ciqlts8_6 branch June 11, 2026 18:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

created-by-kernelci Tag PRs that were automatically created when a user branch was pushed to the repo (kernelCI)

Development

Successfully merging this pull request may close these issues.

2 participants