The earliest mention of Pandora seems to be Hesiod's Works and Days:
Zeus in the anger of his heart hid it, because Prometheus the crafty deceived him; therefore he planned sorrow and mischief against men. He hid fire; but that the noble son of Iapetos stole again for men from Zeus the counsellor in a hollow fennel-stalk, so that Zeus who delights in thunder did not see it. But afterwards Zeus who gathers the clouds said to him in anger : ‘Son of Iapetos, surpassing all in cunning, you are glad that you have outwitted me and stolen fire--a great plague to you yourself and to men that shall be. But I will give men as the price for fire an evil thing in which they may all be glad of heart while they embrace their own destruction.’ So said the father of men and gods, and laughed aloud. And he bade famous Hephaistos (Hephaestus) make haste and mix earth with water and to put in it the voice and strength of human kind, and fashion a sweet, lovely maiden-shape, like to the immortal goddesses in face; and Athene (Athena) to teach her needlework and the weaving of the varied web; and golden Aphrodite to shed grace upon her head and cruel longing and cares that weary the limbs. And he charged Hermes the guide, the Slayer of Argos, to put in her a shameless mind and a deceitful nature. So he ordered. And they obeyed the lord Zeus the son of Kronos (Cronus). Forthwith [Hephaistos] the famous Lame God moulded clay in the likeness of a modest maid, as the son of Kronos purposed. And the goddess bright-eyed Athene girded and clothed her, and the divine Kharites (Charites, Graces) and queenly Peitho (Persuasion) put necklaces of gold upon her, and the rich-haired Horai (Horae, Seasons) crowned her head with spring flowers. And Pallas Athene bedecked her form with all manners of finery. Also [Hermes] the Guide, the Slayer of Argos, contrived within her lies and crafty words and a deceitful nature at the will of loud thundering Zeus, and the Herald of the gods put speech in her. And he called this woman Pandora (All-Gifts), because all they who dwelt on Olympos gave each a gift, a plague to men who eat bread. But when he had finished the sheer, hopeless snare, the Father sent glorious Argus-Slayer [Hermes], the swift messenger of the gods, to take it to Epimetheus as a gift. And Epimetheus did not think on what Prometheus had said to him, bidding him never take a gift of Olympian Zeus, but to send it back for fear it might prove to be something harmful to men. But he took the gift, and afterwards, when the evil thing was already his, he understood. For ere this the tribes of men lived on earth remote and free from ills (kakoi) and hard toil (ponoi) and heavy sickness (nosoi) which bring the Keres (Fates) upon men; for in misery men grow old quickly. But the woman took off the great lid of the jar (pithos) with her hands and scattered all these and her thought caused sorrow and mischief to men. Only Elpis (Hope) remained there in an unbreakable home within under the rim of the great jar, and did not fly out at the door; for ere that, the lid of the jar stopped her, by the will of Aigis-holding Zeus who gathers the clouds. But the rest, countless plagues (lugra), wander amongst men; for earth is full of evils and the sea is full. Of themselves diseases (nosoi) come upon men continually by day and by night, bringing mischief to mortals silently; for wise Zeus took away speech from them. So is there no way to escape the will of Zeus."
Not only does this version mention a jar instead of a box, it doesn't mention why Pandora opened the box. The popular version of this myth usually says that Pandora opened it out of curiosity, wanting to know what was inside, but Hesiod says nothing about that, and indeed considering the way Pandora is described by him, as cunning and deceitful, rather than curious or naive, it wouldn't surprise me that she opened the jar on purpose, knowing what was inside.
The closest ancient source to the modern version of Pandora, which I found while researching, would be one of Aesop's fables:
Zeus gathered all the useful things together in a jar and put a lid on it. He then left the jar in human hands. But man had no self-control and he wanted to know what was in that jar, so he pushed the lid aside, letting those things go back to the abode of the gods. So all the good things flew away, soaring high above the earth, and Elpis (Hope) was the only thing left. When the lid was put back on the jar, Elpis (Hope) was kept inside. That is why Elpis (Hope) alone is still found among the people, promising that she will bestow on each of us the good things that have gone away.
This fable seems to resemble the modern version that we have of Pandora, where she opens the jar out of curiosity and impulse, seeking to know what's inside, and hope is the last thing that remains. Despite that, it still has important differences, instead of evils, the jar contains good things, which goes away when the jar is opened, and Pandora is not mentioned, and it seems to be a man who opens the jar.
Could it be that over the years the myth of Pandora has been mixed with this fable?
Are there any ancient sources that mention why Pandora opened the box, or if she even knew what was inside?