I heard the Prophet ﷺ say, "No man should be alone with a woman unless a close male relative of hers is present."
سمعت النبي ﷺ يقول: ألا لا يخلون رجل بامرأة، إلا ومعها ذو محرم.
Muslim narrated it in Hajj (1341) and Bukhari in jihad (3006), both from the hadith of Sufyan bin Uyayna, who said, Amr bin Dinar narrated to us, from Abu Mabad, who said, I heard Ibn Abbas say, then he related it in a longer hadith than this, and the wording given is that of Muslim, while Bukhari's wording is similar.