Is this evidence of a hack?

This is a discussion on Is this evidence of a hack? within the Linux Security forums, part of the System Security and Security Related category; Hello, I have noticed that the owner of the file 'ls' is not root and is '122' in group '114', ...


Go Back   Usenet Forums > System Security and Security Related > Linux Security

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-06-2006
markstarmer@markstarmer.co.uk
 
Posts: n/a
Default Is this evidence of a hack?

Hello,

I have noticed that the owner of the file 'ls' is not root and is '122'
in group '114', is this normal in Fedora 4? I have not changed it from
default... I tried to change ownership back to root - but this was not
permitted... Any ideas?

I believe that because of this I'm having a problem updating my current
version of core utils to
coreutils-5.2.1-48.1.i386.rpm - taken from the fedora updates page and
I am encountering the following error...

# rpm -Uvh coreutils-5.2.1-48.1.i386.rpm
warning: coreutils-5.2.1-48.1.i386.rpm: V3 DSA signature: NOKEY, key ID
4f2a6fd2

Preparing... ###########################################
[100%]
1:coreutils ###########################################
[100%]
error: unpacking of archive failed on file /bin/ls: cpio: rename failed
- Operat
ion not permitted

I am using fedora 4 on intel platform... The same process failed in the
past when trying to use up2date... There is no version of yum currently
installed on the box...

Has anybody encountered this problem before? Any idea how to resolve?

Best Regards,

Mark Starmer

Reply With Quote
  #2 (permalink)  
Old 06-06-2006
Alexander Krizhanovsky
 
Posts: n/a
Default Re: Is this evidence of a hack?

> I have noticed that the owner of the file 'ls' is not root and is '122'
> in group '114', is this normal in Fedora 4? I have not changed it from
> default... I tried to change ownership back to root - but this was not
> permitted... Any ideas?


What says lsattr `which ls`? Do you use SELinux?

Reply With Quote
  #3 (permalink)  
Old 06-06-2006
Alexander Krizhanovsky
 
Posts: n/a
Default Re: Is this evidence of a hack?

> I tried to change ownership back to root - but this was not
> permitted... Any ideas?


What says lsattr `which ls`? Do you use SELinux?

Reply With Quote
  #4 (permalink)  
Old 06-06-2006
Unruh
 
Posts: n/a
Default Re: Is this evidence of a hack?

markstarmer@markstarmer.co.uk writes:

>Hello,


>I have noticed that the owner of the file 'ls' is not root and is '122'
>in group '114', is this normal in Fedora 4? I have not changed it from
>default... I tried to change ownership back to root - but this was not
>permitted... Any ideas?


Yes, you have been hacked.
Do
lsattr
if the i attribute is set, you have definitely been hacked ( that is why
root cannot change it. That is the immutable flag. )


Backup all of your own important files, wipe the disk, and reinstall.
restore the backup, and then search for suid sgid programs.
find / -perms +6000 -ls

MAKE SURE that they are supposed to be suid/sgid.
(for example no file in a home, tmp,dev,man,share directory should be suid.
)




>I believe that because of this I'm having a problem updating my current
>version of core utils to
>coreutils-5.2.1-48.1.i386.rpm - taken from the fedora updates page and
>I am encountering the following error...


># rpm -Uvh coreutils-5.2.1-48.1.i386.rpm
>warning: coreutils-5.2.1-48.1.i386.rpm: V3 DSA signature: NOKEY, key ID
>4f2a6fd2


>Preparing... ###########################################
>[100%]
>1:coreutils ###########################################
>[100%]
>error: unpacking of archive failed on file /bin/ls: cpio: rename failed
>- Operat
>ion not permitted


Yup -- the immuatable attribute.


>I am using fedora 4 on intel platform... The same process failed in the
>past when trying to use up2date... There is no version of yum currently
>installed on the box...


>Has anybody encountered this problem before? Any idea how to resolve?


>Best Regards,


>Mark Starmer


Reply With Quote
  #5 (permalink)  
Old 06-06-2006
Moe Trin
 
Posts: n/a
Default Re: Is this evidence of a hack?

On 6 Jun 2006, in the Usenet newsgroup comp.os.linux.security, in article
<1149594363.557580.281210@g10g2000cwb.googlegroups .com>,
markstarmer@markstarmer.co.uk wrote:

>I have noticed that the owner of the file 'ls' is not root and is '122'
>in group '114', is this normal in Fedora 4?


Well, let's start out by disconnecting this box from the network RIGHT NOW.
No, that is not normal. Which 'ls' are we talking about? '/bin/ls' (and
indeed _everything_ in /bin/) should be owned by root, and very few items
in that directory should be a group other than root (there are a few
exceptions, such as '/bin/mail and /bin/setserial).

>I have not changed it from default...


Something sure as hell did

>I tried to change ownership back to root - but this was not
>permitted... Any ideas?


man chattr which is a _really_ bad sign - look at the 'i' flag
man lsattr and see what extended attributes are set.

>error: unpacking of archive failed on file /bin/ls: cpio: rename failed
>- Operation not permitted


That's a REALLY bad sign. Quick and dirty check 'rpm -Va > files.2.check'
which _may_ detect bad stuff if rpm and the rpm databases haven't been
altered. A second check

/usr/bin/find / -type f -perm -111 -exec /usr/bin/lsattr {} \; > /some.file

should not show any files with attributes set. (This command will take a
moderately long time to run - the redirection to a file is so that you can
then parse the file ignoring the banners and unset files). Again, this
command assumes that '/usr/bin/find' and '/usr/bin/lsattr' haven't been
altered.

The reason the username/group is showing numbers instead of 'root:root' is
that this file is owned by a user ID _OTHER_THAN_ a person listed in the
/etc/passwd file. This raises grave concerns - how the fsck did the file
get into /bin/ which should be owned by root:root, and NEVER be writable
by anyone except the owner (drwxr-xr-x). Likewise, no one other than root
should be able to use the chattr and chown commands.

Has this system been unmaintained and exposed to the world? The package
you are trying to install (coreutils-5.2.1-48.1) came out ten months ago,
and there certainly are other packages that should be installed to prevent
problems.

>I am using fedora 4 on intel platform... The same process failed in the
>past when trying to use up2date... There is no version of yum currently
>installed on the box...


If things were failing in the past, did anyone investigate why? Things
really don't randomly fail for no reason at all.

>Has anybody encountered this problem before?


Yes - hundreds of times

>Any idea how to resolve?


From: CERT Advisory <cert-advisory@cert.org>
Newsgroups: comp.security.announce
Subject: CERT Summary CS-98.06
Date: 11 Jun 1998 20:05:13 GMT

Web Results 1 - 10 of about 482 for CERT Summary CS-98.06. (0.58
seconds)

You can find that document on the web. Read section 3.

Old guy
Reply With Quote
  #6 (permalink)  
Old 06-07-2006
Colin McKinnon
 
Posts: n/a
Default Re: Is this evidence of a hack?

Unruh wrote:

> markstarmer@markstarmer.co.uk writes:
>
>>Hello,

>
>>I have noticed that the owner of the file 'ls' is not root and is '122'

<snip>
> Yes, you have been hacked.

<snip>
>
> Backup all of your own important files, wipe the disk, and reinstall.


Whoa! Before you wipe the disk, note the size and date of any compromised
program - use the information to help identify a safe backup!

C.

Reply With Quote
  #7 (permalink)  
Old 06-07-2006
Unruh
 
Posts: n/a
Default Re: Is this evidence of a hack?

Colin McKinnon <colin.thisisnotmysurname@ntlworld.deletemeunlessU RaBot.com> writes:

>Unruh wrote:


>> markstarmer@markstarmer.co.uk writes:
>>
>>>Hello,

>>
>>>I have noticed that the owner of the file 'ls' is not root and is '122'

><snip>
>> Yes, you have been hacked.

><snip>
>>
>> Backup all of your own important files, wipe the disk, and reinstall.


>Whoa! Before you wipe the disk, note the size and date of any compromised
>program - use the information to help identify a safe backup!


??? and how is he to do that? His system is comprimized. The tools on his
system are unreliable.



>C.


Reply With Quote
  #8 (permalink)  
Old 06-08-2006
M. Trimble
 
Posts: n/a
Default Re: Is this evidence of a hack?

Unruh wrote:


>
>>Whoa! Before you wipe the disk, note the size and date of any compromised
>>program - use the information to help identify a safe backup!

>
> ??? and how is he to do that? His system is comprimized. The tools on his
> system are unreliable.
>
>
>
>>C.


Getting a set of trustworthy tools is trivial - use your choice of live
distro. Getting correct file size/date information, on the other hand, is
np-trivial. That problem breaks down as follows:

1. identify all system-critical files by name, version, date and source.
2. obtain locate the correct version and date of each of those files,
according to their respective sources.
3. compare all files one - to - one, matching on the name, examining for
differences in name, version and date. Oh, and don't let's forget the
trivial detail of owner/group/permissions.

You get going on that, and I'll see you back here in a couple or five days.
Reply With Quote
  #9 (permalink)  
Old 06-08-2006
Unruh
 
Posts: n/a
Default Re: Is this evidence of a hack?

"M. Trimble" <user@127.0.0.1> writes:

>Unruh wrote:



>>
>>>Whoa! Before you wipe the disk, note the size and date of any compromised
>>>program - use the information to help identify a safe backup!

>>
>> ??? and how is he to do that? His system is comprimized. The tools on his
>> system are unreliable.
>>
>>
>>
>>>C.


>Getting a set of trustworthy tools is trivial - use your choice of live
>distro. Getting correct file size/date information, on the other hand, is
>np-trivial. That problem breaks down as follows:


>1. identify all system-critical files by name, version, date and source.
>2. obtain locate the correct version and date of each of those files,
>according to their respective sources.
>3. compare all files one - to - one, matching on the name, examining for
>differences in name, version and date. Oh, and don't let's forget the
>trivial detail of owner/group/permissions.


>You get going on that, and I'll see you back here in a couple or five days.


And exactly why would he want to do that? If he wants to do forensics,
write everything to a DVD(s) but you will find that you never actually look
at the DVD.

Note on an rpm system
rpm -Va |grep '^..5' >/tmp/verify
will give you a list of the changed files, assuming you trust the rpm
database, and your rpm binary.

Reply With Quote
  #10 (permalink)  
Old 06-08-2006
M. Trimble
 
Posts: n/a
Default Re: Is this evidence of a hack?

Unruh wrote:

> "M. Trimble" <user@127.0.0.1> writes:
>
>>Unruh wrote:

....
> Note on an rpm system
> rpm -Va |grep '^..5' >/tmp/verify
> will give you a list of the changed files, assuming you trust the rpm
> database, and your rpm binary.


Kindly note: assuming you trust the rpm database.
^^^^^^^^

I'm going from the assumption that since system-critical files are
compromised, the probability of other files also being compromised is
sufficiently high that NO files or tools on the system are trustworthy.
That's the whole point: the OP doesn't KNOW what's been
compromised/changed/reconfigured/etc., so it's best IMHO to do everything
possible to obtain absolutely reliable information. Who's to say the
alleged hacker didn't put in a version of ls that would report erroneous
information in the interest of hiding his/her/their activity.
Reply With Quote
Reply


Thread Tools
Display Modes

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

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 04:39 AM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0