SunsetTwilight
Last updated
Last updated
First up is checking SMB. We are able to connect and list shared without providing credentials as shown below:
We can then move into the WRKSHARE directory to view the contents:
As this looks like we can see the entire directory from '/' we can have a look about for interesting information. We know that port 80 is open so likely we are running a webserver.
Looking at the contents of the directory /var/www/html/ we can see PHP files.
If we can upload a reverse PHP shell we should in theory be able to get shell access. I used the following command to upload a PHP reverse shell with curl into the /var/www/html directory:
Checking the directory contents with smbclient
again shows we have uploaded our PHP reverse shell.
We can then set a netcat
listener up then execute the shell with curl
.
The current shell can then be improved by:
Next we can move into the /tmp/ directory. Started a Python SimpleHTTPServer
on my attacking machine and transferred over linpeas
.
linpeas
picks up that /etc/passwd is writeable by everyone. Which means we can make changes to the file.
As such we can add a new root user to the target machine to gain root access.
Generate password on attacking machine:
Echo the password and new user to the end of /etc/passwd on the target machine.
We can then use su
to move into the new account and gain a root shell.