I heard the Messenger of Allah ﷺ say, "Avoid the three causes of cursing."Someone asked, "What are the causes of cursing, Messenger of Allah?"He replied, "That one of you relieves himself in a shaded spot where people seek shelter, or in a pathway, or in a source of water."
حدثنا عتاب بن زياد حدثنا عبد الله قال أخبرنا ابن لهيعة قال حدثني ابن هبيرة قال أخبرني من سمع
سمعت رسول الله ﷺ يقول اتقوا الملاعن الثلاث قيل ما الملاعن يا رسول الله قال أن يقعد أحدكم في ظل يستظل فيه أو في طريق أو في نقع ماء
No references are available.
Its isnad is daif due to the anonymity of the narrator who reported it from Ibn Abbas. The hadith is found in Majma al-Zawaid 1:204, where it is faulted for the same reason. See also Muntaqa 137, 138.