It is reported on the authority of Sa'd b. Abi Waqqas:Both of my ears heard the Messenger of Allah saying this: He who claimed the fatherhood of anyone else besides his real father knowingly (committed a great sin) ;Paradise is forbidden to him. Abu Bakra asserted that he too heard it from the Messenger of Allah (may peace be upon him)
سَمِعَتْهُ أُذُنَاىَ، وَوَعَاهُ، قَلْبِي مُحَمَّدًا صلى الله عليه وسلم يَقُولُ " مَنِ ادَّعَى إِلَى غَيْرِ أَبِيهِ وَهُوَ يَعْلَمُ أَنَّهُ غَيْرُ أَبِيهِ فَالْجَنَّةُ عَلَيْهِ حَرَامٌ ".
Sa'd and Abu Bakra each one of them said:My ears heard and my hearing preserved it that Muhammad (peace and blessings be upon him) observed: He who claimed for another one his fatherhood besides his own father knowingly that he was not his father-to him Paradise is forbidden