In the Linux kernel, the following vulnerability has been resolved:
SUNRPC: Do not credit control-record octets to the RPC stream
svc_tcp_sock_recv_cmsg() receives up to two octets into a local
buffer, and returns that count for any record type other than
TLS_RECORD_TYPE_ALERT. Nothing reached the caller's buffer, but
svc_tcp_read_marker() adds the count to sk_tcplen and
svc_tcp_read_msg()'s caller adds it to sk_datalen. The RPC stream
advances over octets it never received. The fragment marker is
assembled from stale sk_marker octets. The message body comes from
pages nothing wrote.
A conforming client reaches this. RFC 8446 Section 4.6.3 lets either
peer send KeyUpdate once it has sent its Finished, and svcsock has no
rekey path. kTLS leaves the partially consumed record on ctx->rx_list,
so the body drains two octets per svc_tcp_recvfrom() call. Each pair
is credited the same way.
Return -EAGAIN for a record that is not an alert. That is what
svc_tcp_sock_process_cmsg()'s default arm returned before the receive
moved into a local buffer.
CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
CVSS Score: 9.8
AV:N - The attacker-controlled bytes are a TLS application-data record (three 0x00 octets) followed by a TLS KeyUpdate handshake record (RFC 8446 §4.6.3) on the nfsd TCP connection. kTLS delivers the KeyUpdate to svc_tcp_sock_recvmsg with MSG_CTRUNC, which calls svc_tcp_sock_recv_cmsg, the function this fix changes, from svc_tcp_read_marker.
AC:L - The attacker opens the connection and sends the RPC NULL AUTH_TLS probe that svcauth_tls_accept turns into svc_tcp_handshake, then sends the three marker bytes and the KeyUpdate. svc_data_ready runs on each record the attacker transmits, so sk_tcplen going from 3 to 5 does not depend on a race or on any state the attacker cannot send.
PR:N - svcauth_tls_accept accepts proc 0 with a zero-length AUTH_TLS credential and never checks a uid, and tls_server_hello_x509 is invoked with no client certificate. The over-credit occurs in svc_tcp_recvfrom, before svc_process and before nfsd's check_xprtsec_policy.
UI:N - The TLS records are sent by the attacker on the TCP connection they opened. svc_tcp_read_marker consumes them with no mount, file open, or other action by a victim.
S:U - bvec_set_page corrupts rq_bvec and the neighboring heap of the nfsd svc_rqst inside this kernel, the same security authority as the SUNRPC server.
C:H - The SIZE_MAX buflen makes svc_tcp_read_msg read rq_pages[i] and write those pointers through bvec_set_page past the kcalloc'd rq_maxpages arrays. That unbounded heap read and the corruption of neighboring objects disclose kernel memory.
I:H - svc_tcp_sock_recv_cmsg returns 2 for the KeyUpdate into a private alert[2] buffer. svc_tcp_read_marker adds 2 to sk_tcplen when only one marker byte was wanted, so sk_tcplen becomes 5 while svc_sock_reclen stays 0. svc_tcp_recvfrom's size_t want underflows, and svc_tcp_read_msg writes bio_vecs off the end of rq_bvec.
A:H - The rq_bvec walk in svc_tcp_read_msg continues until it faults on unmapped kernel memory, oopsing the nfsd thread that is inside svc_tcp_recvfrom.
| Attack Vector |
Network |
Scope |
Unchanged |
| Attack Complexity |
Low |
Confidentiality Impact |
High |
| Privileges Required |
None |
Integrity Impact |
High |
| User Interaction |
None |
Availability Impact |
High |
AV:N - The attacker-controlled bytes are a TLS application-data record (three 0x00 octets) followed by a TLS KeyUpdate handshake record (RFC 8446 §4.6.3) on the nfsd TCP connection. kTLS delivers the KeyUpdate to svc_tcp_sock_recvmsg with MSG_CTRUNC, which calls svc_tcp_sock_recv_cmsg, the function this fix changes, from svc_tcp_read_marker.
AC:L - The attacker opens the connection and sends the RPC NULL AUTH_TLS probe that svcauth_tls_accept turns into svc_tcp_handshake, then sends the three marker bytes and the KeyUpdate. svc_data_ready runs on each record the attacker transmits, so sk_tcplen going from 3 to 5 does not depend on a race or on any state the attacker cannot send.
PR:N - svcauth_tls_accept accepts proc 0 with a zero-length AUTH_TLS credential and never checks a uid, and tls_server_hello_x509 is invoked with no client certificate. The over-credit occurs in svc_tcp_recvfrom, before svc_process and before nfsd's check_xprtsec_policy.
UI:N - The TLS records are sent by the attacker on the TCP connection they opened. svc_tcp_read_marker consumes them with no mount, file open, or other action by a victim.
S:U - bvec_set_page corrupts rq_bvec and the neighboring heap of the nfsd svc_rqst inside this kernel, the same security authority as the SUNRPC server.
C:H - The SIZE_MAX buflen makes svc_tcp_read_msg read rq_pages[i] and write those pointers through bvec_set_page past the kcalloc'd rq_maxpages arrays. That unbounded heap read and the corruption of neighboring objects disclose kernel memory.
I:H - svc_tcp_sock_recv_cmsg returns 2 for the KeyUpdate into a private alert[2] buffer. svc_tcp_read_marker adds 2 to sk_tcplen when only one marker byte was wanted, so sk_tcplen becomes 5 while svc_sock_reclen stays 0. svc_tcp_recvfrom's size_t want underflows, and svc_tcp_read_msg writes bio_vecs off the end of rq_bvec.
A:H - The rq_bvec walk in svc_tcp_read_msg continues until it faults on unmapped kernel memory, oopsing the nfsd thread that is inside svc_tcp_recvfrom.
CVSS 3.1