He heard the Prophet ﷺ say, "Any man who claims someone other than his real father as his father, knowing the truth, has committed disbelief. And whoever claims to belong to a people to whom he has no lineage, let him take his seat in the Fire."
أنه سمع النبي ﷺ يقول: ليس من رجل ادعى لغير أبيه وهو يعلمه إلا كفر، ومن ادعى قوما ليس له فيهم فليتبوأ مقعده من النار.
Bukhari related it in the Book of Virtues (3508), and Muslim in the Book of Faith (61), both through the route of Abdul-Warith, who said, Husayn the Teacher narrated to us, from Abdullah bin Burayda, who said, Yahya bin Yamar narrated to me, that Abu Aswad Dili narrated to him from Abu Dharr, and he mentioned it. The wording given is Bukhari's, and Muslim's wording is similar.Slandering people's lineages and claiming descent from someone other than one's real father is forbidden in Islamic law, because of the corruption it leads to in matters of marriage, inheritance, and other affairs. However, it is permissible to call another person "son" as a way of showing kindness and affection, without implying actual descent, for it has come in the sahih that