The Messenger of Allah ﷺ said, "A time will come upon people when a group will go out to fight, and it will be asked, 'Is there among you anyone who was a companion of the Messenger of Allah ﷺ?' They will say, 'Yes,' and victory will be granted to them.Then another group will go out to fight, and it will be asked, 'Is there among you anyone who was a companion of a companion of the Messenger of Allah ﷺ?' They will say, 'Yes,' and victory will be granted to them.Then another group will go out to fight, and it will be asked, 'Is there among you anyone who was a companion of a companion of the companions of the Messenger of Allah ﷺ?' They will say, 'Yes,' and victory will be granted to them."
حدثنا سفيان عن عمرو سمع جابرا يحدث
قال رسول الله ﷺ يأتي على الناس زمان يغزو فئام من الناس فيقال هل فيكم من صاحب رسول الله ﷺ فيقولون نعم فيفتح لهم ثم يغزو فئام من الناس فيقال هل فيكم من صاحب من صاحب رسول الله ﷺ فيقولون نعم فيفتح لهم ثم يغزو فئام من الناس فيقولون هل فيكم من صاحب من صاحب أصحاب رسول الله ﷺ فيقولون نعم فيفتح لهم
Its isnad is sahih, its narrators are leading authorities. Sufyan is Ibn Uyayna, Amr is Ibn Dinar, and Jabir is Ibn Abdullah the companion. The hadith is found in Bukhari 4/44, in the book of jihad, chapter on seeking help from the weak, and in Muslim 4/1962, no. 2532, in the book of the virtues of the companions, chapter on the virtue of the companions and those who come after them.