It is narrated from Sayyiduna Zaid bin Arqam (may Allah be pleased with him) that the Noble Prophet (peace and blessings be upon him) said: "Evil and wicked jinn are present in the toilets. Therefore, when any one of you intends to enter them, he should recite this supplication: « اللَّهُمَّ إِنِّی أَعُوذُ بِکَ مِنْ الْخُبْثِ وَالْخَبَائِثِ » 'O Allah, I seek refuge with You from the evil male and female jinn.' These are the words of Bundar's narration. But he has said 'from Al-Nadr bin Anas.' Similarly, Yahya bin Hakeem, narrating from Ibn Abi Adi, has said '« عن النصر » bin Anas' (i.e., he has used the word 'from' instead of 'I heard')."
Related hadith on this topic