In this challenge, we are given an image in PNG format and we need to find the hidden message inside the image.
At first, we view the strings of this image (mario_.png) and observe that it has a URL present in it:
We grab the enc0de_.py script from the above URL.
This script has the algorithm which was used to encrypt the base image.
The pixels of the new image have the same RGB values as the pixels of the original image except for one condition. (when x ==0 and y < len(code))
We need to find the value of code used to perform the XOR encryption of the original image.
The values of R and G for each pixel remain the same, the last value (B) is XOR encrypted when the above condition is true. In order to get the value of code, we can perform the XOR encryption between the value of B for each pixel in the new image and 0x13, 0x37 with the above condition.
since,
plaintext XOR key = ciphertext
ciphertext XOR key = plaintext
so, we write a new script as follows:
We are assuming the length of the code to be less than 100, let's run the above script:
So, the value of the flag is: "mario_st3gan0_".md5(file_getcontents("mario_.png"))
The flag is: mario_st3gan0_606cd321933e37926e0edeefd1d6eb8d
At first, we view the strings of this image (mario_.png) and observe that it has a URL present in it:
We grab the enc0de_.py script from the above URL.
This script has the algorithm which was used to encrypt the base image.
The pixels of the new image have the same RGB values as the pixels of the original image except for one condition. (when x ==0 and y < len(code))
We need to find the value of code used to perform the XOR encryption of the original image.
The values of R and G for each pixel remain the same, the last value (B) is XOR encrypted when the above condition is true. In order to get the value of code, we can perform the XOR encryption between the value of B for each pixel in the new image and 0x13, 0x37 with the above condition.
since,
plaintext XOR key = ciphertext
ciphertext XOR key = plaintext
so, we write a new script as follows:
We are assuming the length of the code to be less than 100, let's run the above script:
So, the value of the flag is: "mario_st3gan0_".md5(file_getcontents("mario_.png"))
The flag is: mario_st3gan0_606cd321933e37926e0edeefd1d6eb8d
0 comments: