Magnet Weekly CTF Challenge Week 8 Writeup

This week's Magnet Weekly CTF Challenge is once again another two-parter. Part I of the challenge asked the following:

What package(s) were installed by the threat actor? Select the most correct answer!

From the user hadoop's .bash_history file, there was an entry that indicated hadoop used ll command to list out the details of a /usr/local/hadoop/bin/cluster.php file. Since Hadoop does not run on PHP, why on Earth would there be a cluster.php file inside the Hadoop binary folder?

Moreover, from either /var/log/apt/history.log or /var/log/apt/term.log, it was shown that the php package was installed on 2019-10-17 and most of the packages were installed on 2017.


Therefore, it was highly likely that the threat actor installed the php package on the HDFS primary node and it turned out to be correct.

After that, Part II of the challenge was released and it asked the following:
Why?
  •  hosting a database
  •  serving a webpage
  •  to run a php webshell
  •  create a fake systemd service

 As the cluster.php file was found earlier, the contents of cluster.php file should be inspected and there was some intriguing PHP code:


This piece of PHP code would bind a socket on all IP addresses on the local machine on TCP port 17001. Then it would continuously receive incoming remote commands and execute them. Upon remote command execution, the command execution output would be returned to the command issuer. 
Thus, this cluster.php should be a PHP webshell and the answer to this part should be to run a php webshell.




Comments

Popular posts from this blog

Dumpster Diving in Google Photos Android App: "local_trash.db"

Hexordia Weekly CTF Challenge 2024 - Week 1 Writeup

Hexordia Weekly CTF Challenge 2024 - Week 2 Writeup