PDA

Просмотр полной версии : vbulletin 4.1.11 - дыра ли?


Pirotexnik
27.07.2012, 04:46
Всем доброго времени суток.

Ковырял я булку. Но булку сделали такой, что ковырять ее с неокрепшей психокой опасно. Что со мной и произошло.

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

Дело вот в чем:

Есть такой код.


PHP:
eval(standard_error(fetch_error('forumpasswordinco rrect',

$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() .'userin fo['securitytoken'] .'" />';

Тоесть переменная postvars содержат какой никакой, но инпут.

P.S. если я написал бред - не пинайте, достаточно объяснить почему бред


PHP:
functionfetch_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=vBulletin Hook::fetch_hook('error_fetch')) ? eval($hook) :false;

}



if (!function_exists('fetch_phr ase') 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') ANDVB_API===true)

{

return$args;

}



$args[0] =fetch_phrase($args[0],'error','',false);

if (sizeof($args) >1)

{

returncall_user_ func_array('construct_phrase',$args);

}

else

{

return$args[0];

}

}



PHP:
functionstandard_error($error='',$headinsert='',$s avebadlocation=true,$override_template='')

{

global$header,$footer,$headinclu de,$forumjump,$timezone,$gobutton;

global$vbulletin,$vbphrase,$temp late_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($vb ulletin->GPC['postvars']));

if ($_postvars['securitytoken'] =='guest')

{

unset($_postvars);

}

}

else if ($_POS T['securitytoken'] =='guest')

{

unset($postvars);

}

}

else

{

$postvars='';

}



if (defined('VB_ERROR_PERMISSIO N') ANDVB_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') A NDVB_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= newvB_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 ($valueAND$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());

}

}