Fiqh-us-Sunnah Volume 2, Supererogatory Prayer, Fiqh 2.046A.

Section : How to perform these prostrations of forgetfulness.

The “prostrations of forgetfulness” (sujjud us-sahu) are two prostrations which a person makes before the taslim. All of this has been confirmed from the Prophet sallallahu alehi wasallam. In the sahih, it is recorded from Abu Sa’id al-Khudri that the Prophet said: “If one of you has some doubts during his salah and he does not recall (the number of rak’at) he has prayed, three or four, then he can put an end to his doubt by performing salah according to what he was certain of [the lesser amount] and then making two sujjud before the taslim.” In the story of Zhul-Yadain, in the two Sahihs, we are told the Prophet sallallahu alehi wassalam made the prostrations after the taslim.

Ash-Shaukani says: “The best that is stated on this subject is that one must follow what the Prophet said or did, respecting the sujjud before or after the taslim. If one does something that necessitates sujjud before the taslim, one should make them before the taslim, and if one does something requiring sujjud after the taslim, then one should make them after the taslim. As for those acts of forgetfulness that are not related to any specific time either before or after the taslim, one may choose to make the prostrations before or after the taslim in cases of addition or reduction in the salah. This is based on what Muslim recorded in his Sahih from Ibn Mas’ud that the Prophet sallallahu alehi wasallam said: ‘If one adds or decreases something from his salah, he should make two sujjud.”‘