The Messenger of Allah ﷺ said, "Beware of the two acts that bring curses."Someone asked, "Messenger of Allah, what are the two acts that bring curses?"He replied, "Relieving oneself on the people's pathways or in the shade where they rest."
قال رسول الله ﷺ: اتقوا اللعانين. قيل وما اللعانان يا رسول الله؟ قال: الذي يتخلى في طريق الناس أو في ظلهم.
Reported by Muslim in the Book of Purification (269), through the route of Ismail bin Jafar, who said, Ala told me, from his father, from Abu Hurairah, and he mentioned the hadith.Regarding his words, "the two accursed acts," Khattabi said, "What is meant by the two accursed acts is the two matters that bring about cursing, that lead people to curse and invite it. This is because whoever does them is reviled and cursed, meaning that it is people's habit to curse him. So since the two acts became a cause for that, the cursing was attributed to them."He also said, "What is meant here by shade is the shade that people take as a resting place and a spot to stop at, for not every shade makes it forbidden to relieve oneself beneath it. The Prophet ﷺ relieved himself beneath a walled grove of palm trees, and that inevitably had shade." End of quote.The hadith of Abu Hurairah has corroborating narrations from Ibn Abbas, Muaz bin Jabal, Jabir bin Abdullah, Ibn Umar, Abu Dharr, and others, but none of them is sahih.