mirror of
https://github.com/freebsd/freebsd-src
synced 2024-10-06 16:40:47 +00:00
4d3fc8b057
This release fixes a number of security bugs and has minor new features and bug fixes. Security fixes, from the release notes (https://www.openssh.com/txt/release-9.3): This release contains fixes for a security problem and a memory safety problem. The memory safety problem is not believed to be exploitable, but we report most network-reachable memory faults as security bugs. * ssh-add(1): when adding smartcard keys to ssh-agent(1) with the per-hop destination constraints (ssh-add -h ...) added in OpenSSH 8.9, a logic error prevented the constraints from being communicated to the agent. This resulted in the keys being added without constraints. The common cases of non-smartcard keys and keys without destination constraints are unaffected. This problem was reported by Luci Stanescu. * ssh(1): Portable OpenSSH provides an implementation of the getrrsetbyname(3) function if the standard library does not provide it, for use by the VerifyHostKeyDNS feature. A specifically crafted DNS response could cause this function to perform an out-of-bounds read of adjacent stack data, but this condition does not appear to be exploitable beyond denial-of- service to the ssh(1) client. The getrrsetbyname(3) replacement is only included if the system's standard library lacks this function and portable OpenSSH was not compiled with the ldns library (--with-ldns). getrrsetbyname(3) is only invoked if using VerifyHostKeyDNS to fetch SSHFP records. This problem was found by the Coverity static analyzer. Sponsored by: The FreeBSD Foundation
77 lines
2.3 KiB
Bash
77 lines
2.3 KiB
Bash
# $OpenBSD: integrity.sh,v 1.25 2023/03/01 09:29:32 dtucker Exp $
|
|
# Placed in the Public Domain.
|
|
|
|
tid="integrity"
|
|
cp $OBJ/sshd_proxy $OBJ/sshd_proxy_bak
|
|
|
|
# start at byte 2900 (i.e. after kex) and corrupt at different offsets
|
|
tries=10
|
|
startoffset=2900
|
|
macs=`${SSH} -Q mac`
|
|
# The following are not MACs, but ciphers with integrated integrity. They are
|
|
# handled specially below.
|
|
macs="$macs `${SSH} -Q cipher-auth`"
|
|
|
|
# avoid DH group exchange as the extra traffic makes it harder to get the
|
|
# offset into the stream right.
|
|
#echo "KexAlgorithms -diffie-hellman-group*" \
|
|
# >> $OBJ/ssh_proxy
|
|
|
|
# sshd-command for proxy (see test-exec.sh)
|
|
cmd="$SUDO env SSH_SK_HELPER="$SSH_SK_HELPER" sh ${OBJ}/sshd-log-wrapper.sh -i -f $OBJ/sshd_proxy"
|
|
|
|
for m in $macs; do
|
|
trace "test $tid: mac $m"
|
|
elen=0
|
|
epad=0
|
|
emac=0
|
|
etmo=0
|
|
ecnt=0
|
|
skip=0
|
|
for off in `jot $tries $startoffset`; do
|
|
skip=`expr $skip - 1`
|
|
if [ $skip -gt 0 ]; then
|
|
# avoid modifying the high bytes of the length
|
|
continue
|
|
fi
|
|
cp $OBJ/sshd_proxy_bak $OBJ/sshd_proxy
|
|
# modify output from sshd at offset $off
|
|
pxy="proxycommand=$cmd | $OBJ/modpipe -wm xor:$off:1"
|
|
if ${SSH} -Q cipher-auth | grep "^${m}\$" >/dev/null 2>&1 ; then
|
|
echo "Ciphers=$m" >> $OBJ/sshd_proxy
|
|
macopt="-c $m"
|
|
else
|
|
echo "Ciphers=aes128-ctr" >> $OBJ/sshd_proxy
|
|
echo "MACs=$m" >> $OBJ/sshd_proxy
|
|
macopt="-m $m -c aes128-ctr"
|
|
fi
|
|
verbose "test $tid: $m @$off"
|
|
${SSH} $macopt -F $OBJ/ssh_proxy -o "$pxy" \
|
|
-oServerAliveInterval=1 -oServerAliveCountMax=30 \
|
|
999.999.999.999 'printf "%4096s" " "' >/dev/null
|
|
if [ $? -eq 0 ]; then
|
|
fail "ssh -m $m succeeds with bit-flip at $off"
|
|
fi
|
|
ecnt=`expr $ecnt + 1`
|
|
out=$(egrep -v "^debug" $TEST_SSH_LOGFILE | tail -2 | \
|
|
tr -s '\r\n' '.')
|
|
case "$out" in
|
|
Bad?packet*) elen=`expr $elen + 1`; skip=3;;
|
|
Corrupted?MAC* | *message?authentication?code?incorrect*)
|
|
emac=`expr $emac + 1`; skip=0;;
|
|
padding*) epad=`expr $epad + 1`; skip=0;;
|
|
*Timeout,?server*)
|
|
etmo=`expr $etmo + 1`; skip=0;;
|
|
*) fail "unexpected error mac $m at $off: $out";;
|
|
esac
|
|
done
|
|
verbose "test $tid: $ecnt errors: mac $emac padding $epad length $elen timeout $etmo"
|
|
if [ $emac -eq 0 ]; then
|
|
fail "$m: no mac errors"
|
|
fi
|
|
expect=`expr $ecnt - $epad - $elen - $etmo`
|
|
if [ $emac -ne $expect ]; then
|
|
fail "$m: expected $expect mac errors, got $emac"
|
|
fi
|
|
done
|