<div dir="ltr">On Wed, Jun 6, 2018 at 2:52 PM, Mikalai Birukou via kwlug-disc <span dir="ltr"><<a href="mailto:kwlug-disc@kwlug.org" target="_blank">kwlug-disc@kwlug.org</a>></span> wrote:<br><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
Sometimes we store secret session ids in db, and we use these for authentication. Usually there is query that get respective record, searching a table for a given by user session id.<br>
Usual `WHERE` clause uses the most fast comparison, which run timing is dependent on input values. This can be used as a base for an attack with session id guessing via timing.<br></blockquote><div><br></div><div>Are the session IDs sequential? If so, then they should not (ideally) be so.<br><br></div><div>For example, in Drupal, when it wants to create a session, it calls PHP's session_id() with a function that basically gets some random bytes, does a base64 encode on them, and uses that as the session key. <br><br>The random bytes are from a variety of sources: if OpenSSL is installed, then pseudo random bytes from it are requests, otherwise, /dev/urandom, process ID, microtime(), ....etc.<br><br>So, nothing sequential gets used, or stored. <br><br></div></div>-- <br><div class="gmail_signature"><div dir="ltr"><div>Khalid M. Baheyeldin<br><a href="http://2bits.com" target="_blank">2bits.com</a>, Inc.<br>Fast Reliable Drupal<br>Drupal optimization, development, customization and consulting.<br>Simplicity is prerequisite for reliability. -- Edsger W.Dijkstra<br>Simplicity is the ultimate sophistication. -- anonymous<br><br></div></div></div>
</div></div>