Abdullah bin Amr bin As reported,

The Messenger of Allah ﷺ said, "Any person whose paternity is claimed after the death of the father to whom he is attributed, the claim being made by his heirs after him, the ruling is as follows. If the child was born from a slave-woman whom the father owned at the time of conception, then the child is attached to the one who claimed him. However, the child has no share of any inheritance already distributed before the claim was established. As for any inheritance not yet distributed at the time the claim is made, the child receives his share. But the child is not attached if the father to whom he is attributed denied him during his lifetime. If the child was born from a slave-woman the father did not own, or from a free woman with whom he committed adultery, then the child is not attached to him and does not inherit from him, even if the one to whom he is attributed claimed him. Such a child is a child of adultery and belongs to his mother's family, whether she was free or a slave."Muhammad bin Rashid said, "By this he means inheritance that had been distributed during the period of pre-Islamic ignorance, before Islam."

Ibn Majah 2746

Hasan

حدثنا محمد بن يحيى حدثنا محمد بن بكار بن بلال الدمشقي أنبأنا محمد بن راشد عن سليمان بن موسى

عن عمرو بن شعيب عن أبيه عن جده

أن رسول الله ﷺ قال كل مستلحق استلحق بعد أبيه الذي يدعى له ادعاه ورثته من بعده فقضى أن من كان من أمة يملكها يوم أصابها فقد لحق بمن استلحقه وليس له فيما قسم قبله من الميراث شيء وما أدرك من ميراث لم يقسم فله نصيبه ولا يلحق إذا كان أبوه الذي يدعى له أنكره وإن كان من أمة لا يملكها أو من حرة عاهر بها فإنه لا يلحق ولا يورث وإن كان الذي يدعى له هو ادعاه فهو ولد زنا لأهل أمه من كانوا حرة أو أمة قال محمد بن راشد يعني بذلك ما قسم في الجاهلية قبل الإسلام

ابن ماجه 2746حسن
Contents
Reference
Commentary
Ayat
Collection
Sunan Ibn Majah
Book
Obligatory duties
Chapter
Claiming a child
Numbering
Darussalam 2746
Ibn Majah 2746