Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve logic of privileged_writable #43

Open
GoogleCodeExporter opened this issue Mar 17, 2015 · 1 comment
Open

Improve logic of privileged_writable #43

GoogleCodeExporter opened this issue Mar 17, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

I believe there are a couple of deficiencies in the current implementation of 
the privileged_writable check:

1. I think files writable by a low privileged owner should always be a warning, 
not just if YOU are the current owner. If I'm running the tool as the root user 
for auditing purposes then I want to know if a standard user owns a script 
they're permitted to run as root via sudo.

2. Furthermore, if a low privileged user owns a privileged file then it should 
be reported no matter what the current permissions are. This is because the 
owner can just set it to writable if necessary.

3. Similarly to (1), if an untrusted group can write to a privileged file then 
it should be a warning even if the current user isn't a member of the group.

The attached patch will make these changes. In it's current form it only trusts 
the user with ID zero and the main group of the user with ID zero. Hopefully 
this can be improved with configurable trusts in future, see #20.

I also modified some user and group utilities to support the changes:

* Implemented the group_is_root() function by checking against `id -g -n 0`
* Switched user_is_root() and user_is_user_root() to match other 
user_is_user_*() functions which check the current user rather than a supplied 
user.
* Implemented user_is_root()

Original issue reported on code.google.com by JJC...@googlemail.com on 25 Feb 2015 at 1:30

Attachments:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant