Zend\Session
session validators do not work as expected if set prior to the start of a session.
For instance, the following test case fails (where $this->manager is an instance of Zend\Session\SessionManager
):
$this
->manager
->getValidatorChain()
->attach('session.validate', array(new RemoteAddr(), 'isValid'));
$this->manager->start();
$this->assertSame(
array(
'Zend\Session\Validator\RemoteAddr' =3D> '',
),
$_SESSION['__ZF']['_VALID']
);
The implication is that subsequent calls to Zend\Session\SessionManager#start()
(in later requests, assuming a session was created) will not have any validator metadata attached, which causes any validator metadata to be re-built from scratch, thus marking the session as valid.
An attacker is thus able to simply ignore session validators such as RemoteAddr
or HttpUserAgent
, since the "signature" that these validators check against is not being stored in the session.
{ "nvd_published_at": null, "cwe_ids": [ "CWE-384" ], "severity": "MODERATE", "github_reviewed": true, "github_reviewed_at": "2024-06-07T21:25:23Z" }