Anas bin Malik said to me, "What did Yahya Ibn Abu Amra die of?"I said, "Of the plague."She said, He then said, "The Messenger of Allah ﷺ said, 'The plague is martyrdom for every Muslim.'"
قال لي أنس بن مالك: بم مات يحيى ابن أبي عمرة؟ قالت: قلت بالطاعون. قالت: فقال: قال رسول الله ﷺ: الطاعون شهادة لكل مسلم.
Bukhari narrated it in the book of jihad and expeditions (2830), and Muslim in the book of leadership (1916:166), both from the hadith of Asim, from Hafsa bint Sirin, who related it. The wording is Muslim's, and Bukhari confined himself to the part attributed directly to the Prophet.