diff --git a/backport-CVE-2024-54661-Arbitrary-file-overwr.patch b/backport-CVE-2024-54661-Arbitrary-file-overwr.patch new file mode 100644 index 0000000000000000000000000000000000000000..b637d38b04c31e56abc01976ec7608802fd40d9b --- /dev/null +++ b/backport-CVE-2024-54661-Arbitrary-file-overwr.patch @@ -0,0 +1,112 @@ +From 4ee1f31cf80019c5907876576d6dfd49368d660f Mon Sep 17 00:00:00 2001 +From: Gerhard Rieger +Date: Fri, 6 Dec 2024 11:42:09 +0100 +Subject: [PATCH] Version 1.8.0.2 - CVE-2024-54661: Arbitrary file overwrite in + readline.sh + +Conflict: only the modified content of readline.sh and test.sh is included. +Reference: https://repo.or.cz/socat.git/patch/4ee1f31cf80019c5907876576d6dfd49368d660f +--- + readline.sh | 10 +++++++-- + test.sh | 63 +++++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 71 insertions(+), 2 deletions(-) + +diff --git a/readline.sh b/readline.sh +index b6f8438..1045303 100755 +--- a/readline.sh ++++ b/readline.sh +@@ -22,9 +22,15 @@ if [ "$withhistfile" ]; then + else + HISTOPT= + fi +-mkdir -p /tmp/$USER || exit 1 + # + # + +-exec socat -d readline"$HISTOPT",noecho='[Pp]assword:' exec:"$PROGRAM",sigint,pty,setsid,ctty,raw,echo=0,stderr 2>/tmp/$USER/stderr2 ++if test -w .; then ++ STDERR=./socat-readline.${1##*/}.log ++ rm -f $STDERR ++else ++ STDERR=/dev/null ++fi ++ ++exec socat -d readline"$HISTOPT",noecho='[Pp]assword:' exec:"$PROGRAM",sigint,pty,setsid,ctty,raw,echo=0,stderr 2>$STDERR + +diff --git a/test.sh b/test.sh +index 46bebf8..5204ac7 100755 +--- a/test.sh ++++ b/test.sh +@@ -12728,6 +12728,69 @@ esac + PORT=$((PORT+1)) + N=$((N+1)) + ++# 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 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)) ++ + ################################################################################## + #================================================================================= + # here come tests that might affect your systems integrity. Put normal tests +-- +2.33.0 + diff --git a/socat.spec b/socat.spec index e8b142f9db9c233a0de186eeed7341b7cadeebc1..f9a9b40af7b1c9300104fcb452e7e1613b808dfa 100644 --- a/socat.spec +++ b/socat.spec @@ -3,11 +3,13 @@ Summary: Multipurpose relay Name: socat Version: 1.7.3.2 -Release: 8 +Release: 9 License: GPLv2 Url: http://www.dest-unreach.org/socat/ Source: http://www.dest-unreach.org/socat/download/%{name}-%{version}.tar.gz +Patch6000: backport-CVE-2024-54661-Arbitrary-file-overwr.patch + BuildRequires: gcc openssl-devel readline-devel ncurses-devel BuildRequires: autoconf kernel-headers > 2.6.18 BuildRequires: iproute net-tools coreutils procps-ng openssl iputils @@ -60,5 +62,8 @@ cp -a *.sh %{buildroot}/%{_docdir}/socat/ %doc %{_mandir}/man1/socat.1* %changelog +* Thu Dec 12 2024 yueyuankun - 1.7.3.2-9 +- Fix CVE-2024-54661 + * Tue Nov 19 2019 mengxian - 1.7.3.2-8 -- Package init \ No newline at end of file +- Package init