The Messenger of Allah ﷺ said, "Who will deal with Kaab bin Ashraf, for he has harmed Allah and His Messenger?"Muhammad bin Maslama replied, "I will, Messenger of Allah. Would you like me to kill him?"He said, "Yes."So he went and killed him.
قال رسول الله ﷺ: من لكعب بن الأشرف، فإنه آذى الله ورسوله؟ فقال محمد بن مسلمة: أنا يا رسول الله! أتحب أن أقتله؟ قال: نعم فذهب فقتله.
Bukhari narrated it in the chapter on pledges (2510), and Muslim narrated it in the chapter on jihad (1801), both of them from the hadith of Sufyan, from Amr, from Jabir, mentioning it in both abridged and fuller forms.