Ali Baba (Dharmendra) and his elder brother Qassim were the sons of a wealthy merchant. After the death of their father, Qassim exiled Ali Baba from their father's inheritance and business. Ali Baba would earn his daily bread by cutting firewood in the forest.
One day he happens to overhear a group of forty thieves visiting their treasure store in the forest. The treasure is in a cave, the mouth of which is sealed by magic. It opens when someone utters the words ""Khulja Simsim" and seals itself again if they say ""Band Hoja Simsim"". When the thieves are gone, Ali Baba enters the cave himself, and takes some of the treasure home.
Ali Baba's sister-in-law informs her husband, Qassim about the wealth. Qassim goes to the cave to take more of the treasure. Nonetheless, in his greed and excitement, he forgets the magic words to get back out of the cave. The thieves find him there and kill him. When his brother does not come back, Ali Baba goes to the cave to look for him. He finds Qassim's body, cut into many pieces and displayed just inside the entrance of the cave to discourage any similar attempts in the future. Ali Baba gets enraged and decides to settle scores with all the forty thieves? How adventurous will this combat be? What will happen to the box of treasures? Who will own the wealth ultimately?