Original URL: https://www.theregister.com/2013/11/28/thousands_of_ror_sites_leave_logins_lying_around/

THOUSANDS of Ruby on Rails sites leave logins lying around

Unexpired session cookies can be stolen, re-used

By Richard Chirgwin

Posted in Security, 28th November 2013 02:03 GMT

A security researcher has warned that a Ruby on Rails vulnerability first outlined in September is continuing to linger on the Web, courtesy of admins that don't realise a vulnerability exists in its default CookieStore session storage mechanism.

The weakness affects some big names, with the research turning up names like Warner Bros, Kickstarter, and the popular Tweet-aggregator tool Paper.li.

As US researcher G.S. McNamara detailed in September, the problem is that CookieStore retains valid session cookies at the client-side forever. This is referred to as an “insufficient session expiration” weakness.

That means if a malicious attacker were to steal the cookie from any authenticated request (via, for example, an XSS attack that gives the attacker access to a user's cookie store, but there's a host of other ways to get a copy of the cookie), they could use it to impersonate the victim and log into the Ruby Web app.

It also poses a risk for people using public terminals, or office computers that could be accessed by workmates.

As ThreatPost explained at the time, “the app issues a new cookie in the browser to overwrite the one that was created when the user was authenticated. Rails tells the browser to recognise that new cookie … but the old one still works, it hasn’t been invalidated and can’t be, by default”.

McNamara's recommendation is that admins should abandon CookieStore in favour of other mechanisms such as ActiveRecordStore – but his latest work finds that this isn't happening.

Instead, he's found 1,897 sites - including the names mentioned above - that are still using the weak CookieStore mechanism.

“This is not an exhaustive list,” he writes, “and there is future work to be done in detecting remotely the use of Rails’ CookieStore with encrypted values”. Django’s cookie storage is also bad at expiring cookies, and McNamara says he will continue the research to identify sites that haven't altered their cookie storage. ®