]> git.ipfire.org Git - thirdparty/dracut-ng.git/commitdiff
fix(iscsi): sanitize netroot= value passed to initqueue scripts main
authorAntonio Alvarez Feijoo <antonio.feijoo@suse.com>
Mon, 10 Aug 2026 13:30:11 +0000 (15:30 +0200)
committerNeal Gompa (ニール・ゴンパ) <ngompa13@gmail.com>
Mon, 10 Aug 2026 14:04:43 +0000 (07:04 -0700)
The value of the `netroot=` kernel command line option is passed unsanitized to
initqueue scripts, which end up being sourced as shell scripts.

modules.d/74iscsi/parse-iscsiroot.sh

index 7ff9bda37fbffb50f3dd8263f132681d9cd91599..3dc37f55e7af9c4ab5bfd018d0d2c047d79a7c51 100755 (executable)
@@ -106,7 +106,7 @@ modprobe -b -q be2iscsi
 
 if [ -n "$netroot" ] && [ "$root" != "/dev/root" ] && [ "$root" != "dhcp" ]; then
     if ! getargbool 1 rd.neednet > /dev/null || ! getarg "ip="; then
-        /sbin/initqueue --unique --onetime --settled /sbin/iscsiroot dummy "'$netroot'" "'$NEWROOT'"
+        /sbin/initqueue --unique --onetime --settled /sbin/iscsiroot dummy "'$(escape "$netroot")'" "'$NEWROOT'"
     fi
 fi
 
@@ -146,7 +146,7 @@ if [ -z "$netroot" ] || ! [ "${netroot%%:*}" = "iscsi" ]; then
     return 1
 fi
 
-/sbin/initqueue --unique --onetime --timeout /sbin/iscsiroot timeout "$netroot" "$NEWROOT"
+/sbin/initqueue --unique --onetime --timeout /sbin/iscsiroot timeout "'$(escape "$netroot")'" "$NEWROOT"
 
 for nroot in $(getargs netroot); do
     [ "${nroot%%:*}" = "iscsi" ] || continue