I heard the Messenger of Allah ﷺ say, "The world is cursed, and cursed is everything in it, except the remembrance of Allah and what aligns with it, or a scholar, or a student of knowledge."
سمعت رسول الله ﷺ يقول: الدنيا ملعونة، ملعون ما فيها، إلا ذكر الله وما والاه أو عالما أو متعلما.
Tirmidhi (2322) and Ibn Majah (4112) both narrated it through Abdul-Rahman bin Thabit bin Thawban, who said, "I heard Ataa bin Qurrah say, 'I heard Abdullah bin Damrah Saluli say, "Abu Hurairah narrated to us,"'" and he mentioned it. Its chain is hasan because of Ibn Thawban, his teacher, and his teacher's teacher, since all three are at the rank of saduq.