And afterward Moses and Aaron came; and when they reached the gate of the king's house, behold, two young lions were bound there with chains of iron, and no one could go out or come in past them except whomever the king alone would command. The handlers would come and remove the lions by their whisperings and bring the person in. But Moses hurried and waved the staff over the lions and set them loose. They came into the king's house, and the lions came with them in great joy, as a dog rejoices toward its master when he comes from the field. When Pharaoh saw this, he was astonished and greatly alarmed at the men, for their appearance was like the appearance of the sons of God. The king said to them, "What do you want?" They said to him, "The LORD, God of the Hebrews, has sent us to you, saying: Send out My people that they may serve Me." He was very afraid of them and said to them, "Go today and come tomorrow," and they did as the king said. After they left, Pharaoh sent and called for Balaam the soothsayer, and Jannes and Jambres his sons the sorcerers, and all the magicians of Egypt. They came to the king, and the king told them what the men had said to him. The magicians said to him, "How did these men come to you past the lions?" [He said to them, "They waved the staff over them"] and freed them, and they came to me; moreover the lions became like dogs and rejoiced toward them. Balaam answered the king, "These are nothing but sorcerers like ourselves. Now send for them and let them come, and we will test them." And the king did so.
Moses Tames the Chained Lions at Pharaoh's Gate
Yalkut Shimoni on Torah 176:4
וְאַחַר בָּאוּ מֹשֶׁה וְאַהֲרֹן, וַיְהִי כְּבוֹאָם אֶל שַׁעַר בֵּית הַמֶּלֶךְ, וְהִנֵּה שְׁנֵי כְּפִירֵי אֲרָיוֹת אֲסוּרִים שָׁם בְּכַבְלֵי בַּרְזֶל, וְאֵין אִישׁ יוֹצֵא וּבָא מִפְּנֵיהֶם, לְבַד אֲשֶׁר יְצַוֶּה הַמֶּלֶךְ לְבַדּוֹ, וַיֵּלְכוּ הָאֻמָּנִין וַיָּסִירוּ הַכְּפִירִים בְּלַחֲשֵׁיהֶם וִיבִיאוּהוּ. וַיְמַהֵר מֹשֶׁה וַיָּנֶף אֶת הַמַּטֶּה עַל הַכְּפִירִים וַיַּתִּירֵם. וַיָּבֹאוּ בְּבֵית הַמֶּלֶךְ, וְהַכְּפִירִים בָּאוּ עִמָּם בְּשִׂמְחָה גְּדוֹלָה כַּאֲשֶׁר יִשְׂמַח הַכֶּלֶב אֶל אֲדוֹנָיו בְּבוֹאוֹ מִן הַשָּׂדֶה. וַיְהִי כִּרְאוֹת פַּרְעֹה כֵּן, וַיִּתְמַהּ עַל כָּכָה וַיִּבָּהֵל מְאֹד מִפְּנֵי הָאֲנָשִׁים כִּי הָיָה תָּאֳרָם כְּתֹּאַר בְּנֵי אֶלֹהִים. וַיֹּאמֶר לָהֶם הַמֶּלֶךְ, מָה אַתֶּם רוֹצִים, וַיֹּאמְרוּ לוֹ, "ה' אֱלֹהֵי הָעִבְרִים שְׁלָחָנוּ אֵלֶיךָ לֵאְמֹר, שַׁלַּח אֶת עַמִּי וְיַעַבְדֻנִי". וַיִּירָא מְאֹד מִפְּנֵיהֶם וַיֹּאמֶר לָהֶם לְכוּ הַיּוֹם וּבֹאוּ לְמָחָר, וַיַּעֲשׂוּ כִּדְבַר הַמֶּלֶךְ. וַיְהִי אַחֲרֵי לֶכְתָּם, וַיִּשְׁלַח פַּרְעֹה וַיִּקְרָא אֶל בִּלְעָם הַקּוֹסֵם וינו"ס וימברינו"ס בָּנָיו הַמְּכַשְּׁפִים וְכָל חָרָשֵׁי מִצְרַיִם, וַיָּבֹאוּ אֶל הַמֶּלֶךְ וַיְסַפֵּר לָהֶם הַמֶּלֶךְ אֶת אֲשֶׁר דִבְּרוּ אֵלָיו. וַיֹּאמְרוּ הַחַרְטֻמִּים אֵלָיו, אֵיךְ בָּאוּ אֵלֶיךָ הָאֲנָשִׁים מִפְּנֵי הַכְּפִירִים, [וַיֹּאמֶר לָהֶם הֵנִיפוּ הַמַּטֶּה עֲלֵיהֶן] וַיַּתִּירוּם וַיָּבֹאוּ אֵלַי, גַּם הַכְּפִירִים נַעֲשׂוּ כִּכְלָבִים וַיִּשְׂמְחוּ לִקְרָאתָם. וַיַּעַן בִּלְעָם אֶל הַמֶּלֶךְ, אֵין אֵלֶּה כִּי אִם מְכַשְּׁפִים כָּמוֹנוּ, וְעַתָּה שְׁלַח בַּעֲדָם וְיָבֹאוּ וְנִבְחֲנָה אוֹתָם, וַיַּעַשׁ הַמֶּלֶךְ כֵּן.