Re: [PATCH 24/32] vfs: syscall: Add fsopen() to prepare for superblock creation [ver #9]

From: David Howells
Date: Wed Jul 11 2018 - 03:22:45 EST


Andy Lutomirski <luto@xxxxxxxxxxxxxx> wrote:

> > sfd = fsopen("ext4", FSOPEN_CLOEXEC);
> > write(sfd, "s /dev/sdb1"); // note I'm ignoring write's length arg
>
> Imagine some malicious program passes sfd as stdout to a setuid
> program. That program gets persuaded to write "s /etc/shadow". What
> happens? Youâre okay as long as *every single fs* gets it right, but thatâs
> asking a lot.

Do note that you must already have CAP_SYS_ADMIN to be able to call fsopen().

David