Sahih al-Bukhari, Hadith 397

Narrated Mujahid: Someone came to Ibn `Umar and said, "Here is Allah's Messenger entering the Ka`ba." Ibn `Umar said, "I went there but the Prophet had come out of the Ka`ba and I found Bilal standing between its two doors. I asked Bilal, 'Did the Prophet pray in the Ka`ba?' Bilal replied, 'Yes, he prayed two rak`at between the two pillars which are to your left on entering the Ka`ba. Then Allah's Messenger came out and offered a two-rak`at prayer facing the Ka`ba.' "

حَدَّثَنَا مُسَدَّدٌ، قَالَ حَدَّثَنَا يَحْيَى، عَنْ سَيْفٍ، قَالَ سَمِعْتُ مُجَاهِدًا، قَالَ أُتِيَ ابْنُ عُمَرَ فَقِيلَ لَهُ هَذَا رَسُولُ اللَّهِ صلى الله عليه وسلم دَخَلَ الْكَعْبَةَ‏.‏ فَقَالَ ابْنُ عُمَرَ فَأَقْبَلْتُ وَالنَّبِيُّ صلى الله عليه وسلم قَدْ خَرَجَ، وَأَجِدُ بِلاَلاً قَائِمًا بَيْنَ الْبَابَيْنِ، فَسَأَلْتُ بِلاَلاً فَقُلْتُ أَصَلَّى النَّبِيُّ صلى الله عليه وسلم فِي الْكَعْبَةِ قَالَ نَعَمْ رَكْعَتَيْنِ بَيْنَ السَّارِيَتَيْنِ اللَّتَيْنِ عَلَى يَسَارِهِ إِذَا دَخَلْتَ، ثُمَّ خَرَجَ فَصَلَّى فِي وَجْهِ الْكَعْبَةِ رَكْعَتَيْنِ‏.‏

sunnah.com