The Messenger of Allah ﷺ said, "When a servant curses something, the curse rises up to the sky, but the gates of the sky are closed against it. Then it descends to the earth, but its gates are closed against it. Then it turns right and left, and when it finds no way through, it returns to the one who was cursed. If that one deserves it, the curse settles upon him; otherwise, it returns to the one who uttered it."
حدثنا أحمد بن صالح حدثنا يحيى بن حسان حدثنا الوليد بن رباح قال سمعت نمران يذكر عن أم الدرداء قالت سمعت
قال رسول الله ﷺ إن العبد إذا لعن شيئا صعدت اللعنة إلى السماء فتغلق أبواب السماء دونها ثم تهبط إلى الأرض فتغلق أبوابها دونها ثم تأخذ يمينا وشمالا فإذا لم تجد مساغا رجعت إلى الذي لعن فإن كان لذلك أهلا وإلا رجعت إلى قائلها
[Its isnad is daif] Bayhaqi narrated it 9/164 from the hadith of Abu Dawud through him, and it has a corroborating narration in Ahmad 1/408, but its chain is daif. Namran had a group of narrators who reported from him, and Ibn Hibban alone deemed him trustworthy.