HackTheBox - Shield Writeup
Contents
Box author | TRX
Enumeration
- scan top 1000 ports
- the result
|
|
- scan all ports
- the result
|
|
- all scan still the same
- open ports
- 80 / http
- 3306 / mysql
WebPage
- Just default windows server page
Gobuster
- Using gobuster to find any hidden directory
- the result
WordPress
- the result show this server have
wordpress
install - as we know, the wordpress login path is
/wp-admin
- let’s take a look
Admin Login
- Try to login as admin with credentials from previous box
vaccine
- Success
Foothold/Gaining Access
WordPress Theme Injection
- Let’s try get the reverse shell by injected the theme
- I’m gonna use this theme “GutenBooster”
- and the shell I’m gonna use Nishang
- Now, I’m gonna put command in the
404.php
. - Which is a 404 template
- Source
|
|
- This command will download the reverse shell and execute it
- Well, the reverse shell is succefully execute
SeImpersonatePrivilege
-
everytime you’ve got
powershell reverse shell
-
make sure to run
whoami /all
-
The result
- Looks like
SeImpersonatePrivilege is enable
- We can privesc by using
juicy potato
- Source
- download the binary into
local machine
. Then, upload intovictim machine
- via this command
|
|
- then run the binary.
- the result
Privilege Escalation
- First, I’m gonna make
bat
file with powershell command on it. - I’m called the file
yo_my.bat
- the command:
- Source
|
|
POTATO
-
I’m gonna run
again_gimme.exe
again with this flag:./again_gimme.exe -t * -p yo_my.bat -l 9902
-
the result
- it is failed but we can try with more
CLSID
- Source
- before we start using the CLSID. We’re need to know what type of
OS version
this machine running on - by using this command:
(Get-WmiObject Win32_OperatingSystem).Caption
- the result
- Now, we’re need to pick Windows Server 2016 Standard CLSID
- I’m gonna try with
wpnservice CLSID
- I’m gonna run this command
|
|
Note
Make sure you’re running the
nc
for listening the connection
REMEMBER: The powershell command in the bat file
was downloading another reverse shell file called rev.ps1
.
in that file. I’m listening on 9901. If you listen on the other port. Just change the port on that file.- the result
- we’ve got the root flag
Conclusion
I’ve learned a lot today. Do not put any credentials on the exposure machine to the hacker or non-secure machine. Even tho it’s happened, quickly change the password. I’m also introducing a bunch of tools for windows pentest/hack. Lastly, always update and patch the machine.
I have a fun time doing this machine and I hope you guys do too. Bye ;)