These are the edits needed to patch the new exploit in IPB.
For IPB 2.0.x onlyOpen /sources/functions.phpFind:
CODE
$ibforums->forum_read[$id] = $stamp;
Replace with:
CODE
$ibforums->forum_read[ intval($id) ] = intval($stamp);
Find:
CODE
/*-------------------------------------------------------------------------*/
// Makes incoming info "safe"
/*-------------------------------------------------------------------------*/
Add above:
CODE
/*-------------------------------------------------------------------------*/
// 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) OR count($array) < 1 )
{
return $return;
}
foreach( $array as $k => $v )
{
$return[ intval($k) ] = intval($v);
}
return $return;
}
Saved & upload /sources/functions.php
Open /sources/forums.php
Find:
CODE
$this->read_array = unserialize(stripslashes($read));
Replace with:
CODE
$this->read_array = $std->clean_int_array( unserialize(stripslashes($read)) );
Save & upload /sources/forums.php
Open /sources/search.php
Find:
CODE
$this->read_array = unserialize(stripslashes($read));
Replace with:
CODE
$this->read_array = $std->clean_int_array( unserialize(stripslashes($read)) );
Save & upload /sources/search.php
Open /sources/topics.php
Find:
CODE
$this->read_array = unserialize(stripslashes($read));
Replace with:
CODE
$this->read_array = $std->clean_int_array( unserialize(stripslashes($read)) );
Save & upload /sources/topics.php
Open /sources/usercp.php
Find:
CODE
$topic_array = array_slice( array_keys( $topics ), 0, 5 );
Add below:
CODE
$topic_array = $std->clean_int_array( $topic_array );
Save & upload /sources/usercp.php
That's it! You now have the security patch applied!
*********************************
For IPB 2.1.xOpen /sources/ipsclass.php
Find:
CODE
$this->forum_read[$id] = $stamp;
Replace with:
CODE
$this->forum_read[ intval($id) ] = intval($stamp);
Find:
CODE
/*-------------------------------------------------------------------------*/
// Makes incoming info "safe"
/*-------------------------------------------------------------------------*/
Add Above:
CODE
/*-------------------------------------------------------------------------*/
// 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;
}
Save & upload /sources/ipsclass.php
Open sources/action_public/topics.php
Find:
CODE
$this->read_array = unserialize(stripslashes($read));
Replace with:
CODE
$this->read_array = $this->ipsclass->clean_int_array( unserialize(stripslashes($read)) );
Save & upload /sources/action_public/topics.php
Open sources/action_public/usercp.php
Find:
CODE
$topic_array = array_slice( array_keys( $topics ), 0, 5 );
Add Below:
CODE
$topic_array = $this->ipsclass->clean_int_array( $topic_array );
Save & upload /sources/action_public/usercp.php
Open sources/action_public/search.php
Find:
[code]
$this->read_array = unserialize(stripslashes($read));
Replace with:
CODE
$this->read_array = $this->ipsclass->clean_int_array( unserialize(stripslashes($read)) );
Save & upload /sources/action_public/search.php
Open sources/action_public/forums.php
Find:
CODE
$this->read_array = unserialize(stripslashes($read));
Replace with:
CODE
$this->read_array = $this->ipsclass->clean_int_array( unserialize(stripslashes($read)) );
Save & upload /sources/action_public/forums.php
Done for IPB 2.1.x