ʿAbd al-Razzāq, from Maʿmar, from Ibn Khuthaym, from Abū al-Ṭufayl, who said:
In the pre-Islamic period the Kaʿbah was built of loosely piled stones without any mortar. It was low enough for us to climb over, and it had no roof; its cloth covering was simply laid on top and then allowed to hang down. The Black Stone (al-rukn al-aswad) was set upon the rim of its wall and jutted outward, and the structure had only two corners, giving it the shape of a ring.
A ship from the land of Byzantium was wrecked near Jeddah, so Quraysh went out to take its timber. They found a Byzantine man beside it, seized the wood—the vessel had been bound for Abyssinia—and brought the carpenter back with them. Quraysh said, “With this timber we shall rebuild the House of our Lord.”
When they prepared to tear it down, however, a snake appeared upon the wall of the House, as long as a joist, black-backed and white-bellied. Whenever anyone drew near to demolish it or remove its stones, the snake would rush at him with its mouth gaping. Quraysh gathered at the maqām and implored Allah, crying, “Our Lord, do not take us unawares. We only wish to honor and adorn Your House. If You approve of that, then grant us leave; otherwise, do with us as You will.”
They then heard a loud bellowing in the sky. Suddenly a bird with a black back, white breast and legs, and larger than an eagle swooped down, fixed its talon in the snake’s head, and carried it off toward Ajyād, the serpent’s huge tail dragging behind. Quraysh thereupon demolished the Kaʿbah and rebuilt it with stones from the valley, which they bore upon their necks, raising the walls to a height of twenty cubits.
While the Prophet ﷺ was helping to carry stones from Ajyād, he was wearing a striped wrap (nimrah). The wrap became tight, so he tried to place it on his shoulder, and his private parts were momentarily exposed because of its short length. A voice called out, “O Muhammad, cover your private parts!” Thereafter he was never seen uncovered.
Five years separated the rebuilding of the Kaʿbah from the beginning of revelation to him. This is a sound ḥadīth.