[20.02.08] XSS уязвимость в BB-кодах IP.Board версий 2.3.x

Для исправления уязвимостей Вы можете воспользоваться готовыми файлами. В архиве сохранена структура файлов для простоты использования. Делать это стоит только в том случае, если не было произведено никаких изменений в этих файлах.

Либо воспользоваться инструкциями приведенными ниже.

XSS уязвимость в BB-кодах Invision Power Board версий 2.3.x

Internet Explorer может некорректно обрабатывать специально измененные ВВ-коды, которые содержат Javascript. Опасность данной уязвимости не значительна, если Ваши форумы используют httpOnly cookies.

Исправление

В файле sources\classes\bbcode\class_bbcode_core.php найти:

							# Recurse?
							if ( preg_match( "#\[.+?\]#s", $match[ $_content ][$i] ) )
							{
								$match[ $_content ][$i] = $this->post_db_parse_bbcode( $match[ $_content ][$i] );
							}

Добавить после:

							$match[ $_content ][$i] = preg_replace( '#(style)=#is', "$1=", $match[ $_content ][$i] );	
							$match[ $_option ][$i] = preg_replace( '#(style)=#is', "$1=", $match[ $_option ][$i] );

Найти:

		//-----------------------------------------
		// Check...
		//-----------------------------------------	
 
		if ( $this->ipsclass->xss_check_url( $url ) !== TRUE )
		{
			return '';
		}

Добавить после:

		//-----------------------------------------
		// Don't let emos in URL..
		//-----------------------------------------
 
		if ( $this->parse_smilies )
		{
			if ( count( $this->ipsclass->cache['emoticons'] ) > 0 )
			{
				foreach( $this->ipsclass->cache['emoticons'] as $row)
				{
					$code	= $row['typed'];
					$code	= str_replace( '<', '&lt;', str_replace( '>', '&gt;', $code ) );						
 
					if( strpos( $url, $code ) )
					{
						$new  = '';
 
						for( $i=0; $i<strlen($code); $i++ )
						{
							//print dechex(ord($code{$i})).'<Br>';
							$new .= '%' . dechex(ord($code{$i}));
						}
 
						$url = str_replace( $code, $new, $url );
					}
				}
			}
		}
 
		$url = htmlspecialchars($url);

Найти:

		if ( preg_match( "#\[(" . implode( '|', $bbcodes ) . ")(.*?)\]#is", $url['html'] ) )
		{
			$this->error = 'domain_not_allowed';
			return $url['html'];
		}
 
		//-----------------------------------------

Добавить после:

		// Don't let emos in URL..
		//-----------------------------------------
 
		if ( $this->parse_smilies )
		{
			if ( count( $this->ipsclass->cache['emoticons'] ) > 0 )
			{
				foreach( $this->ipsclass->cache['emoticons'] as $row)
				{
					$code	= $row['typed'];
					$code	= str_replace( '<', '&lt;', str_replace( '>', '&gt;', $code ) );	
 
					if( strpos( $url['html'], $code ) )
					{
						$new  = '';
 
						for( $i=0; $i<strlen($code); $i++ )
						{
							//print dechex(ord($code{$i})).'<Br>';
							$new .= '%' . dechex(ord($code{$i}));
						}
 
						$url['html'] = str_replace( $code, $new, $url['html'] );
 
					}
				}
			}
		}	
 
		//-----------------------------------------

Найти:

		{
			$url['end'] .= $match[1];
			$url['html'] = preg_replace( "/(\+\-\-\>)$/", "", $url['html'] );
			$url['show'] = preg_replace( "/(\+\-\-\>)$/", "", $url['show'] );
		}
 
		//-----------------------------------------
		// clean up the ampersands / brackets
		//-----------------------------------------

Добавить после:

		$url['html'] = htmlspecialchars( $url['html'] );
 

security/2.3.x/lesscritical/20.02.2008.txt · Последние изменения: 2008/03/22 12:46 root

Работает на DokuWiki
© 2002—2006 ibresource
e-mail: wikiteam@iblink.ru