The Messenger of Allah ﷺ... Hammad and Thabit narrated from al-Hasan from the Prophet ﷺ who said, "Whoever fasts Ramadan with faith and seeking reward, his past and future sins will be forgiven."
حدثنا عفان قال حدثنا حماد بن سلمة أنبأنا محمد بن عمرو عن أبي سلمة
أن رسول الله ﷺ قال حماد وثابت عن الحسن عن النبي ﷺ قال من صام رمضان إيمانا واحتسابا غفر له ما تقدم من ذنبه وما تأخر
Its isnad is sahih. Hammad's narration from Hasan is mursal, but the hadith is well known among the imams. Bukhari related it, 1/6, in the Book of Faith, chapter on fasting Ramadan out of faith, Muslim, 1/524, number 525, in the Book of the Prayer of Travelers, chapter on encouraging the night prayer in Ramadan, Nasai, 4/156, number 2205, in the Book of Fasting, chapter on the reward of one who prays and fasts during Ramadan, and Ibn Majah, 1/526, number 1641, in the Book of Fasting, chapter on what has been said concerning the merit of Ramadan.