LinuxQuestions.org
Visit Jeremy's Blog.
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 02-01-2006, 01:19 AM   #1
docboat
LQ Newbie
 
Registered: Jan 2006
Posts: 3

Rep: Reputation: 0
trinoo_master - removal?


Greetings all,

I have googled and asked on ubuntu forum (great group, but no answers to this problem) - I wonder if anyone here can help?

Problem: infection with trinoo_master
Question: how can I get rid of trinoo?

Bastille firewall is installed, and working well as far as I can tell after remote scanning. I have reinstalled the OS (Ubuntu linux of the breezy flavour) twice now, but each time I get information that I have a problem.

rkhunter repeatedly shows an abnormal scan for /dev/.static/dev (fuser shows no connection to any user, which I umount and rm -R. There has to be another area not picked up by rkhunter where trinoo lurks.

On a thread in 2004 on this forum, someone mentioned they had removed trinoo, and it had taken some hours to do so. Any information on how to do that?

nmap:

Starting nmap 3.81 at 2006-02-01 13:48 HKT
Interesting ports on localhost.localdomain (127.0.0.1):
(The 1638 ports scanned but not shown below are in state: closed)
PORT STATE SERVICE
1/tcp open tcpmux
11/tcp open systat
15/tcp open netstat
25/tcp open smtp
79/tcp open finger
111/tcp open rpcbind
119/tcp open nntp
143/tcp open imap
540/tcp open uucp
631/tcp open ipp
635/tcp open unknown
1080/tcp open socks
1524/tcp open ingreslock
2000/tcp open callbook
6667/tcp open irc
12345/tcp open NetBus
12346/tcp open NetBus
27665/tcp open Trinoo_Master
31337/tcp open Elite
32770/tcp open sometimes-rpc3
32771/tcp open sometimes-rpc5
32772/tcp open sometimes-rpc7
32773/tcp open sometimes-rpc9
32774/tcp open sometimes-rpc11
54320/tcp open bo2k
 
Old 02-01-2006, 06:45 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,417
Blog Entries: 55

Rep: Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627
...most likely... not necessary

Problem: infection with trinoo_master
If there's a rational explanation we'll find it here. IMHO chances of you being a Trinoo host are small.


rkhunter repeatedly shows an abnormal scan for /dev/.static/dev (fuser shows no connection to any user, which I umount and rm -R. There has to be another area not picked up by rkhunter where trinoo lurks.
If you could show us the actual line from the Rootkit Hunter report that would be cool. IIGC /dev/.static/ is caused by the Udev package and perfectly normal behaviour. So this could be a FP (false positive). If you think it's that, please go to the Rootkit Hunter mailinglist (see sticky threads) and fire off a bug report. It would be much appreciated.


Starting nmap 3.81 at 2006-02-01 13:48 HKT
Interesting ports on localhost.localdomain (127.0.0.1):
(The 1638 ports scanned but not shown below are in state: closed)
PORT STATE SERVICE
27665/tcp open Trinoo_Master

First of all scanning from and to localhost isn't going to do you much good. If you've got another box please use that or use one of the free online scans. Your Linux system comes with a static service listing (/etc/services) against which resolution takes place. Nmap comes with it's own static listing. Static listings are only good if you're looking up services or applications that have a commonly (IANA) accepted, fixed, port designation like for instance SMTP (tcp/25) or IMAPS (tcp/993). This kind of portnumber - service resolution doesn't use any details you could get with an Nmap banner/version scan. If your system is clean issuing "netstat -np -A inet" should give you the PID and processname of the application running on the port. If you want to check with other tools, try "lsof -lMnP -i tcp:27665" or "fuser -n tcp 27665". If you want to check with other tools try Unhide (similar functionality will appear in the next Chkrootkit release, but the release isn't there yet).

Most likely it will be a regular process.
 
Old 02-03-2006, 12:27 AM   #3
docboat
LQ Newbie
 
Registered: Jan 2006
Posts: 3

Original Poster
Rep: Reputation: 0
OK - many thanks for the information. I had stopped all suspicious PID and indeed had no positive reports from the commands you suggested. Good commands, I really must read more about lsof and netstat!

Now the results after rebooting, and (I suspect) allowing the trojan to restart:

root@ubuntu:~# netstat -np -A inet
Active Internet connections (w/o servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:631 127.0.0.1:36610 ESTABLISHED8219/cupsd
tcp 0 0 127.0.0.1:32769 127.0.0.1:58208 ESTABLISHED8244/hpiod
tcp 0 0 127.0.0.1:58208 127.0.0.1:32769 ESTABLISHED8265/python
tcp 0 0 127.0.0.1:36610 127.0.0.1:631 ESTABLISHED9450/gnome-cups-ico


Now for lsof:

root@ubuntu:~# lsof -lMnP -i tcp:27665
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
portsentr 8590 0 17u IPv4 12862 TCP *:27665 (LISTEN)

similar for fuser:

root@ubuntu:~# fuser -n tcp 27665
27665/tcp: 8590

Running lsof -i I got this result (Note please the line which reads master 8371 root 11u IPv4 12248 TCP *:smtp (LISTEN):

ot@ubuntu:~# lsof -i
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
cupsd 8219 cupsys 0u IPv4 12044 TCP localhost.localdomain:ipp (LISTEN)
cupsd 8219 cupsys 4u IPv4 14755 TCP localhost.localdomain:ipp->localhost.localdomain:36610 (ESTABLISHED)
hpiod 8244 hplip 0u IPv4 12006 TCP localhost.localdomain:32769 (LISTEN)
hpiod 8244 hplip 2u IPv4 12018 TCP localhost.localdomain:32769->localhost.localdomain:58208 (ESTABLISHED)
python 8265 hplip 4u IPv4 12071 TCP localhost.localdomain:32770 (LISTEN)
python 8265 hplip 5u IPv4 12076 TCP localhost.localdomain:58208->localhost.localdomain:32769 (ESTABLISHED)
master 8371 root 11u IPv4 12248 TCP *:smtp (LISTEN)
portsentr 8590 root 0u IPv4 12828 TCP *:tcpmux (LISTEN)
portsentr 8590 root 1u IPv4 12830 TCP *:systat (LISTEN)
portsentr 8590 root 2u IPv4 12832 TCP *:netstat (LISTEN)
portsentr 8590 root 3u IPv4 12834 TCP *:finger (LISTEN)
portsentr 8590 root 4u IPv4 12836 TCP *:sunrpc (LISTEN)
portsentr 8590 root 5u IPv4 12838 TCP *:nntp (LISTEN)
portsentr 8590 root 6u IPv4 12840 TCP *:imap2 (LISTEN)
portsentr 8590 root 7u IPv4 12842 TCP *:uucp (LISTEN)
portsentr 8590 root 8u IPv4 12844 TCP *:635 (LISTEN)
portsentr 8590 root 9u IPv4 12846 TCP *:socks (LISTEN)
portsentr 8590 root 10u IPv4 12848 TCP *:ingreslock (LISTEN)
portsentr 8590 root 11u IPv4 12850 TCP *:sieve (LISTEN)
portsentr 8590 root 12u IPv4 12852 TCP *:5742 (LISTEN)
portsentr 8590 root 13u IPv4 12854 TCP *:ircd (LISTEN)
portsentr 8590 root 14u IPv4 12856 TCP *:12345 (LISTEN)
portsentr 8590 root 15u IPv4 12858 TCP *:12346 (LISTEN)
portsentr 8590 root 16u IPv4 12860 TCP *:20034 (LISTEN)
portsentr 8590 root 17u IPv4 12862 TCP *:27665 (LISTEN)
portsentr 8590 root 18u IPv4 12864 TCP *:31337 (LISTEN)
portsentr 8590 root 19u IPv4 12866 TCP *:32771 (LISTEN)
portsentr 8590 root 20u IPv4 12868 TCP *:32772 (LISTEN)
portsentr 8590 root 21u IPv4 12870 TCP *:32773 (LISTEN)
portsentr 8590 root 22u IPv4 12872 TCP *:32774 (LISTEN)
portsentr 8590 root 23u IPv4 12874 TCP *:40421 (LISTEN)
portsentr 8590 root 24u IPv4 12876 TCP *:49724 (LISTEN)
portsentr 8590 root 25u IPv4 12878 TCP *:54320 (LISTEN)
portsentr 8594 root 0u IPv4 12908 UDP *:1
portsentr 8594 root 1u IPv4 12910 UDP *:echo
portsentr 8594 root 2u IPv4 12912 UDP *:discard
portsentr 8594 root 3u IPv4 12914 UDP *:tftp
portsentr 8594 root 4u IPv4 12916 UDP *:snmp
portsentr 8594 root 5u IPv4 12918 UDP *:snmp-trap
portsentr 8594 root 6u IPv4 12920 UDP *:who
portsentr 8594 root 7u IPv4 12922 UDP *:635
portsentr 8594 root 8u IPv4 12924 UDP *:640
portsentr 8594 root 9u IPv4 12926 UDP *:641
portsentr 8594 root 10u IPv4 12928 UDP *:700
portsentr 8594 root 11u IPv4 12930 UDP *:37444
portsentr 8594 root 12u IPv4 12932 UDP *:34555
portsentr 8594 root 13u IPv4 12934 UDP *:31335
portsentr 8594 root 14u IPv4 12936 UDP *:32770
portsentr 8594 root 15u IPv4 12938 UDP *:32771
portsentr 8594 root 16u IPv4 12940 UDP *:32772

Does this look normal to you? I can easily kill -9 the processes, but I really want to know IF I have a trojan, THEN how can I remove it. There is precious little information in Google on that topic.

Am I way off base?
 
Old 02-03-2006, 06:41 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,417
Blog Entries: 55

Rep: Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627Reputation: 3627
root@ubuntu:~# lsof -lMnP -i tcp:27665
COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME
portsentr 8590 0 17u IPv4 12862 TCP *:27665 (LISTEN)

PID 8590 says its argv[0] is portsentr, Portsentry. because it's trivial to change the name of the running process, in case of doubt, you should verify the location of the binary by listing the contents of the PID dir: "ls -l /proc/8590/exe" or "stat -c %N /proc/8590/exe". It should point to the regular directory you've installed Portsentry in. This doesn't give you onehundred percent surety. If you have a filesystem integrity checker like Aide, Samhain or even tripwire installed you should use that to verify next. If you haven't, but your distro has a package manager that can validate package contents by checksum that would be your second choice.


Does this look normal to you?
Yes, it looks normal. Except you shouldn't run Portsentry but Snort. Portsentry, IMNSHO, is a piece of cr*p. Check out any of my threads here where I've made a comparison.


(..) but I really want to know IF I have a trojan, THEN how can I remove it.
Malicious code can for instance be introduced into the system because source code gets infected (OpenSSH, TCP Wrappers, Sendmail, Debian, NonGNU), because the system has a vulnerability or because someone asks them to.
Mass infection, the first case, usually doesn't live long if there are enough developers or users checking it. If any gets through then developers and distro maintainers are to blame for not checking the integrity of their systems and code timely enough. As user about the only thing you can do is to not use unofficial packages, check package GPG-sums before installing and check source package contents. From the users perspective this basically is a question of trusting upstream chains to "do it right". Given the fact we all have the tools for verifying source code, maybe we shouldn't. (Lack of time kills this)
In the second case users are to blame for not hardening or upgrading the system. Period. The third case again is a question of trust: do you really know someone's intentions well enough to accept a binary over IM/DCC/whatever else and run it? Most likely not.

In the second case the trojan was put there for a distinct reason, usually is to hide one's activities on the system or learn more, and we can assert it's not standalone but part of a rootkit which eases installing and configuring. We can also assert a rootkit to have defensive capabilities to "protect" the cracker in case something goes wrong.

Take the fact a box was compromised using an exploit and not knowing for how long the system was not owned by you and not knowing what the cracker has learnt, simply removing one trojan doesn't equal damage control. Unfortunately there is no single "best" way to deal with compromises, so we usually default to having people list processes and network connections (untrusted output) and then powering off the box fast and only ever powering it on using a bootable LiveCD, like for instance KNOPPIX, to start investigation (in colo this aint gonna work ofcourse). Now the system is "dead" it is easier to find anomalies in the system and work from there. In most cases unfortunately trust can only be restored onehundred percent by repartitioning, reformatting and reinstalling from scratch, changing all passwords and properly hardening the box. Wanna know more? Check out the LQ FAQ: Security references.


HTH
 
Old 02-03-2006, 10:52 PM   #5
docboat
LQ Newbie
 
Registered: Jan 2006
Posts: 3

Original Poster
Rep: Reputation: 0
Indeed it does help! Many thanks
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
removal invinciblegod Linux - Laptop and Netbook 3 06-06-2005 03:47 PM
Trinoo_Master Axo Linux - Security 7 07-10-2003 05:28 PM
grub removal Diablo25 LinuxQuestions.org Member Success Stories 1 05-30-2003 10:31 PM
Mesa3d removal jfrey Linux - Software 0 05-24-2003 12:38 AM
linux 7.0 removal dogg Linux - Software 1 08-16-2001 09:53 PM

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

All times are GMT -5. The time now is 12:01 AM.

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