This solution was posted the slack channel by someone : https://pastebin.com/StmJCCjQ. This is exactly the approach we used during the CTF.
However, the provided solution does not work. Not because of the approach, but because the password given in the chall's decription "jailbreak123" seems to be incorrect.
During the challenge, we alerted admins about this challenge being bogus, but no verification or corrective actions were taken.