From: Siddhesh Poyarekar <siddhesh@gotplt.org>
To: Florian Weimer <fweimer@redhat.com>, libc-alpha@sourceware.org
Subject: Re: [PATCH v2 2/4] CVE-2022-23219: Buffer overflow in sunrpc clnt_create for "unix" (bug 22542)
Date: Mon, 17 Jan 2022 08:59:25 +0530 [thread overview]
Message-ID: <1fc61d4b-4efa-4776-b3dc-58741bee3baf@gotplt.org> (raw)
In-Reply-To: <aafa82f116bad4d781e66751177cdd4995eb7c07.1642148513.git.fweimer@redhat.com>
On 14/01/2022 13:54, Florian Weimer via Libc-alpha wrote:
> Processing an overlong pathname in the sunrpc clnt_create function
> results in a stack-based buffer overflow.
> ---
> NEWS | 4 +++-
> sunrpc/clnt_gen.c | 10 +++++++---
> 2 files changed, 10 insertions(+), 4 deletions(-)
LGTM.
Reviewed-by: Siddhesh Poyarekar <siddhesh@sourceware.org>
>
> diff --git a/NEWS b/NEWS
> index a957b19fdc..94248b580d 100644
> --- a/NEWS
> +++ b/NEWS
> @@ -150,7 +150,9 @@ Changes to build and runtime requirements:
>
> Security related changes:
>
> - [Add security related changes here]
> + CVE-2022-23219: Passing an overlong file name to the clnt_create
> + legacy function could result in a stack-based buffer overflow when
> + using the "unix" protocol. Reported by Martin Sebor.
>
> The following bugs are resolved with this release:
>
> diff --git a/sunrpc/clnt_gen.c b/sunrpc/clnt_gen.c
> index 13ced8994e..b44357cd88 100644
> --- a/sunrpc/clnt_gen.c
> +++ b/sunrpc/clnt_gen.c
> @@ -57,9 +57,13 @@ clnt_create (const char *hostname, u_long prog, u_long vers,
>
> if (strcmp (proto, "unix") == 0)
> {
> - memset ((char *)&sun, 0, sizeof (sun));
> - sun.sun_family = AF_UNIX;
> - strcpy (sun.sun_path, hostname);
> + if (__sockaddr_un_set (&sun, hostname) < 0)
> + {
> + struct rpc_createerr *ce = &get_rpc_createerr ();
> + ce->cf_stat = RPC_SYSTEMERROR;
> + ce->cf_error.re_errno = errno;
> + return NULL;
> + }
> sock = RPC_ANYSOCK;
> client = clntunix_create (&sun, prog, vers, &sock, 0, 0);
> if (client == NULL)
next prev parent reply other threads:[~2022-01-17 3:29 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-14 8:23 [PATCH v2 0/4] CVE-2022-23218, CVE-2022-23219: sunrpc buffer overflows Florian Weimer
2022-01-14 8:23 ` [PATCH 1/4] socket: Add the __sockaddr_un_set function Florian Weimer
2022-01-17 3:28 ` Siddhesh Poyarekar
2022-01-14 8:24 ` [PATCH v2 2/4] CVE-2022-23219: Buffer overflow in sunrpc clnt_create for "unix" (bug 22542) Florian Weimer
2022-01-17 3:29 ` Siddhesh Poyarekar [this message]
2022-01-14 8:24 ` [PATCH 3/4] sunrpc: Test case for clnt_create "unix" buffer overflow " Florian Weimer
2022-01-17 3:31 ` Siddhesh Poyarekar
2022-01-17 3:35 ` Siddhesh Poyarekar
2022-01-17 9:15 ` Florian Weimer
2022-01-17 9:30 ` Siddhesh Poyarekar
2022-01-17 9:32 ` Florian Weimer
2022-01-17 9:42 ` Siddhesh Poyarekar
2022-01-14 8:24 ` [PATCH v2 4/4] CVE-2022-23218: Buffer overflow in sunrpc svcunix_create (bug 28768) Florian Weimer
2022-01-17 9:43 ` Siddhesh Poyarekar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1fc61d4b-4efa-4776-b3dc-58741bee3baf@gotplt.org \
--to=siddhesh@gotplt.org \
--cc=fweimer@redhat.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).