For this
blog I am using the lab provided by TryHackMe. TryHackMe provides many
different labs for understanding security concepts. I am using these labs to
cover my OSCP basics.
What is a
Magic Number?
A magic number is a number that is embedded at or near the beginning of the file
which indicates that the file is of the desired format. The number is not visible
to us. Every file has a number that represents the name of the file types which
is in hexadecimal format.
For example: PDF file: 25 50 44 46
JPG file: FF D8 FF
GIF file : 47 49 46 38 37 61
In the example provided below we are going to try this method; we are trying to change the initial signatures of the file that is provided and try to upload a shell file. Let’s consider the below provided application.
1. In the application that is provided below we are able upload only gif files on the application.
8. Now we upload this file on the application and check if it gets uploaded. Make sure that the uploaded file is PHP file.
10. Now we can access the file on the browser with the file path provided (<URL>/graphics/<filename>). Now we can see that the reverse shell connection is provided to us and we were able to access the flag by changing the directory to var/www.
Finally,
we have it here.
Thanks for going through the whole blog!!!
Click on the links to read my previous blogs on file upload
No comments:
Post a Comment