Al-Hasan bin Kathir heard his father say: I was present with Sayyiduna Ali (may Allah be pleased with him) in the case of a hermaphrodite (khuntha); he said: Look at the outlet of his urine and make him an heir accordingly.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الفرائض / 12513
Sayyiduna Ali (may Allah be pleased with him) was asked about a newborn of whom it is not known whether it is a male or a female. Sayyiduna Ali (may Allah be pleased with him) said: He will be made an heir according to where he urinates from.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الفرائض / 12514
Abdul Jalil narrates from a man of Bakr bin Wa'il that he said: I was present with Ali (may Allah be pleased with him) when he was asked about a hermaphrodite (khuntha); he asked the people, and they did not know. Then Sayyiduna Ali (may Allah be pleased with him) said: If he urinates from the male organ, he is a boy, and if he urinates from the female organ, she is a girl.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الفرائض / 12515
Qatadah (may Allah have mercy on him) said: Jabir bin Zayd (may Allah have mercy on him) was imprisoned in the time of al-Hajjaj. Then they sent to Jabir (may Allah have mercy on him) to ask him about the inheritance of a hermaphrodite. Jabir (may Allah have mercy on him) said: You imprison me and then ask me for a fatwa as well! Then he said: Look at where he urinates from, and make him an heir accordingly. Qatadah (may Allah have mercy on him) said: I mentioned this to Sa'id bin al-Musayyib (may Allah have mercy on him), and he said: What if he urinates from both? I said: I do not know. Sa'id (may Allah have mercy on him) said: He will be made an heir according to whichever comes first.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الفرائض / 12516
Salamah bin Kulayb (may Allah have mercy on him) said that Jabir bin Zayd (may Allah have mercy on him) was asked about the inheritance of a hermaphrodite, and he said: He should stand and urinate towards a wall. If the urine hits the wall, he is a boy, and if it flows between his thighs, she is a girl.
A hadith with a connected chain (musnad) has been narrated on this, with a weak chain.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الفرائض / 12517
It is narrated from Ibn Abbas (may Allah be pleased with them both) that the Messenger of Allah (peace and blessings be upon him) was asked about a newborn who was born with both a female organ and a male organ: how will he inherit? The Prophet (peace and blessings be upon him) said: "He will be made an heir according to where he urinates from."
Muhammad bin al-Sa'ib al-Kalbi is not used as evidence.
Hadith Referenceالسنن الكبرى للبيهقي / كتاب الفرائض / 12518