Linux NFS development
 help / color / mirror / Atom feed
* Possible NFS 4.1 client vulnerability: uninitialized/garbage kfree() in decode_cb_sequence_args()
@ 2015-02-11 21:39 David Ramos
  2015-02-11 22:42 ` Trond Myklebust
  0 siblings, 1 reply; 4+ messages in thread
From: David Ramos @ 2015-02-11 21:39 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: linux-nfs

Hello,

Our UC-KLEE tool found a kfree() of an uninitialized pointer in decode_cb_sequence_args (fs/nfs/callback_xdr.c) that may be remotely exploitable. The bug affects Linux kernel 3.16.3, but it appears to date back to commit 4aece6a19cf7f474f15eb861ba74db4479884ce3 (4/1/2009), which first implemented the CB_SEQUENCE operation from NFS 4.1.

Here is some of the relevant code:
 458        if (args->csa_nrclists) {
 459                args->csa_rclists = kmalloc_array(args->csa_nrclists,
 460                                                  sizeof(*args->csa_rclists),
 461                                                  GFP_KERNEL);
 ...
 465                for (i = 0; i < args->csa_nrclists; i++) {
 466                        status = decode_rc_list(xdr, &args->csa_rclists[i]);
 467                        if (status)
 468                                goto out_free;
 469                }
 470        }
 …
 487out_free:
 488        for (i = 0; i < args->csa_nrclists; i++)
 489                kfree(args->csa_rclists[i].rcl_refcalls);

If a call to decode_rc_list() on line 466 returns non-zero during iteration ‘i', the kfree() call at line 489 will attempt to free uninitialized (heap garbage) pointers for all indices in [i, args->csa_nrclists).

I’m not familiar enough with the NFS internals to understand whether an attacker can cause decode_rc_list() to fail (i.e., by causing read_buf() to fail), but it seems plausible?

Thanks,
-David




^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-02-11 23:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-11 21:39 Possible NFS 4.1 client vulnerability: uninitialized/garbage kfree() in decode_cb_sequence_args() David Ramos
2015-02-11 22:42 ` Trond Myklebust
2015-02-11 22:58   ` David Ramos
     [not found]   ` <C957EAEA-BA10-4C95-A95B-09FD0F9B12B1@stanford.edu>
2015-02-11 23:08     ` Trond Myklebust

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox