He traced it back to the Prophet ﷺ, who said, "Satan comes to one of you while he is in his prayer and confuses him until he no longer knows how many units he has prayed. Whoever experiences any of that, let him perform two prostrations while seated."
حدثنا سفيان عن الزهري عن أبي سلمة
يبلغ به النبي ﷺ يأتي أحدكم الشيطان وهو في صلاته فيلبس عليه حتى لا يدري كم صلى فمن وجد من ذلك شيئا فليسجد سجدتين وهو جالس
Its isnad is sahih. Malik also narrated it in the Muwatta 100 from Zuhri, with similar wording. Bukhari narrated it in 3:84, and Muslim in 1:158, both through the route of Malik, with this wording. Muslim then narrated it through the route of Sufyan, who is Ibn Uyayna, and Layth bin Saad, both of them from Zuhri, but he did not mention its wording, instead referring back to Malik's narration before it.His statement, "so it becomes confused for him," is from the triliteral verb. It is said, "labasa alayhi," from the pattern of "daraba," meaning "it became mixed up." The doubled form is also permissible, to indicate intensity and emphasis. However, its narration with the past tense verb in the Muwatta and the Sahihayn is with the undoubled letter, from the triliteral verb.