LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 03-29-2008, 03:27 PM   #1
soplin
Member
 
Registered: Apr 2007
Distribution: Mostly Debian
Posts: 114

Rep: Reputation: 19
Linux Traps


How I could make the following traps for any outside users who may try to access a computer. This is hypothetical and a discussion that I had with a Linux newbie interested in security for some reason.

A) A user accesses a computer, and somehow becomes root. Now this root user isn't root, but a launch point to become the user who is root. In this voided root, not much can be done, except for logins and log outs. However, all the information about that user is scanned and stored in a log.

B) A user accesses a computer with no problems. To leave the computer, however, requires another password or a user in the computer to dislodge that connection. At that point, the network connection is somewhat permanent and any information about that user can be retrieved.

thank you
 
Old 03-29-2008, 03:30 PM   #2
paulsm4
LQ Guru
 
Registered: Mar 2004
Distribution: SusE 8.2
Posts: 5,863
Blog Entries: 1

Rep: Reputation: Disabled
You might be interested in this:
http://www.honeynet.org/
 
Old 03-29-2008, 03:56 PM   #3
soplin
Member
 
Registered: Apr 2007
Distribution: Mostly Debian
Posts: 114

Original Poster
Rep: Reputation: 19
Looks very interesting.
I'll relay this information to that newbie.

thanks
 
Old 03-30-2008, 09:27 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by soplin View Post
How I could make the following traps for any outside users who may try to access a computer.
If you're looking for exactly that, traps, then a honeypot would do. Honeypots however are single purpose devices, like firewalls or routers, placed at strategical locations in a network. If you're interested in logging information in a regular environment then a honeypot won't do.


Quote:
Originally Posted by soplin View Post
A user accesses a computer, and somehow becomes root. Now this root user isn't root, but a launch point to become the user who is root. In this voided root, not much can be done, except for logins and log outs. However, all the information about that user is scanned and stored in a log.
Quote:
Originally Posted by soplin View Post
A user accesses a computer, and somehow becomes root.
That's one hell of a way to open a question because there's a subtle difference. One of the basic security rules says not to allow users access if they don't need an account (example: allowing Apache Vhost uploads through virtual FTP user accounts instead of user accounts). Having an account means a miscreant can start probing the system right away, it doesn't need to compromise the system first. So the chances are if a user is allowed legitimate access (say SSH) to its account then its login will be noted in the login records (utmp), if a user is not allowed access (say through SSH) then its login will be noted in whatever SSH logs to (say syslog).

Quote:
Originally Posted by soplin View Post
Now this root user isn't root, but a launch point to become the user who is root. In this voided root, not much can be done, except for logins and log outs.
If a user logs in and becomes root legitimately using su or sudo this will be logged. If a user logs in and becomes root without using su or sudo then the system was compromised. Digressing for a bit here's an example. Take for instance the recent Vmsplice kernel exploit. Going the easy way, the offender logs in (account access logged) and (w)gets code (allowed network access and -j LOG rules) or uploads the code to the host (anon FTP account could do) or pasting it into a new file (inotify, create, watching temp areas), then compiling the code (note about compilers on production hosts and making them accessable to untrusted users) and running it (trusted path execution or allowing untrusted users to run binaries outside of the global $PATH). Running it successfully may only yield few clues in syslog (316 being the vmsplice syscall number) like:
Code:
date host kernel audit major=316 name_count=0: freeing multiple contexts
and if the exploit fails lines like:
Code:
date host kernel time kernel BUG at include/linux/mm.h:300!
date host kernel time invalid opcode: 0000 [#1]
date host kernel time Process oivey (pid: 01, ti=c639d000 task=dff20550 task.ti=c639d000)
date host kernel time Call Trace:
date host kernel time [<c01735f1>] sys_vmsplice+0x235/0x25e
On a SELinux-enabled box with targeted policy and with 'auditd' having a watch set on dir /var/tmp/incoming, would show a file created:
Code:
type=PATH msg=audit(datespec): item=1 name="/var/tmp/incoming/oivey.c" inode=3311 dev=11:01 mode=0100664 ouid=666 ogid=666 rdev=00:00 obj=user_u:object_r:tmp_t:s0
And Rootkit Hunter's standalone 'suspscan' paired up with inotifywait would show its slightly suspect:
Code:
suspscan: [INFO] /var/tmp/incoming/oivey.c (score:168).
What I tried to convey is that even though GNU/Linux installs don't come with all-encompassing logging enabled by default, there are still clues logged wrt account access and "problems", and that using something like Logwatch could alert an admin things go awry (if he reads e-mail, that is), and that you can configure more elaborate process (GRSecurity, SELinux, Samhain), network (iptables logging, Snort, system and user (shell wrapping with Rootsh) logging yourself and without going through too much loopholes. If you want more details about a practical setup for this, go ahead and read this forums past threads about auditing and logging. We've got quite a few. * All of this of course asserts a machine was properly hardened first (which should be standard post-install procedure). Adding auditing without hardening first doesn't make sense.



Quote:
Originally Posted by soplin View Post
A user accesses a computer with no problems. To leave the computer, however, requires another password or a user in the computer to dislodge that connection. At that point, the network connection is somewhat permanent and any information about that user can be retrieved.
Ten pts for creativity but with all due respect thats an example of reasoning the wrong way around. Regardless of what you want to audit it should not interact or interfere with users. Doing so will make users aware of it, will make them find other ways or more likely will simply break and be ineffective because of a total disregard for standards.

Last edited by unSpawn; 03-30-2008 at 09:30 AM. Reason: more nfo
 
Old 03-30-2008, 12:30 PM   #5
soplin
Member
 
Registered: Apr 2007
Distribution: Mostly Debian
Posts: 114

Original Poster
Rep: Reputation: 19
Hi,

That is all very informative. I like, and will certainly relay that information.

For the outside user becoming root, according to this hypothetical trap, root is not the superuser, but only the point at which to login as the superuser.
Example:

The user logs in through ssh or in a home computer:
login: naughty
password:***********

Then, the user tries to login as root with as many tries as possible. At that point, as the first security procedure I would make it that login will no longer work for that user after X times, but we're not going with that hypothetical scenario. The user manages to become root because the world of Unix has the idea that the superuser is root, but in this method, root is not the superuser.

login: root
password: ************

Now the user can only do su, login or logout. It is only from this point, however, that a user can become the superuser. Also, at this point everything is recorded about that user.

login: superusername
password: ************
 
Old 03-30-2008, 07:05 PM   #6
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by soplin View Post
The user manages to become root because the world of Unix has the idea that the superuser is root, but in this method, root is not the superuser.
Ah. I see. You're going to make it all "better" by changing things in a fundamental way nobody ever thought of.
Awesome. So, what account does hold superuser powers in your scenario? Or are none needed?
 
Old 03-30-2008, 07:09 PM   #7
XavierP
Moderator
 
Registered: Nov 2002
Location: Kent, England
Distribution: Debian Testing
Posts: 19,192
Blog Entries: 4

Rep: Reputation: 475Reputation: 475Reputation: 475Reputation: 475Reputation: 475
I'm not a security professional at all (*tips hat to unspawn*), but how is this better than sudo? Sudo logs what the user does, is available on near to 100% of distros and requires little more than a change via visudo.
 
Old 03-31-2008, 01:30 PM   #8
soplin
Member
 
Registered: Apr 2007
Distribution: Mostly Debian
Posts: 114

Original Poster
Rep: Reputation: 19
The point is to talk about security and to make Linux and Linux security better.

As for that previous interesting dialogue about security, it certainly shows that there are other ways of messing up a system without being a superuser. So what you're saying is that any of these traps are no more than nuisances to a hacker.

I figured out that it is easy to create a fake root user. In Slackware's initial install, it is possible to have a different name other than root to be the superuser.

Create a user named root. Root has access to su, and root only has access to this command and logout, which is pretty dull, but secure.
A faster way of doing this is to create user who does the same as the above and root remains the superuser.

For XavierP,

sudo is a great compromise between root and user activities, but I find it to be a big possible door to messing things up and becoming root. Simply by typing sudo su, and using user password, gains root access. There could be a way of locking that access, but I haven't figured that out and perhaps Unspawn could explain how to do that.
 
Old 03-31-2008, 03:28 PM   #9
beadyallen
Member
 
Registered: Mar 2008
Location: UK
Distribution: Fedora, Gentoo
Posts: 209

Rep: Reputation: 36
Quote:
Simply by typing sudo su, and using user password, gains root access. There could be a way of locking that access
That's what the sudoers file is for (/etc/sudoers). It's stupid to give normal users 'carte blanche' access with the sudo. You may as well run everything as root.
 
Old 03-31-2008, 04:36 PM   #10
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by soplin View Post
So what you're saying is that any of these traps are no more than nuisances to a hacker.
Such traps are kind of like an equivalent of blacklisting, a waste of time. If I have access to the system legitimately I can see NP there's an UID == 0 and if the name is not "root" then I will be alerted somebody is "playing" around.


Quote:
Originally Posted by soplin View Post
I figured out that it is easy to create a fake root user. In Slackware's initial install, it is possible to have a different name other than root to be the superuser. Create a user named root. Root has access to su, and root only has access to this command and logout, which is pretty dull, but secure.
...and if I can use kernel or userland vulnerabilities to gain access with, what should I care about names? So what does this really protect the system from?
 
Old 03-31-2008, 04:56 PM   #11
anomie
Senior Member
 
Registered: Nov 2004
Location: Texas
Distribution: RHEL, Scientific Linux, Debian, Fedora
Posts: 3,935
Blog Entries: 5

Rep: Reputation: Disabled
Quote:
Originally Posted by soplin
... it certainly shows that there are other ways of messing up a system without being a superuser.
It's good to be thinking through things. Keep it up. But there is also a time to acknowledge, "Hmm. We've been down this road a few times already."

Quote:
Originally Posted by soplin
I figured out that it is easy to create a fake root user. In Slackware's initial install, it is possible to have a different name other than root to be the superuser.
UID 0 is the man, period. And /etc/passwd is world readable. This "fake user" will fool no one.

Quote:
Originally Posted by soplin
Create a user named root. Root has access to su, and root only has access to this command and logout, which is pretty dull, but secure.
I'm with you right up until the "but secure" part. How is this any different than requiring (via pam) that users be members of the wheel group in order to use su?

One more thing: you change root's (UID 0's) login name, you invite in the possibility of breaking software in ways you may not expect.
 
Old 03-31-2008, 06:50 PM   #12
soplin
Member
 
Registered: Apr 2007
Distribution: Mostly Debian
Posts: 114

Original Poster
Rep: Reputation: 19
This is a wonderful and very interesting discussion.

With programs there is always the possibility of bugs and holes, and undoubtedly from what I'm reading from yous, operating systems suffer from the same.

More questions.

Aside from the users who have access to the computer via networking or direct, are there other vulnerabilities through networking, let's say by out bound only connections such as port 80?

Is Unix/Linux attacked as much by viruses and hackers as Windows is, and if not, would it be able to handle such threats better if it were attacked as much?

Is there an opened Unix/Linux internet/network environment that exists solely for the purpose of being attacked so that research and improvements can be made?

What are your opinions and ways in which you would make Unix/Linux more secure?
 
Old 04-01-2008, 12:03 AM   #13
konsolebox
Senior Member
 
Registered: Oct 2005
Distribution: Gentoo, Slackware, LFS
Posts: 2,248
Blog Entries: 8

Rep: Reputation: 235Reputation: 235Reputation: 235
i found a cleaner way to have a different superuser account.. it's like having a root alias like this:
/etc/passwd
Code:
trunk:x:0:0:trunk:/home/trunk:/bin/bash
root:x:0:0:root:/root:/bin/false
/etc/shadow
Code:
trunk:validhash:1234:0:::::
root:garbagehash:1234:0:::::
To do this you just have to create a new user then set that user with similar entries to root.
The different superuser must come before root.

IMO having a different superuser name won't do much help to security at all.. I just did this because I don't like the username root.

Last edited by konsolebox; 04-01-2008 at 12:04 AM. Reason: oops my bad.. did you saw something :)
 
Old 04-01-2008, 07:23 AM   #14
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by soplin View Post
Aside from the users who have access to the computer via networking or direct, are there other vulnerabilities through networking, let's say by out bound only connections such as port 80?
Sure, why not? Any application that interpretes a request or reads a response wrong could do, don't even have to talk about webbrowsers. Search the CAN-CVE, Secunia, SecurityFocus for examples.


Quote:
Originally Posted by soplin View Post
Is Unix/Linux attacked as much by viruses and hackers as Windows is, and if not, would it be able to handle such threats better if it were attacked as much?
Search LQ for terms like Linux and virus and see for yourself. Good threads will include terms like "separation of privilege" (as in architecture, DAC), "other threaths" (as in worms, exploits, rootkits), purpose (as in better used as gateway for attacking others) and will warn against complacency, misconfiguration and PEBCAK.


Quote:
Originally Posted by soplin View Post
Is there an opened Unix/Linux internet/network environment that exists solely for the purpose of being attacked so that research and improvements can be made?
You mean like a honeynet?


Quote:
Originally Posted by soplin View Post
What are your opinions
With respect to securing a machine one shouldn't need to resort to opinions but go with the facts.


Quote:
Originally Posted by soplin View Post
ways in which you would make Unix/Linux more secure?
I think the fundamental issues are those of attitude and perception:
0. Be alert. Security is not a "fire and forget" but a continuous process: audit, adjust, reiterate.
1. Don't make assumptions. The fact the machine is inside a LAN, the process is called "httpd" or the connection comes in over the LAN-side interface doesn't automagically mean it's safe, legitimate or benign.
2. Be prepared. GNU/Linux is about performance, stability and providing continuous access to services. Do plan ahead and do play common attack scenario's (DoS, resource exhaustion, piggybacking) to see how the machine and auditing holds. Anybody with about zero knowledge can install and run LAMP. A lot of them don't care and get 0wned. Getting aquainted with assessment and recovery tools when under stress leads to making mistakes. Avoid that by playing out recovery scenario's.
3. Be responsable. If your machines are compromised they are not only your problem but also a hazard to us. *Be* the admin, *be* the problem owner and keep it from happening.

Some basic hints:
0. Do use a recent distro release as basis. If not you'll miss out on crucial updates.
1. Do install only what you need (according to the purpose of the machine like no compilers and R-services on production servers).
2. Do keep the installation up to date.
3. Do use a security-enhancing framework like SELinux or GRSecurity if it's provided. There's RL examples showing SELinux *does* stop malicious activity.
4. Do use a host-based firewall (with logging, in and egress bogon fitering and other service restrictions according to the purpose of the machine).
5. Do deploy a host-based integrity checker (Aide, Samhain or even tripwire) right after OS install.
6. Do use hardening tools to assess and reconfigure (Tiger, Nsat, Bastille-Linux, audit_env, etc, etc) service and system access.
7. Do deploy and use auditing tools (Tiger, Chkrootkit, Nsat, Rootkit Hunter) and log auditing tools (Logwatch, etc, etc) and do read those e-mails.
8. Do make backups and keep them off-site.
9. Do audit the system regularly.

The above list is not complete and it doesn't go into details, nor does it address all of what I want to. Most of that you can find in the LQ FAQ: Security references (even though it's a bit unwieldy).


That said some of your questions look like homework to me or you not having done any research at all. You should. I find this thread is not a discussion (since you haven't replied to some questions) and not "to talk about security and to make Linux and Linux security better" (in a way I may benefit from), but for *you* to benefit from, it most likely will be.
 
Old 04-01-2008, 02:59 PM   #15
soplin
Member
 
Registered: Apr 2007
Distribution: Mostly Debian
Posts: 114

Original Poster
Rep: Reputation: 19
Quote:
You mean like a honeynet?
No. I mean like a network location that is dedicated to being virus attacked and hacked to get the facts and to improve Linux security. Such a site could use honeynet tools. Technically, it is an open invitation to the world that site X wants to be attacked, and that the attackers would not be penalized for doing so.

Quote:
With respect to securing a machine one shouldn't need to resort to opinions but go with the facts.
I agree that facts are important.
Opinions can be very useful, but you don't have to agree with that.

Quote:
That said some of your questions look like homework to me or you not having done any research at all.
No. These are not homework questions.

As mentioned at the beginning of the thread, this started because of a discussion I had with a newbie who is interested in security. I got carried away in the topic myself.

Quote:
I find this thread is not a discussion (since you haven't replied to some questions) and not "to talk about security and to make Linux and Linux security better" (in a way I may benefit from), but for *you* to benefit from, it most likely will be.
Obviously, from a stand point of a person who has more experience and knowledge, none of this may be beneficial.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Snmp Traps magin Linux - Networking 0 07-13-2007 05:13 AM
The Traps Of Linux & Open Source Software john20004 General 48 07-17-2004 04:00 PM
The Traps Of Linux...&open Source Software john20004 Linux - General 1 04-22-2004 03:16 PM
The Traps Of Linux...&open Source Software john20004 LQ Suggestions & Feedback 1 04-22-2004 02:46 PM
The Traps Of Linux...&open Source Software john20004 Linux - Software 1 04-22-2004 02:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 06:19 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration