CVE-2025-38147 Information
Description
In the Linux kernel the following vulnerability has been resolved:
calipso: Don’t call calipso functions for AF_INET sk.
syzkaller reported a null-ptr-deref in txopt_get(). [0]
The offset 0x70 was of struct ipv6_txoptions in struct ipv6_pinfo so struct ipv6_pinfo was NULL there.
However this never happens for IPv6 sockets as inet_sk(sk)->pinet6 is always set in inet6_create() meaning the socket was not IPv6 one.
The root cause is missing validation in netlbl_conn_setattr().
netlbl_conn_setattr() switches branches based on struct sockaddr.sa_family which is passed from userspace. However netlbl_conn_setattr() does not check if the address family matches the socket.
The syzkaller must have called connect() for an IPv6 address on an IPv4 socket.
We have a proper validation in tcp_v[46]_connect() but security_socket_connect() is called in the earlier stage.
Let’s copy the validation to netlbl_conn_setattr().
[0]:
Oops: general protection fault probably for non-canonical address 0xdffffc000000000e: 0000 [1] PREEMPT SMP KASAN NOPTI
KASAN: null-ptr-deref in range [0x0000000000000070-0x0000000000000077]
CPU: 2 UID: 0 PID: 12928 Comm: syz.9.1677 Not tainted 6.12.0 1
Hardware name: QEMU Standard PC (i440FX + PIIX 1996) BIOS 1.15.0-1 04/01/2014
RIP: 0010:txopt_get include/net/ipv6.h:390 [inline]
RIP: 0010:
Code: 02 00 00 49 8b ac 24 f8 02 00 00 e8 84 69 2a fd e8 ff 00 16 fd 48 8d 7d 70 48 b8 00 00 00 00 00 fc ff df 48 89 fa 48 c1 ea 03 <80> 3c 02 00 0f 85 53 02 00 00 48 8b 6d 70 48 85 ed 0f 84 ab 01 00
RSP: 0018:ffff88811b8afc48 EFLAGS: 00010212
RAX: dffffc0000000000 RBX: 1ffff11023715f8a RCX: ffffffff841ab00c
RDX: 000000000000000e RSI: ffffc90007d9e000 RDI: 0000000000000070
RBP: 0000000000000000 R08: ffffed1023715f9d R09: ffffed1023715f9e
R10: ffffed1023715f9d R11: 0000000000000003 R12: ffff888123075f00
R13: ffff88810245bd80 R14: ffff888113646780 R15: ffff888100578a80
FS: 00007f9019bd7640(0000) GS:ffff8882d2d00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007f901b927bac CR3: 0000000104788003 CR4: 0000000000770ef0
PKRU: 80000000
Call Trace:
Reference
https://git.kernel.org/stable/c/0c813dbc851dbf418fdc6dc883fd0592d6c555cd https://git.kernel.org/stable/c/26ce90f1ce60b0ff587de8d6aec399aa55cab28e https://git.kernel.org/stable/c/6e9f2df1c550ead7cecb3e450af1105735020c92 https://git.kernel.org/stable/c/946bfdfcb76ac2bac5b8526447035885ff41c598 https://git.kernel.org/stable/c/c32ebe33626335a536dbbdd09571c06dd9bc1729 https://git.kernel.org/stable/c/dd8928897594931d6912ef2f7a43e110b4958d3d https://git.kernel.org/stable/c/e2ec310c7a50271843c585e27ef14e48c66ce649 https://git.kernel.org/stable/c/fc2da88411470480b8b7e9177e930cedd893cf56
Related CNNVD
CNNVD-202507-234 (Published: 2025-07-03)
Share on: