I was among the people when a woman said, "I have offered myself to you, Messenger of Allah, so consider as you see fit."A man stood up and said, "Marry her to me."The Messenger of Allah said, "Go and find something, even an iron ring."He went but could not find anything, not even an iron ring.The Messenger of Allah then asked, "Do you know any of the surahs of the Quran?"He answered, "Yes."So he married her to him for what he knew of the surahs of the Quran.
أخبرنا محمد بن عبد الله بن يزيد المقرئ قال حدثنا سفيان قال حدثنا أبو حازم
أنا في القوم إذ قالت امرأة إني قد وهبت نفسي لك يا رسول الله فرأ في رأيك فقام رجل فقال زوجنيها فقال اذهب فاطلب ولو خاتما من حديد فذهب فلم يجد شيئا ولا خاتما من حديد فقال رسول الله أمعك من سور القرآن شيء قال نعم قال فزوجه بما معه من سور القرآن
Bukhari transmitted it in the Book of Marriage, chapter, "Marrying in exchange for teaching the Quran and without a dowry," hadith no. 5149, and Muslim in the Book of Marriage, chapter, "The dowry and its permissibility being teaching the Quran, an iron ring, or other things, etc.," hadith no. 1425/77, from the hadith of Sufyan bin Uyayna, with this wording. It is also in Kubra, hadith no. 5305.