Let me offer a slight variant of @Shir's answer. For your first problem, it really doesn't matter what you work on. Just pick a random problem out of the air and start working on it. Do not worry about "finding a thesis". Do not worry about "finding an advisor". However, you may find more problems floating in the air near active researchers—both faculty and students—than, say, in your apartment or at the library. And you may find that people are more willing to help you solve your problem (and polish the solution for publication) if it's a problem they care about. Talk to everyone. Listen to everyone. Read everything. Then pick your own problem.
Once you've solved your first problem, start over. Pick a different problem, and talk to different people. Meanwhile, write up your first solution, and give talks about it, if only to a faculty member or another student or your cat. Listen to their feedback. (Meow.) Practice, practice, practice. (Don't forget to ace your classes and your qualifying exams. If necessary, find a faculty member to sign your paperwork.)
Once you have experience solving individual problems, then you can start developing a larger research program (aka a thesis direction). [This is probably about the point where you finish your MS thesis and start as a PhD student.] With a two-point sample of problem space, you have a better view of your own talents and interests. With a multiple-point sample of potential-collaborator-space, you have some idea of what kind of researchers (in particular, what kind of advisor) you work well with. Having feedback from multiple audiences, you'll have some clue about what problems other people and/or cats care about, and what kind of intuition you're best at conveying. All that information will help you make more informed decisions about what to work on in the future.
But for your first problem, it really doesn't matter. Just pick something you're interested in and start working.