During some basic security test. When the apache request sent with same custom header-CSRF-cookie
and POST-CSRF-Cookie
.
CSRF token get validated and request is processed.
I have gone through the implementation.
$valid = isset($_POST[$this->_csrf_token_name], $_COOKIE[$this->_csrf_cookie_name])
&& is_string($_POST[$this->_csrf_token_name]) && is_string($_COOKIE[$this->_csrf_cookie_name])
&& hash_equals($_POST[$this->_csrf_token_name], $_COOKIE[$this->_csrf_cookie_name]);
Both verifying data is from client-side.
hash_equals($_POST[$this->_csrf_token_name], $_COOKIE[$this->_csrf_cookie_name])
Is there any purpose that CodeIgniter implementation in this ways.
Does anyone tried to implement it in session instead of cookie?