The Messenger of Allah ﷺ said, "When the imam stands after the second rakah, if he remembers before he has fully risen, he should sit back down. But if he has already risen fully, he should not sit, and he should perform the two prostrations of forgetfulness."
حدثنا الحسن بن عمرو عن عبد الله بن الوليد عن سفيان عن جابر يعني الجعفي قال حدثنا المغيرة بن شبيل الأحمسي عن قيس بن أبي حازم
قال رسول الله ﷺ إذا قام الإمام في الركعتين فإن ذكر قبل أن يستوي قائما فليجلس فإن استوى قائما فلا يجلس ويسجد سجدتي السهو
Its chain of transmission is very daif.Ibn Majah narrated it in "Establishing Prayers", the chapter on what has been said about one who stands up after two units of prayer forgetfully, hadith 1208, from the hadith of Sufyan Thawri, with the same wording. Jabir Jafi is very daif, and the coming hadith, 1037, suffices in place of it.