News for hackers. Stuff that matters.
Re:MySQL madness and Rails (+possible exploit) by Gigablah on Tuesday February 05, 2013 @08:18PM (#5174376)
I posted a question in the other thread: http://news.ycombinator.com/item?id=5171025

Turns out the matches are determined by the beginning character of the string column. For example, if the user's token is '5feZas0352f', the query

  SELECT * FROM users WHERE reset_token = 5;
will match that user. And if it doesn't start with a number, 0 will match it.

The behaviour is documented here:

http://dev.mysql.com/doc/refman/5.6/en/type-conversion.html

> For comparisons of a string column with a number ... there are many different strings that may convert to the value 1, such as '1', ' 1', or '1a'.

There are no comments on this comment yet.