A man came to the Prophet ﷺ and said, "Messenger of Allah, I have not left any major sin or minor sin uncommitted."The Prophet ﷺ asked him three times, "Do you not bear witness that there is no god but Allah, and that Muhammad is the Messenger of Allah?"The man replied, "Yes."The Prophet ﷺ said, "That will wipe all of that away."
جاء رجل النبي ﷺ فقال: يا رسول الله! ما تركت حاجة ولا داجة إلا قد أتيت قال: أليس تشهد أن لا إله إلا الله، وأن محمدا رسول الله؟ ثلاث مرات. قال: نعم. قال: ذاك يأتي على ذلك.
Bazzar (6887), Abu Yaala (3433) — the wording is his — Tabarani in al-Awsat (7073) and al-Saghir (1025), and Diya in al-Mukhtarah (1773) all narrated it, from the hadith of Dahhak bin Makhlad, who said, "Mastur bin Abbad narrated to us, from Thabit, from Anas," and he mentioned it. Its chain of transmission is sahih. Haythami said in al-Majma (10/83), "Their men are trustworthy."