كتاب الجهاد والسير
32  
The Book of Jihad and Expeditions
(39)
Chapter: The persecution suffered by the prophet (saws) at the hands of the idolaters and hypocrites
(39)
باب مَا لَقِيَ النَّبِيُّ صلى الله عليه وسلم مِنْ أَذَى الْمُشْرِكِينَ وَالْمُنَافِقِينَ ‏‏
Sahih Muslim 1796 b

It has been narrated on the authority of Aswad b. Qais who said:

The Messenger of Allah (ﷺ) was in a cave (or raid) when his finger was hurt.
وَحَدَّثَنَاهُ أَبُو بَكْرِ بْنُ أَبِي شَيْبَةَ، وَإِسْحَاقُ بْنُ إِبْرَاهِيمَ، جَمِيعًا عَنِ ابْنِ عُيَيْنَةَ، عَنِ الأَسْوَدِ بْنِ قَيْسٍ، بِهَذَا الإِسْنَادِ وَقَالَ كَانَ رَسُولُ اللَّهِ صلى الله عليه وسلم فِي غَارٍ فَنُكِبَتْ إِصْبَعُهُ ‏.‏
Reference : Sahih Muslim 1796b
In-book reference : Book 32, Hadith 137
USC-MSA web (English) reference : Book 19, Hadith 4427
  (deprecated numbering scheme)