The dangers of sudoedit

Madushan Nishantha
Feb 23, 2017 · 1 min read

Giving access to execute vim or any other editor as root for a unprivileged user in a Linux system using sudo policies has been heavily frowned upon because then the user, if using vim can simply execute “:!shell” and quickly gain a root shell.

For this reason, my coworkers have been using sudoedit, which ultimately limits the vim commands so the user can’t do things like dropping into a root shell.

But imagine their surprise when I told them, the user, having access to something like “sudo sudoedit /etc/apache2/apache.conf”, can then simply execute “:e /etc/sudoers/” alter the the sudoers file and give themselves more privileges.

At the end, we came to the conclusion that giving user any kind of editor access under root permission is not safe.

Madushan Nishantha

Written by

Asynchronous Assumptions........