ghostšŸ‘»sonofabot-sec:~#

I scan, I map, I exploit .... Ghost is in your shell!!!

View on GitHub

Screenshot_20220324_031714

Less chatting more hacking 🤤

Let’s jump right into it

Here we are working with couple of broke programmers who built a web hosting ……

Upon firing up the machine we get an IP address

First thing for every good security operative is enumeration so we run an nmap scan to know which ports/services are up and running

Screenshot_20220326_003154 After the scan we notice 3 ports opened and a bunch of vulnerebilities

Keys importion in PGP

How to change gpg passphrase

First change directory to one the contains your backup extracted files make sure you have gpg installed on yyour machine then we get into it In your terminal type this

Screenshot_20220326_004741

Now changing its passphase

Decrypting the gpg file

In order to decrypt an encrypted file on Linux, you have to use the ā€œgpgā€ command with the ā€œ-dā€ option for ā€œdecryptā€ and specify the ā€œ. gpgā€ file that you want to decrypt. Again, you will be probably be prompted with a window (or directly in the terminal) for the passphrase.

Screenshot_20220326_011324

Screenshot_20220326_011913

We have login credentials where to use it ? Remember in our scan we had FTP&SSH being open Upon trying the SSH with all login details we didn’t have any successfull ssh login Let’s try the FTP make sure you have ftp installed on your pc

After logging in, we run ls to list directories we see the backups directory and some other things It seems that’s web directory lets upload our web rev shell (/usr/share/webshells/php/php-reverse-shell.php) or any php of your choice change the ip and port to port of our preferance and IP to our attacker machine’s

Screenshot_20220324_152536

Set up your listner

Screenshot_20220324_153103

We should caught a shell

So yes from Screenshot_20220324_152557(2)

That’s our initial shell, make the shell a stable one (* that’ll be your little task, use bash to stabilize the shell, but rlwrap is a pretty stable shell) from THM hint the webflag is in the apache user path

we have a user paradox who we have his password so let’s head to his path

so let’s try getting the user flag now, Paradox lacks the right to

run linpeas.sh or you can go through a series of manual exploitation

pay attention to NFS we check /etc/exports and see that the user james has a share to his path and it has the root_no_squat option on our pc try mounting this share

but before we do that let’s get a user we can successfully ssh to

we noticed we couldn’t ssh to paradox even tho we had his password lets try replacing his authorized_keys with ours

SSH Port forwarding on GitHub

We run the following Setup ssh tunnel

so yh cd to the folder me mounted it to /tmp/nfs

Screenshot_20220324_152959 WE’RE IN šŸ˜Ž cat out the user flag

Now time for the privilege escalation path pay good attention to this, things get tricky here actually we use hacktricks trick xD

Hack tricks

Head back to our /tmp/nfs folder

Now head back to the james’s ssh and the shared folder path

./bash -p

gives drops us a root shell Screenshot_20220324_153023

and BOOM root access 🄸 🤯

so the last task of finding root flag is up to you nah just kidding

That’s it for Overpass 3

Hit me up on Twitter if you run into any issues



Back To Home