Rocket Science
Code injection vulnerability in lambdaJSON
Last updated
Code injection vulnerability in lambdaJSON
Last updated
Welcome to Rocket Science! In this class, we will learn all about rockets. But first, let's revise your numbers!
nc 20.198.209.142 55020
The flag is in the flag format: STC{...}
Author: zeyu2001
The requirements file contains only a single dependency.
Let's take a look at the part of the source code in which this is used.
We can see that lj.deserialize()
is called directly on the user input.
It's always a good idea to check dependencies for vulnerabilities, so let's go to the PyPi page for lambdaJSON. If version 0.1.4 is vulnerable, then we should expect later versions to issue security fixes.
On the release notes from version 0.1.5, we find our vulnerability.
Under the "Changes from previous" section:
Security fix. Using ast.literal_eval as eval.
From the release history, we can find out when this fix was released.
This allows us to find the GitHub commit for this fix.
Great! We have found the source code for the vulnerable version of the package. In the source code, we find that the restore()
function used by deserialize()
uses eval()
!
Note that the deserialized output must be a tuple of integers.
The vulnerable version of deserialize()
will strip the starting tuple://
and eval()
the rest of the input string.
So, if we use the following payload:
we will get the integer representation of the flag.
The flag is STC{3v4l_1s_3v1l_00e80002e832f357cf5c05ee114a5cb40e746757}