My ears heard it and my heart retained it, that Muhammad ﷺ said, "Whoever claims descent from someone other than his father, knowing that he is not his father, Paradise is forbidden to him."
سمعته أذناي ووعاه قلبي، أن محمدا ﷺ يقول: من ادعى إلى غير أبيه وهو يعلم أنه غير أبيه، فالجنة عليه حرام.
Bukhari narrated it in Maghazi (4326), and Muslim in Iman (63), both from the hadith of Asim, who said, "I heard Abu Uthman say, 'I heard Saad and Abu Bakra, both of them saying,'" then he mentioned it.