The Prophet ﷺ said, "Spitting in the mosque is a sin, and its expiation is to bury it."
حدثنا مسلم بن إبراهيم حدثنا هشام وشعبة وأبان عن قتادة
أن النبي ﷺ قال التفل في المسجد خطيئة وكفارته أن تواريه
Bukhari narrated it in the Book of Prayer, Chapter on the Expiation for Spitting in the Masjid, hadith no. 415, and Muslim narrated it in the Book of Masjids, Chapter on the Prohibition of Spitting in the Masjid during Prayer and Otherwise... etc., hadith no. 552, from the hadith of Shubah, through this same chain.