mirror of
https://repo.or.cz/socat.git
synced 2025-07-12 14:43:24 +00:00
Version 1.8.0.2 - CVE-2024-54661: Arbitrary file overwrite in readline.sh
This commit is contained in:
parent
6ff391324d
commit
4ee1f31cf8
6 changed files with 91 additions and 5 deletions
63
test.sh
63
test.sh
|
@ -20349,6 +20349,69 @@ DCCP-CONNECT dccp4 PORT
|
|||
"
|
||||
|
||||
|
||||
# Test the readline.sh file overwrite vulnerability
|
||||
NAME=READLINE_SH_OVERWRITE
|
||||
case "$TESTS" in
|
||||
*%$N%*|*%functions%*|*%bugs%*|*%readline%*|*%security%*|*%$NAME%*)
|
||||
TEST="$NAME: Test the readline.sh file overwrite vulnerability"
|
||||
# Create a symlink /tmp/$USER/stderr2 pointing to a temporary file,
|
||||
# run readline.sh
|
||||
# When the temporary file is kept the test succeeded
|
||||
if ! eval $NUMCOND; then :
|
||||
elif ! cond=$(checkconds \
|
||||
"" \
|
||||
"" \
|
||||
"readline.sh" \
|
||||
"" \
|
||||
"" \
|
||||
"" \
|
||||
"" ); then
|
||||
$PRINTF "test $F_n $TEST... ${YELLOW}$cond${NORMAL}\n" $N
|
||||
numCANT=$((numCANT+1))
|
||||
listCANT="$listCANT $N"
|
||||
namesCANT="$namesCANT $NAME"
|
||||
else
|
||||
tf="$td/test$N.file"
|
||||
te="$td/test$N.stderr"
|
||||
tdiff="$td/test$N.diff"
|
||||
da="test$N $(date) $RANDOM"
|
||||
echo "$da" >"$tf"
|
||||
ln -sf "$tf" /tmp/$USER/stderr2
|
||||
CMD0="readline.sh cat"
|
||||
printf "test $F_n $TEST... " $N
|
||||
$CMD0 </dev/null >/dev/null 2>"${te}0"
|
||||
rc0=$?
|
||||
# if [ "$rc0" -ne 0 ]; then
|
||||
# $PRINTF "$CANT (rc0=$rc0)\n"
|
||||
# echo "$CMD0"
|
||||
# cat "${te}0" >&2
|
||||
# numCANT=$((numCANT+1))
|
||||
# listCANT="$listCANT $N"
|
||||
# namesCANT="$namesCANT $NAME"
|
||||
# elif ! echo "$da" |diff - "$tf" >$tdiff; then
|
||||
if ! echo "$da" |diff - "$tf" >$tdiff; then
|
||||
$PRINTF "$FAILED (diff)\n"
|
||||
echo "$CMD0 &"
|
||||
cat "${te}0" >&2
|
||||
echo "// diff:" >&2
|
||||
cat "$tdiff" >&2
|
||||
numFAIL=$((numFAIL+1))
|
||||
listFAIL="$listFAIL $N"
|
||||
namesFAIL="$namesFAIL $NAME"
|
||||
else
|
||||
$PRINTF "$OK\n"
|
||||
if [ "$VERBOSE" ]; then echo "$CMD0 &"; fi
|
||||
if [ "$DEBUG" ]; then cat "${te}0" >&2; fi
|
||||
if [ "$VERBOSE" ]; then echo "$CMD1"; fi
|
||||
if [ "$DEBUG" ]; then cat "${te}1" >&2; fi
|
||||
numOK=$((numOK+1))
|
||||
listOK="$listOK $N"
|
||||
fi
|
||||
fi # NUMCOND
|
||||
;;
|
||||
esac
|
||||
N=$((N+1))
|
||||
|
||||
# end of common tests
|
||||
|
||||
##################################################################################
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue