public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "cvs-commit at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sourceware.org Subject: [Bug network/30843] potential use-after-free in getcanonname (CVE-2023-4806) Date: Fri, 15 Sep 2023 18:38:55 +0000 [thread overview] Message-ID: <bug-30843-131-PHupRPxnfa@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-30843-131@http.sourceware.org/bugzilla/> https://sourceware.org/bugzilla/show_bug.cgi?id=30843 --- Comment #5 from cvs-commit at gcc dot gnu.org <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Siddhesh Poyarekar <siddhesh@sourceware.org>: https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=973fe93a5675c42798b2161c6f29c01b0e243994 commit 973fe93a5675c42798b2161c6f29c01b0e243994 Author: Siddhesh Poyarekar <siddhesh@sourceware.org> Date: Fri Sep 15 13:51:12 2023 -0400 getaddrinfo: Fix use after free in getcanonname (CVE-2023-4806) When an NSS plugin only implements the _gethostbyname2_r and _getcanonname_r callbacks, getaddrinfo could use memory that was freed during tmpbuf resizing, through h_name in a previous query response. The backing store for res->at->name when doing a query with gethostbyname3_r or gethostbyname2_r is tmpbuf, which is reallocated in gethosts during the query. For AF_INET6 lookup with AI_ALL | AI_V4MAPPED, gethosts gets called twice, once for a v6 lookup and second for a v4 lookup. In this case, if the first call reallocates tmpbuf enough number of times, resulting in a malloc, th->h_name (that res->at->name refers to) ends up on a heap allocated storage in tmpbuf. Now if the second call to gethosts also causes the plugin callback to return NSS_STATUS_TRYAGAIN, tmpbuf will get freed, resulting in a UAF reference in res->at->name. This then gets dereferenced in the getcanonname_r plugin call, resulting in the use after free. Fix this by copying h_name over and freeing it at the end. This resolves BZ #30843, which is assigned CVE-2023-4806. Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org> -- You are receiving this mail because: You are on the CC list for the bug.
next prev parent reply other threads:[~2023-09-15 18:38 UTC|newest] Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-09-12 15:32 [Bug network/30843] New: " siddhesh at sourceware dot org 2023-09-12 15:32 ` [Bug network/30843] " siddhesh at sourceware dot org 2023-09-13 3:18 ` sam at gentoo dot org 2023-09-14 6:45 ` xry111 at xry111 dot site 2023-09-14 9:56 ` siddhesh at sourceware dot org 2023-09-14 10:02 ` xry111 at xry111 dot site 2023-09-15 18:38 ` cvs-commit at gcc dot gnu.org [this message] 2023-09-15 19:19 ` cvs-commit at gcc dot gnu.org 2023-09-15 20:53 ` cvs-commit at gcc dot gnu.org 2023-09-15 22:25 ` cvs-commit at gcc dot gnu.org 2023-09-15 23:48 ` cvs-commit at gcc dot gnu.org 2023-09-16 0:50 ` cvs-commit at gcc dot gnu.org 2023-09-16 0:50 ` siddhesh at sourceware dot org 2023-09-25 0:40 ` romain.geissler at amadeus dot com 2023-09-25 5:55 ` fweimer at redhat dot com 2023-09-26 11:40 ` cvs-commit at gcc dot gnu.org 2023-09-26 22:52 ` cvs-commit at gcc dot gnu.org 2023-09-26 22:53 ` cvs-commit at gcc dot gnu.org 2023-09-26 22:54 ` cvs-commit at gcc dot gnu.org 2023-09-26 22:54 ` cvs-commit at gcc dot gnu.org 2023-09-26 22:54 ` cvs-commit at gcc dot gnu.org 2023-12-11 16:29 ` m.novosyolov at rosalinux dot ru 2023-12-11 16:37 ` siddhesh at sourceware dot org
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=bug-30843-131-PHupRPxnfa@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=glibc-bugs@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: linkBe 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).