2 сентября 2005 - уязвимы версии 2.1.0 и ниже
Открыть файл
./sources/lib/post_parser.php
найти: (строчка 520)
Код:
if ( is_array( $ibforums->cache['bbcode'] ) and count( $ibforums->cache['bbcode'] ) )
{
Добавить после:
Код:
# XSS Clean
$t = preg_replace( "#javascript\:#is", "java script:", $t );
$t = str_replace( "`" , "& #96;" , $t );
Убрать пробел между
& и # !
Скачать файл и загрузить его на сервер. Файл
Изменение MIME-типов:
Так же изменить MIME-типы некоторых опасных файлов, которые разрешены на форуме для прикрепления.
Сделать следующее:
1)Войти в Админцентр
2)Воспользоваться группой настроек Прикрепляемые файлы -> Типы прикрепляемых файлов
3)Отредактировать опции для файлов ".htm", ".html", ".txt", ".rtf", выставив в поле "MIME-тип файла" значение "unknown/unknown" (без ковычек)
5 января 2006 - уязвимы версии 2.1.4 и ниже
Открыть файл
./sources/ipsclass.php
найти:
Код:
$this->forum_read[$id] = $stamp;
заменить на:
Код:
$this->forum_read[ intval($id) ] = intval($stamp);
найти код:
Код:
/*-------------------------------------------------------------------------*/
// Makes incoming info "safe"
/*-------------------------------------------------------------------------*/
заменить на:
Код:
/*-------------------------------------------------------------------------*/
// Makes topics read or forum read cookie safe
/*-------------------------------------------------------------------------*/
/**
* Makes int based arrays safe
* XSS Fix: Ticket: 243603
* Problem with cookies allowing SQL code in keys
*
* @param array Array
* @return array Array (Cleaned)
* @since 2.1.4(A)
*/
function clean_int_array( $array=array() )
{
$return = array();
if ( is_array( $array ) and count( $array ) )
{
foreach( $array as $k => $v )
{
$return[ intval($k) ] = intval($v);
}
}
return $return;
}
/*-------------------------------------------------------------------------*/
// Makes incoming info "safe"
/*-------------------------------------------------------------------------*/
Открыть файл
./sources/action_public/forums.php
найти код:
Код:
$this->read_array = unserialize(stripslashes($read));
заменить на:
Код:
$this->read_array = $this->ipsclass->clean_int_array( unserialize(stripslashes($read)) );
Открыть файл
./sources/action_public/search.php
найти код:
Код:
$this->read_array = unserialize(stripslashes($read));
заменить на:
Код:
$this->read_array = $this->ipsclass->clean_int_array( unserialize(stripslashes($read)) );
Открыть файл
./sources/action_public/topics.php
найти код:
Код:
$this->read_array = unserialize(stripslashes($read));
заменить на:
Код:
$this->read_array = $this->ipsclass->clean_int_array( unserialize(stripslashes($read)) );
31 Января 2006 - Уязвимы версии 2.1.4 и ниже
Открыть файл
./sources/action_public/usercp.php
найти код:
Код:
$topic_array = array_slice( array_keys( $topics ), 0, 5 );
добавить после:
Код:
$topic_array = $this->ipsclass->clean_int_array( $topic_array );
Файл
/sources/classes/bbcode/class_bbcode.php
найти код:
Код:
$txt = preg_replace( "#javascript\:#is", "java script:", $txt );
$txt = str_replace( "`" , "`" , $txt );
заменить на:
Код:
$txt = preg_replace( "#javascript\:#is", "java script:", $txt );
$txt = preg_replace( "#vb script:", $txt );
$txt = str_replace( "`" , "`" , $txt );
$txt = preg_replace( "#moz\-binding:#is", "moz binding:", $txt );
25 апреля 2006 - Уязвимы версии 2.1.5 и ниже
Открыть файл
./ips_kernel/class_upload.php
найти код:
Код:
else if ( ! $img_attributes[2] )
{
// Unlink the file first
@unlink( $this->saved_upload_name );
$this->error_no = 5;
return;
}
заменить на:
Код:
else if ( ! $img_attributes[2] )
{
// Unlink the file first
@unlink( $this->saved_upload_name );
$this->error_no = 5;
return;
}
else if ( $img_attributes[2] == 1 AND ( $this->file_extension == 'jpg' OR $this->file_extension == 'jpeg' ) )
{
// Potential XSS attack with a fake GIF header in a JPEG
@unlink( $this->saved_upload_name );
$this->error_no = 5;
return;
}
Открыть файл
./sources/action_public/search.php
найти код:
Код:
$this->output = preg_replace( "#(value=[\"']{$this->ipsclass->input['lastdate']}[\"'])#i", "\\1 selected='selected'", $this->output );
заменить на:
Код:
$this->output = preg_replace( "#(value=[\"']".intval($this->ipsclass->input['lastdate'])."[\"'])#i", "\\1 selected='selected'", $this->output );
Открыть файл
./sources/action_public/messenger.php
найти код:
Код:
$this->msglib->to_by_id = $this->ipsclass->input['from_contact'];
заменить на:
Код:
$this->msglib->to_by_id = intval( $this->ipsclass->input['from_contact'] );
Открыть файл
./sources/lib/func_taskmanager.php
найти код:
Код:
$this->cron_key = substr( trim(stripslashes($_REQUEST['ck'])), 0, 32 );
заменить на:
Код:
$this->cron_key = addslashes( substr( trim(stripslashes($this->ipsclass->txt_alphanumerical_clean($_REQUEST['ck']))), 0, 32 ) );
16 мая 2006 - Уязвимы версии 2.1.6 и ниже
Открыть файл
./sources/ipsclass.php
найти код
Код:
var $acpversion = '21012.60504.u';
заменить на:
Код:
var $acpversion = '21012.060516.s';
Открыть файл
./sources/classes/post/class_post.php
найти код:
Код:
$html = preg_replace( "/name=[\"']iconid[\"']\s*value=[\"']$post_icon\s?[\"']/", "name='iconid' value='$post_icon' checked", $html );
заменить на:
Код:
$html = preg_replace( "/name=[\"']iconid[\"']\s*value=[\"']".intval($post_icon)."\s?[\"']/", "name='iconid' value='$post_icon' checked", $html );
Открыть файл
./sources/action_public/moderate.php
найти код:
Код:
$html_forums = preg_replace( "/<option value=\"".$this->ipsclass->input['df']."\"/", "<option value=\"".$this->ipsclass->input['df']."\" selected", $html_forums );
заменить на:
Код:
$html_forums = preg_replace( "/<option value=\"".intval($this->ipsclass->input['df'])."\"/", "<option value=\"".$this->ipsclass->input['df']."\" selected", $html_forums );
Открыть файл
./sources/classes/post/class_post_edit.php
найти в нем код:
Код:
$this->orig_post = $this->ipsclass->DB->fetch_row();
if (! $this->orig_post['pid'])
{
$this->ipsclass->Error( array( LEVEL => 1, MSG => 'missing_files') );
}
заменить на:
Код:
$this->orig_post = $this->ipsclass->DB->fetch_row();
if (! $this->orig_post['pid'])
{
$this->ipsclass->Error( array( LEVEL => 1, MSG => 'missing_files') );
}
//-----------------------------------------
// Same topic?
//-----------------------------------------
if ( $this->orig_post['topic_id'] != $this->topic['tid'] )
{
$this->ipsclass->Error( array( LEVEL => 1, MSG => 'missing_files') );
19 июня 2006 - Уязвимы версии 2.1.6 и ниже
Открыть файл
./sources/classes/bbcode/class_bbcode.php
найти код:
Код:
# XSS Clean
if( $this->strip_hex_entity )
{
while( preg_match( "/[&|&\;]#x(\w+?);/i", $txt ) )
{
$txt = preg_replace( "/[&|&\;]#x(\w+?);/ies" , "\$this->regex_bash_hex( '\\1' )" , $txt );
}
$txt = preg_replace( "#&(?!\;)#", "", $txt );
}
заменить на:
Код:
# XSS Clean
/*if( $this->strip_hex_entity )
{
while( preg_match( "/[&|&\;]#x(\w+?);/i", $txt ) )
{
$txt = preg_replace( "/[&|&\;]#x(\w+?);/ies" , "\$this->regex_bash_hex( '\\1' )" , $txt );
}
$txt = preg_replace( "#&(?!\;)#", "", $txt );
}*/
Открыть файл
./sources/classes/bbcode/class_bbcode_core.php
найти код:
Код:
for ($i=0; $i < count($match[0]); $i++)
{
$tmp = $row['bbcode_replace'];
$tmp = str_replace( '{content}', $match[2][$i], $tmp );
$t = str_replace( $match[0][$i], $tmp, $t );
}
заменить на:
Код:
for ($i=0; $i < count($match[0]); $i++)
{
# XSS Check: Bug ID: 980
if ( $row['bbcode_tag'] == 'post' OR $row['bbcode_tag'] == 'topic' )
{
$match[2][$i] = intval( $match[2][$i] );
}
$tmp = $row['bbcode_replace'];
$tmp = str_replace( '{content}', $match[2][$i], $tmp );
$t = str_replace( $match[0][$i], $tmp, $t );
}
Открыть файл
./sources/classes/bbcode/class_bbcode_core.php
найти код:
Код:
$url['html'] = str_replace( "&" , "&" , $url['html'] );
заменить на:
Код:
$url['html'] = str_replace( "&" , "&" , $url['html'] );
Открыть файл
./sources/classes/bbcode/class_bbcode_core.php
найти код:
Код:
$url['show'] = preg_replace( "/&/" , "&" , $url['show'] );
заменить на:
Код:
$url['show'] = str_replace( "&" , "&" , $url['show'] );
29 июня 2006 - Уязвимы версии 2.1.6 и ниже
Открыть файл
./sources/ipsclass.php
найти код:
Код:
/*-------------------------------------------------------------------------*/
// Convert string between char-sets
/*-------------------------------------------------------------------------*/
Добавить перед:
Код:
/*-------------------------------------------------------------------------*/
// XSS Clean: URLs
/*-------------------------------------------------------------------------*/
/**
* Check URL validity
*
* @param string Input String
* @return boolean
* @since 2.1.0
*/
function xss_check_url( $url )
{
$url = trim( urldecode( $url ) );
if ( ! preg_match( "#^https?://(?:[^<>*\"]+|[a-z0-9/\._\- !]+)$#iU", $url ) )
{
return FALSE;
}
return TRUE;
}
Открыть файл
./sources/lib/func_usercp.php
найти код:
Код:
if ( preg_match( "/^http:\/\/$/i", $this->ipsclass->input['url_photo'] ) )
{
$this->ipsclass->input['url_photo'] = "";
}
Добавить после:
Код:
if ( $this->ipsclass->xss_check_url( $this->ipsclass->input['url_photo'] ) !== TRUE )
{
$this->ipsclass->input['url_photo'] = '';
}
Открыть файл
./sources/lib/func_usercp.php
найти код:
Код:
if ( preg_match( "/^http:\/\/$/i", $this->ipsclass->input['url_avatar'] ) )
{
$this->ipsclass->input['url_avatar'] = "";
}
Добавить после :
Код:
if ( $this->ipsclass->xss_check_url( $this->ipsclass->input['url_avatar'] ) !== TRUE )
{
$this->ipsclass->input['url_avatar'] = '';
}
Открыть файл
./sources/classes/bbcode/class_bbcode_core.php
найти код:
Код:
if ( preg_match( "/java(\s+?)?script(\:|\s)/is", $url ) )
Заменить на:
Код:
if ( preg_match( "/javascript\:/is", preg_replace( "#/\s{1,}#s", "", $url ) ) )
Открыть файл
./sources/classes/bbcode/class_bbcode_core.php
найти код:
Код:
//-----------------------------------------
// Is the img extension allowed to be posted?
//-----------------------------------------
if ( $this->ipsclass->vars['img_ext'] )
{
Добавить перед :
Код:
//-----------------------------------------
// Check...
//-----------------------------------------
if ( $this->ipsclass->xss_check_url( $url ) !== TRUE )
{
return '';
}
Открыть файл
./sources/action_public/moderate.php
найти код:
Код:
$this->topic = $this->ipsclass->DB->fetch_row();
if (empty($this->topic['tid']))
{
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files') );
}
Добавить после :
Код:
if ( $this->ipsclass->input['f'] AND ( $this->topic['forum_id'] != $this->ipsclass->input['f'] ) )
{
$this->ipsclass->Error( array( 'LEVEL' => 1, 'MSG' => 'missing_files') );
}
10 августа 2006 - Уязвимы версии 2.1.7 и ниже
Открыть файл
./sources/lib/func_topic_threaded.php
найти:
Код:
//-----------------------------------------
// Are we viewing Posts?
//-----------------------------------------
$post_id = intval($this->ipsclass->input['pid']);
заменить на:
Код:
//-----------------------------------------
// Are we viewing Posts?
//-----------------------------------------
$post_id = intval($this->ipsclass->input['pid']);
if($post_id && !in_array($post_id, $this->pids))
{
$this->ipsclass->Error( array( LEVEL => 1, MSG => 'missing_files') );
}
5 октября 2006 - Уязвимы версии 2.1.7 и ниже
Открыть файл
./sources/action_admin/member.php
найти:
Код:
//-----------------------------------------
// Avatar?
//-----------------------------------------
if ( $r['avatar_location'] and $r['avatar_type'] )
{
$avatar = $this->ipsclass->get_avatar( $r['avatar_location'], 1, '25x25', $r['avatar_type'] );
if ( ! strstr( $avatar, 'width=' ) )
{
$avatar = str_replace( '<img', "<img width='25' height='25'", $avatar );
}
}
else
{
$avatar = "<img src='{$this->ipsclass->skin_url}/images/memsearch_head.gif' border='0' />";
}
заменить на:
Код:
//-----------------------------------------
// Avatar?
//-----------------------------------------
//-----------------------------------------
// SECURITY UPDATE: Removing user avatar
//-----------------------------------------
$avatar = "<img src='{$this->ipsclass->skin_url}/images/memsearch_head.gif' border='0' />";
17 октября 2006 - Уязвимы версии 2.1.7 и ниже
Открыть файл
./sources/classes/bbcode/class_bbcode_core.php
найти: (строка ~ 924)
Код:
$default = "[img]".$url."[/img]";
Заменить на:
Код:
$default = "[img]".str_replace( '[', '&# 091;', $url )."[/img]";
Найти:
Код:
if ( preg_match( "/[?&;]/", $url) )
Заменить на:
Код:
if ( preg_match( "/[?&;\<\[]/", $url) )
найти (строка ~ 486)
Код:
preg_match_all( "#(\[$preg_tag\])((?!\[/$preg_tag\]).+?)?(\[/$preg_tag\])#si", $t, $match );
Заменить на:
Код:
preg_match_all( "#(\[$preg_tag\])((?!\[/$preg_tag\]).+?)?(\[/$preg_tag\])#si", $t, $match );
if ( $row['bbcode_tag'] == 'snapback' )
{
$match[2][$i] = intval( $match[2][$i] );
}
P.S В принципи можно было прикрипить эту тему.