Visualizzazione dei risultati da 1 a 2 su 2
  1. #1
    Utente di HTML.it
    Registrato dal
    Jan 2002
    Messaggi
    93

    Aiuto quesito su protezione e register globals

    Scusate il titolo Urfido ma non saprei come meglio esprimermi
    Sto collaborando a mxBB e in fase di debug del nuovo codice ci siamo imbattuti in un problema legato alle maledette register globals, vi posto il codice completo sperando che almeno a voi dica qualcosa (a non me dice nulla ma è risaputo quanto sono gnurante)
    Codice PHP:
    if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on')
    {
        
    // PHP4+ path
        
    $not_unset = array('HTTP_GET_VARS''HTTP_POST_VARS''HTTP_COOKIE_VARS''HTTP_SERVER_VARS''HTTP_SESSION_VARS''HTTP_ENV_VARS''HTTP_POST_FILES''phpEx''phpbb_root_path');
        
    //+MOD: Added by mxBB
        
    $not_unset[] = 'mx_root_path';
        
    //-MOD: Added by mxBB

        // Not only will array_merge give a warning if a parameter
        // is not an array, it will actually fail. So we check if
        // HTTP_SESSION_VARS has been initialised.
        
    if (!isset($HTTP_SESSION_VARS) || !is_array($HTTP_SESSION_VARS))
        {
            
    $HTTP_SESSION_VARS = array();
        }

        
    // Merge all into one extremely huge array; unset
        // this later
        //
        // Note! Since array_merge() destroys numerical keys - if the array is numerically indexed, the keys get reindexed in a continuous way - we use the + operator instead
        //
        //$input = array_merge($HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS, $HTTP_SERVER_VARS, $HTTP_SESSION_VARS, $HTTP_ENV_VARS, $HTTP_POST_FILES);
        
    $input $HTTP_GET_VARS $HTTP_POST_VARS $HTTP_COOKIE_VARS $HTTP_SERVER_VARS $HTTP_SESSION_VARS $HTTP_ENV_VARS $HTTP_POST_FILES;

        unset(
    $input['input']);
        unset(
    $input['not_unset']);

        while (list(
    $var,) = @each($input))
        {
            if (
    in_array($var$not_unset))
            {
                die(
    'Hacking attempt!');
            }
            unset($
    $var);
        }
        unset(
    $input);

    in particolare
    sostituendo
    //$input = array_merge($HTTP_GET_VARS, $HTTP_POST_VARS, $HTTP_COOKIE_VARS, $HTTP_SERVER_VARS, $HTTP_SESSION_VARS, $HTTP_ENV_VARS, $HTTP_POST_FILES);
    con
    $input = $HTTP_GET_VARS + $HTTP_POST_VARS + $HTTP_COOKIE_VARS + $HTTP_SERVER_VARS + $HTTP_SESSION_VARS + $HTTP_ENV_VARS + $HTTP_POST_FILES;
    pensate che andiamo a introdurre dei potenziali bachi nella sicurezza?

  2. #2
    Utente di HTML.it
    Registrato dal
    Jan 2002
    Messaggi
    93
    ci provo una volta
    up

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.