public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
From: Pavel Reichl <preichl@redhat.com>
To: git-commits@fedoraproject.org
Subject: [rpms/xfsprogs] f45: xfs_admin: Fix Local privilege escalation via xfs_admin
Date: Fri, 13 Nov 2026 19:55:09 GMT	[thread overview]
Message-ID: <179459970932.1.11342731642226314692.rpms-xfsprogs-4ec70bc853fb@fedoraproject.org> (raw)

            A new commit has been pushed.

            Repo   : rpms/xfsprogs
            Branch : f45
            Commit : 4ec70bc853fb0e64844c72c229bd699d0dc61c44
            Author : Pavel Reichl <preichl@redhat.com>
            Date   : 2026-11-13T20:00:28+01:00
            Stats  : +226/-1 in 2 file(s)
            URL    : https://src.fedoraproject.org/rpms/xfsprogs/c/4ec70bc853fb0e64844c72c229bd699d0dc61c44?branch=f45

            Log:
            xfs_admin: Fix Local privilege escalation via xfs_admin

CVE: CVE-2026-108472
Resolves: rhbz#2573060
Signed-off-by: Pavel Reichl <preichl@redhat.com>

---
diff --git a/hotfix-xfs_admin-remove-eval-use-due-to-possible-command-in.patch b/hotfix-xfs_admin-remove-eval-use-due-to-possible-command-in.patch
new file mode 100644
index 0000000..98a6269
--- /dev/null
+++ b/hotfix-xfs_admin-remove-eval-use-due-to-possible-command-in.patch
@@ -0,0 +1,218 @@
+From 219b4754fadb7efc1c0de5ac1f46f037b75b3343 Mon Sep 17 00:00:00 2001
+From: Andrey Albershteyn <aalbersh@kernel.org>
+Date: Mon, 19 Oct 2026 11:16:20 +0200
+Subject: [PATCH] xfs_admin: remove eval use due to possible command injection
+
+[ RHEL 10.2 Adaptation ]
+Adapted for xfsprogs v6.16.0: the upstream patch includes -C cfgfile /
+xfs_spaceman support which this codebase lacks, so those portions are
+omitted. The core security fix (removing eval) remains identical.
+
+The -L (label) argument is 12 bytes string which is reparsed by eval out
+of the crafted arguments string. The label could be crafted to fail
+xfs_db command and continue with user injected command.
+
+In the scenario when user provided arguments are passed to the xfs_admin
+running under root, this leads to root command injection.
+
+Fix this by removing use of eval and instead set a bunch of boolean
+and value flags. These are latter appended to the empty set of
+positional parameters $@. These parameters are not parsed.
+
+Reported-by: Hazley Samsudin <muhammad_hazley_samsudin_from.tp@tech.gov.sg>
+Signed-off-by: Andrey Albershteyn <aalbersh@kernel.org>
+---
+ db/xfs_admin.sh | 133 +++++++++++++++++++++++++++++++++++-------------
+ 1 file changed, 98 insertions(+), 35 deletions(-)
+
+diff --git a/db/xfs_admin.sh b/db/xfs_admin.sh
+index 52a658b..4a342fa 100755
+--- a/db/xfs_admin.sh
++++ b/db/xfs_admin.sh
+@@ -7,49 +7,68 @@
+ status=0
+ require_offline=""
+ require_online=""
+-DB_OPTS=""
+-DB_DEV_OPTS=""
+-REPAIR_OPTS=""
+-IO_OPTS=""
+-REPAIR_DEV_OPTS=""
+-LOG_OPTS=""
++have_db=""
++have_repair=""
++opt_extflg=""			# -e
++opt_force=""			# -f
++opt_log2=""			# -j
++opt_projid32bit=""		# -p
++opt_get_label=""		# -l
++opt_get_uuid=""			# -u
++opt_set_label=""		# -L
++set_label=""
++opt_set_uuid=""			# -U
++set_uuid=""
++opt_rtdev=""			# -r
++rtdev=""
++repair_tokens=""
++
+ USAGE="Usage: xfs_admin [-efjlpuV] [-c 0|1] [-L label] [-O v5_feature] [-r rtdev] [-U uuid] device [logdev]"
+
+ while getopts "c:efjlL:O:pr:uU:V" c
+ do
+ 	case $c in
+-	c)	REPAIR_OPTS=$REPAIR_OPTS" -c lazycount="$OPTARG
++	c)	repair_tokens="$repair_tokens lazycount=$OPTARG"
+ 		require_offline=1
++		have_repair=1
+ 		;;
+-	e)	DB_OPTS=$DB_OPTS" -c 'version extflg'"
++	e)	opt_extflg=1
++		have_db=1
+ 		require_offline=1
+ 		;;
+-	f)	DB_OPTS=$DB_OPTS" -f"
++	f)	opt_force=1
++		have_db=1
+ 		require_offline=1
+ 		;;
+-	j)	DB_OPTS=$DB_OPTS" -c 'version log2'"
++	j)	opt_log2=1
++		have_db=1
+ 		require_offline=1
+ 		;;
+-	l)	DB_OPTS=$DB_OPTS" -r -c label"
+-		IO_OPTS=$IO_OPTS" -r -c label"
++	l)	opt_get_label=1
++		have_db=1
+ 		;;
+-	L)	DB_OPTS=$DB_OPTS" -c 'label "$OPTARG"'"
+-		IO_OPTS=$IO_OPTS" -c 'label -s "$OPTARG"'"
++	L)	opt_set_label=1
++		set_label=$OPTARG
++		have_db=1
+ 		;;
+-	O)	REPAIR_OPTS=$REPAIR_OPTS" -c $OPTARG"
++	O)	repair_tokens="$repair_tokens $OPTARG"
+ 		require_offline=1
++		have_repair=1
+ 		;;
+-	p)	DB_OPTS=$DB_OPTS" -c 'version projid32bit'"
++	p)	opt_projid32bit=1
++		have_db=1
+ 		require_offline=1
+ 		;;
+-	r)	REPAIR_DEV_OPTS=" -r '$OPTARG'"
+-		DB_DEV_OPTS=" -R '$OPTARG'"
++	r)	opt_rtdev=1
++		rtdev=$OPTARG
+ 		require_offline=1
+ 		;;
+-	u)	DB_OPTS=$DB_OPTS" -r -c uuid"
+-		IO_OPTS=$IO_OPTS" -r -c fsuuid"
++	u)	opt_get_uuid=1
++		have_db=1
+ 		;;
+-	U)	DB_OPTS=$DB_OPTS" -c 'uuid "$OPTARG"'"
++	U)	opt_set_uuid=1
++		set_uuid=$OPTARG
++		have_db=1
+ 		require_offline=1
+ 		;;
+ 	V)	xfs_db -p xfs_admin -V
+@@ -61,43 +80,77 @@ do
+ 		;;
+ 	esac
+ done
+-set -- extra $@
++set -- extra "$@"
+ shift $OPTIND
++device=$1
++logdev=$2
++
++# We use a bunch of opt_* flags here instead of crafting argument strings
++# directly in the getopts loop above. This is because passing such strings
++# to eval could cause command injection.
++#
++# As we cannot use arrays in POSIX, instead we resort to using the positional
++# parameters ($@). Before calling any of the xfs_* utilities we reset $@ to an
++# empty set with "set --". Then, based on the flags parsed above, we append all
++# necessary arguments. This way each argument is passed verbatim, without being
++# re-parsed or word-split by the shell.
+ case $# in
+ 	1|2)
+-		if mntpt="$(findmnt -t xfs -f -n -o TARGET "$1" 2>/dev/null)"; then
++		if mntpt="$(findmnt -t xfs -f -n -o TARGET "$device" 2>/dev/null)"; then
+ 			# filesystem is mounted
+ 			if [ -n "$require_offline" ]; then
+-				echo "$1: filesystem is mounted."
++				echo "$device: filesystem is mounted."
+ 				exit 2
+ 			fi
+
+-			if [ -n "$IO_OPTS" ]; then
+-				eval xfs_io -p xfs_admin $IO_OPTS "$mntpt"
+-				exit $?
++			have_io=""
++			if [ -n "$opt_get_label" ] || [ -n "$opt_set_label" ] || \
++			   [ -n "$opt_get_uuid" ]; then
++				have_io=1
++			fi
++
++			if [ -n "$have_io" ]; then
++				set --
++				[ -n "$opt_get_label" ] && set -- "$@" -r -c label
++				[ -n "$opt_set_label" ] && set -- "$@" -c "label -s $set_label"
++				[ -n "$opt_get_uuid" ] && set -- "$@" -r -c fsuuid
++				exec xfs_io -p xfs_admin "$@" "$mntpt"
+ 			fi
+ 		fi
+
+ 		# filesystem is not mounted
+ 		if [ -n "$require_online" ]; then
+-			echo "$1: filesystem is not mounted"
++			echo "$device: filesystem is not mounted"
+ 			exit 2
+ 		fi
+
+-		# Pick up the log device, if present
+-		if [ -n "$2" ]; then
+-			LOG_OPTS=" -l '$2'"
+-		fi
+-
+-		if [ -n "$DB_OPTS" ]
++		if [ -n "$have_db" ]
+ 		then
+-			eval xfs_db -x -p xfs_admin $LOG_OPTS $DB_DEV_OPTS $DB_OPTS "$1"
++			set --
++			[ -n "$logdev" ] && set -- "$@" -l "$logdev"
++			[ -n "$opt_rtdev" ] && set -- "$@" -R "$rtdev"
++			[ -n "$opt_extflg" ] && set -- "$@" -c "version extflg"
++			[ -n "$opt_force" ] && set -- "$@" -f
++			[ -n "$opt_log2" ] && set -- "$@" -c "version log2"
++			[ -n "$opt_get_label" ] && set -- "$@" -r -c label
++			[ -n "$opt_set_label" ] && set -- "$@" -c "label $set_label"
++			[ -n "$opt_projid32bit" ] && set -- "$@" -c "version projid32bit"
++			[ -n "$opt_get_uuid" ] && set -- "$@" -r -c uuid
++			[ -n "$opt_set_uuid" ] && set -- "$@" -c "uuid $set_uuid"
++			xfs_db -x -p xfs_admin "$@" "$device"
+ 			status=$?
+ 		fi
+-		if [ -n "$REPAIR_OPTS" ]
++		if [ -n "$have_repair" ]
+ 		then
+ 			echo "Running xfs_repair to upgrade filesystem."
+-			eval xfs_repair $LOG_OPTS $REPAIR_DEV_OPTS $REPAIR_OPTS "$1"
++			set --
++			[ -n "$logdev" ] && set -- "$@" -l "$logdev"
++			[ -n "$opt_rtdev" ] && set -- "$@" -r "$rtdev"
++			for token in $repair_tokens
++			do
++				set -- "$@" -c "$token"
++			done
++			xfs_repair "$@" "$device"
+ 			status=`expr $? + $status`
+ 		fi
+ 		;;
+--
+2.54.0
+

diff --git a/xfsprogs.spec b/xfsprogs.spec
index 0b44232..b7ce62a 100644
--- a/xfsprogs.spec
+++ b/xfsprogs.spec
@@ -1,7 +1,7 @@
 Summary:	Utilities for managing the XFS filesystem
 Name:		xfsprogs
 Version:	7.1.1
-Release:	1%{?dist}
+Release:	1%{?dist}.1
 License:	GPL-1.0-or-later AND LGPL-2.1-or-later
 URL:		https://xfs.wiki.kernel.org
 Source0:	http://kernel.org/pub/linux/utils/fs/xfs/xfsprogs/%{name}-%{version}.tar.xz
@@ -30,6 +30,8 @@ Provides:       /usr/sbin/fsck.xfs
 Provides:       /usr/sbin/mkfs.xfs
 %endif
 
+Patch0: hotfix-xfs_admin-remove-eval-use-due-to-possible-command-in.patch
+
 %description
 A set of commands to use the XFS filesystem, including mkfs.xfs.
 
@@ -159,6 +161,11 @@ rm -rf $RPM_BUILD_ROOT/%{_datadir}/doc/xfsprogs/
 %{_libdir}/*.so
 
 %changelog
+* Fri Nov 13 2026 Pavel Reichl <preichl@redhat.com> - 7.1.1-1.1
+- Fix Local privilege escalation via xfs_admin
+- CVE: CVE-2026-108472
+- Related: rhbz#2573060
+
 * Fri Jul 17 2026 Pavel Reichl <preichl@redhat.com> - 7.1.1-1
 - Update to upstream v7.1.1
 - Related: rhbz#2501833

                 reply	other threads:[~2026-11-13 19:55 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179459970932.1.11342731642226314692.rpms-xfsprogs-4ec70bc853fb@fedoraproject.org \
    --to=preichl@redhat.com \
    --cc=git-commits@fedoraproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox