Blasts, Injections, and how to stop them

Results 1 to 14 of 14
  1. #1
    Account Upgraded | Title Enabled! themad is offline
    MemberRank
    Dec 2004 Join Date
    BulgariaLocation
    1,018Posts

    Blasts, Injections, and how to stop them

    CzF explanation: Simple but effective Server Security
    1. Blasts - server files manipulations
      The muserver files are quite good, but some of them are not with a good security level.
      • Dataservers
        The dataservers are used to connect the ODBC Data source to the GameServer, but there is no ip limitations and basicly the unlimited (untouched) dataserver can be connected through any other host pretending to be a persistant gameserver. Which may cause the all known of you item,stats blast and other server manipulations
        Solution: install a firewall or portblocker and stop the incomming/outgoing traffic from the dataservers (Allow only for the host on remote server (IF) working remotely)
      • MSSQL Server 2000
        The server is used to store all your server online info. It connects to the ODBC. However there are some exploits,hacks,hijacking applications to break up mssql's security (google it).
        Solution: same as dataserver...allowing traffic for a specific host should be only for your remote mueditor or dataserver or just a machine you want to have access to the server
    2. Web code manipulations
      • SQL injections in php
        How does it work?
        lets suppose we have a page containing the registration form the server the code
        PHP Code:
        <?php
        mssql_connect
        (..);
        mssql_select_db(..);
        $account $_POST['acc']; // account field
        $password $_POST['pass']; // password field
        // other vars bla bla..
        // Now here is the base query
        // First we check if this acc exists
        $query mssql_query("select count(*) from [memb_info] where [memb___id]='$account'"); // This is where the 'hacker" (lame kiddie) will hit you
        //other code does not matter
        ?>
        lets change the $account with
        '; shutdown; --
        the code becomes
        PHP Code:
        <?php
        mssql_connect
        (..);
        mssql_select_db(..);
        $account $_POST['acc']; // account field
        $password $_POST['pass']; // password field
        // other vars bla bla..
        // Now here is the base query
        // First we check if this acc exists
        $query mssql_query("select count(*) from [memb_info] where [memb___id]='[COLOR=Green]'; shutdown; --[/COLOR]'"); // This is where the 'hacker" (lame kiddie) will hit you
        //other code does not matter
        ?>
        defining the ';shutdown; --

        ' - ends the define of the acc name
        ; - ends the current query line
        shutdown - our new query (shuts down mssql server)
        ; -- - completes our new query (in case there is further code after the if memb___id bit)

        This way everyone can inject whatever query he likes into ur database. Really easy
        Most people think that by limiting there fields to maxlength=10 they will avoid anything - nah totally wrong...the only thing that our NEWB hacker must do is to create the same form in his own html file and remove the maxlength...and KABOOOM..you get fucked up again

        Solution: A way to avoid this w/o disabeling any symbols ?
        PHP Code:
        <?php
        mssql_connect
        (..);
        mssql_select_db(..);
        $account addslashes($_POST['acc']); // account field
        $password addslashes($_POST['pass']); // password field
        // other vars bla bla..
        // Now here is the base query
        // First we check if this acc exists
        $query mssql_query("select count(*) from [memb_info] where [memb___id]='$account'"); // This is where the 'hacker" (lame kiddie) will hit you
        //other code does not matter
        ?>
        effective and easy

        Injections can be done in $_POST, $_GET or $_REQUEST, $_COOKIE or every value that the user has access to, so i suggest you addslashes() to all (addslashes changes ' to \' and " to "\ - this way user cannot end ur current query)
      • XSS web vunrability
        What is XSS? - Cross Style Sheeting
        Usable: Stealing user passwords (Cookies or Session issues)
        Ends a html code and may execute a js in client side (retreiving cookies)
        Php - Solution: htmlspecialchars(); in every variable that is entered by the user and DISPLAYED in the server page
    Basicly thats most of the stuff you need to do to stay alive .... :)
    But NOTHING online is secured enough u know ^^

    Credits: [CzF] Savoy
    Last edited by themad; 21-11-06 at 05:39 PM.


  2. #2
    Mu Master heartagram is offline
    MemberRank
    Jul 2005 Join Date
    LithuaniaLocation
    452Posts
    nice

  3. #3
    Member didi3d is offline
    MemberRank
    Aug 2004 Join Date
    BrasilLocation
    68Posts
    hey themad i try to post in your post down but i can

  4. #4
    Account Upgraded | Title Enabled! =Master= is offline
    MemberRank
    May 2006 Join Date
    <? here ?>Location
    507Posts
    I have try with addslashes, and same, work to inject
    i have tryed with sql code: ' or 1=1; drop table Character; --
    And successfully works to drop the table...

  5. #5
    Enthusiast digitalspy is offline
    MemberRank
    Jul 2006 Join Date
    IsraelLocation
    48Posts
    really good post . tnx :)

  6. #6
    /m\ q[0_o]p /m\ Boossik is offline
    MemberRank
    Aug 2006 Join Date
    LorenciaLocation
    342Posts
    $account = stripslashes($_POST['account']);
    $password = stripslashes($_POST['password']);

    stripslashes is ok?

  7. #7
    Proficient Member sobix is offline
    MemberRank
    Dec 2004 Join Date
    Event HorizonLocation
    174Posts
    Very nice guide ;)

  8. #8
    Novice powerx is offline
    MemberRank
    Sep 2005 Join Date
    RomaniaLocation
    2Posts
    Nice guide. Thanks

  9. #9
    Member razu3 is offline
    MemberRank
    Oct 2005 Join Date
    Sega MuContinentLocation
    60Posts
    When i hacked mu servers, i was using "my own form page" to post on their db's, but you are now completely right, thx for this guid, you deffinetly helped someone out there, even me, so thx and keep it on.
    :)

  10. #10
    Novice ceacovarulz is offline
    MemberRank
    Jan 2007 Join Date
    1Posts
    how can i be sure?

  11. #11
    Account Upgraded | Title Enabled! ca_ale_16 is offline
    MemberRank
    May 2006 Join Date
    MONTEVIDEO URUGUAYLocation
    835Posts
    great guide... congrats

  12. #12
    Novice pouli is offline
    MemberRank
    Mar 2007 Join Date
    1Posts

    Re: [Guide] Blasts, Injections, and how to stop them

    gamw tn mana sas :@

  13. #13
    Elite Member O_o oleg35 is offline
    MemberRank
    Jan 2007 Join Date
    nvm i'm RussianLocation
    403Posts

    Re: [Guide] Blasts, Injections, and how to stop them

    where i need put that codes ?:eek:

  14. #14
    Apprentice stopa2005 is offline
    MemberRank
    Mar 2006 Join Date
    Paris , FrenchLocation
    8Posts

    Cool Re: [Guide] Blasts, Injections, and how to stop them

    PHP Anti SQL Injection script :

    <?php
    $xa = getenv('REMOTE_ADDR');
    $badwords = array(";","'","\"","*","union","del","DEL","insert","update","=","drop","sele","$","UPDATE","Resets","Dexterity","CLevel","TABLE","cLevel","Energy");

    foreach($_POST as $value)
    foreach($badwords as $word)
    if(substr_count($value, $word) > 0)
    die("SQL Injection Detected!");
    ?>

    you cand add values in array , if needed ...:technolog



Advertisement