On Tue, 12 Jul 2016 16:22:07 -0500 ebiederm at xmission.com (Eric W. Biederman) wrote: > Petr Tesarik <ptesarik at suse.cz> writes: > > > On Tue, 12 Jul 2016 13:25:11 -0300 > > Thiago Jung Bauermann <bauerman at linux.vnet.ibm.com> wrote: >[...] > >> I also don't understand what you mean by code execution. How does passing a > >> device tree blob via kexec enables code execution? How can the signature > >> scheme be defeated? > > > > I'm not an expert on DTB, so I can't provide an example of code > > execution, but you have already mentioned the /chosen/linux,stdout-path > > property. If an attacker redirects the bootloader to an insecure > > console, they may get access to the system that would otherwise be > > impossible. > > > > In general, tampering with the hardware inventory of a machine opens up > > a security hole, and one must be very cautious which modifications are > > allowed. You're giving this power to an (unsigned, hence untrusted) > > userspace application; Eric argues that only the kernel should have > > this power. > > At the very least it should be signed. And of course the more signed > images we have in different combinations the more easily someone can > find a combination that does things the people performing the signing > didn't realizing they were allowing. Exactly. Reminds me of nasty setuid application exploits when one or more of stdin, stdout and stderr are closed before exec(), so the first file to be opened gets one of those special file descriptors. Imagine what happens if the application opens a secret file for reading (now file descriptor 0), then expects user input on stdin, detects a syntax error and complains on stderr, including the full input for reference ("%s is not a valid command")... No one has designed bootloaders to cope with similar unexpected situations. > So if we can not add an extra variable into the mix it would be good. Indeed. Writing boot loaders is difficult enough already. Adding the same kind of precautions that are necessary to write secure setuid applications is over the top IMO. Petr T