Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.debian.kernel > #79655 > unrolled thread
| Started by | Marco d'Itri <md@Linux.IT> |
|---|---|
| First post | 2023-07-20 20:10 +0200 |
| Last post | 2023-08-27 02:40 +0200 |
| Articles | 10 — 7 participants |
Back to article view | Back to linux.debian.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Bug#1041552: HFS/HFS+ are insecure Marco d'Itri <md@Linux.IT> - 2023-07-20 20:10 +0200
Re: HFS/HFS+ are insecure Marco d'Itri <md@Linux.IT> - 2023-07-21 11:00 +0200
Re: HFS/HFS+ are insecure Magissia <debianlist@magissia.com> - 2023-07-21 11:10 +0200
Re: HFS/HFS+ are insecure Martin Steigerwald <martin@lichtvoll.de> - 2023-07-21 12:10 +0200
Re: HFS/HFS+ are insecure Bastien Roucariès <rouca@debian.org> - 2023-07-21 13:00 +0200
Re: HFS/HFS+ are insecure Bastien Roucariès <rouca@debian.org> - 2023-07-21 13:10 +0200
Re: HFS/HFS+ are insecure Matthew Garrett <mjg59@srcf.ucam.org> - 2023-07-21 19:40 +0200
Re: HFS/HFS+ are insecure Ben Hutchings <ben@decadent.org.uk> - 2023-07-23 02:40 +0200
Processed: Re: HFS/HFS+ are insecure "Debian Bug Tracking System" <owner@bugs.debian.org> - 2023-08-27 02:40 +0200
Bug#1041552: HFS/HFS+ are insecure Marco d'Itri <md@Linux.IT> - 2023-08-27 02:40 +0200
| From | Marco d'Itri <md@Linux.IT> |
|---|---|
| Date | 2023-07-20 20:10 +0200 |
| Subject | Bug#1041552: HFS/HFS+ are insecure |
| Message-ID | <GTG6t-1z5m-31@gated-at.bofh.it> |
[Multipart message — attachments visible in raw view] — view raw
Package: src:linux Severity: normal You are totally correct. Kernel team, please blacklist HFS/HFS+ for automounting. On Jul 20, John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de> wrote: > Hello! > > On Thu, 2023-07-20 at 18:30 +0100, Matthew Wilcox wrote: > > On Thu, Jul 20, 2023 at 05:27:57PM +0200, Dmitry Vyukov wrote: > > > On Thu, 5 Jan 2023 at 17:45, Viacheslav Dubeyko <slava@dubeyko.com> wrote: > > > > > On Wed, Jan 04, 2023 at 08:37:16PM -0800, Viacheslav Dubeyko wrote: > > > > > > Also, as far as I can see, available volume in report (mount_0.gz) somehow corrupted already: > > > > > > > > > > Syzbot generates deliberately-corrupted (aka fuzzed) filesystem images. > > > > > So basically, you can't trust anything you read from the disc. > > > > > > > > > > > > > If the volume has been deliberately corrupted, then no guarantee that file system > > > > driver will behave nicely. Technically speaking, inode write operation should never > > > > happened for corrupted volume because the corruption should be detected during > > > > b-tree node initialization time. If we would like to achieve such nice state of HFS/HFS+ > > > > drivers, then it requires a lot of refactoring/implementation efforts. I am not sure that > > > > it is worth to do because not so many guys really use HFS/HFS+ as the main file > > > > system under Linux. > > > > > > > > > Most popular distros will happily auto-mount HFS/HFS+ from anything > > > inserted into USB (e.g. what one may think is a charger). This creates > > > interesting security consequences for most Linux users. > > > An image may also be corrupted non-deliberately, which will lead to > > > random memory corruptions if the kernel trusts it blindly. > > > > Then we should delete the HFS/HFS+ filesystems. They're orphaned in > > MAINTAINERS and if distros are going to do such a damnfool thing, > > then we must stop them. > > Both HFS and HFS+ work perfectly fine. And if distributions or users are so > sensitive about security, it's up to them to blacklist individual features > in the kernel. > > Both HFS and HFS+ have been the default filesystem on MacOS for 30 years > and I don't think it's justified to introduce such a hard compatibility > breakage just because some people are worried about theoretical evil > maid attacks. > > HFS/HFS+ mandatory if you want to boot Linux on a classic Mac or PowerMac > and I don't think it's okay to break all these systems running Linux. > > Thanks, > Adrian > > -- > .''`. John Paul Adrian Glaubitz > : :' : Debian Developer > `. `' Physicist > `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913 -- ciao, Marco
[toc] | [next] | [standalone]
| From | Marco d'Itri <md@Linux.IT> |
|---|---|
| Date | 2023-07-21 11:00 +0200 |
| Subject | Re: HFS/HFS+ are insecure |
| Message-ID | <GTU9r-1HIa-5@gated-at.bofh.it> |
| In reply to | #79655 |
[Multipart message — attachments visible in raw view] — view raw
On Jul 21, Matthew Garrett <mjg59@srcf.ucam.org> wrote: > > You are totally correct. > > Kernel team, please blacklist HFS/HFS+ for automounting. > Isn't this a userland policy decision? udisks will happily trigger a > module load for hfsplus if udev has identified it, and I don't think > there's a trivial mechanism for the kernel to disable that. I believe Yes, I was also thinking about this and I believe that you are right. The kernel team did this in the past for some uncommon network protocols, but they could do it themselves because these modules are autoloaded using aliases. Since I happen to be the kmod maintainer it looks like that solving this is on me. :-) Unless somebody has a better idea then then my plan is to ship in the next upload of kmod a file in /etc/modprobe.d/ which uses the blacklist directive to prevent automatically loading some file system modules. By looking at the MAINTAINERS file I have identified these file systems marked as "orphan" and "odd fixes": efs hfs hfaplus qnx6 sysv affs ecryptfs jffs2 jfs And I think that I can also safely add a few more which while actively maintained I believe are only used in a retrocomputing context or are generally uncommon anyway: befs bfs hpfs omfs qnx4 reiserfs spu ufs Did i miss anything? I think that all of these have enough of a niche usage that it would not be an unreasonable burden for the affected users to manually load the modules when needed (ad hoc or using /etc/modules-load.d/). -- ciao, Marco
[toc] | [prev] | [next] | [standalone]
| From | Magissia <debianlist@magissia.com> |
|---|---|
| Date | 2023-07-21 11:10 +0200 |
| Subject | Re: HFS/HFS+ are insecure |
| Message-ID | <GTUj7-1I0G-1@gated-at.bofh.it> |
| In reply to | #79658 |
Looks reasonable. Le vendredi 21 juillet 2023 à 10:55 +0200, Marco d'Itri a écrit : > On Jul 21, Matthew Garrett <mjg59@srcf.ucam.org> wrote: > > > > You are totally correct. > > > Kernel team, please blacklist HFS/HFS+ for automounting. > > > > Isn't this a userland policy decision? udisks will happily trigger > > a > > module load for hfsplus if udev has identified it, and I don't > > think > > there's a trivial mechanism for the kernel to disable that. I > > believe > > Yes, I was also thinking about this and I believe that you are right. > The kernel team did this in the past for some uncommon network > protocols, but they could do it themselves because these modules are > autoloaded using aliases. > > Since I happen to be the kmod maintainer it looks like that solving > this > is on me. :-) > > Unless somebody has a better idea then then my plan is to ship in > the > next upload of kmod a file in /etc/modprobe.d/ which uses the > blacklist > directive to prevent automatically loading some file system modules. > > By looking at the MAINTAINERS file I have identified these file > systems > marked as "orphan" and "odd fixes": > > efs > hfs > hfaplus > qnx6 > sysv > > affs > ecryptfs > jffs2 > jfs > > And I think that I can also safely add a few more which while > actively > maintained I believe are only used in a retrocomputing context or > are > generally uncommon anyway: > > befs > bfs > hpfs > omfs > qnx4 > reiserfs > spu > ufs > > Did i miss anything? > > I think that all of these have enough of a niche usage that it would > not > be an unreasonable burden for the affected users to manually load > the > modules when needed (ad hoc or using /etc/modules-load.d/). >
[toc] | [prev] | [next] | [standalone]
| From | Martin Steigerwald <martin@lichtvoll.de> |
|---|---|
| Date | 2023-07-21 12:10 +0200 |
| Subject | Re: HFS/HFS+ are insecure |
| Message-ID | <GTVfb-1Iza-3@gated-at.bofh.it> |
| In reply to | #79658 |
Hi Marco, hi, Marco d'Itri - 21.07.23, 10:55:39 CEST: > On Jul 21, Matthew Garrett <mjg59@srcf.ucam.org> wrote: > > > You are totally correct. > > > Kernel team, please blacklist HFS/HFS+ for automounting. > > > > Isn't this a userland policy decision? udisks will happily trigger a > > module load for hfsplus if udev has identified it, and I don't think > > there's a trivial mechanism for the kernel to disable that. I > > believe > > Yes, I was also thinking about this and I believe that you are right. > The kernel team did this in the past for some uncommon network > protocols, but they could do it themselves because these modules are > autoloaded using aliases. > > Since I happen to be the kmod maintainer it looks like that solving > this is on me. :-) > > Unless somebody has a better idea then then my plan is to ship in the > next upload of kmod a file in /etc/modprobe.d/ which uses the > blacklist directive to prevent automatically loading some file system > modules. […] > I think that all of these have enough of a niche usage that it would > not be an unreasonable burden for the affected users to manually load > the modules when needed (ad hoc or using /etc/modules-load.d/). In case you do this, I'd like there to be a NEWS.Debian entry about this, explaining both the justification behind it and how people can work around it. It could go like this: ----------------------------------------------------------------------- Since version xyz of kmod the file /etc/modprobe.d/block-unsafe- filesystems.conf prevents loading of several filesystem modules that are automatically loaded by udev when inserting a medium that contains one of them. These filesystems are either known to be unsafe or are not maintained actively anymore. A deliberately corrupted filesystem structure could trigger the filesystem driver in the module to crash, corrupt memory of other kernel components or to cause other problems. [Adjust to whatever risks are most likely to occur] [Add some links here for the discussion about that] In case you rely on using one or more of these filesystems you can either edit the file /etc/modprobe.d/block-unsafe-filesystems.conf and put a comment sign before the filesystem in question or add the filesystem to a file to a file in /etc/modules-load.d/. [Please clarify here as needed] Please take care not to plug in any device that you do not trust. ----------------------------------------------------------------------- This is just a rough idea it probably needs several iterations to obtain a good wording that balances on assessing the risk correctly (without over or under estimating it). Also the method of circumventing the blocking may need further explanations. I am not using systemd, so I can not describe exactly how modules-load.d works. In case you like to use any of the above wording, feel free to use it under the license of the packaging of kmod. I wonder about other kernel modules in other areas of the kernel that may be automatically loaded when connecting some hardware… especially some random USB device, but… that appears to me like opening a huge can of worms. I bet the Linux kernel has more than several hundreds of specialized USB drivers maybe even more than thousand meanwhile despite all the USB standards out there? Linux is not a micro kernel. It was not designed to run drivers in a restricted and (somewhat) safe environment to begin with. That means ideally you'd have to audit all the drivers for security issues regularly or at least after a certain amount of changes made to it. In case you do not, for some random driver it will be difficult to know for sure whether it is safe or unsafe to use. Maybe some small filesystem driver like affs that still receives a patch every now and then is safer to use than the much more complex BTRFS filesystem driver.¹ Who knows? Of cause some fuzzing may really help. But it is not a guarantee either. And then what about other kernel functionally that is loaded as module on demand that is only rarely used by some people? So I wonder what body of evidence there is to base a policy decision on which driver to load or not to load automatically. Without a reliable body of evidence there is always the risk to either over or under policy the users of Debian and derived distributions (whose maintainers do not decide to change such a policy decision again). So I'd argue against taking the quick route on that to allow the time for a more informed decision. Maybe start with clear-cut cases likely probably HFS/HFS+ instead of just adding all kinds of other filesystems without even know whether there is a known exploit. Of course you could go by maintenance status, however, this can be inaccurate. How to do accurately determine maintenance status, especially as MAINTAINERS file may not be accurate or up-to-date at all times? And how many specialized USB drivers are there that are compiled as modules on Debian kernels that may not be maintained as well? Disable all of them by default? Risk assessment is very challenging here, if you ask me. [1] After a long time finally some RDB partitioning overflow fixes went into the kernel. The overflow bug could have caused overwriting of data at a different place of the disk on a different partition than intended which could mean a two-way data loss of both the written data and the data that was accidentally overwritten. While this theoretically could have been used for an exploit by deliberately causing the kernel to overwrite data at a certain location of the disk, I am not aware of any existing exploit for this. Such an exploit would only target a quite low amount of users I bet. See: Partitions: Amiga RDB partition on 2 TB disk way too big, while OK in AmigaOS 4.1 https://bugzilla.kernel.org/show_bug.cgi?id=43511 Plus a ton of discussions on various mailing lists, hopefully all linked in above bug report. Thanks, -- Martin
[toc] | [prev] | [next] | [standalone]
| From | Bastien Roucariès <rouca@debian.org> |
|---|---|
| Date | 2023-07-21 13:00 +0200 |
| Subject | Re: HFS/HFS+ are insecure |
| Message-ID | <GTW1z-1IPn-1@gated-at.bofh.it> |
| In reply to | #79658 |
[Multipart message — attachments visible in raw view] — view raw
Le vendredi 21 juillet 2023, 08:55:39 UTC Marco d'Itri a écrit : > efs https://pypi.org/project/qnxmount/ claim to mount it. Check > hfs https://github.com/0x09/hfsfuse > hfaplus https://github.com/0x09/hfsfuse > qnx6 Fuse ro filesystem https://pypi.org/project/qnxmount/ better support then kernel one > sysv no fuse equivalent may be easier to port from (net)?bsd source to fuse or use the method of qnxmount > > affs no fuse equivalent but a grub filesystem may be ported to fuse > ecryptfs no fuse equivalent > jffs2 no fuse equivalent > jfs no fuse equivalent but a grub filesystem may be ported to fuse > > And I think that I can also safely add a few more which while actively > maintained I believe are only used in a retrocomputing context or are > generally uncommon anyway: > > befs A fuse module seems to be avalaible https://www.haiku-os.org/guides/daily-tasks/access_bfs_with_fuse/ > bfs no fuse equivalent > hpfs no fuse > omfs https://github.com/bcopeland/omfs_fuse/ > qnx4 Maybe Fuse ro filesystem https://pypi.org/project/qnxmount/ > reiserfs so incomplete work using grub filesystem https://github.com/albertz/reiserfs-fuse > spu This one is a virtual fs for powerpc should be dropped of the list > ufs https://github.com/mkatiyar/fuse-ufs2 >
[toc] | [prev] | [next] | [standalone]
| From | Bastien Roucariès <rouca@debian.org> |
|---|---|
| Date | 2023-07-21 13:10 +0200 |
| Subject | Re: HFS/HFS+ are insecure |
| Message-ID | <GTWbf-1J8e-21@gated-at.bofh.it> |
| In reply to | #79661 |
[Multipart message — attachments visible in raw view] — view raw
Le vendredi 21 juillet 2023, 10:52:17 UTC Bastien Roucariès a écrit : > Le vendredi 21 juillet 2023, 08:55:39 UTC Marco d'Itri a écrit : > > efs > https://pypi.org/project/qnxmount/ claim to mount it. Check > > hfs > https://github.com/0x09/hfsfuse Corrected not supported by this package may be emulated by using user space hfs tools ? > > hfaplus > https://github.com/0x09/hfsfuse > > qnx6 > Fuse ro filesystem https://pypi.org/project/qnxmount/ better support then kernel one > > sysv > no fuse equivalent may be easier to port from (net)?bsd source to fuse or use the method of qnxmount > > > > affs > no fuse equivalent but a grub filesystem may be ported to fuse > > ecryptfs > no fuse equivalent > > jffs2 > no fuse equivalent > > jfs > no fuse equivalent but a grub filesystem may be ported to fuse > > > > And I think that I can also safely add a few more which while actively > > maintained I believe are only used in a retrocomputing context or are > > generally uncommon anyway: > > > > befs > A fuse module seems to be avalaible https://www.haiku-os.org/guides/daily-tasks/access_bfs_with_fuse/ > > bfs > no fuse equivalent > > hpfs > no fuse > > omfs > https://github.com/bcopeland/omfs_fuse/ > > qnx4 > Maybe Fuse ro filesystem https://pypi.org/project/qnxmount/ > > reiserfs > so incomplete work using grub filesystem https://github.com/albertz/reiserfs-fuse > > spu > This one is a virtual fs for powerpc should be dropped of the list > > ufs > https://github.com/mkatiyar/fuse-ufs2 > > > >
[toc] | [prev] | [next] | [standalone]
| From | Matthew Garrett <mjg59@srcf.ucam.org> |
|---|---|
| Date | 2023-07-21 19:40 +0200 |
| Subject | Re: HFS/HFS+ are insecure |
| Message-ID | <GU2gH-1MGS-19@gated-at.bofh.it> |
| In reply to | #79658 |
On Fri, Jul 21, 2023 at 10:55:39AM +0200, Marco d'Itri wrote:
> Unless somebody has a better idea then then my plan is to ship in the
> next upload of kmod a file in /etc/modprobe.d/ which uses the blacklist
> directive to prevent automatically loading some file system modules.
I think this would break any existing fstab entries that reference hfs
and hfsplus, and the convenient way to integrate Linux boot with x86
Macs is certainly to have an hfsplus EFI partition so this may be a
legitimate use-case. It also means that anyone who has a need to use one
of these filesystems in a static manner is vulnerable to automount
attacks using them.
Completely untested, but I think something along the lines of:
SUBSYSTEM!="block", GOTO="udisks_insecure_fs_end"
ENV{ID_FS_TYPE}=="hfs", ENV{UDISKS_AUTO}="0"
ENV{ID_FS_TYPE}=="hfsplus", ENV{UDISKS_AUTO}="0"
LABEL="udisks_insecure_fs_end"
in a udev fragment should work? Any static fstab or mount units should
still work, but it should disable udisks automounting regardless of the
desktop agent involved, even if the fs modules are already loaded.
[toc] | [prev] | [next] | [standalone]
| From | Ben Hutchings <ben@decadent.org.uk> |
|---|---|
| Date | 2023-07-23 02:40 +0200 |
| Subject | Re: HFS/HFS+ are insecure |
| Message-ID | <GUviF-259b-1@gated-at.bofh.it> |
| In reply to | #79665 |
[Multipart message — attachments visible in raw view] — view raw
On Fri, 2023-07-21 at 18:35 +0100, Matthew Garrett wrote:
> On Fri, Jul 21, 2023 at 10:55:39AM +0200, Marco d'Itri wrote:
>
> > Unless somebody has a better idea then then my plan is to ship in the
> > next upload of kmod a file in /etc/modprobe.d/ which uses the blacklist
> > directive to prevent automatically loading some file system modules.
>
> I think this would break any existing fstab entries that reference hfs
> and hfsplus, and the convenient way to integrate Linux boot with x86
> Macs is certainly to have an hfsplus EFI partition so this may be a
> legitimate use-case. It also means that anyone who has a need to use one
> of these filesystems in a static manner is vulnerable to automount
> attacks using them.
Right, auto-loading of filesystems has to keep working. And since
mount() of arbitrary filesystems is restricted to root (CAP_NET_ADMIN
in the initial namespace), we should let the callers apply a block- or
allow-list.
The reason we have to disable auto-loading of network protocols is that
socket creation is generally an unprivileged operation, so there's no
trusted user-space that can apply the policy (besides kmod).
> Completely untested, but I think something along the lines of:
>
> SUBSYSTEM!="block", GOTO="udisks_insecure_fs_end"
> ENV{ID_FS_TYPE}=="hfs", ENV{UDISKS_AUTO}="0"
> ENV{ID_FS_TYPE}=="hfsplus", ENV{UDISKS_AUTO}="0"
> LABEL="udisks_insecure_fs_end"
>
> in a udev fragment should work? Any static fstab or mount units should
> still work, but it should disable udisks automounting regardless of the
> desktop agent involved, even if the fs modules are already loaded.
I agree we should not have UDisks probing for any of the (many) kernel
filesystems that aren't being actively maintained including responding
to security issues.
Beyond that, I would also like to see libmount limiting the filesystems
that it will probe when the fstab type is "auto". But since UDisks
normally handles mounting for unprivileged users, that's probably less
of a concern.
Ben.
--
Ben Hutchings
If you seem to know what you are doing, you'll be given more to do.
[toc] | [prev] | [next] | [standalone]
| From | "Debian Bug Tracking System" <owner@bugs.debian.org> |
|---|---|
| Date | 2023-08-27 02:40 +0200 |
| Subject | Processed: Re: HFS/HFS+ are insecure |
| Message-ID | <H7bYR-4DEw-3@gated-at.bofh.it> |
| In reply to | #79655 |
Processing control commands: > reassign -1 udisks2 Bug #1041552 [src:linux] HFS/HFS+ are insecure Bug reassigned from package 'src:linux' to 'udisks2'. Ignoring request to alter found versions of bug #1041552 to the same values previously set Ignoring request to alter fixed versions of bug #1041552 to the same values previously set > retitle -1 do not mount automatically unmaintained file systems Bug #1041552 [udisks2] HFS/HFS+ are insecure Changed Bug title to 'do not mount automatically unmaintained file systems' from 'HFS/HFS+ are insecure'. -- 1041552: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1041552 Debian Bug Tracking System Contact owner@bugs.debian.org with problems
[toc] | [prev] | [next] | [standalone]
| From | Marco d'Itri <md@Linux.IT> |
|---|---|
| Date | 2023-08-27 02:40 +0200 |
| Message-ID | <H7bYR-4DEw-5@gated-at.bofh.it> |
| In reply to | #79655 |
[Multipart message — attachments visible in raw view] — view raw
Control: reassign -1 udisks2
Control: retitle -1 do not mount automatically unmaintained file systems
On Jul 20, md wrote:
> You are totally correct.
> Kernel team, please blacklist HFS/HFS+ for automounting.
As discussed on debian-devel@, this policy should not be handled by the
kernel because modules autoloading of file systems drivers should not be
disabled.
So I propose this content for a file like
/usr/lib/udev/rules.d/75-insecure-fs.rules:
# Do not automatically mount these file systems because their drivers are
# marked as "orphan" or "odd fixes" in the kernel MAINTAINERS file and so
# are more at risk of having security-sensitive defects which could be
# exploited by a crafted file system.
SUBSYSTEM!="block", GOTO="udisks_insecure_fs_end"
ENV{ID_FS_TYPE}=="affs", ENV{UDISKS_AUTO}="0"
ENV{ID_FS_TYPE}=="ecryptfs", ENV{UDISKS_AUTO}="0"
ENV{ID_FS_TYPE}=="efs", ENV{UDISKS_AUTO}="0"
ENV{ID_FS_TYPE}=="hfs", ENV{UDISKS_AUTO}="0"
ENV{ID_FS_TYPE}=="hfsplus", ENV{UDISKS_AUTO}="0"
ENV{ID_FS_TYPE}=="jffs2", ENV{UDISKS_AUTO}="0"
ENV{ID_FS_TYPE}=="jfs", ENV{UDISKS_AUTO}="0"
ENV{ID_FS_TYPE}=="qnx6", ENV{UDISKS_AUTO}="0"
ENV{ID_FS_TYPE}=="sysv", ENV{UDISKS_AUTO}="0"
LABEL="udisks_insecure_fs_end"
--
ciao,
Marco
[toc] | [prev] | [standalone]
Back to top | Article view | linux.debian.kernel
csiph-web