Re: [gentoo-user] Re: How many ways are there for a user to increase their permissions?

2010-04-18 Thread Alan McKinnon
On Sunday 18 April 2010 05:05:23 walt wrote:
> On 04/17/2010 06:02 PM, Jonathan wrote:
> > What does the E in EUID stand for?
> > I did a quick Google and found RUID and EUID but I did not find anything
> > else.
> 
> Did you really type what you meant?  Doesn't make much sense as is, so I
> assume there is a typo in there somewhere.
> 
> Have a leisurely browse through /usr/include/unistd.h to answer your
> question.

Nice retort :-)

But to answer his question

The "E" stands for "effective". His apps are running as a normal user with his 
UID. In kernel-speak they are effectively running with that UID, hence the 
term EUID.

When you run an app with sudo (or any other app that raises priviledges), sudo 
is SUID so it runs as root, who permits the user's app to run as root. The UID 
of that running app is 0, but it's launched by a regular user.

That's why we have EUID. It's not the same thing as UID.

-- 
alan dot mckinnon at gmail dot com



Re: [gentoo-user] Re: How many ways are there for a user to increase their permissions?

2010-04-17 Thread Jonathan
On Sat, 17 Apr 2010 20:05:23 -0700
walt  wrote:

> Have a leisurely browse through /usr/include/unistd.h to answer your question.
That file has answer to my question.
Thank you.



Re: [gentoo-user] Re: How many ways are there for a user to increase their permissions?

2010-04-17 Thread Jonathan
On Sun, 18 Apr 2010 08:29:37 +1000
Lie Ryan  wrote:

> sudoedit is mainly just a shortcut for "sudo $EDITOR" (plus doing a few
> things).

sudoedit is safer then sudo because sudoedit runs as root but nano (The editor) 
runs as your user.
sudoedit uses a fixed path which is compiled into the program (The was a thread 
about changing the editor on this mailing some time ago. ).

> Everything above (su,sudo,policykit,polkit) are just sugar for
> permission bits (owner,group,others+SUID,GUID); attempting to give finer
> control over the permissions or provide convenience services.

Mess up the configuration and you may as well hand out the root password.

> The basis of all Linux security scheme is the file permission bits
> (owner,group,other) and the SUID/GUID bit (ACL is a distinct security
> scheme, so we're explicitly excluding it here). Everything else is just
> sugar. If you want to lock everything, just remove the SUID/GUID-bit
> from all executables in your system (except for a select few) and remove
> all groups (make sure you know what you're doing though, lots of program
> won't work if you really do that). Starting from step zero, you can have
> very fine control over everything.

I just checked my system for files not owned by me and had a non root group set 
to rw.
I found "/usr/share/games/eternal-lands" with rw set and all the sub-folders 
and files.
It would be very easy to do a DOS attack on a system side partition but then 
again
the same could be said about "/tmp".

If you setup quotas for the users home folder. Ones the home folder is full the
user will look for another place to save they files.
When I was at school. A kid ran out of space so he started to move his files to 
the recycling bin, before creating
his new files. Of course the recycling bin had no quota nor was it backed up.
Some time after that the admin set a quota on the recycling bin and the kid 
asked why he could not save.
So I showed him how to empty his recycling bin. I was 10 second away from 
deleting all his work
before he pointed out he keeps his work in there!
That was some fun on windows but it could happen with Linux "/tmp" is wiped 
after each reboot and any
other places that is not backed up, does not have quota and the user can write 
to.

> Most security holes in Linux comes from a SUID program that lets
> untrusted programs into the "trusted-space".

53 SUID or GUID programs on my system!
Why does cdrecord have SUID set?
"/dev/sr0" is in the cdrom group with rw set so
SUID should not be needed in the first place.

> If you want simplify your environment, you can clear all the `group` and
> `other` permission bits from all files in your computer and everyone
> (except root) will only have access to files they own. Then you can
> start adding permissions on case-by-case basis. Too much hassle though,
> I think.

I could remove other from all the SUID programs then setup a ACL group that 
could run then.
That would stop RandomFool from running then in the first place.
I could see that being useful for say "mount" (Yes it's has SUID set). If the 
was security hole in it.

> the only way the program can chmod a file in your home folder is because
> the program have the permission to chmod a file in your home folder. The
> only program that have permission to chmod a file in your home folder is
> the one run with EUID-root or EUID-owner. The only way a program can be
> run with EUID root is they are executed by root himself or a SUID-root
> program. The only way a program can be run with EUID owner is SUID-owner
> program or program executed by the owner himself.

What does the E in EUID stand for?
I did a quick Google and found RUID and EUID but I did not find anything else.

> However, I don't think buggy program is the case here. It is much more
> likely that you accidentally runs chmod on your home folder when you
> actually want to run it in another directory.

No, this was before I used chmod for anything (read noob) I set the permissions 
back with nautilus
but after each login or was reboot and login. The permissions got set back to 
o+rwx.
The was a very help error box at login that said "The permissions for your home 
folder are set wrong.".
That was the helpful version the real version was talking about some file in 
"~/.config".

> You can use this to find all SUID program accesible by your user:
> find / -perm -u+s -exec ls -l '{}' \; 2> /dev/null

Yes, I have being making use of this page 
http://www.gentoo.org/doc/en/security/security-handbook.xml?part=1&chap=6
for a long time.

> I found sudo, although very handy for desktop, is a huge security hole.
> And is inadequate for any secure system. This is simply because if you
> run a program as sudo, then in the next five minute you start a
> malicious program *without* sudo; the malicious program can gain root
> access by stealing your previous sudo's timestamp (yes, it can steal the
> timestamp without being explicitly invoked with sudo[1]). Before 

Re: [gentoo-user] Re: How many ways are there for a user to increase their permissions?

2010-04-17 Thread Jonathan
On Fri, 16 Apr 2010 17:25:18 -0700
walt  wrote:

> I've been an amateur linux/*BSD user for about ten years or so, and I would 
> love to
> answer your questions -- but I don't know the answers.  Yet.

Around 4 years, 3 years with Ubuntu and one with Gentoo.

> While you and I wait for a guru to enlighten us, you might learn something 
> here:
> 
> http://en.wikipedia.org/wiki/The_UNIX-HATERS_Handbook

I had a look at it. The whole thing is a rant. I think half of it does not 
apply to Linux and it's all very out of date.
On the other hand in "Accidents Will Happen" he talks about 'rm'.
I have never done a 'rm /' but I have done 'chmod 660 /', it made my blood run 
cold but that was very easy to fixes.
Now I always use the 'u+rwx' syntax.

Still waiting on the guru's!