Skip to content

Fix potential security flaw in creation of sockets/directories #4

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

Merged
merged 7 commits into from
Dec 15, 2011

Conversation

git-core
Copy link
Collaborator

See commit 8dc2877f8dbdf4161c394c28e714ee3efd645cf5

Well, I fixed last bit I didn't like in su-binary as promised. There is more stuff to fix:

  1. Move Requestor cache dir to /dev
    (requires change in corresponding macro only)
    Thus, su-binary won't touch flash, /dev is tmpfs nowadays
  2. Rearrange db code
    su-binary acess db only once, so db open/close can be moved to database_check
  3. Drop mktemp so gcc stops complaining about "unsafe" function
    The socket is created once per su invocation. We can use pid in the socket name.
    It's neither "safer" nor "weaker"
    If you'll agree to accept mentioned changes I could prepare the patches.

setegid(st.st_gid);
seteuid(st.st_uid);
setegid(req_uid);
seteuid(req_uid);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bit isn't really necessary, as req_uid == st.st_uid == st.st_gid. I should really just remove req_uid as it's not needed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Have to rebase the patchset though

@ChainsDD
Copy link
Owner

ChainsDD commented Dec 6, 2011

I'll test this when I get home. If we could discuss some more things over gtalk, I'd really appreciate it, I could use some help with a couple of things.

@ChainsDD
Copy link
Owner

Works in my testing, will send a couple builds out to my testers to see how it works for them before merging it. Doesn't seem to affect too much, so I don't see there being any issues.

ChainsDD and others added 7 commits December 15, 2011 23:43
supplementary groups have been dropped already at this time
(introduced by commit 00f1bb5)
Previous code created a file object with two steps: the creation itself with
default umask/mode and setting necessary permissions then. This approach is known to
lead to a race condition when malicious process can open an object before
permissions is set.

The patch sets creation mask (mask) to 027, thus denying any access from others. Also,
the patch removes all dead code which is not needed after changes mentioned.
ChainsDD added a commit that referenced this pull request Dec 15, 2011
Fix potential security flaw in creation of sockets/directories
@ChainsDD ChainsDD merged commit 690dcc6 into ChainsDD:master Dec 15, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants