Saad bin Abu Waqqas reported,

I heard the Prophet ﷺ say, "Whoever claims to belong to someone other than his real father, knowing he is not his father, Paradise is forbidden to him."

Bukhari 6766

Sahih

حدثنا مسدد حدثنا خالد هو ابن عبد الله حدثنا خالد عن أبي عثمان

عن سعد رضي الله عنه قال

سمعت النبي ﷺ يقول من ادعى إلى غير أبيه وهو يعلم أنه غير أبيه فالجنة عليه حرام

البخاري 6766صحيح
Contents
Reference
Commentary
Ayat
Collection
Sahih Bukhari
Book
Obligatory duties
Chapter
One who claims lineage to other than his father
Numbering
Darussalam 6766
Bukhari 6766