It is narrated from Sayyiduna Abdullah bin Mas'ud (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) said: "When one of you has a doubt in his prayer, let him seek out what is correct, and perform the two prostrations of forgetfulness (sahw) while sitting."
Hadith Referenceالمعجم الكبير للطبراني / باب العين / 9798