This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug network/21115] New: sunrpc: Use-after-free in error path in clntudp_call


https://sourceware.org/bugzilla/show_bug.cgi?id=21115

            Bug ID: 21115
           Summary: sunrpc: Use-after-free in error path in clntudp_call
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: network
          Assignee: unassigned at sourceware dot org
          Reporter: fweimer at redhat dot com
  Target Milestone: ---
             Flags: security+

After commit bc779a1a5b3035133024b21e2f339fe4219fb11c (CVE-2016-4429: sunrpc:
Do not use alloca in clntudp_call [BZ #20112]), ancillary data is stored on the
heap, but it is accessed after it has been freed.

The free call needs to be moved further down:

diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c
index a923521..be6b878 100644
--- a/sunrpc/clnt_udp.c
+++ b/sunrpc/clnt_udp.c
@@ -416,9 +416,9 @@ send_again:
                 cmsg = CMSG_NXTHDR (&msg, cmsg))
              if (cmsg->cmsg_level == SOL_IP && cmsg->cmsg_type == IP_RECVERR)
                {
-                 free (cbuf);
                  e = (struct sock_extended_err *) CMSG_DATA(cmsg);
                  cu->cu_error.re_errno = e->ee_errno;
+                 free (cbuf);
                  return (cu->cu_error.re_status = RPC_CANTRECV);
                }
          free (cbuf);

Technically, this is a security vulnerability, but the chance of information
disclosure is very slim.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]