net: trust-after-modification fixes for IPv4 options + netlabel
Subsystems (4)
cover net: trust-after-modification fixes for IPv4 options + netlabel
Four small bounds-check fixes for a recurring pattern in IPv4 options and CIPSO/CALIPSO consumers. The parse-time validator stores only the option offset into IPCB / skb metadata. Later consumers (cmsg echo, mrouted report, netlabel getattr) re-read the length / pointer / cat_len bytes from the skb body and use them for indexed memcpy or bitmap walk. An nftables payload mutation reachable from an unprivileged user namespace (CAP_NET_ADMIN inside the namespace) rewrites those bytes between parse and consume.
1/4 __ip_options_echo() 40-byte stack OOB write
(KASAN: stack-out-of-bounds,
Write of size 255). 2/4 ipmr_cache_report() Up to 40-byte OOB read of
skb head leaked into the IGMPMSG cmsg delivered to mrouted.
3/4 netlbl_skbuff_getattr() / CALIPSO ~232-byte slab OOB read
driving SELinux/Smack MLS category bitmap.
4/4 netlbl_skbuff_getattr() / CIPSO Sibling of 3/4 on the
AF_INET (CIPSO IPv4) path.
Qi Tang (4):
ipv4: validate ip_options length in __ip_options_echo() against skb
tail
ipv4: ipmr: clamp ip_hdrlen against skb_headlen in ipmr_cache_report
netlabel: validate CALIPSO option against skb tail in
netlbl_skbuff_getattr
netlabel: validate CIPSO option against skb tail in
netlbl_skbuff_getattr
net/ipv4/ip_options.c | 8 ++++++++ net/ipv4/ipmr.c | 2 +- net/netlabel/netlabel_kapi.c | 27 +++++++++++++++++++++++---- 3 files changed, 32 insertions(+), 5 deletions(-)
Signature · 1 line
2.47.3
Sorry, v1 went out unthreaded and 1/4 was duplicated. I will resend properly as [PATCH net v2 0/4] in ~24h. Please ignore the v1 thread.
Qi Tang <[email protected]>
Tong Liu <[email protected]>