Skip to content
This repository was archived by the owner on May 4, 2024. It is now read-only.

sudoers entries should be prefixed with a digest spec #18

Closed
jandubois opened this issue Aug 22, 2021 · 2 comments · Fixed by #20
Closed

sudoers entries should be prefixed with a digest spec #18

jandubois opened this issue Aug 22, 2021 · 2 comments · Fixed by #20
Labels
documentation Improvements or additions to documentation

Comments

@jandubois
Copy link
Member

Allowing password-less execution of /usr/local/bin/vde_vmnet as root is a vulnerability when the user has non-sudo write access to /usr/local/bin (which is typically the case when using homebrew), because they could simply replace vde_vmnet with any other command or script and then execute that under root.

This can be mitigated by including a checksum of the executable in the sudo rule, e.g.

$ sha256sum /usr/local/bin/vde_vmnet
cabb4c8bac4a2923a1feb21f597ae6c8145de25e44f408b75ec254da6ffa09ce  /usr/local/bin/vde_vmnet

should lead to a rule such as (untested):

%staff ALL=(root:root) NOPASSWD:NOSETENV: sha256:cabb4c8bac4a2923a1feb21f597ae6c8145de25e44f408b75ec254da6ffa09ce /usr/local/bin/vde_vmnet --vmnet-gateway=192.168.105.1 /var/run/vde.ctl
@jandubois
Copy link
Member Author

Most compact supported checksum seems to be sha224 in base64 format:

$ openssl dgst -binary -sha224 /usr/local/bin/vde_vmnet | openssl base64
ZcbnYBmyNCQZGuamPvTkKBDoj4RXqZw/OyPHoA==

leading to

%staff ALL=(root:root) NOPASSWD:NOSETENV: sha224:ZcbnYBmyNCQZGuamPvTkKBDoj4RXqZw/OyPHoA== /usr/local/bin/vde_vmnet --vmnet-gateway=192.168.105.1 /var/run/vde.ctl

@AkihiroSuda AkihiroSuda added the documentation Improvements or additions to documentation label Aug 22, 2021
@AkihiroSuda
Copy link
Member

Thanks, opened #20

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants