Skip to contentSkip to conversation

xfrm_user: fix info leak in build_report()

PATCH New Greg Kroah-Hartman 1 participant 1 message Apr 6

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfrm_user: fix info leak in build_report()

struct xfrm_user_report is a __u8 proto field followed by a struct xfrm_selector which means there is three "empty" bytes of padding, but the padding is never zeroed before copying to userspace. Fix that up by zeroing the structure before setting individual member variables.

Cc stable <[email protected]>
Cc Steffen Klassert <[email protected]>
Cc Herbert Xu <[email protected]>
Cc "David S. Miller" <[email protected]>
Cc Eric Dumazet <[email protected]>
Cc Jakub Kicinski <[email protected]>
Cc Paolo Abeni <[email protected]>
Cc Simon Horman <[email protected]>
Assisted-by gregkh_clanker_t1000

---
As before, I _think_ this is right, but my code paths might be missing something where the whole buffer is set to 0 ahead of time somewhere else?

 net/xfrm/xfrm_user.c | 1 +
 1 file changed, 1 insertion(+)
net/xfrm/xfrm_user.c +1 -0
index 6d7b5bb2ec9e..1bb8d05561df 100644
@@ -4117,6 +4117,7 @@ static int build_report(struct sk_buff *skb, u8 proto,
 		return -EMSGSIZE;
 
 	ur = nlmsg_data(nlh);
+	memset(ur, 0, sizeof(*ur));
 	ur->proto = proto;
 	memcpy(&ur->sel, sel, sizeof(ur->sel));
 
Signature · 1 line
2.53.0