Go to file
Siddhesh Poyarekar 973fe93a56 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>
2023-09-15 14:38:28 -04:00
argp argp-parse: Get rid of alloca 2023-08-28 16:49:27 +00:00
assert
benchtests
bits linux: Add posix_spawnattr_{get, set}cgroup_np (BZ 26371) 2023-09-05 13:08:48 -03:00
catgets gencat: Get rid of alloca. 2023-08-28 16:42:53 +00:00
ChangeLog.old Create ChangeLog.old/ChangeLog.27 2023-07-30 21:45:27 +02:00
conform
crypt
csu
ctype
debug chk: Add and fix hidden builtin definitions for *_chk 2023-08-03 22:46:48 +02:00
dirent
dlfcn
elf elf: Remove unused l_text_end field from struct link_map 2023-09-08 18:39:20 +02:00
gmon
gnulib
grp
gshadow
hesiod
htl __call_tls_dtors: Use call_function_static_weak 2023-09-04 20:03:37 +02:00
hurd hurd: Avoid including thread_state.h in installed header 2023-09-05 11:58:26 +02:00
iconv iconv: restore verbosity with unrecognized encoding names (bug 30694) 2023-08-02 13:30:04 +02:00
iconvdata add GB18030-2022 charmap and test the entire GB18030 charmap [BZ #30243] 2023-08-29 19:02:30 +02:00
include stdio: Remove __libc_message alloca usage 2023-09-11 16:16:49 +00:00
inet nscd: Do not rebuild getaddrinfo (bug 30709) 2023-08-11 10:10:16 +02:00
intl intl: Treat C.UTF-8 locale like C locale (BZ# 16621) 2023-09-04 15:31:36 +02:00
io io: Fix record locking contants for powerpc64 with __USE_FILE_OFFSET64 2023-09-07 21:56:31 +02:00
libio libio: Fix oversized __io_vtables 2023-09-08 23:00:04 +02:00
locale
localedata add GB18030-2022 charmap and test the entire GB18030 charmap [BZ #30243] 2023-08-29 19:02:30 +02:00
login
mach
malloc malloc: Remove bin scanning from memalign (bug 30723) 2023-08-15 08:07:36 +02:00
manual manual: Fix ld.so diagnostics menu/section structure 2023-09-06 18:37:21 +02:00
math
mathvec
misc
nis
nptl __call_tls_dtors: Use call_function_static_weak 2023-09-04 20:03:37 +02:00
nptl_db
nscd nscd: Skip unusable entries in first pass in prune_cache (bug 30800) 2023-08-29 08:28:38 +02:00
nss getaddrinfo: Fix use after free in getcanonname (CVE-2023-4806) 2023-09-15 14:38:28 -04:00
po translations: update cs, nl, vi 2023-07-27 00:21:13 +02:00
posix posix: Add pidfd_spawn and pidfd_spawnp (BZ 30349) 2023-09-05 13:08:59 -03:00
pwd
resolv CVE-2023-4527: Stack read overflow with large TCP responses in no-aaaa mode 2023-09-13 14:10:56 +02:00
resource
rt
scripts Use Linux 6.5 in build-many-glibcs.py 2023-09-08 20:04:42 +00:00
setjmp chk: Add and fix hidden builtin definitions for *_chk 2023-08-03 22:46:48 +02:00
shadow
signal
socket
soft-fp
stdio-common fxprintf: Get rid of alloca 2023-08-15 14:28:25 +00:00
stdlib __call_tls_dtors: Use call_function_static_weak 2023-09-04 20:03:37 +02:00
string string: Fix tester build with fortify enable with gcc < 12 2023-08-18 07:59:55 -05:00
sunrpc sunrpc: Fix netname build with older gcc 2023-07-26 09:45:22 -03:00
support
sysdeps getaddrinfo: Fix use after free in getcanonname (CVE-2023-4806) 2023-09-15 14:38:28 -04:00
sysvipc
termios
time
timezone
wcsmbs
wctype
.clang-format
.gitattributes
.gitignore
abi-tags
aclocal.m4
config.h.in LoongArch: Add minuimum binutils required version 2023-08-14 09:47:09 +08:00
config.make.in configure: Remove --enable-all-warnings option 2023-08-01 15:35:25 -03:00
configure configure: Remove --enable-all-warnings option 2023-08-01 15:35:25 -03:00
configure.ac configure: Remove --enable-all-warnings option 2023-08-01 15:35:25 -03:00
CONTRIBUTED-BY
COPYING
COPYING.LIB
extra-lib.mk
gen-locales.mk
INSTALL elf: Check that --list-diagnostics output has the expected syntax 2023-08-25 14:19:16 +02:00
libc-abis
libof-iterator.mk
LICENSES
MAINTAINERS
Makeconfig configure: Add -Wall again to the default CFLAGS 2023-08-15 08:07:50 +02:00
Makefile scripts: Fix fortify checks if compiler does not support _FORTIFY_SOURCE=3 2023-07-20 17:58:26 -03:00
Makefile.help
Makefile.in
Makerules
NEWS CVE-2023-4527: Stack read overflow with large TCP responses in no-aaaa mode 2023-09-13 14:10:56 +02:00
o-iterator.mk
README
Rules scripts: Fix fortify checks if compiler does not support _FORTIFY_SOURCE=3 2023-07-20 17:58:26 -03:00
SECURITY.md
SHARED-FILES
shlib-versions
test-skeleton.c
version.h Open master branch for glibc 2.39 development 2023-07-31 20:07:55 +02:00

This directory contains the sources of the GNU C Library.
See the file "version.h" for what release version you have.

The GNU C Library is the standard system C library for all GNU systems,
and is an important part of what makes up a GNU system.  It provides the
system API for all programs written in C and C-compatible languages such
as C++ and Objective C; the runtime facilities of other programming
languages use the C library to access the underlying operating system.

In GNU/Linux systems, the C library works with the Linux kernel to
implement the operating system behavior seen by user applications.
In GNU/Hurd systems, it works with a microkernel and Hurd servers.

The GNU C Library implements much of the POSIX.1 functionality in the
GNU/Hurd system, using configurations i[4567]86-*-gnu and x86_64-gnu.

When working with Linux kernels, this version of the GNU C Library
requires Linux kernel version 3.2 or later.

Also note that the shared version of the libgcc_s library must be
installed for the pthread library to work correctly.

The GNU C Library supports these configurations for using Linux kernels:

	aarch64*-*-linux-gnu
	alpha*-*-linux-gnu
	arc*-*-linux-gnu
	arm-*-linux-gnueabi
	csky-*-linux-gnuabiv2
	hppa-*-linux-gnu
	i[4567]86-*-linux-gnu
	x86_64-*-linux-gnu	Can build either x86_64 or x32
	ia64-*-linux-gnu
	loongarch64-*-linux-gnu Hardware floating point, LE only.
	m68k-*-linux-gnu
	microblaze*-*-linux-gnu
	mips-*-linux-gnu
	mips64-*-linux-gnu
	or1k-*-linux-gnu
	powerpc-*-linux-gnu	Hardware or software floating point, BE only.
	powerpc64*-*-linux-gnu	Big-endian and little-endian.
	s390-*-linux-gnu
	s390x-*-linux-gnu
	riscv32-*-linux-gnu
	riscv64-*-linux-gnu
	sh[34]-*-linux-gnu
	sparc*-*-linux-gnu
	sparc64*-*-linux-gnu

If you are interested in doing a port, please contact the glibc
maintainers; see https://www.gnu.org/software/libc/ for more
information.

See the file INSTALL to find out how to configure, build, and install
the GNU C Library.  You might also consider reading the WWW pages for
the C library at https://www.gnu.org/software/libc/.

The GNU C Library is (almost) completely documented by the Texinfo manual
found in the `manual/' subdirectory.  The manual is still being updated
and contains some known errors and omissions; we regret that we do not
have the resources to work on the manual as much as we would like.  For
corrections to the manual, please file a bug in the `manual' component,
following the bug-reporting instructions below.  Please be sure to check
the manual in the current development sources to see if your problem has
already been corrected.

Please see https://www.gnu.org/software/libc/bugs.html for bug reporting
information.  We are now using the Bugzilla system to track all bug reports.
This web page gives detailed information on how to report bugs properly.

The GNU C Library is free software.  See the file COPYING.LIB for copying
conditions, and LICENSES for notices about a few contributions that require
these additional notices to be distributed.  License copyright years may be
listed using range notation, e.g., 1996-2015, indicating that every year in
the range, inclusive, is a copyrightable year that would otherwise be listed
individually.