12

I was reading the this question over on Ask Ubuntu and they suggest adding the following line to etc/sudoers so that you're not prompted to enter your password each time you run sudo

%admin  ALL=(ALL) NOPASSWD:ALL

Is this a security risk and if so, what are some ways people can exploit this?

jwerre
  • 333
  • 1
  • 6
  • 2
    Yes, it's a security risk, but if somebody gains access to an account of the `admin` group, you're already in trouble. It's rather easy to create an alias that executes malicious code that will be executed the instead of the actual `sudo` command. – Dennis Jan 09 '16 at 06:23
  • 2
    Does this answer your question? [How secure is NOPASSWD in passwordless sudo mode?](https://security.stackexchange.com/questions/45712/how-secure-is-nopasswd-in-passwordless-sudo-mode) – Steffen Ullrich Sep 06 '20 at 05:38

1 Answers1

27

Yes, it's a risk. Anyone who touches your keyboard can get root access by running sudo and not worrying about your password. Anyone who has an exploit that gets them userland access can instantly get root access using the sudo command. This reduces isolation and increases the effort to recover from an attack or intrusion.

Neil Smithline
  • 14,621
  • 4
  • 38
  • 55
Adam Shostack
  • 2,659
  • 1
  • 10
  • 12