0148-templates-Disable-the-os-prober-by-default.patch 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. From e346414725a70e5c74ee87ca14e580c66f517666 Mon Sep 17 00:00:00 2001
  2. From: Alex Burmashev <alexander.burmashev@oracle.com>
  3. Date: Tue, 16 Feb 2021 11:12:12 +0100
  4. Subject: [PATCH] templates: Disable the os-prober by default
  5. The os-prober is enabled by default what may lead to potentially
  6. dangerous use cases and borderline opening attack vectors. This
  7. patch disables the os-prober, adds warning messages and updates
  8. GRUB_DISABLE_OS_PROBER configuration option documentation. This
  9. way we make it clear that the os-prober usage is not recommended.
  10. Simplistic nature of this change allows downstream vendors, who
  11. really want os-prober to be enabled out of the box in their
  12. relevant products, easily revert to it's old behavior.
  13. Reported-by: NyankoSec (<nyanko@10x.moe>, https://twitter.com/NyankoSec),
  14. working with SSD Secure Disclosure
  15. Signed-off-by: Alex Burmashev <alexander.burmashev@oracle.com>
  16. Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
  17. Signed-off-by: Stefan Sørensen <stefan.sorensen@spectralink.com>
  18. ---
  19. docs/grub.texi | 18 ++++++++++--------
  20. util/grub.d/30_os-prober.in | 5 ++++-
  21. 2 files changed, 14 insertions(+), 9 deletions(-)
  22. diff --git a/docs/grub.texi b/docs/grub.texi
  23. index e302797..45a9f80 100644
  24. --- a/docs/grub.texi
  25. +++ b/docs/grub.texi
  26. @@ -1481,10 +1481,13 @@ boot sequence. If you have problems, set this option to @samp{text} and
  27. GRUB will tell Linux to boot in normal text mode.
  28. @item GRUB_DISABLE_OS_PROBER
  29. -Normally, @command{grub-mkconfig} will try to use the external
  30. -@command{os-prober} program, if installed, to discover other operating
  31. -systems installed on the same system and generate appropriate menu entries
  32. -for them. Set this option to @samp{true} to disable this.
  33. +The @command{grub-mkconfig} has a feature to use the external
  34. +@command{os-prober} program to discover other operating systems installed on
  35. +the same machine and generate appropriate menu entries for them. It is disabled
  36. +by default since automatic and silent execution of @command{os-prober}, and
  37. +creating boot entries based on that data, is a potential attack vector. Set
  38. +this option to @samp{false} to enable this feature in the
  39. +@command{grub-mkconfig} command.
  40. @item GRUB_OS_PROBER_SKIP_LIST
  41. List of space-separated FS UUIDs of filesystems to be ignored from os-prober
  42. @@ -1812,10 +1815,9 @@ than zero; otherwise 0.
  43. @section Multi-boot manual config
  44. Currently autogenerating config files for multi-boot environments depends on
  45. -os-prober and has several shortcomings. While fixing it is scheduled for the
  46. -next release, meanwhile you can make use of the power of GRUB syntax and do it
  47. -yourself. A possible configuration is detailed here, feel free to adjust to your
  48. -needs.
  49. +os-prober and has several shortcomings. Due to that it is disabled by default.
  50. +It is advised to use the power of GRUB syntax and do it yourself. A possible
  51. +configuration is detailed here, feel free to adjust to your needs.
  52. First create a separate GRUB partition, big enough to hold GRUB. Some of the
  53. following entries show how to load OS installer images from this same partition,
  54. diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in
  55. index 515a68c..99de043 100644
  56. --- a/util/grub.d/30_os-prober.in
  57. +++ b/util/grub.d/30_os-prober.in
  58. @@ -26,7 +26,8 @@ export TEXTDOMAINDIR="@localedir@"
  59. . "$pkgdatadir/grub-mkconfig_lib"
  60. -if [ "x${GRUB_DISABLE_OS_PROBER}" = "xtrue" ]; then
  61. +if [ "x${GRUB_DISABLE_OS_PROBER}" = "xfalse" ]; then
  62. + gettext_printf "os-prober will not be executed to detect other bootable partitions.\nSystems on them will not be added to the GRUB boot configuration.\nCheck GRUB_DISABLE_OS_PROBER documentation entry.\n"
  63. exit 0
  64. fi
  65. @@ -39,6 +40,8 @@ OSPROBED="`os-prober | tr ' ' '^' | paste -s -d ' '`"
  66. if [ -z "${OSPROBED}" ] ; then
  67. # empty os-prober output, nothing doing
  68. exit 0
  69. +else
  70. + grub_warn "$(gettext_printf "os-prober was executed to detect other bootable partitions.\nIt's output will be used to detect bootable binaries on them and create new boot entries.")"
  71. fi
  72. osx_entry() {
  73. --
  74. 2.14.2