]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
libceph: prevent potential out-of-bounds writes in handle_auth_session_key()
authorziming zhang <ezrakiez@gmail.com>
Fri, 14 Nov 2025 08:56:10 +0000 (16:56 +0800)
committerIlya Dryomov <idryomov@gmail.com>
Thu, 27 Nov 2025 08:59:49 +0000 (09:59 +0100)
The len field originates from untrusted network packets. Boundary
checks have been added to prevent potential out-of-bounds writes when
decrypting the connection secret or processing service tickets.

[ idryomov: changelog ]

Cc: stable@vger.kernel.org
Signed-off-by: ziming zhang <ezrakiez@gmail.com>
Reviewed-by: Ilya Dryomov <idryomov@gmail.com>
Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
net/ceph/auth_x.c

index b71b1635916e1712bf0e1723dab1307d06a16bc1..a21c157daf7dd32dd81292dfe5d340e587b88957 100644 (file)
@@ -631,6 +631,7 @@ static int handle_auth_session_key(struct ceph_auth_client *ac, u64 global_id,
 
        /* connection secret */
        ceph_decode_32_safe(p, end, len, e_inval);
+       ceph_decode_need(p, end, len, e_inval);
        dout("%s connection secret blob len %d\n", __func__, len);
        if (len > 0) {
                dp = *p + ceph_x_encrypt_offset();
@@ -648,6 +649,7 @@ static int handle_auth_session_key(struct ceph_auth_client *ac, u64 global_id,
 
        /* service tickets */
        ceph_decode_32_safe(p, end, len, e_inval);
+       ceph_decode_need(p, end, len, e_inval);
        dout("%s service tickets blob len %d\n", __func__, len);
        if (len > 0) {
                ret = ceph_x_proc_ticket_reply(ac, &th->session_key,