Ayesha reported,

Two men came in to see the Messenger of Allah ﷺ and spoke to him about something I do not know what it was, and they angered him, so he cursed them and reviled them. When they had left, I said, "Messenger of Allah, no one will attain any good from what these two have received."He asked, "What do you mean?"I replied, "You cursed them and reviled them."He said, "Do you not know what I have stipulated with my Lord? I said, 'O Allah, I am only a human being, so whichever of the Muslims I curse or revile, make it for him a purification and a reward.'"

Muslim 6614

Sahih

حدثنا زهير بن حرب حدثنا جرير عن الأعمش عن أبي الضحى عن مسروق

عن عائشة قالت

دخل على رسول الله ﷺ رجلان فكلماه بشيء لا أدري ما هو فأغضباه فلعنهما وسبهما فلما خرجا قلت يا رسول الله من أصاب من الخير شيئا ما أصابه هذان قال وما ذاك قالت قلت لعنتهما وسببتهما قال أو ما علمت ما شارطت عليه ربي قلت اللهم إنما أنا بشر فأي المسلمين لعنته أو سببته فاجعله له زكاة وأجرا

مسلم 6614صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Muslim
Book
Righteousness, maintaining ties, and good manners
Chapter
Whoever the Prophet ﷺ cursed, reviled, or supplicated against
Numbering
Darussalam 6614
Muslim 6614