I just noticed that my host started using Suhosin Hardening, I am not completely familiar with this, and I have serious problems with my application, mainly in sessions.
The session will be saved in the following format:
_EzyqHpPJqmQbSpRmXAJTxuFq980aNQlc3XAiRkWxlZQ9B0fnV...
I do not mind this, but also breaking my application, I need a way to decode the encryption, because because of this, it does not allow me to enter my application.
I have a function for unserializing session data, not sure where I got it, but here it is:
public function unserialize_session_data($data) { $variables = array(); $a = preg_split( "/(\w+)\|/", $serialized_string, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE ); for( $i = 0; $i < count( $a ); $i = $i+2 ) { $variables[$a[$i]] = unserialize( $a[$i+1] ); } return($variables); }
It gives bias errors with this function because the session data is not in the format that it expects, and that is why I was wondering if anyone knew of a way to decrypt / decode the aforementioned ugly data of Sukhoshin to present it in its original format ?
- EDIT -
Posting a function that uses the unserialize function above
public function get_session_data($session_id) { if (isset($session_id) && $session_id != "") { $sql = mysql_query("SELECT ses_value FROM sessions WHERE (ses_id = '$session_id');") or die ("MySQL Error : <b>" . mysql_error() . "</b><br />"); if (mysql_num_rows($sql) > 0) { $res = mysql_fetch_assoc($sql); $res = $this->unserialize_session_data($res['ses_value']); return $res; } } }
Thanks in advance!
security php suhosin
Zubair1
source share