The Messenger of Allah ﷺ cursed women who frequently visit graves, those who build mosques over them, and those who place lamps upon them.
حدثنا محمد بن كثير أخبرنا شعبة عن محمد بن جحادة قال سمعت أبا صالح يحدث
لعن رسول الله ﷺ زائرات القبور والمتخذين عليها المساجد والسرج
Its isnad is daif. Tirmidhi transmitted it, Prayer, chapter on the dislike of taking a masjid over a grave, no. 320, and Ibn Majah, no. 1575, and Nasai, no. 2045, from the hadith of Muhammad bin Jahada with this wording. Tirmidhi said, "Hasan."Abu Salih, the freed slave of Umm Hani, is daif and a mudallis, and he narrated this hadith after he had grown old.