Skip to content

Commit 7a10387

Browse files
committed
Merge sudo 1.9.12p1 from tip.
--HG-- branch : 1.9
2 parents 3d2b84e + 3df1e9a commit 7a10387

25 files changed

Lines changed: 216 additions & 96 deletions

NEWS

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
What's new in Sudo 1.9.12p1
2+
3+
* Sudo's configure script now does a better job of detecting when
4+
the -fstack-clash-protection compiler option does not work.
5+
GitHub issue #191.
6+
7+
* Fixed CVE-2022-43995, a potential out-of-bounds write for passwords
8+
smaller than 8 characters when passwd authentication is enabled.
9+
This does not affect configurations that use other authentication
10+
methods such as PAM, AIX authentication or BSD authentication.
11+
12+
* Fixed a build error with some configurations compiling host_port.c.
13+
114
What's new in Sudo 1.9.12
215

316
* Fixed a bug in the ptrace-based intercept mode where the current

aclocal.m4

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
# generated automatically by aclocal 1.16.3 -*- Autoconf -*-
1+
# generated automatically by aclocal 1.16.5 -*- Autoconf -*-
22

3-
# Copyright (C) 1996-2020 Free Software Foundation, Inc.
3+
# Copyright (C) 1996-2021 Free Software Foundation, Inc.
44

55
# This file is free software; the Free Software Foundation
66
# gives unlimited permission to copy and/or distribute it,

configure

Lines changed: 68 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#! /bin/sh
22
# Guess values for system-dependent variables and create Makefiles.
3-
# Generated by GNU Autoconf 2.71 for sudo 1.9.12.
3+
# Generated by GNU Autoconf 2.71 for sudo 1.9.12p1.
44
#
55
# Report bugs to <https://bugzilla.sudo.ws/>.
66
#
@@ -621,8 +621,8 @@ MAKEFLAGS=
621621
# Identity of this package.
622622
PACKAGE_NAME='sudo'
623623
PACKAGE_TARNAME='sudo'
624-
PACKAGE_VERSION='1.9.12'
625-
PACKAGE_STRING='sudo 1.9.12'
624+
PACKAGE_VERSION='1.9.12p1'
625+
PACKAGE_STRING='sudo 1.9.12p1'
626626
PACKAGE_BUGREPORT='https://bugzilla.sudo.ws/'
627627
PACKAGE_URL=''
628628

@@ -1640,7 +1640,7 @@ if test "$ac_init_help" = "long"; then
16401640
# Omit some internal or obsolete options to make the list less imposing.
16411641
# This message is too long to be a string in the A/UX 3.1 sh.
16421642
cat <<_ACEOF
1643-
\`configure' configures sudo 1.9.12 to adapt to many kinds of systems.
1643+
\`configure' configures sudo 1.9.12p1 to adapt to many kinds of systems.
16441644

16451645
Usage: $0 [OPTION]... [VAR=VALUE]...
16461646

@@ -1706,7 +1706,7 @@ fi
17061706

17071707
if test -n "$ac_init_help"; then
17081708
case $ac_init_help in
1709-
short | recursive ) echo "Configuration of sudo 1.9.12:";;
1709+
short | recursive ) echo "Configuration of sudo 1.9.12p1:";;
17101710
esac
17111711
cat <<\_ACEOF
17121712

@@ -1996,7 +1996,7 @@ fi
19961996
test -n "$ac_init_help" && exit $ac_status
19971997
if $ac_init_version; then
19981998
cat <<\_ACEOF
1999-
sudo configure 1.9.12
1999+
sudo configure 1.9.12p1
20002000
generated by GNU Autoconf 2.71
20012001

20022002
Copyright (C) 2021 Free Software Foundation, Inc.
@@ -2653,7 +2653,7 @@ cat >config.log <<_ACEOF
26532653
This file contains any messages produced by compilers while
26542654
running configure, to aid debugging if configure makes a mistake.
26552655

2656-
It was created by sudo $as_me 1.9.12, which was
2656+
It was created by sudo $as_me 1.9.12p1, which was
26572657
generated by GNU Autoconf 2.71. Invocation command line was
26582658

26592659
$ $0$ac_configure_args_raw
@@ -31899,42 +31899,40 @@ printf "%s\n" "$sudo_cv_var_stack_protector" >&6; }
3189931899
fi
3190031900
fi
3190131901
if test "$enable_hardening" != "no"; then
31902-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts -fstack-clash-protection" >&5
31903-
printf %s "checking whether the linker accepts -fstack-clash-protection... " >&6; }
31904-
if test ${ax_cv_check_ldflags___fstack_clash_protection+y}
31902+
# The gcc front-end may accept -fstack-clash-protection even if the
31903+
# machine-specific code does not support it. We use a test program
31904+
# with a large stack allocation to try to cause the compiler to
31905+
# insert the stack clash protection code, or fail if not supported.
31906+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler supports -fstack-clash-protection" >&5
31907+
printf %s "checking whether C compiler supports -fstack-clash-protection... " >&6; }
31908+
if test ${sudo_cv_check_cflags___fstack_clash_protection+y}
3190531909
then :
3190631910
printf %s "(cached) " >&6
3190731911
else $as_nop
3190831912

31909-
ax_check_save_flags=$LDFLAGS
31910-
LDFLAGS="$LDFLAGS -fstack-clash-protection"
31911-
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
31913+
_CFLAGS="$CFLAGS"
31914+
CFLAGS="$CFLAGS -fstack-clash-protection"
31915+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
3191231916
/* end confdefs.h. */
3191331917

31914-
int
31915-
main (void)
31916-
{
31918+
int main(int argc, char *argv[]) { char buf[16384], *src = argv[0], *dst = buf; while ((*dst++ = *src++) != '\0'); return buf[argc]; }
3191731919

31918-
;
31919-
return 0;
31920-
}
3192131920
_ACEOF
31922-
if ac_fn_c_try_link "$LINENO"
31921+
if ac_fn_c_try_compile "$LINENO"
3192331922
then :
31924-
ax_cv_check_ldflags___fstack_clash_protection=yes
31923+
sudo_cv_check_cflags___fstack_clash_protection=yes
3192531924
else $as_nop
31926-
ax_cv_check_ldflags___fstack_clash_protection=no
31925+
sudo_cv_check_cflags___fstack_clash_protection=no
3192731926
fi
31928-
rm -f core conftest.err conftest.$ac_objext conftest.beam \
31929-
conftest$ac_exeext conftest.$ac_ext
31930-
LDFLAGS=$ax_check_save_flags
31931-
fi
31932-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_ldflags___fstack_clash_protection" >&5
31933-
printf "%s\n" "$ax_cv_check_ldflags___fstack_clash_protection" >&6; }
31934-
if test x"$ax_cv_check_ldflags___fstack_clash_protection" = xyes
31935-
then :
31927+
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
31928+
CFLAGS="$_CFLAGS"
3193631929

3193731930

31931+
fi
31932+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $sudo_cv_check_cflags___fstack_clash_protection" >&5
31933+
printf "%s\n" "$sudo_cv_check_cflags___fstack_clash_protection" >&6; }
31934+
if test X"$sudo_cv_check_cflags___fstack_clash_protection" = X"yes"; then
31935+
3193831936
if test ${HARDENING_CFLAGS+y}
3193931937
then :
3194031938

@@ -32000,12 +31998,43 @@ else $as_nop
3200031998

3200131999
fi
3200232000

32001+
fi
3200332002

32003+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fcf-protection" >&5
32004+
printf %s "checking whether C compiler accepts -fcf-protection... " >&6; }
32005+
if test ${ax_cv_check_cflags___fcf_protection+y}
32006+
then :
32007+
printf %s "(cached) " >&6
3200432008
else $as_nop
32005-
:
32009+
32010+
ax_check_save_flags=$CFLAGS
32011+
CFLAGS="$CFLAGS -fcf-protection"
32012+
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
32013+
/* end confdefs.h. */
32014+
32015+
int
32016+
main (void)
32017+
{
32018+
32019+
;
32020+
return 0;
32021+
}
32022+
_ACEOF
32023+
if ac_fn_c_try_compile "$LINENO"
32024+
then :
32025+
ax_cv_check_cflags___fcf_protection=yes
32026+
else $as_nop
32027+
ax_cv_check_cflags___fcf_protection=no
32028+
fi
32029+
rm -f core conftest.err conftest.$ac_objext conftest.beam conftest.$ac_ext
32030+
CFLAGS=$ax_check_save_flags
3200632031
fi
32032+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ax_cv_check_cflags___fcf_protection" >&5
32033+
printf "%s\n" "$ax_cv_check_cflags___fcf_protection" >&6; }
32034+
if test x"$ax_cv_check_cflags___fcf_protection" = xyes
32035+
then :
3200732036

32008-
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts -fcf-protection" >&5
32037+
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking whether the linker accepts -fcf-protection" >&5
3200932038
printf %s "checking whether the linker accepts -fcf-protection... " >&6; }
3201032039
if test ${ax_cv_check_ldflags___fcf_protection+y}
3201132040
then :
@@ -32107,6 +32136,11 @@ else $as_nop
3210732136
fi
3210832137

3210932138

32139+
else $as_nop
32140+
:
32141+
fi
32142+
32143+
3211032144
else $as_nop
3211132145
:
3211232146
fi
@@ -33114,7 +33148,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
3311433148
# report actual input values of CONFIG_FILES etc. instead of their
3311533149
# values after options handling.
3311633150
ac_log="
33117-
This file was extended by sudo $as_me 1.9.12, which was
33151+
This file was extended by sudo $as_me 1.9.12p1, which was
3311833152
generated by GNU Autoconf 2.71. Invocation command line was
3311933153

3312033154
CONFIG_FILES = $CONFIG_FILES
@@ -33182,7 +33216,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\
3318233216
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
3318333217
ac_cs_config='$ac_cs_config_escaped'
3318433218
ac_cs_version="\\
33185-
sudo config.status 1.9.12
33219+
sudo config.status 1.9.12p1
3318633220
configured by $0, generated by GNU Autoconf 2.71,
3318733221
with options \\"\$ac_cs_config\\"
3318833222

configure.ac

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dnl ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1818
dnl OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1919
dnl
2020
AC_PREREQ([2.70])
21-
AC_INIT([sudo], [1.9.12], [https://bugzilla.sudo.ws/], [sudo])
21+
AC_INIT([sudo], [1.9.12p1], [https://bugzilla.sudo.ws/], [sudo])
2222
AC_CONFIG_HEADERS([config.h pathnames.h])
2323
AC_CONFIG_SRCDIR([src/sudo.c])
2424
AC_CONFIG_AUX_DIR([scripts])
@@ -4956,13 +4956,31 @@ if test "$enable_hardening" != "no" && test "$enable_ssp" != "no"; then
49564956
fi
49574957
fi
49584958
if test "$enable_hardening" != "no"; then
4959-
AX_CHECK_LINK_FLAG([-fstack-clash-protection], [
4959+
# The gcc front-end may accept -fstack-clash-protection even if the
4960+
# machine-specific code does not support it. We use a test program
4961+
# with a large stack allocation to try to cause the compiler to
4962+
# insert the stack clash protection code, or fail if not supported.
4963+
AC_CACHE_CHECK([whether C compiler supports -fstack-clash-protection],
4964+
[sudo_cv_check_cflags___fstack_clash_protection],
4965+
[
4966+
_CFLAGS="$CFLAGS"
4967+
CFLAGS="$CFLAGS -fstack-clash-protection"
4968+
AC_COMPILE_IFELSE([
4969+
AC_LANG_SOURCE([[int main(int argc, char *argv[]) { char buf[16384], *src = argv[0], *dst = buf; while ((*dst++ = *src++) != '\0'); return buf[argc]; }]])
4970+
], [sudo_cv_check_cflags___fstack_clash_protection=yes], [sudo_cv_check_cflags___fstack_clash_protection=no])
4971+
CFLAGS="$_CFLAGS"
4972+
]
4973+
)
4974+
if test X"$sudo_cv_check_cflags___fstack_clash_protection" = X"yes"; then
49604975
AX_APPEND_FLAG([-fstack-clash-protection], [HARDENING_CFLAGS])
49614976
AX_APPEND_FLAG([-Wc,-fstack-clash-protection], [HARDENING_LDFLAGS])
4962-
])
4963-
AX_CHECK_LINK_FLAG([-fcf-protection], [
4964-
AX_APPEND_FLAG([-fcf-protection], [HARDENING_CFLAGS])
4965-
AX_APPEND_FLAG([-Wc,-fcf-protection], [HARDENING_LDFLAGS])
4977+
fi
4978+
4979+
AX_CHECK_COMPILE_FLAG([-fcf-protection], [
4980+
AX_CHECK_LINK_FLAG([-fcf-protection], [
4981+
AX_APPEND_FLAG([-fcf-protection], [HARDENING_CFLAGS])
4982+
AX_APPEND_FLAG([-Wc,-fcf-protection], [HARDENING_LDFLAGS])
4983+
])
49664984
])
49674985
AX_CHECK_LINK_FLAG([-Wl,-z,relro], [AX_APPEND_FLAG([-Wl,-z,relro], [LDFLAGS])])
49684986
AX_CHECK_LINK_FLAG([-Wl,-z,now], [AX_APPEND_FLAG([-Wl,-z,now], [LDFLAGS])])

lib/iolog/host_port.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
#endif /* HAVE_STDBOOL_H */
3131
#include <stdio.h>
3232
#include <string.h>
33+
#include <time.h>
3334

3435
#include "sudo_compat.h"
3536
#include "sudo_debug.h"

plugins/sudoers/auth/API

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ typedef struct sudo_auth {
1414

1515
int (*init)(struct passwd *pw, sudo_auth *auth);
1616
int (*setup)(struct passwd *pw, char **prompt, sudo_auth *auth);
17-
int (*verify)(struct passwd *pw, char *p, sudo_auth *auth, struct sudo_conv_callback *callback);
17+
int (*verify)(struct passwd *pw, const char *p, sudo_auth *auth, struct sudo_conv_callback *callback);
1818
int (*approval)(struct passwd *pw, sudo_auth *auth);
1919
int (*cleanup)(struct passwd *pw, sudo_auth *auth, bool force);
2020
int (*begin_session)(struct passwd *pw, char **user_env[], struct sudo_auth *auth);

plugins/sudoers/auth/afs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
#include "check.h"
4646

4747
int
48-
sudo_afs_verify(struct passwd *pw, char *pass, sudo_auth *auth, struct sudo_conv_callback *callback)
48+
sudo_afs_verify(struct passwd *pw, const char *pass, sudo_auth *auth, struct sudo_conv_callback *callback)
4949
{
5050
struct ktc_encryptionKey afs_key;
5151
struct ktc_token afs_token;

plugins/sudoers/auth/aix_auth.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ sudo_aix_change_password(const char *user)
229229
}
230230

231231
int
232-
sudo_aix_verify(struct passwd *pw, char *prompt, sudo_auth *auth, struct sudo_conv_callback *callback)
232+
sudo_aix_verify(struct passwd *pw, const char *prompt, sudo_auth *auth, struct sudo_conv_callback *callback)
233233
{
234234
char *pass, *message = NULL;
235235
int result = 1, reenter = 0;

plugins/sudoers/auth/bsdauth.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ bsdauth_init(struct passwd *pw, sudo_auth *auth)
104104
}
105105

106106
int
107-
bsdauth_verify(struct passwd *pw, char *prompt, sudo_auth *auth, struct sudo_conv_callback *callback)
107+
bsdauth_verify(struct passwd *pw, const char *prompt, sudo_auth *auth, struct sudo_conv_callback *callback)
108108
{
109109
char *pass;
110110
char *s;
@@ -133,20 +133,20 @@ bsdauth_verify(struct passwd *pw, char *prompt, sudo_auth *auth, struct sudo_con
133133
pass = auth_getpass(prompt, SUDO_CONV_PROMPT_ECHO_OFF, callback);
134134
} else {
135135
pass = auth_getpass(s, SUDO_CONV_PROMPT_ECHO_OFF, callback);
136-
if (pass && *pass == '\0') {
136+
if (pass != NULL && *pass == '\0') {
137137
if ((prompt = strrchr(s, '\n')))
138138
prompt++;
139139
else
140140
prompt = s;
141141

142142
/*
143143
* Append '[echo on]' to the last line of the challenge and
144-
* reprompt with echo turned on.
144+
* re-prompt with echo turned on.
145145
*/
146-
len = strlen(prompt) - 1;
147-
while (isspace(prompt[len]) || prompt[len] == ':')
148-
prompt[len--] = '\0';
149-
if (asprintf(&s, "%s [echo on]: ", prompt) == -1) {
146+
len = strlen(prompt);
147+
while (len > 0 && (isspace((unsigned char)prompt[len - 1]) || prompt[len - 1] == ':'))
148+
len--;
149+
if (asprintf(&s, "%.*s [echo on]: ", (int)len, prompt) == -1) {
150150
log_warningx(0, N_("unable to allocate memory"));
151151
debug_return_int(AUTH_FATAL);
152152
}

plugins/sudoers/auth/dce.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
static int check_dce_status(error_status_t, char *);
6060

6161
int
62-
sudo_dce_verify(struct passwd *pw, char *plain_pw, sudo_auth *auth, struct sudo_conv_callback *callback)
62+
sudo_dce_verify(struct passwd *pw, const char *plain_pw, sudo_auth *auth, struct sudo_conv_callback *callback)
6363
{
6464
struct passwd temp_pw;
6565
sec_passwd_rec_t password_rec;

0 commit comments

Comments
 (0)