The Messenger of Allah ﷺ said something similar to the hadith of Ali, with this addition, "The protection granted by the lowest among them is binding upon all of them, the strong among them must share with the weak, and those who set out on raids must share their gains with those who remained behind."
حدثنا عبيد الله بن عمر حدثنا هشيم عن يحيى بن سعيد
قال رسول الله ﷺ ذكر نحو حديث علي زاد فيه ويجير عليهم أقصاهم ويرد مشدهم على مضعفهم ومتسريهم على قاعدهم
No references are available.
[Hasan] Previously mentioned, hadith 2751. Ibn Majah narrated it in Kitab al-Diyat, chapter on "Muslims are equal in their blood," hadith 2685, from the hadith of Amr bin Shuayb through the same chain.