CVE-2022-48687
Severity CVSS v4.0:
Pending analysis
Type:
CWE-125
Out-of-bounds Read
Publication date:
03/05/2024
Last modified:
23/05/2024
Description
In the Linux kernel, the following vulnerability has been resolved:<br />
<br />
ipv6: sr: fix out-of-bounds read when setting HMAC data.<br />
<br />
The SRv6 layer allows defining HMAC data that can later be used to sign IPv6<br />
Segment Routing Headers. This configuration is realised via netlink through<br />
four attributes: SEG6_ATTR_HMACKEYID, SEG6_ATTR_SECRET, SEG6_ATTR_SECRETLEN and<br />
SEG6_ATTR_ALGID. Because the SECRETLEN attribute is decoupled from the actual<br />
length of the SECRET attribute, it is possible to provide invalid combinations<br />
(e.g., secret = "", secretlen = 64). This case is not checked in the code and<br />
with an appropriately crafted netlink message, an out-of-bounds read of up<br />
to 64 bytes (max secret length) can occur past the skb end pointer and into<br />
skb_shared_info:<br />
<br />
Breakpoint 1, seg6_genl_sethmac (skb=, info=) at net/ipv6/seg6.c:208<br />
208 memcpy(hinfo->secret, secret, slen);<br />
(gdb) bt<br />
#0 seg6_genl_sethmac (skb=, info=) at net/ipv6/seg6.c:208<br />
#1 0xffffffff81e012e9 in genl_family_rcv_msg_doit (skb=skb@entry=0xffff88800b1f9f00, nlh=nlh@entry=0xffff88800b1b7600,<br />
extack=extack@entry=0xffffc90000ba7af0, ops=ops@entry=0xffffc90000ba7a80, hdrlen=4, net=0xffffffff84237580 , family=,<br />
family=) at net/netlink/genetlink.c:731<br />
#2 0xffffffff81e01435 in genl_family_rcv_msg (extack=0xffffc90000ba7af0, nlh=0xffff88800b1b7600, skb=0xffff88800b1f9f00,<br />
family=0xffffffff82fef6c0 ) at net/netlink/genetlink.c:775<br />
#3 genl_rcv_msg (skb=0xffff88800b1f9f00, nlh=0xffff88800b1b7600, extack=0xffffc90000ba7af0) at net/netlink/genetlink.c:792<br />
#4 0xffffffff81dfffc3 in netlink_rcv_skb (skb=skb@entry=0xffff88800b1f9f00, cb=cb@entry=0xffffffff81e01350 )<br />
at net/netlink/af_netlink.c:2501<br />
#5 0xffffffff81e00919 in genl_rcv (skb=0xffff88800b1f9f00) at net/netlink/genetlink.c:803<br />
#6 0xffffffff81dff6ae in netlink_unicast_kernel (ssk=0xffff888010eec800, skb=0xffff88800b1f9f00, sk=0xffff888004aed000)<br />
at net/netlink/af_netlink.c:1319<br />
#7 netlink_unicast (ssk=ssk@entry=0xffff888010eec800, skb=skb@entry=0xffff88800b1f9f00, portid=portid@entry=0, nonblock=)<br />
at net/netlink/af_netlink.c:1345<br />
#8 0xffffffff81dff9a4 in netlink_sendmsg (sock=, msg=0xffffc90000ba7e48, len=) at net/netlink/af_netlink.c:1921<br />
...<br />
(gdb) p/x ((struct sk_buff *)0xffff88800b1f9f00)->head + ((struct sk_buff *)0xffff88800b1f9f00)->end<br />
$1 = 0xffff88800b1b76c0<br />
(gdb) p/x secret<br />
$2 = 0xffff88800b1b76c0<br />
(gdb) p slen<br />
$3 = 64 &#39;@&#39;<br />
<br />
The OOB data can then be read back from userspace by dumping HMAC state. This<br />
commit fixes this by ensuring SECRETLEN cannot exceed the actual length of<br />
SECRET.
Impact
Base Score 3.x
5.50
Severity 3.x
MEDIUM
Vulnerable products and versions
| CPE | From | Up to |
|---|---|---|
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 4.10 (including) | 4.14.298 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 4.15 (including) | 4.19.258 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 4.20 (including) | 5.4.213 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.5 (including) | 5.10.143 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.11 (including) | 5.15.68 (excluding) |
| cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:* | 5.16 (including) | 5.19.9 (excluding) |
To consult the complete list of CPE names with products and versions, see this page
References to Advisories, Solutions, and Tools
- https://git.kernel.org/stable/c/076f2479fc5a15c4a970ca3b5e57d42ba09a31fa
- https://git.kernel.org/stable/c/3df71e11a4773d775c3633c44319f7acdb89011c
- https://git.kernel.org/stable/c/55195563ec29f80f984237b743de0e2b6ba4d093
- https://git.kernel.org/stable/c/56ad3f475482bca55b0ae544031333018eb145b3
- https://git.kernel.org/stable/c/84a53580c5d2138c7361c7c3eea5b31827e63b35
- https://git.kernel.org/stable/c/dc9dbd65c803af1607484fed5da50d41dc8dd864
- https://git.kernel.org/stable/c/f684c16971ed5e77dfa25a9ad25b5297e1f58eab



