linux-security-module.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Kernel memory corruption in CIPSO labeled TCP packets processing.
@ 2019-01-15 17:06 Nazarov Sergey
  2019-01-15 17:55 ` Casey Schaufler
  0 siblings, 1 reply; 46+ messages in thread
From: Nazarov Sergey @ 2019-01-15 17:06 UTC (permalink / raw)
  To: linux-security-module

Hello!
Security modules (selinux, smack) use icmp_send for discarded incorrectly labeled network packets.
This could be on TCP level too (security_sock_rcv_skb -> cipso_v4_error for INET stream connection, for example).
icmp_send calls ip_option_echo, which uses IPCB to take compiled IP options.
After moving IP header data to the end of the struct tcp_skb_cb (since 3.18 kernel), this could lead to
kernel memory corruption when IP options copying.
This patch fix a bug, but I'm not sure, that this is a best solution. Perhaps someone more familiar with the
linux TCP/IP stack will offer a better one.
Thanks.

--- a/net/ipv4/icmp.c
+++ b/net/ipv4/icmp.c
@@ -679,7 +679,8 @@ void icmp_send(struct sk_buff *skb_in, i
 					  iph->tos;
 	mark = IP4_REPLY_MARK(net, skb_in->mark);
 
-	if (ip_options_echo(&icmp_param->replyopts.opt.opt, skb_in))
+	if (__ip_options_echo(&icmp_param->replyopts.opt.opt, skb_in,
+			ip_hdr(skb_in)->protocol == IPPROTO_TCP ? &TCP_SKB_CB(skb_in)->header.h4.opt : &IPCB(skb_in)->opt))
 		goto out_unlock;


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

end of thread, other threads:[~2019-02-25 23:30 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-15 17:06 Kernel memory corruption in CIPSO labeled TCP packets processing Nazarov Sergey
2019-01-15 17:55 ` Casey Schaufler
2019-01-15 19:52   ` Paul Moore
2019-01-18 14:53     ` Paul Moore
2019-01-18 16:34       ` Nazarov Sergey
2019-01-18 17:17         ` Paul Moore
2019-01-21 17:11           ` Nazarov Sergey
2019-01-22 16:49             ` Paul Moore
2019-01-22 17:35               ` Nazarov Sergey
2019-01-22 17:48                 ` Paul Moore
2019-01-24 14:46                   ` Nazarov Sergey
2019-01-25 16:45                     ` Paul Moore
2019-01-28 13:10                       ` Nazarov Sergey
2019-01-28 22:18                         ` Paul Moore
2019-01-29  7:23                           ` Nazarov Sergey
2019-01-29 22:42                             ` Paul Moore
2019-01-30 13:11                               ` Nazarov Sergey
2019-01-31  2:10                                 ` Paul Moore
2019-01-31 13:20                                   ` Nazarov Sergey
2019-02-11 20:37                                     ` Paul Moore
2019-02-11 21:21                                       ` Nazarov Sergey
2019-02-11 23:43                                         ` Paul Moore
2019-02-12 15:10                                           ` [PATCH] NETWORKING: avoid use IPCB in cipso_v4_error Nazarov Sergey
2019-02-13 21:41                                             ` Paul Moore
2019-02-14 18:00                                               ` Nazarov Sergey
2019-02-14 18:59                                                 ` Stephen Smalley
2019-02-14 16:43                                             ` David Miller
2019-02-14 18:14                                               ` Nazarov Sergey
2019-02-15 19:02                                               ` Paul Moore
2019-02-15 20:00                                                 ` David Miller
2019-02-15 20:04                                                   ` Paul Moore
2019-02-18 13:39                                                     ` Nazarov Sergey
2019-02-19  1:25                                                       ` David Miller
2019-02-22 16:35                                                         ` Nazarov Sergey
2019-02-22 17:39                                                           ` [PATCH v2 0/2] " Nazarov Sergey
2019-02-25  1:33                                                             ` David Miller
2019-02-25 16:24                                                               ` [PATCH v2 1/2] " Nazarov Sergey
2019-02-25 22:07                                                                 ` Paul Moore
2019-02-25 22:33                                                                 ` David Miller
2019-02-25 23:30                                                                   ` Paul Moore
2019-02-25 16:27                                                               ` [PATCH v2 2/2] " Nazarov Sergey
2019-02-25 22:06                                                                 ` Paul Moore
2019-02-25 22:34                                                                 ` David Miller
2019-02-22 17:43                                                           ` [PATCH v2 1/2] " Nazarov Sergey
2019-02-22 17:50                                                           ` [PATCH v2 2/2] " Nazarov Sergey
2019-02-25  1:33                                                           ` [PATCH] " David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).