Part of the EllisLab Network
   
 
System files disappearing! Installation security help, please?
Posted: 29 October 2009 03:17 PM   [ Ignore ]  
Grad Student
Avatar
Rank
Total Posts:  99
Joined  02-05-2008

Hi-

We are hosting several sites with rackspace cloud hosting, and everything has been just fine up until a couple days ago. Suddenly a client started complaining that their sites are no longer sending them emails from things like contact forms.

So I ftp into one of their sites to take a look, and what I find is an empty system folder. Nothing in it.

Strangely, the site was still working, with the exception of the application blank-screening whenever the line

$this->load->library('email');

was encountered.

I reuploaded the entire system folder, and things are working again.

Now another client is complaining that the same thing has happened.

So, I’m wondering—well, first, I’m wondering if we’ve been hacked. But second, I’m wondering what the permissions should be on the system directory and application directory. Also, what kind of access should be enabled through .htaccess.

Any help would be greatly appreciated.

 Signature 

- Jay

Profile
 
 
Posted: 29 October 2009 05:44 PM   [ Ignore ]   [ # 1 ]  
Grad Student
Avatar
Rank
Total Posts:  65
Joined  02-16-2009

Check your CI logs and FTP logs to see what’s going on. Enable error reporting using ini_set() or in your php.ini might help as well.

I myself have cause a virus before that stole all the saved ftp accounts on my PC and routinely injected XSS malware in various files. I’m pretty sure you probably are seeing the white space due to syntax errors from a similar cause.

I should also note that I recently purchased a cloud server from Rackspace, and they neglected to tell me that the IP was blacklisted for spam. This could cause emails to be blocked on the receiving end.

Let me know what happens this is interesting wink

I should also add that if you did suffer the FTP intrusion that you should reset all your passwords and clean the infected PC.

Thanks,
Jason

Profile
 
 
Posted: 29 October 2009 05:47 PM   [ Ignore ]   [ # 2 ]  
Grad Student
Avatar
Rank
Total Posts:  99
Joined  02-05-2008

Thanks, I’ll try this. I doubt it’s a virus; I recently switched to Linux, and the malware there seems to be a much smaller ecosystem wink But it’s certainly a possibility. And yes, I’ll keep you posted.

 Signature 

- Jay

Profile
 
 
Posted: 29 October 2009 05:48 PM   [ Ignore ]   [ # 3 ]  
Grad Student
Avatar
Rank
Total Posts:  65
Joined  02-16-2009

Are you running a ftp server? What I meant is this nasty bug will infect YOUR PC, if you are using a PC to develop on. Be careful.

Profile
 
 
Posted: 29 October 2009 05:55 PM   [ Ignore ]   [ # 4 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  811
Joined  06-10-2009

Well in the words of Gidget from Wow Wow Wubbzy, “that wasn’t supposed to happen.”

For CI files you should be ok to set everything to 0555 (read and execute only), and depending on your configuration you might be ok with 0444 (read only) but you’d have to play with it to make sure.

Note that you’d probably best run this recursively on CI system AFTER moving out your application folder smile

You will need to go in and manually set permissions for your logger though, or you will be unintentionally disabling logging.

Security lock down procedures basically state you need to assume total password compromise across the board and reset all usernames and passwords for anyone with access to your system, including database passwords. It’s usually what causes this sort of things, compromised accounts.

I’d also check all your code and make certain to check any unset, unlink, eval, and exec commands and make sure you don’t have something that could be injected to cause such deletions.

Also if CI still runs with no System, there is something wrong there, it should error out. Check for symlinks and your index.php and make sure you know what CI system folder it is really using.

 Signature 

CreativeHalls Web Design and Printing
A few of my projects:
OurGulfCoast Property Management and Vacation Rental (ASP/.NET)
BukuBux - Money Saving Coupons and Gift Certificates (CodeIgniter, LAMP/MySQL)
Rentals800.com - Find a place to rent (CodeIgniter, LAMP/MySQL)
bdh (dot) hall (at) gmail (dotcom)

Profile
 
 
Posted: 29 October 2009 05:56 PM   [ Ignore ]   [ # 5 ]  
Grad Student
Avatar
Rank
Total Posts:  99
Joined  02-05-2008

Okay, I got you.

Our host, of course, is running an FTP server.

I am personally running Ubuntu 9.04 on my laptop (at least until tonight when I upgrade to 9.10) and am NOT running an FTP server on it. I am however running Apache and MySQL with nice strong firewall rules to block everything in or out except for port 80. My router is firewalled too.

 Signature 

- Jay

Profile
 
 
Posted: 29 October 2009 05:56 PM   [ Ignore ]   [ # 6 ]  
Research Assistant
Avatar
RankRankRank
Total Posts:  811
Joined  06-10-2009

oh yeah, it should be pointed out that as markup2go notes, most compromises are not of servers, but far less secure workstations with admin access, especially ones with stored passwords.

 Signature 

CreativeHalls Web Design and Printing
A few of my projects:
OurGulfCoast Property Management and Vacation Rental (ASP/.NET)
BukuBux - Money Saving Coupons and Gift Certificates (CodeIgniter, LAMP/MySQL)
Rentals800.com - Find a place to rent (CodeIgniter, LAMP/MySQL)
bdh (dot) hall (at) gmail (dotcom)

Profile
 
 
Posted: 29 October 2009 06:03 PM   [ Ignore ]   [ # 7 ]  
Grad Student
Avatar
Rank
Total Posts:  99
Joined  02-05-2008
BrianDHall - 29 October 2009 05:55 PM

Well in the words of Gidget from Wow Wow Wubbzy, “that wasn’t supposed to happen.”

For CI files you should be ok to set everything to 0555 (read and execute only), and depending on your configuration you might be ok with 0444 (read only) but you’d have to play with it to make sure.

Note that you’d probably best run this recursively on CI system AFTER moving out your application folder smile

You will need to go in and manually set permissions for your logger though, or you will be unintentionally disabling logging.

Security lock down procedures basically state you need to assume total password compromise across the board and reset all usernames and passwords for anyone with access to your system, including database passwords. It’s usually what causes this sort of things, compromised accounts.

I’d also check all your code and make certain to check any unset, unlink, eval, and exec commands and make sure you don’t have something that could be injected to cause such deletions.

Also if CI still runs with no System, there is something wrong there, it should error out. Check for symlinks and your index.php and make sure you know what CI system folder it is really using.

Okay, thanks. Running through this point by point:

0555 is what I am using, except on cache and log directories. Applications reside outside of the system directory. No unset/unlink/eval/exec statements used as far as I can tell. XSS and SQL injection in place. index.php DOES point to correct system folder

The “still running” is - I am thinking - having something to do with the “cloud” persisting the application somehow, perhaps through caching. This is unclear to me, and was never a problem in the past on previous hosts.

Now that I think about it though, the previous site was infested with malware at one point, and I am pretty sure it came from our client who uses a mini-CMS I built to edit site content. I wiped it from the site and did a complete password change across the board, and that took care of it. That was a few months ago.

Now that it’s on three of our client sites in the cloud, and I haven’t even accessed one of them with my new linux system, I am thinking it’s probably not malware on my end.

Thanks for the help!

 Signature 

- Jay

Profile
 
 
Posted: 07 November 2009 08:15 AM   [ Ignore ]   [ # 8 ]  
Summer Student
Total Posts:  8
Joined  12-15-2007

We are also on rackspace cloud and 2 days ago have been noticing that porn links are being appended to the root level index.php file for multiple domains.

I am still trying to sort out where the compromise happened. Was it XSS, or does somebody have our master password? Freaking out a little bit. In security lockdown right now. I spent the entire day yesterday changing passwords only to awake to a fresh batch of new porn links today.

If you discover anything new, please let me know. Starting to think this could be a rackspace issue as only one person has our master password.

Profile
 
 
Posted: 07 November 2009 08:17 AM   [ Ignore ]   [ # 9 ]  
Summer Student
Total Posts:  8
Joined  12-15-2007

BTW also… your “still running” issue may be that the attacker placed a static version of your home page in the web root directory. One of our domains had that.

Profile
 
 
   
 
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 721, on January 06, 2010 09:38 AM
Total Registered Members: 115027 Total Logged-in Users: 57
Total Topics: 122466 Total Anonymous Users: 3
Total Replies: 647381 Total Guests: 467
Total Posts: 769847    
Members ( View Memberlist )