Bulugh al-Maram #337 · The Book of Prayer

Bulugh al-MaramAl-Mughira bin Shu'ba
Bulugh al-Maram · Book 2 · The Book of Prayer
Bulugh al-Maram · كتاب 2 · كتاب الصلاة
Allah's Messenger (صلى الله عليه وسلم) said: "When one of you doubts and stands at the end of two Rak'at, if he remembers while having stood up completely he should continue and should not return (to the sitting position) and he should make two prostrations, but if he did not stand up straight he should sit down and there is no forgetfulness (prostration) upon him." [Reported Abu Dawud, Ibn Majah, and ad-Daraqutni, with a weak Sanad (chain); the wording is ad-Daraqutni's].
وَعَنِ الْمُغِيرَةِ بْنِ شُعْبَةَ - رضى الله
عنه - أَنَّ رَسُولَ اَللَّهِ - صلى الله عليه وسلم -قَالَ { إِذَا شَكَّ أَحَدُكُمْ , فَقَامَ فِي اَلرَّكْعَتَيْنِ , فَاسْتَتَمَّ قَائِمًا , فَلْيَمْضِ , وَلْيَسْجُدْ سَجْدَتَيْنِ , وَإِنْ لَمْ يَسْتَتِمْ قَائِمًا فَلْيَجْلِسْ وَلَا سَهْوَ عَلَيْهِ } رَوَاهُ أَبُو دَاوُدَ , وَابْنُ مَاجَهْ , وَاَلدَّارَقُطْنِيُّ , وَاللَّفْظُ لَهُ بِسَنَدٍ ضَعِيفٍ.
Reference : Bulugh al-Maram 337In-book reference : Book 2, Hadith 234