Jami` at-Tirmidhi, Book 10, Hadith 1 (Tirmidhi 967)

Aishah narrated that:

The Messenger of Allah said: "The believer is not afflicted by the prick of a thorn or what is worse (or greater) than that, except that by it Allah raises him in rank and removes sin from him."