- Issue created by @el7cosmos
The only way Drupal expire a session is via GC, which is based on probability by default.
Because of this, it is possible to gain access to a session that should have expired but hasn't been deleted by the GC.
Even if the GC is run periodically (eg via cron), there is still a possibility to gain access in between cron runs.
The problem lies in \Drupal\Core\Session\SessionHandler::read not checking the timestamp compared to the session lifetime.
Looking at Symfony and Laravel, both are checking the expiration/lifetime when reading a session.
References:
gc_probability to 0 in session.storage.options in services.yml parameters, to make sure the GC don't run on request.gc_maxlifetime, for example 300 (5 minutes)gc_maxlifetimesession.gc_maxlifetime in \Drupal\Core\Session\SessionHandler::read (eg adding condition in the query)session.gc_maxlifetime config, but fall back to it.Active
11.1 🔥
base system