صحيح البخاري Sahih Bukhari كتاب النفقات The Book of Provision (Outlay)
بَابُ قَوْلِ النَّبِيِّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ: «مَنْ تَرَكَ كَلاًّ أَوْ ضَيَاعًا فَإِلَيَّ»:

(15) Chapter. The statement of the Prophet: “If one dies leaving debts to be repaid or dependants to be taken care of, it is for me (to pay the debts and look after needy dependents)."

1 hadith
Hadith 5371
حَدَّثَنَا يَحْيَى بْنُ بُكَيْرٍ ، حَدَّثَنَا اللَّيْثُ ، عَنْ عُقَيْلٍ ، عَنْ ابْنِ شِهَابٍ ، عَنْ أَبِي سَلَمَةَ ، عَنْ أَبِي هُرَيْرَةَ رَضِيَ اللَّهُ عَنْهُ ، " أَنَّ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ كَانَ يُؤْتَى بِالرَّجُلِ الْمُتَوَفَّى عَلَيْهِ الدَّيْنُ ، فَيَسْأَلُ : هَلْ تَرَكَ لِدَيْنِهِ فَضْلًا ؟ فَإِنْ حُدِّثَ أَنَّهُ تَرَكَ وَفَاءً صَلَّى ، وَإِلَّا قَالَ لِلْمُسْلِمِينَ : صَلُّوا عَلَى صَاحِبِكُمْ ، فَلَمَّا فَتَحَ اللَّهُ عَلَيْهِ الْفُتُوحَ ، قَالَ : أَنَا أَوْلَى بِالْمُؤْمِنِينَ مِنْ أَنْفُسِهِمْ ، فَمَنْ تُوُفِّيَ مِنَ الْمُؤْمِنِينَ فَتَرَكَ دَيْنًا فَعَلَيَّ قَضَاؤُهُ ، وَمَنْ تَرَكَ مَالًا فَلِوَرَثَتِهِ " .
Narrated Abu Huraira: A dead man in debt used to be brought to Allah's Apostle who would ask, "Has he left anything to re pay his debts?" If he was informed that he had left something to cover his debts the Prophet would offer the funeral prayer for him; otherwise he would say to the Muslims present there), "Offer the funeral prayer for your friend:"but when Allah helped the Prophet to gain victory (on his expeditions), he said, "I am closer to the Believers than themselves, so. if one of the Believers dies in debt, I will repay it, but if he leaves wealth, it will be for his heirs.
Hadith Reference Sahih Bukhari / The Book of Provision (Outlay) / Hadith: 5371
Hadith Grading محدثین: أحاديث صحيح البخاريّ كلّها صحيحة