It is narrated from Sayyiduna Abu Hurayrah (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) said: "The wretched one is he who became wretched in his mother's womb, and the fortunate one is he who became fortunate in his mother's womb."
Imam al-Bazzar (may Allah have mercy on him) recorded it in his Musnad, that the Prophet (peace and blessings be upon him) said the same.
Imam al-Bazzar (may Allah have mercy on him) said: "As far as we know, no one narrated it from Hisham (may Allah have mercy on him) except Hammad (may Allah have mercy on him), and no one from Hammad except Abd al-Rahman (may Allah have mercy on him)."
And this chain is sahih (authentic).
Hadith Takhrij«أخرجه صحيح مسلم برقم: 4783، وأخرجه سنن أبي داود برقم: 4708، وأخرجه سنن ابن ماجه برقم: 76، وأخرجه مسند أحمد برقم: 3924، وأخرجه فتح الباري برقم: 6221، وأخرجه المعجم الأوسط للطبراني برقم: 2652، وأخرجه صحيح ابن حبان برقم: 6177»