Ali Baba is a poor woodcutter who discovers the secret of a thieves' den, entered with the phrase "Open Sesame".
One day, Ali Baba is at work collecting and cutting firewood in the forest, when he happens to overhear a group of forty thieves visiting their treasure store.
When the thieves are gone, Ali Baba enters the cave himself, and discreetly takes a single bag of gold coins home.
Unbeknownst to them, Cassim's wife puts a bit of wax in the scales to find out what Ali Baba is using them for, as she is curious to know what kind of grain her impoverished brother-in-law needs to measure.
Ali Baba and his family are able to give Cassim a proper burial without anyone asking awkward questions.
One of the thieves goes down to the town and comes across Baba Mustafa, who mentions that he has just sewn a dead man's body back together.
Realizing that the dead man must have been the thieves' victim, the thief asks Baba Mustafa to lead the way to the house where the deed was performed.
When the forty thieves return that night, they cannot identify the correct house and their leader, in a furious rage, kills the unsuccessful thief.
Again Morgiana foils the plan by making similar chips in all the other doorsteps, and the second thief is killed for his failure as well.