The earliest source of what happened appears to be the Jewish historian Flavius Josephus, who was familiar with both Jewish oral tradition and Scripture.
In the First Century, he wrote in Book 2, Chapter 3, of his Antiquity of the Jews:
(32) But Judas, being one of Jacob’s sons also, seeing some Arabians, of the posterity of Ismael, carrying spices and Syrian wares out of the land of Gilead to the Egyptians, after Reubel was gone, advised his brethren to draw Joseph out of the pit, and sell him to the Arabians; (33) for if he should die among strangers a great way off, they should be freed from this barbarous action. This, therefore, was resolved on; so they drew Joseph up out of the pit, and sold him to the merchants for twenty pounds. He was now seventeen years old; (34) but Reubel, coming in the nighttime to the pit, resolved to save Joseph, without the privity of his brethren; and when, upon his calling to him, he made no answer, he was afraid that they had destroyed him after he was gone; of which he complained to his brethren; but when they had told him what they had done, Reubel left off his mourning.
Josephus, F., & Whiston, W. (1987). The works of Josephus: complete and unabridged. Peabody: Hendrickson, 55.