LinuxQuestions.org
Review your favorite Linux distribution.
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 07-08-2011, 08:32 PM   #16
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 micxz View Post
I even found some files w/php3 ext. Removed old wordpress installs etc.
Setup files left on a server may cause trouble but with 10 years of admin experience you know that. What do you mean with "files w/php3 ext"? Just old extensions or rogue files like PHP shells? Wrt extensions: when uploading is enabled a common trick is to change extension so "evil.tar" becomes "innocuous.jpeg"...


Quote:
Originally Posted by micxz View Post
Yep I've been watching closely logs and anything suspicious I would run a small script to block them via iptables+*.deny.
Automate it? Fail2ban is not confined to SSH and FTP.


Quote:
Originally Posted by micxz View Post
Working on getting ssl setup for imap, pop & smtp.
I don't know if this works for your setup but SSL can also be wrapped around services using Stunnel.


Quote:
Originally Posted by micxz View Post
it could easily be internal leak, maybe the guy that said I wasn't compromised.


Quote:
Originally Posted by micxz View Post
This is the part that is killing me. All we've got is an IP and theories (most likely order):
- internal leak from my provider or the security company
- intercepted the passwords in email transmission
- exploited software to gain priv
...or the image wasn't clean or had services enabled that shouldn't have been, no access restrictions or way too easy passwords?..
That reminds me: the firm that handled your security, did they deliver a report with changes made?


Quote:
Originally Posted by micxz View Post
- Implemented a secure firewall + additional security software
- Hardened the web services & permissions
- Requiring stronger passwords for email
- Changed all user passwords
- Policy to sms passwords without usernames or ips (for people that have login shells)
I'd really love to see a new thread for that or else a more elaborate list here you and us can add items and details to.


Quote:
Originally Posted by micxz View Post
- Engaged an security firm to conduct a investigation if my provider will let me access the infected image.
Any word on that?



Quote:
Originally Posted by micxz View Post
I did try on the new box (well re-imaged same IPs) to replicate the adding a user via cron from the Plesk admin interface. I was able to escalate myself from admin to user micxzsendmail (uid 0) within 5 mins by adding a cron job for root. But when I tried to log in failed as root is now only allowed key login or use su of course. Maybe Plesk should be notified?
Echo allowed users into /etc/cron.allow instead? Additionally see http://www.centos.org/modules/newbb/...30303&forum=42 for suggested rules related to cron ("CFG_cron") and examples for logging potential violations by the web server user ("HTTPD_problem").


Quote:
Originally Posted by micxz View Post
I'm rich!
Hmm. I spose one can't become a Contributing Member twice...
 
Old 07-09-2011, 04:03 AM   #17
micxz
Senior Member
 
Registered: Sep 2002
Location: CA
Distribution: openSuSE, Cent OS, Slackware
Posts: 1,131

Original Poster
Rep: Reputation: 75
Quote:
Originally Posted by unSpawn View Post
Setup files left on a server may cause trouble but with 10 years of admin experience you know that. What do you mean with "files w/php3 ext"? Just old extensions or rogue files like PHP shells? Wrt extensions: when uploading is enabled a common trick is to change extension so "evil.tar" becomes "innocuous.jpeg"...
Harmless just extentions just pointing out there are old files in there. I see your point here.
Quote:
Originally Posted by unSpawn View Post
Automate it? Fail2ban is not confined to SSH and FTP.
I'm getting it.
Quote:
Originally Posted by unSpawn View Post
I don't know if this works for your setup but SSL can also be wrapped around services using Stunnel.
I got imaps and pops working good just need to figure out smtp. I will look into Stunnel thanks again'
Quote:
Originally Posted by unSpawn View Post
...or the image wasn't clean or had services enabled that shouldn't have been, no access restrictions or way too easy passwords?..
That reminds me: the firm that handled your security, did they deliver a report with changes made?
Passwords where fairly long from the start but yes no firewall. And no they have not delivered a report haven't in the past, I am going to ask for one.
Quote:
Originally Posted by unSpawn View Post
I'd really love to see a new thread for that or else a more elaborate list here you and us can add items and details to.
I think a new thread is best for this. I will try to do this sooner then later still trying to clean up house. Found a real nasty php file with "info.php: Atomicorp.honeypot.hex.php.cmdshell.cih.210.UNOFFICIAL FOUND" but I found this one the old server as well and it's a year old. So is my son so maybe I need to spend more time with the server. (bad joke)
Quote:
Originally Posted by unSpawn View Post
Any word on that?
Yes. They're working on this one they first said ("mounting 'offline area' on the VPS container (such as /old).") now it looks as if they want to deliver it some other way. It's 50GB. + they wanted to go over it as well with the "level 2" security team.

I called and email (to the right place I guess):

"Per our phone discussion the we will be taking the following actions to resolve this issue with you:

1) thoroughly scanning the current system to reveal any possibly remaining issues with the accounts as restored
2) re-reviewing the previous server image to determine if there is any useful data about the attack that might
have been missed
3) Ensuring all related issues in the follow up are handled by an upper tier security administrator
4) following up with the related employees to ensure they are aware of the mistakes in procedure made
5) issuing a general reminder about escalation procedures with respect to server-wide compromises"

Quote:
Originally Posted by unSpawn View Post
Echo allowed users into /etc/cron.allow instead? Additionally see http://www.centos.org/modules/newbb/...30303&forum=42 for suggested rules related to cron ("CFG_cron") and examples for logging potential violations by the web server user ("HTTPD_problem").
Cool I will check this out though I don't want to break Plesk.

Quote:
Originally Posted by unSpawn View Post
Hmm. I spose one can't become a Contributing Member twice...
Right next to this thread reminder, I got a email with the subject, "Paid Subscription Expiry Notice" from LQ' Always when the are server compromises it seems the word "coincidence" comes up more than once when investigating. (ok another bad joke)
 
Old 07-09-2011, 05:37 AM   #18
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125

Rep: Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781
Quote:
Originally Posted by micxz View Post
I got imaps and pops working good just need to figure out smtp. I will look into Stunnel thanks again
This is really the sort of thing that belongs in a different thread on hardening but: Postfix and Dovecot will natively use secured connections and can be configured for this. You shouldn't need to tunnel them through another process, which means that it will work for all users. The 'trick' is to use plain text sasl authentication over a TLS connection, which still uses the common ports, like port 25 for SMTP. The POP/IMAP, I think use the secured ports still. The really cool part is that these work with the same certificate for your Apache web pages.

This follows with the more generalized approach of not putting administrative interfaces on your public network. Instead you privatize them and make the user authenticate against the machine with a secure connection like SSH and then access these applications over that secured tunnel. You configure Apache such that if someone tries to access them, they get a forbidden error or a better yet a not found.
 
Old 07-09-2011, 01:35 PM   #19
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 micxz View Post
I called and email (to the right place I guess):

"Per our phone discussion the we will be taking the following actions to resolve this issue with you:

1) thoroughly scanning the current system to reveal any possibly remaining issues with the accounts as restored
2) re-reviewing the previous server image to determine if there is any useful data about the attack that might
have been missed
3) Ensuring all related issues in the follow up are handled by an upper tier security administrator
4) following up with the related employees to ensure they are aware of the mistakes in procedure made
5) issuing a general reminder about escalation procedures with respect to server-wide compromises"
1) I'd hope they'd do something like that *before* handing over.
2) This depends on how much you trust them. If you do then you could say they got your data in custody but if you don't then you could say they hold your data hostage. Similarly if they're going in with forensic procedures in mind then all good. (But then you'd expect a report, right?) If they don't, or want to cover things up, this is a fine opportunity to trample things good.
3) So what does that say quality-wise for "lower tier"?..
4) Interesting. Is "server-wide compromises" your or their choice of words? Because if it is theirs then "server-wide" may have a different meaning. I mean opposed to "this paying customers VPS only".


Anyway, good to see you haven't lost your sense of humor.
 
Old 07-10-2011, 02:57 AM   #20
micxz
Senior Member
 
Registered: Sep 2002
Location: CA
Distribution: openSuSE, Cent OS, Slackware
Posts: 1,131

Original Poster
Rep: Reputation: 75
Quote:
Originally Posted by unSpawn View Post
1) I'd hope they'd do something like that *before* handing over.
2) This depends on how much you trust them. If you do then you could say they got your data in custody but if you don't then you could say they hold your data hostage. Similarly if they're going in with forensic procedures in mind then all good. (But then you'd expect a report, right?) If they don't, or want to cover things up, this is a fine opportunity to trample things good.
3) So what does that say quality-wise for "lower tier"?..
4) Interesting. Is "server-wide compromises" your or their choice of words? Because if it is theirs then "server-wide" may have a different meaning. I mean opposed to "this paying customers VPS only".


Anyway, good to see you haven't lost your sense of humor.
1) I would expect nothing less. Clamav and some in house scripts/tools they are using to "scan" they refused to share with me (I asked for them in the ticket). Then I:
Code:
[root@jay bin]# ls
attackers  check-quotas  cwd       dstat  hg                   isnulled  oi           pwtemp  scoreboard  sqlabuse  tree  user.old
bup        chgacctip     cwd.pl    ec     install-google-apps  logtog    perlharvest  scan    scores      sup       ui    wlmodsec
buptime    chpass        denyhost  ecpp   ipscan               nclean    perms        scan2   sdu         syncing   user
2) Of course I would expect a report and notice that they are doing anything at all* and status updates as they go. *They got my blood boiling again by changing the root password, removing my authorized_keys file and logging in with a IP that was not the normal hostname without prior notice. After I watched what they were up to (clamav/other) my blood pressure when back to normal. After all I've gone though they should at least let me know. After I `wall`ed terminals I got the call from the head honcho apologizing.

I did get some output on the scan of the now functioning VPS. And have fixed or removed the problems. As of now they are still "scanning" the infected image "We will let you know when the scan has finished." (Date: Jul 09, 2011 Time: 02:43 PM CST) its a long scan apparently

3) Not much at all.

4) I pasted exactly what they said. And that's just a scary to comment.

Noway2: I did have my cert file in postfix already and it turns out I didn't check the tls box in my client duh' Also I have blocked access to the control panel via allowed IP. Your right I don't want it public just me and my clients.
 
Old 07-10-2011, 06:17 AM   #21
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125

Rep: Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781
Quote:
Clamav and some in house scripts/tools they are using to "scan" they refused to share with me
This is patronizing, if not downright insulting. I have to wonder if given the high degree of competence that they have exhibited so far if 'refused to share' really means 'we don't have an fsk'ing idea'? You do realize that Clam will scan for WINDOWS viruses don't you? This is the type of response that is customary in a WINDOWS environment, where getting a virus is blasé.

Your server has been compromised. The two primary theories following an impartial investigation suggest that they were either involved in the event or their negligence contributed to a situation that allowed it to happen. I would certain demand a more detailed explanation than a virus scan.

As far as that list of files you posted above I assume that is the list of 'tools' that they put on? Most of those are not standard Linux binaries so they would have to be custom tools. One of them, EC, could be the openSSL component, in which case I wonder what they would be using it for. I don't fully understand the man pages for it, but I see that it is related to key-pair generation. Other files names sound suspicious or ominous, like ipscan and isnulled.

The "server wide" compromise is an interesting choice of term that they used and it makes me wonder if this problem isn't bigger than just your system? Of course they would never admit to it, if it were.

Last edited by Noway2; 07-10-2011 at 06:18 AM.
 
Old 07-10-2011, 05:14 PM   #22
micxz
Senior Member
 
Registered: Sep 2002
Location: CA
Distribution: openSuSE, Cent OS, Slackware
Posts: 1,131

Original Poster
Rep: Reputation: 75
I agree I feel a bit insulted "it is not available for public use." was the words used. As if I'm the "public" and they are some government. Obviously they aren't open source advocates. And yes I am fully aware of clam's purpose, on the other hand if one of my clients had they're windows box blaséd and obtained a ftp password or other access this way could be another entry point.

Quote:
Originally Posted by Noway2 View Post
Your server has been compromised....
I plan on demanding more explanation, as of now the ticket ended in, "The scan of the backup is complete, and nothing was found. However, that does not mean that it is completely clean. I strongly recommend verifying any data that you recover from this backup."

Quote:
Originally Posted by Noway2 View Post
As far as that list of files you posted....
They are all perl, python and bash scripts ipscan is perl snip that looks through all the logs snip:
Code:
print "[=D] Scanning logs for $ip...\n";
chdir '/var/log';
my @filelist = <*>;
isnulled is bash chunk that checks if an IP is blocked by wrappers, route or iptables very simple tool box by browsing a few files.

Quote:
Originally Posted by Noway2 View Post
The "server wide" compromise ...
Wouldn't they legally have to admit this? I felt a legal obligation to write all my clients. But I'm not a lawyer.

Last edited by micxz; 07-10-2011 at 05:16 PM. Reason: cleaned up quotes too much reposting
 
Old 07-10-2011, 06:12 PM   #23
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 micxz View Post
I agree I feel a bit insulted
Hard, true, but leaving out emotions may be beneficial when conducting business?


Quote:
Originally Posted by micxz View Post
Wouldn't they legally have to admit this?
If there is a server-wide breach (searching the 'net for recent trouble at your provider shows only the usual I-frame infections and stale WP installations) then they will want to conduct their own investigation and during that time maintain radio silence. A time frame of a week should be more than enough for that, after that time starts to work against them. However at the basis of this all I'm beginning to wonder about their management, procedures and personnel as evidenced by the fact 0) you've had to deal with various admins(?), 1) the points 3, 4 and 5 of your "Per our phone discussion" list, 2) the fact they mobilized their "level 2 security team" more than a week after we've concluded the machine was subverted and 3) they use an AV scanner to find "evidence". As unfortunately goes with a lot of businesses immediate and full disclosure may not be in their interest. Wrt legal aspects best check what the small print in your contract says. At least now you've got an idea if what service they provide is on a par with what you pay them.


Quote:
Originally Posted by micxz View Post
I felt a legal obligation to write all my clients. But I'm not a lawyer.
I'm not a lawyer either but I agree: even if not stipulated contract-wise you have, IMHO, at least a moral obligation to inform your customers. And while it isn't fun to be the bearer of bad news, showing them you addressed the problem immediately and professionally (and emphasizing your dependency on your provider) should not necessarily tarnish your business image and show them they made the right choice to trust you with their business. If you already wrote your customers: well done.
 
Old 07-10-2011, 07:02 PM   #24
OlRoy
Member
 
Registered: Dec 2002
Posts: 306

Rep: Reputation: 86
I'm also certainly no lawyer. However, if you're located in the US, you are often legally obligated to inform data owners if it's believed their personal information has been compromised. Breach Notification Laws. Other countries may have similar laws, so you will probably want to make sure you're in compliance.
 
Old 07-12-2011, 09:50 AM   #25
micxz
Senior Member
 
Registered: Sep 2002
Location: CA
Distribution: openSuSE, Cent OS, Slackware
Posts: 1,131

Original Poster
Rep: Reputation: 75
OlRoy: Thanks for that. I have written all my clients days ago explaining not only the migration but the possibility of data being stolen.
Quote:
leaving out emotions may be beneficial when conducting business?
I agree and I feel I have kept my cool.

My response to their post, "The scan of the backup is complete and nothing was found".... was, "I would love a more detailed explanation than a virus scan (which btw seems like a windows response). Though I do understand this could be a potential entry point from an infected windows. What else was done to investigate? Is the investigation over now? I would like to add #6 "a final report on what was done with results."

I got back earlier today:
Quote:
I am sorry for the delay on this. We are starting the full investigating over. Currently we are transferring the 55G backup to another location so we can start a new investigation. The eta on the transfer is about 7 hours. Once this is completed we will be going through all logs to determine exactly how this was compromised and should be able to provide you with a full report at that time.
So I've been searching through logs and found in /usr/local/psa/admin/logs/httpsd_access_log the culprit (IP matching the virtual shell found later) logging in to the Plesk control panel and immediately going to tools > cron lines 107-140 & 185-201 are the cron requests. So I have pretty much nailed the point of entry.

But how they got the password is still a mystery. I guess I'm back to the theory either leak at my provider or someone with access sniffing out setup emails in the route between myProvider > old server (my mailbox at the time [both softlayer]) > me or me > comcast:smtp > google:smtp ([emailed pass to partner] though this seems unlikely). To bad email headers don't let you know if ssl was used.
 
Old 07-12-2011, 10:53 PM   #26
micxz
Senior Member
 
Registered: Sep 2002
Location: CA
Distribution: openSuSE, Cent OS, Slackware
Posts: 1,131

Original Poster
Rep: Reputation: 75
I'm thinking I can mark this solved!

OK even further findings:
Code:
110701 01:51:22 mysqld_safe A mysqld process already exists
Turns out within at within three minutes of this log entry my provider added to a ticket they have reset the Mysql password ticket time is "Time: 01:53 AM CST" So to do this of course you must skip grant tables!!! The access logs for the panel and the cron job says the user was created "Jul 2 10:23:01". So there was a good 32-33 hours of mysql port being open and with out authentication. "Lame".

So I can't nail proof exactly by presenting logs, but the series of events on the server and the ticket system lead to me to 99% sure this is how they got on.

(same time frame) I remember launching mysql client as root and was not prompted for a pass. I didn't think much at first because I usually have a .my.cnf file in ~ with login info so I don't have to type. But this was a brand new server so I hadn't setup my aliases and dot files yet. I had this gut feeling something was wrong. Lesson: Always follow your instincts.

So I'll stop trying to blame myself. The admin at my provider should have told me what he was doing and more so should have restarted mysql normally after changing the pass!

Last edited by micxz; 07-13-2011 at 01:23 AM.
 
Old 07-13-2011, 12:42 AM   #27
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Well done, Sherlock! ;-p
 
Old 08-03-2011, 08:47 PM   #28
micxz
Senior Member
 
Registered: Sep 2002
Location: CA
Distribution: openSuSE, Cent OS, Slackware
Posts: 1,131

Original Poster
Rep: Reputation: 75
My provider has just updated the ticket with a job offer! I'm feeling pretty good today.
 
Old 08-04-2011, 07:41 AM   #29
Noway2
Senior Member
 
Registered: Jul 2007
Distribution: Gentoo
Posts: 2,125

Rep: Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781Reputation: 781
Thats great! Funny how things work out sometimes and how sometimes things happen for reasons we can't see at the time.
 
  


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
[SOLVED] Slow SSH Login --> CentOS 5.0 --> VMware Server --> Plesk Control Panel 8.4.0 bskrakes Linux - General 12 01-05-2015 05:32 AM
ls command fails after updating plesk on centos 5.4 delmoras Linux - General 3 06-02-2010 01:30 PM
[SOLVED] Time Sync Issues - Clock Drift Way Off - CentOS 5.2, VMware 1.0.8, Plesk CP 8.6.0 bskrakes Linux - Server 13 03-02-2009 01:38 PM
Plesk 9/CentOS symlinks prophoto Linux - Server 1 02-19-2009 03:47 PM
Can't access Plesk on vmware Centos 5 server on LAN goodgirl Linux - Server 6 09-11-2008 11:25 PM

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

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