LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 01-11-2015, 04:45 AM   #31
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 perrin4869 View Post
I guess the only thing left to do now is to wipe the PC off.
Indeed.


Quote:
Originally Posted by perrin4869 View Post
It was all probably my fault anyways for having a weak root password and allowing ssh password logins in the first place.
Auch!


Quote:
Originally Posted by perrin4869 View Post
I checked the logs and there are tons of failed login attemps to root from different IPs. No successful login logs but those were probably silenced. Learned a whole lot about Linux security through this experience.

Quote:
Originally Posted by perrin4869 View Post
I do have some lingering questions about the results of the clamav scan however. What does it mean that "RKH_libkeyutils.so.1.9-v1" sig is "greedy"?
When you work with regexes a "greedy match" means the search term is not refined meaning it'll return more than it should. The reason for that is there wasn't enough information, not enough time or not enough feedback to refine things.


Quote:
Originally Posted by perrin4869 View Post
Also, the scan
Code:
clamscan --debug --verbose -d . -r /boot /etc | grep UNOFFICIAL
returned many files other than than the binaries.
Code:
/boot/System.map-generic-3.10.17: RKH_libkeyutils.so.1.9-v1.UNOFFICIAL FOUND
/boot/initrd-tree/lib/libc-2.17.so: RKH_libkeyutils.so.1.9-v1.UNOFFICIAL FOUND
/boot/initrd-tree/lib64/libc-2.19.so: RKH_libkeyutils.so.1.9-v1.UNOFFICIAL FOUND
/boot/initrd-tree/bin/busybox: RKH_libkeyutils.so.1.9-v1.UNOFFICIAL FOUND
/boot/System.map-huge-3.10.17: RKH_libkeyutils.so.1.9-v1.UNOFFICIAL FOUND
Are those files infected too?
They are likely false positives.
If you want to make certain you could compare those files (SHA256?) hashes with the hashes created from known good package contents on a repository.


Quote:
Originally Posted by perrin4869 View Post
Does unofficial mean that it hasn't been confirmed yet?
No, "unofficial" means these are signatures not included in ClamAV or any 3rd-party ClamAV signature databases provider like Sanesecurity, MalwarePatrol, INetMsg, etc, etc.


Quote:
Originally Posted by perrin4869 View Post
And why weren't those files detected when I did a scan for the whole filesystem with
Code:
clamscan -r --bell -i /
Because RKH is a post-op tool, because the signatures are for very specific situations and because they aren't as refined as they should be, it would not make sense to have them used by default as it will only confuse users so I explicitly left that functionality out.


Quote:
Originally Posted by perrin4869 View Post
Also, would it be safe for, after wiping out, to go ahead and just copy /etc and $HOME from the old installation as is into the new installation or do I risk having the infection again?
It is never safe until you have either verified or visually inspected files. For text-based files in/etc comparing hashes is easy to do and for binary files it's imperative. (Needless to say any files used for system startup, cron jobs, login or related to providing any access to the system are suspect and should rather come from the installation. If comparing hashes then show a match you discard the "old" file, if they don't you inspect them with say 'diff' to find the cause of the change.) /home is a different situation because we do not know the infection vector and no distribution comes with hashes for that kind of content plus you don't have any backups to compare against. I'd be cautious and visually inspect files individually before introducing them in the system.
 
Old 01-11-2015, 10:21 AM   #32
Miati
Member
 
Registered: Dec 2014
Distribution: Linux Mint 17.*
Posts: 326

Rep: Reputation: 106Reputation: 106
Quote:
Originally Posted by perrin4869 View Post
Also, would it be safe for, after wiping out, to go ahead and just copy /etc and $HOME from the old installation as is into the new installation or do I risk having the infection again?
I would selectively copy the /etc/ config files you have personally adjusted. Then examine them to ensure nothing is incorrect, making sure nothing got appended to the file (or anywhere else in it)

As for home files, copy over the ones you know you'll need. Making sure executable bits are not permitted on files would be a good idea and browsing through to make sure it doesn't look changed. As unspawn said, checksum checks would defintely be the best way to go here - but that really only works if you had them prior to this all happening.
For you to get "re-infected" you would have to run a exectuable file with script to run the install script for the malware, as root.

In the future, intrusion detection software may be of use to you. I haven't used it, but you could try tripwire
Obviously, never letting them in is better. But it could save a lot more headache next time.

Last edited by Miati; 01-11-2015 at 10:33 AM.
 
Old 01-11-2015, 05:28 PM   #33
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 Miati View Post
I would selectively copy the /etc/ config files you have personally adjusted. Then examine them to ensure nothing is incorrect, making sure nothing got appended to the file (or anywhere else in it)
Should be the other way around: compare files first and if found OK then copy.


Quote:
Originally Posted by Miati View Post
For you to get "re-infected" you would have to run a exectuable file with script to run the install script for the malware, as root.
You don't know the infection vector so that's speculation.


Quote:
Originally Posted by Miati View Post
In the future, intrusion detection software may be of use to you. I haven't used it, but you could try tripwire
Running Ckrootkit, Rootkit Hunter, any file system integrity checker (personally I'd suggest Samhain: see previous posts of mine) or any other post-incident tool amounts to just that: after the fact alerting / breach confirmation. Indeed prevention is better. The OP should start by reading his Linux distributions user and security documentation.

*Do note this forum also has some security references.
 
Old 05-25-2015, 12:14 AM   #34
l33y
Member
 
Registered: Jan 2014
Location: Gulf Coast, USA
Distribution: Xubuntu
Posts: 51
Blog Entries: 1

Rep: Reputation: Disabled
Brilliant thread. I learned alot from this. Thanks to everyone for their meticulous and informative responses.
 
Old 05-25-2015, 01:29 AM   #35
mralk3
Slackware Contributor
 
Registered: May 2015
Distribution: Slackware
Posts: 1,900

Rep: Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050Reputation: 1050
Great analysis, though sorry for the necro. I had not ever heard of a Linux desktop being compromised like this in all my 15 years using Linux. Servers compromised, yes, due to not being patched, but never a desktop!
 
Old 06-04-2015, 03:28 PM   #36
joec@home
Member
 
Registered: Sep 2009
Location: Galveston Tx
Posts: 291

Rep: Reputation: 70
Ok, good job on finding the exploit and managing it, but I am still not clear about the initial break in. From what I have gleamed thus far, is there a MySQL server running on this system? You may want to further secure the mysql user account in linux to prevent access to bash?

Triggering a shell script from MySQL
https://patternbuffer.wordpress.com/...pt-from-mysql/

Anatomy of an attack: Gaining Reverse Shell from SQL injection
http://resources.infosecinstitute.co...sql-injection/

Last edited by joec@home; 06-04-2015 at 03:32 PM.
 
  


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
Laptop running Puppy Linux keeps killing ADSL connection on router? darrenforster99 Linux - Laptop and Netbook 3 05-28-2013 04:03 PM
Setting up Linux box as IPv6 router to replace Netgear WNR1000 wireless router samcan Linux - Networking 1 06-19-2011 05:30 AM
Wanted: a bot that logs in and clicks on settings of a router Ulysses_ Linux - Networking 5 01-20-2011 05:37 AM
My box is spamming my router inspleak Linux - Security 3 04-06-2007 11:24 AM
Linux Box Killing Drives? eric_marsh Linux - Hardware 2 12-07-2006 09:43 PM

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

All times are GMT -5. The time now is 05:37 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