What bad things could happen if we don’t use sudoedit

Securitysudosudoedit

We know it's safer* to use sudoedit, but what bad things can happen if we have the following in sudoers?

Cmnd_Alias FOO = /bin/ed, /usr/bin/ed, /usr/bin/vi
foouser LOCALHOST = NOPASSWD: NOEXEC: FOO

Can the "foouser" escape to root prompt? – of course besides that he could now edit the /etc/shadow file to put a custom pwd hash to the root user to become root in about 3 seconds..

Maybe some magic using LD_PRELOAD with ed? How exactly?

*=sudo ed would run as root. but sudoedit would run as the given user, the edited file will be copied before/after editing it.

Best Answer

Can the "foouser" escape to root prompt?

Presumably foouser can now open any system binary and "edit" it into something else completely, leaving whatever kind of security hole foouser can dream up. This has particular potential if you do it to a setuid binary, such as passwd, because it means a non-root user could use it do privileged things it was not intended to do.

besides that he could now edit the /etc/shadow file to put a custom pwd hash

Or just delete the hash, in which case you don't need any password to log in as root.