Skip to content

Commit 271351d

Browse files
lxindavem330
authored andcommitted
tipc: only accept encrypted MSG_CRYPTO msgs
The MSG_CRYPTO msgs are always encrypted and sent to other nodes for keys' deployment. But when receiving in peers, if those nodes do not validate it and make sure it's encrypted, one could craft a malicious MSG_CRYPTO msg to deploy its key with no need to know other nodes' keys. This patch is to do that by checking TIPC_SKB_CB(skb)->decrypted and discard it if this packet never got decrypted. Note that this is also a supplementary fix to CVE-2021-43267 that can be triggered by an unencrypted malicious MSG_CRYPTO msg. Fixes: 1ef6f7c ("tipc: add automatic session key exchange") Acked-by: Ying Xue <[email protected]> Acked-by: Jon Maloy <[email protected]> Signed-off-by: Xin Long <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 6def480 commit 271351d

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

net/tipc/link.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1298,8 +1298,11 @@ static bool tipc_data_input(struct tipc_link *l, struct sk_buff *skb,
12981298
return false;
12991299
#ifdef CONFIG_TIPC_CRYPTO
13001300
case MSG_CRYPTO:
1301-
tipc_crypto_msg_rcv(l->net, skb);
1302-
return true;
1301+
if (TIPC_SKB_CB(skb)->decrypted) {
1302+
tipc_crypto_msg_rcv(l->net, skb);
1303+
return true;
1304+
}
1305+
fallthrough;
13031306
#endif
13041307
default:
13051308
pr_warn("Dropping received illegal msg type\n");

0 commit comments

Comments
 (0)