Amr bin Kharija reported,

Ali reported that the Prophet ﷺ was delivering a sermon while mounted on his she-camel, and I was beneath her neck as she chewed her cud, her saliva dripping between my shoulders. I heard him say, "Whoever claims descent from someone other than his father, or attaches himself to people other than his rightful patrons, upon him is the curse of Allah, the angels, and all of mankind. No obligatory deed nor voluntary one will be accepted from him."

Azami 579

Hasan

عن عمرو بن خارجة

أن النبي ﷺ خطب على ناقته وأنا تحت جرانها، وهي تقصع بجرتها وإن لعابها يسيل بين كتفي فسمعته يقول: من ادعى إلى غير أبيه، أو انتمى إلى غير مواليه فعليه لعنة الله والملائكة والناس أجمعين لا يقبل منه صرف ولا عدل.

الأعظمي 579حسن
Contents
Reference
Commentary
Ayat
Collection
Jami al-Kamil
Book
Faith
Chapter
Belief in the angels
Section
Curse of the angels upon one who claims lineage to other than his father or allies with other than his masters
Numbering
Jami al-Kamil 579 (2nd edition)
Azami 579