[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <YfFigbwhImLQqQsQ@localhost.localdomain>
Date: Wed, 26 Jan 2022 18:02:25 +0300
From: Alexey Dobriyan <adobriyan@...il.com>
To: ariadne@...eferenced.org, keescook@...omium.org
Cc: linux-kernel@...r.kernel.org, linux-fsdevel@...r.kernel.org,
ebiederm@...ssion.com, viro@...iv.linux.org.uk
Subject: Re: [PATCH] fs/exec: require argv[0] presence in do_execveat_common()
> execve("...", NULL, NULL);
I personally wrote a program which relies on execve(NULL) to succeed.
It wasn't an exploit, it was test program against IMA-like kernel
"only whitelisted executables can run" feature.
Test copies and "corrupts" itself by appending \0 to the end, then tries
to reexec itself with execve("/proc/self/exe", NULL, NULL);
main() if run with argc==0 exits with specific error code.
Appending \0 breaks checksum so working kernel protection scheme must
not allow it, therefore if execve(NULL) succeeded, than the parent
process doing test hard fails.
Also appending \0 doesn't break ELF structure. In other words,
if executable A is working (and it is working because it is running)
then A||\0 is valid executable as well and will run too.
This is independent from filesystem layout, libc, kernel, dynamic
libraries, compile options and what not.
Now QNX doesn't allow execve(NULL) and I don't remember if I changed it
to the next simplest variant and I don't work anymore at that company,
so I can't check :^)
execve("/proc/self/exe", (char*[]){"Alexey", NULL}, NULL);
P.S.:
> tptacek 5 minutes ago | root | parent | next [–]
> There is not.
Yes, there is!
Powered by blists - more mailing lists