vbulletin 4.1.11 - дыра ли?

Discussion in 'Песочница' started by Pirotexnik, 27 Jul 2012.

  1. Pirotexnik

    Pirotexnik Member

    Joined:
    13 Oct 2010
    Messages:
    375
    Likes Received:
    73
    Reputations:
    38
    Всем доброго времени суток.
    Ковырял я булку. Но булку сделали такой, что ковырять ее с неокрепшей психокой опасно. Что со мной и произошло.

    Вобщем, я ещё не уверен, что это баг, но мне так очень кажется.

    Дело вот в чем:
    Есть такой код.
    PHP:
    eval(standard_error(fetch_error('forumpasswordincorrect',
                
    $vbulletin->session->vars['sessionhash'],
                
    htmlspecialchars_uni($vbulletin->GPC['url']),
                
    $foruminfo['forumid'],
                
    $postvars,
                
    10,
                
    1,
                
    $forumlink
            
    )));
    функция fetch_error() возвращает ТЕКСТ.
    Что возвращает функция standart_error() я не разобрался, и прошу помочь разобратся. Но темнемение, это что-то выполняется eval-ом. Что интересно. Ниже код обеих функций. НО! Есть ещё вет что.
    PHP:
    204: $postvars = construct_post_vars_html () . '<input type="hidden" name="securitytoken" value="' . $vbulletin->userinfo['securitytoken'] . '" />';
    Тоесть переменная postvars содержат какой никакой, но инпут.
    P.S. если я написал бред - не пинайте, достаточно объяснить почему бред :)
    PHP:
    function fetch_error()  
     {  
             global 
    $vbulletin;  
       
             
    $args = func_get_args();  
       
             
    // Allow an array of phrase and variables to be passed in as arg0 (for some internal functions)  
             
    if (is_array($args[0]))  
             {  
                     
    $args = $args[0];  
             }  
       
             if (
    class_exists('vBulletinHook', false))  
             {  
                     (
    $hook = vBulletinHook::fetch_hook('error_fetch')) ? eval($hook) : false;  
             }  
       
             if (!
    function_exists('fetch_phrase') AND !VB_API)  
             {  
                     require_once(
    DIR . '/includes/functions_misc.php');  
             }  
       
             if (
    $vbulletin->GPC['ajax'])  
             {  
                     switch (
    $args[0])  
                     {  
                             case 
    'invalidid':  
                             case 
    'nopermission_loggedin':  
                             case 
    'forumpasswordmissing':  
                                     
    $args[0] = $args[0] . '_ajax';  
                     }  
             }  
       
             
    // API only needs error phrase name and args.  
             
    if (defined('VB_API') AND VB_API === true)  
             {  
                     return 
    $args;  
             }  
       
             
    $args[0] = fetch_phrase($args[0], 'error', '', false);  
             if (
    sizeof($args) > 1)  
             {  
                     return 
    call_user_func_array('construct_phrase', $args);  
             }  
             else  
             {  
                     return 
    $args[0];  
             }  
     }  
    PHP:
    function standard_error($error = '', $headinsert = '', $savebadlocation = true, $override_template = '')  
     {  
             global 
    $header, $footer, $headinclude, $forumjump, $timezone, $gobutton;  
             global 
    $vbulletin, $vbphrase, $template_hook;  
             global 
    $pmbox, $show, $ad_location, $notifications_menubits, $notifications_total;  
       
             
    $show['notices'] = false;  
       
             
    construct_quick_nav(array(), -1, true, true);  
       
             
    $title = $vbulletin->options['bbtitle'];  
             
    $pagetitle =& $title;  
             
    $errormessage = $error;  
       
             if (!
    $vbulletin->userinfo['badlocation'] AND $savebadlocation)  
             {  
                     
    $vbulletin->userinfo['badlocation'] = 3;  
             }  
             require_once(
    DIR . '/includes/functions_misc.php');  
             if (
    $_POST['securitytoken'] OR $vbulletin->GPC['postvars'])  
             {  
                     
    $postvars = construct_post_vars_html();  
                     if (
    $vbulletin->GPC['postvars'])  
                     {  
                             
    $_postvars = @unserialize(verify_client_string($vbulletin->GPC['postvars']));  
                             if (
    $_postvars['securitytoken'] == 'guest')  
                             {  
                                     unset(
    $_postvars);  
                             }  
                     }  
                     else if (
    $_POST['securitytoken'] == 'guest')  
                     {  
                             unset(
    $postvars);  
                     }  
             }  
             else  
             {  
                     
    $postvars = '';  
             }  
       
             if (
    defined('VB_ERROR_PERMISSION') AND VB_ERROR_PERMISSION == true)  
             {  
                     
    $show['permission_error'] = true;  
             }  
             else  
             {  
                     
    $show['permission_error'] = false;  
             }  
       
             
    $show['search_noindex'] = (bool)($vbulletin->userinfo['permissions']['forumpermissions'] & $vbulletin->bf_ugp_forumpermissions['canview']);  
       
             
    $navbar = '';  
             
    $navbits = construct_navbits(array('' => $vbphrase['vbulletin_message']));  
       
             if (
    defined('VB_ERROR_LITE') AND VB_ERROR_LITE == true)  
             {  
                     
    $templatename = 'STANDARD_ERROR_LITE';  
                     
    define('NOPMPOPUP', 1); // No Footer here  
             
    }  
             else  
             {  
                     
    $templatename = ($override_template ? preg_replace('#[^a-z0-9_]#i', '', $override_template) : 'STANDARD_ERROR');  
             }  
       
             
    $show['dst_correction'] = false;  
       
             (
    $hook = vBulletinHook::fetch_hook('error_generic')) ? eval($hook) : false;  
       
             
    // VBIV-4792 always render navbar (also fixes VBIV-11560).  
             
    $navbar = render_navbar_template($navbits);  
       
             if (
    $vbulletin->GPC['ajax'])  
             {  
                     require_once(
    DIR . '/includes/class_xml.php');  
                     
    $xml = new vB_AJAX_XML_Builder($vbulletin, 'text/xml');  
                     
    $xml->add_tag('error', $errormessage);  
                     
    $xml->print_xml();  
                     exit;  
             }  
             else  
             {  
                     if (
    $vbulletin->noheader)  
                     {  
                             @
    header('Content-Type: text/html' . ($vbulletin->userinfo['lang_charset'] != '' ? '; charset=' . $vbulletin->userinfo['lang_charset'] : ''));  
                     }  
       
                     
    $redirpath = SCRIPTPATH;  
                     
    $pathinfo = @parse_url($VB_URL);  
                     
    $options = array(  
                                     
    $vbulletin->options['vbforum_url'],  
                                     
    $vbulletin->options['vbblog_url'],  
                                     
    $vbulletin->options['vbcms_url'],  
                     );  
                     foreach(
    $options AS $value)  
                     {  
                             if (
    $value AND $info = @parse_url($value))  
                             {  
                                     if (
    "{$info['scheme']}://{$info['host']}" == VB_URL_SCHEME . '://' . VB_URL_HOST)  
                                     {  
                                             
    $redirpath = $vbulletin->input->xss_clean(VB_URL);  
                                             break;  
                                     }  
                             }  
                     }  
                       
                     
    $templater = vB_Template::create($templatename);  
                             
    $templater->register_page_templates();  
                             
    $templater->register('errormessage', $errormessage);  
                             
    $templater->register('forumjump', $forumjump);  
                             
    $templater->register('headinsert', $headinsert);  
                             
    $templater->register('navbar', $navbar);  
                             
    $templater->register('pagetitle', $pagetitle);  
                             
    $templater->register('postvars', $postvars);  
                             
    $templater->register('scriptpath', $redirpath);  
                             
    $templater->register('url', $vbulletin->url);  
                     
    print_output($templater->render());  
             }  
     }  
     
    #1 Pirotexnik, 27 Jul 2012
    Last edited: 27 Jul 2012
    1 person likes this.