This box is probably the easiest box I ever did in hackthebox , it's vulnerable to drupalgeddon2 which has both manual exploit and automated exploit (metasploit) , and privilege escalation using the classic snap binary :)
Now seeing port 80 open running on apache server and installed with drupal cms, now it already disclosed the version of the drupal running and that's drupal 7, I decided to search the version up in exploit-db : searchsploit
a lot of exploits available , and drupalgeddon2 seems promising since it works in versions < 8.3.9 , < 8.4.6 , < 8.5.1 , I decided to exploit it with metasploit .
From metasploit I searched for drupalgeddon2 and the exploit showed then I set options and run the exploit , and it worked like charm
but unfortunately I got shell as apache
now to recognize which user I have to gain access to , I had to read the /etc/passwd
file which contained a list of usernames and their home-folders
well I saw brucetherealadmin , who has a home folder in /home/brucetherealadmin
, that's probably where the user.txt must be kept
And here I was like WTH , who sets his password as booboo
, that was easy… , I gained access to ssh using those creds brucetherealadmin:booboo
and inside it we get user.txt
.
this was a straight forward command > googling > root , I listed sudo privileges allowed to brucetherealadmin, and found out that he can run /usr/bin/snap install *
as root technically I can run :P , I decided to look for privesc methodologies using snap and I found this article https://0xdf.gitlab.io/2019/02/13/playing-with-dirty-sock.html , I did the dirty_sock exploit and it worked , so basically I created a snap file which will be installed under root and as it is installed it creates a user named dirt_sock with the password dirty_sock which has privileges to root
then I installed it with sudo snap install evil.snap --dangerous --devmode
after that was done I was able to login to dirt_sock user and gain access directly to root
And there I got root access!