HBH Basic Web 6: PHP Unix Command Processor
Basic web hacking mission 6 in Hellbound Hackers is very situational:
My friend Drake has found this new way on how to execute Unix Commands from a simple php file, but he was testing the security and the logs recorded his activities and reported it to the FBI and it chmod the file logs.txt, now the only chance for him to be safe is that you chmod the file to all+execute and delete that file and the other file that tracks people. Mr. Deitry also said the command to do all these action needs a $ in the begining
This challenge is extremely obscure and confusing. I wasn’t able to do it before reading a spoiler-pumped article by system_meltdown on Hellbound Hackers about this mission. Therefore, I am going to give the solution away.
We need to chmod a file. What file? logs.txt. Where is logs.txt? No idea! Fotunately, system_meltdown’s article reveals that it is in this very directory, in the sub-directory logs/.
The first part-mission is to chmod the log file. chmod is a UNIX command that is used to change the permissions of a file. Remember that the mysterious Mr. Deitry told us that we for some reason need to put a dollar sign ($) in front of the commands.
$ chmod a+x logs/logs.txt
The a+x part stands for “all + execute”, which will allow everyone to execute the file. Now, we will remove it with the rm command.
$ rm logs/logs.txt
Now, we only have to delete the file that tracks our presence. Don’t ask me how we’re supposed to find the filename out — I had to read the article. Apparently, it is logs/track_logs.php.
$ rm logs/track_logs.php
Therefore, the three commands that should be used are the following:
$ chmod a+x logs/logs.txt
$ rm logs/logs.txt
$ rm logs/track_logs.php
Mission accomplished.
Bình luận mới