Hadithcore
Mishkat al-Masabih, 3041

Abu Huraira reported the Prophet (ﷺ) as saying, “I am nearer to the believers than themselves, so if anyone dies leaving a debt without leaving enough to pay it I shall be responsible for paying it, and if anyone leaves property it goes to his heirs.” A version has, “If anyone leaves a debt or children without maintenance let the matter come to me, for I am his guardian.” Another version has, “If anyone leaves property it goes to his heirs and if anyone leaves dependents without resources they come to us.” (Bukhari and Muslim.)

عَنْ أَبِي هُرَيْرَةَ عَنِ النَّبِيِّ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ قَالَ: «أَنَا أَوْلَى بِالْمُؤْمِنِينَ مِنْ أَنْفُسِهِمْ فَمَنْ مَاتَ وَعَلَيْهِ دَيْنٌ وَلَمْ يَتْرُكْ وَفَاءً فَعَلَيَّ قَضَاؤُهُ. وَمَنْ تَرَكَ مَالًا فَلِوَرَثَتِهِ» . وَفِي رِوَايَة: «من ترك دينا أَو ضيَاعًا فَلْيَأْتِنِي فَأَنَا مَوْلَاهُ» . وَفِي رِوَايَةٍ: «مَنْ تَرَكَ مَالًا فَلِوَرَثَتِهِ وَمَنْ تَرَكَ كَلًّا فَإِلَيْنَا»

References1 variant
In-Book Reference
Book 12, Hadith 1