It is narrated from Sayyiduna Ali (may Allah be pleased with him) that he said: The Messenger of Allah (peace and blessings be upon him) said to me: "Do not expose your thigh, and do not look at the thigh of anyone, living or dead."
Imam Abu Dawud (may Allah have mercy on him) narrated it from Ali bin Sahl al-Ramli, from Hajjaj, from Ibn Jurayj, who said: I was informed from Habib bin Abi Thabit with the like of it. Imam Abu Dawud (may Allah have mercy on him) said: "There is nakarah (an objectionable element) in this hadith."
And Imam Ibn Majah (may Allah have mercy on him) narrated it from Bishr bin Adam (the grandson of Azhar al-Samman through his daughter), from Rawh bin Ubadah, from Ibn Jurayj, from Habib.